@economic/taco 2.45.0-alpha.0 → 2.45.0-create.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Accordion/Accordion.d.ts +2 -2
- package/dist/components/Alert/Alert.d.ts +1 -1
- package/dist/components/AlertDialog/components/Content.d.ts +1 -1
- package/dist/components/Calendar/Calendar.d.ts +1 -1
- package/dist/components/Datepicker/Datepicker.d.ts +1 -1
- package/dist/components/Dialog/components/Content.d.ts +1 -1
- package/dist/components/Dialog/components/DialogDrawer.d.ts +2 -2
- package/dist/components/Drawer/components/Content.d.ts +2 -2
- package/dist/components/Header/components/Agreement/Badge.d.ts +1 -1
- package/dist/components/Header/components/Agreement/Display.d.ts +2 -2
- package/dist/components/Header/components/Agreement/Item.d.ts +2 -2
- package/dist/components/Header/components/AgreementSelector.d.ts +2 -2
- package/dist/components/Header/components/Button.d.ts +1 -1
- package/dist/components/HoverCard/HoverCard.d.ts +1 -1
- package/dist/components/Icon/components/AccountPreview.d.ts +1 -1
- package/dist/components/Icon/components/Accounting.d.ts +1 -1
- package/dist/components/Icon/components/AccountingYear.d.ts +1 -1
- package/dist/components/Icon/components/AccountingYearCancel.d.ts +1 -1
- package/dist/components/Icon/components/AiChatSolid.d.ts +1 -1
- package/dist/components/Icon/components/AiStars.d.ts +1 -1
- package/dist/components/Icon/components/ArrowBottom.d.ts +1 -1
- package/dist/components/Icon/components/ArrowDown.d.ts +1 -1
- package/dist/components/Icon/components/ArrowEnd.d.ts +1 -1
- package/dist/components/Icon/components/ArrowLeft.d.ts +1 -1
- package/dist/components/Icon/components/ArrowRight.d.ts +1 -1
- package/dist/components/Icon/components/ArrowStart.d.ts +1 -1
- package/dist/components/Icon/components/ArrowTop.d.ts +1 -1
- package/dist/components/Icon/components/ArrowUp.d.ts +1 -1
- package/dist/components/Icon/components/Attach.d.ts +1 -1
- package/dist/components/Icon/components/AttachAuto.d.ts +1 -1
- package/dist/components/Icon/components/AttachCancel.d.ts +1 -1
- package/dist/components/Icon/components/AttachWarning.d.ts +1 -1
- package/dist/components/Icon/components/Autotext.d.ts +1 -1
- package/dist/components/Icon/components/AutotextInsert.d.ts +1 -1
- package/dist/components/Icon/components/Basic.d.ts +1 -1
- package/dist/components/Icon/components/BasicTabs.d.ts +1 -1
- package/dist/components/Icon/components/BellSolid.d.ts +1 -1
- package/dist/components/Icon/components/Book.d.ts +1 -1
- package/dist/components/Icon/components/Booking.d.ts +1 -1
- package/dist/components/Icon/components/Budget.d.ts +1 -1
- package/dist/components/Icon/components/Calendar.d.ts +1 -1
- package/dist/components/Icon/components/CashAccount.d.ts +1 -1
- package/dist/components/Icon/components/CashReports.d.ts +1 -1
- package/dist/components/Icon/components/ChartArea.d.ts +1 -1
- package/dist/components/Icon/components/ChartBar.d.ts +1 -1
- package/dist/components/Icon/components/ChartLine.d.ts +1 -1
- package/dist/components/Icon/components/ChartPie.d.ts +1 -1
- package/dist/components/Icon/components/ChartTable.d.ts +1 -1
- package/dist/components/Icon/components/Chat.d.ts +1 -1
- package/dist/components/Icon/components/ChatSolid.d.ts +1 -1
- package/dist/components/Icon/components/ChevronDown.d.ts +1 -1
- package/dist/components/Icon/components/ChevronDownDouble.d.ts +1 -1
- package/dist/components/Icon/components/ChevronDownSolid.d.ts +1 -1
- package/dist/components/Icon/components/ChevronLeft.d.ts +1 -1
- package/dist/components/Icon/components/ChevronLeftDouble.d.ts +1 -1
- package/dist/components/Icon/components/ChevronLeftSolid.d.ts +1 -1
- package/dist/components/Icon/components/ChevronRight.d.ts +1 -1
- package/dist/components/Icon/components/ChevronRightDouble.d.ts +1 -1
- package/dist/components/Icon/components/ChevronRightSolid.d.ts +1 -1
- package/dist/components/Icon/components/ChevronUp.d.ts +1 -1
- package/dist/components/Icon/components/ChevronUpDouble.d.ts +1 -1
- package/dist/components/Icon/components/ChevronUpSolid.d.ts +1 -1
- package/dist/components/Icon/components/CircleClose.d.ts +1 -1
- package/dist/components/Icon/components/CircleInformation.d.ts +1 -1
- package/dist/components/Icon/components/CircleMinus.d.ts +1 -1
- package/dist/components/Icon/components/CirclePlus.d.ts +1 -1
- package/dist/components/Icon/components/CircleQuestionmark.d.ts +1 -1
- package/dist/components/Icon/components/CircleTick.d.ts +1 -1
- package/dist/components/Icon/components/CircleWarning.d.ts +1 -1
- package/dist/components/Icon/components/Clamp.d.ts +1 -1
- package/dist/components/Icon/components/ClampOpen.d.ts +1 -1
- package/dist/components/Icon/components/Close.d.ts +1 -1
- package/dist/components/Icon/components/ColumnFreeze.d.ts +1 -1
- package/dist/components/Icon/components/ColumnUnfreeze.d.ts +1 -1
- package/dist/components/Icon/components/Columns.d.ts +1 -1
- package/dist/components/Icon/components/ConnectionEnable.d.ts +1 -1
- package/dist/components/Icon/components/ConnectionRevoke.d.ts +1 -1
- package/dist/components/Icon/components/Contacts.d.ts +1 -1
- package/dist/components/Icon/components/Copy.d.ts +1 -1
- package/dist/components/Icon/components/Courses.d.ts +1 -1
- package/dist/components/Icon/components/Credit.d.ts +1 -1
- package/dist/components/Icon/components/Delete.d.ts +1 -1
- package/dist/components/Icon/components/DeletePermanently.d.ts +1 -1
- package/dist/components/Icon/components/Depecriate.d.ts +1 -1
- package/dist/components/Icon/components/Developer.d.ts +1 -1
- package/dist/components/Icon/components/DistributionTemplate.d.ts +1 -1
- package/dist/components/Icon/components/Document.d.ts +1 -1
- package/dist/components/Icon/components/DocumentApprove.d.ts +1 -1
- package/dist/components/Icon/components/DocumentCreateEntry.d.ts +1 -1
- package/dist/components/Icon/components/DocumentCut.d.ts +1 -1
- package/dist/components/Icon/components/DocumentError.d.ts +1 -1
- package/dist/components/Icon/components/DocumentIsolatePage.d.ts +1 -1
- package/dist/components/Icon/components/DocumentMerge.d.ts +1 -1
- package/dist/components/Icon/components/DocumentMove.d.ts +1 -1
- package/dist/components/Icon/components/DocumentPreview.d.ts +1 -1
- package/dist/components/Icon/components/DocumentReceived.d.ts +1 -1
- package/dist/components/Icon/components/DocumentRejectedRequest.d.ts +1 -1
- package/dist/components/Icon/components/DocumentSigned.d.ts +1 -1
- package/dist/components/Icon/components/DocumentSignedSolid.d.ts +1 -1
- package/dist/components/Icon/components/DocumentSplit.d.ts +1 -1
- package/dist/components/Icon/components/DocumentTime.d.ts +1 -1
- package/dist/components/Icon/components/Download.d.ts +1 -1
- package/dist/components/Icon/components/Drag.d.ts +1 -1
- package/dist/components/Icon/components/ECopedia.d.ts +1 -1
- package/dist/components/Icon/components/Edit.d.ts +1 -1
- package/dist/components/Icon/components/EditSimple.d.ts +1 -1
- package/dist/components/Icon/components/EllipsisHorizontal.d.ts +1 -1
- package/dist/components/Icon/components/EllipsisVertical.d.ts +1 -1
- package/dist/components/Icon/components/EntriesOnAccount.d.ts +1 -1
- package/dist/components/Icon/components/EntriesOpen.d.ts +1 -1
- package/dist/components/Icon/components/EntriesWarning.d.ts +1 -1
- package/dist/components/Icon/components/EntryTypeCustomerInvoice.d.ts +1 -1
- package/dist/components/Icon/components/EntryTypeCustomerPayment.d.ts +1 -1
- package/dist/components/Icon/components/EntryTypeJournalEntry.d.ts +1 -1
- package/dist/components/Icon/components/EntryTypeManualCustomerInvoice.d.ts +1 -1
- package/dist/components/Icon/components/EntryTypeSupplierInvoice.d.ts +1 -1
- package/dist/components/Icon/components/EntryTypeSupplierPayment.d.ts +1 -1
- package/dist/components/Icon/components/Envelope.d.ts +1 -1
- package/dist/components/Icon/components/EnvelopeApproved.d.ts +1 -1
- package/dist/components/Icon/components/EnvelopeSolid.d.ts +1 -1
- package/dist/components/Icon/components/ExpandView.d.ts +1 -1
- package/dist/components/Icon/components/Expenses.d.ts +1 -1
- package/dist/components/Icon/components/Export.d.ts +1 -1
- package/dist/components/Icon/components/ExportToExcel.d.ts +1 -1
- package/dist/components/Icon/components/ExportToPdf.d.ts +1 -1
- package/dist/components/Icon/components/EyeOff.d.ts +1 -1
- package/dist/components/Icon/components/EyeOn.d.ts +1 -1
- package/dist/components/Icon/components/Filter.d.ts +1 -1
- package/dist/components/Icon/components/FilterSolid.d.ts +1 -1
- package/dist/components/Icon/components/FontSize.d.ts +1 -1
- package/dist/components/Icon/components/GraphSolid.d.ts +1 -1
- package/dist/components/Icon/components/Hash.d.ts +1 -1
- package/dist/components/Icon/components/HeightExtraTall.d.ts +1 -1
- package/dist/components/Icon/components/HeightMedium.d.ts +1 -1
- package/dist/components/Icon/components/HeightShort.d.ts +1 -1
- package/dist/components/Icon/components/HeightTall.d.ts +1 -1
- package/dist/components/Icon/components/House.d.ts +1 -1
- package/dist/components/Icon/components/HouseSolid.d.ts +1 -1
- package/dist/components/Icon/components/Id.d.ts +1 -1
- package/dist/components/Icon/components/Images.d.ts +1 -1
- package/dist/components/Icon/components/Import.d.ts +1 -1
- package/dist/components/Icon/components/Inbox.d.ts +1 -1
- package/dist/components/Icon/components/InboxEinvoicing.d.ts +1 -1
- package/dist/components/Icon/components/InboxScanning.d.ts +1 -1
- package/dist/components/Icon/components/InboxSmart.d.ts +1 -1
- package/dist/components/Icon/components/Info.d.ts +1 -1
- package/dist/components/Icon/components/Inventory.d.ts +1 -1
- package/dist/components/Icon/components/InventoryMatrix.d.ts +1 -1
- package/dist/components/Icon/components/JournalPro.d.ts +1 -1
- package/dist/components/Icon/components/Layout.d.ts +1 -1
- package/dist/components/Icon/components/LayoutBoth.d.ts +1 -1
- package/dist/components/Icon/components/LayoutFirst.d.ts +1 -1
- package/dist/components/Icon/components/LayoutLast.d.ts +1 -1
- package/dist/components/Icon/components/LayoutNone.d.ts +1 -1
- package/dist/components/Icon/components/LedgerCard.d.ts +1 -1
- package/dist/components/Icon/components/LedgerCardCustomerReminder.d.ts +1 -1
- package/dist/components/Icon/components/LedgerCardManualCustomerInvoice.d.ts +1 -1
- package/dist/components/Icon/components/LedgerCardObsoleteStock.d.ts +1 -1
- package/dist/components/Icon/components/LedgerCardOpeningEntry.d.ts +1 -1
- package/dist/components/Icon/components/LedgerCardReservedEntry.d.ts +1 -1
- package/dist/components/Icon/components/LedgerCardShrinkagePilferage.d.ts +1 -1
- package/dist/components/Icon/components/LedgerCardStockAdjustment.d.ts +1 -1
- package/dist/components/Icon/components/LedgerCardTransferredOpeningEntry.d.ts +1 -1
- package/dist/components/Icon/components/Lightbulb.d.ts +1 -1
- package/dist/components/Icon/components/Line.d.ts +1 -1
- package/dist/components/Icon/components/LinkExternal.d.ts +1 -1
- package/dist/components/Icon/components/List.d.ts +1 -1
- package/dist/components/Icon/components/ListBulleted.d.ts +1 -1
- package/dist/components/Icon/components/ListSearch.d.ts +1 -1
- package/dist/components/Icon/components/Location.d.ts +1 -1
- package/dist/components/Icon/components/Lock.d.ts +1 -1
- package/dist/components/Icon/components/LockOpen.d.ts +1 -1
- package/dist/components/Icon/components/Log.d.ts +1 -1
- package/dist/components/Icon/components/LogOut.d.ts +1 -1
- package/dist/components/Icon/components/Market.d.ts +1 -1
- package/dist/components/Icon/components/MastercardOs.d.ts +1 -1
- package/dist/components/Icon/components/MatchAmount.d.ts +1 -1
- package/dist/components/Icon/components/MatchEntries.d.ts +1 -1
- package/dist/components/Icon/components/Menu.d.ts +1 -1
- package/dist/components/Icon/components/Mileage.d.ts +1 -1
- package/dist/components/Icon/components/ModalResize.d.ts +1 -1
- package/dist/components/Icon/components/ModalShrink.d.ts +1 -1
- package/dist/components/Icon/components/More.d.ts +1 -1
- package/dist/components/Icon/components/MoreSolid.d.ts +1 -1
- package/dist/components/Icon/components/Move.d.ts +1 -1
- package/dist/components/Icon/components/NavigationList.d.ts +1 -1
- package/dist/components/Icon/components/Note.d.ts +1 -1
- package/dist/components/Icon/components/NoteFollowUp.d.ts +1 -1
- package/dist/components/Icon/components/NoteRead.d.ts +1 -1
- package/dist/components/Icon/components/NovemberFirst.d.ts +1 -1
- package/dist/components/Icon/components/Numbers.d.ts +1 -1
- package/dist/components/Icon/components/PartnerApi.d.ts +1 -1
- package/dist/components/Icon/components/PaymentPaid.d.ts +1 -1
- package/dist/components/Icon/components/PaymentUnpaid.d.ts +1 -1
- package/dist/components/Icon/components/Period.d.ts +1 -1
- package/dist/components/Icon/components/PersonChange.d.ts +1 -1
- package/dist/components/Icon/components/PersonMinus.d.ts +1 -1
- package/dist/components/Icon/components/PersonPlus.d.ts +1 -1
- package/dist/components/Icon/components/PersonTick.d.ts +1 -1
- package/dist/components/Icon/components/Phone.d.ts +1 -1
- package/dist/components/Icon/components/PhoneSolid.d.ts +1 -1
- package/dist/components/Icon/components/Play.d.ts +1 -1
- package/dist/components/Icon/components/PlusMinus.d.ts +1 -1
- package/dist/components/Icon/components/Print.d.ts +1 -1
- package/dist/components/Icon/components/ProcessPayment.d.ts +1 -1
- package/dist/components/Icon/components/ProductLedgerCard.d.ts +1 -1
- package/dist/components/Icon/components/Profile.d.ts +1 -1
- package/dist/components/Icon/components/ProjectCards.d.ts +1 -1
- package/dist/components/Icon/components/Projects.d.ts +1 -1
- package/dist/components/Icon/components/QuestionMark.d.ts +1 -1
- package/dist/components/Icon/components/QuestionMarkBold.d.ts +1 -1
- package/dist/components/Icon/components/Quicklinks.d.ts +1 -1
- package/dist/components/Icon/components/RatingBankruptcy.d.ts +1 -1
- package/dist/components/Icon/components/RatingPaymentProblems.d.ts +1 -1
- package/dist/components/Icon/components/Reconciled.d.ts +1 -1
- package/dist/components/Icon/components/Refresh.d.ts +1 -1
- package/dist/components/Icon/components/Report.d.ts +1 -1
- package/dist/components/Icon/components/ReportSolid.d.ts +1 -1
- package/dist/components/Icon/components/Restore.d.ts +1 -1
- package/dist/components/Icon/components/RotateLeft.d.ts +1 -1
- package/dist/components/Icon/components/RotateRight.d.ts +1 -1
- package/dist/components/Icon/components/Sales.d.ts +1 -1
- package/dist/components/Icon/components/Search.d.ts +1 -1
- package/dist/components/Icon/components/SearchBold.d.ts +1 -1
- package/dist/components/Icon/components/Secure.d.ts +1 -1
- package/dist/components/Icon/components/SecureTick.d.ts +1 -1
- package/dist/components/Icon/components/Settings.d.ts +1 -1
- package/dist/components/Icon/components/SettingsSolid.d.ts +1 -1
- package/dist/components/Icon/components/Shortcuts.d.ts +1 -1
- package/dist/components/Icon/components/ShowAll.d.ts +1 -1
- package/dist/components/Icon/components/ShowLess.d.ts +1 -1
- package/dist/components/Icon/components/ShowMore.d.ts +1 -1
- package/dist/components/Icon/components/ShowTemplate.d.ts +1 -1
- package/dist/components/Icon/components/Sliders.d.ts +1 -1
- package/dist/components/Icon/components/Smartpay.d.ts +1 -1
- package/dist/components/Icon/components/SortBy.d.ts +1 -1
- package/dist/components/Icon/components/Star.d.ts +1 -1
- package/dist/components/Icon/components/StarSolid.d.ts +1 -1
- package/dist/components/Icon/components/Subscriptions.d.ts +1 -1
- package/dist/components/Icon/components/SystemEntries.d.ts +1 -1
- package/dist/components/Icon/components/Tag.d.ts +1 -1
- package/dist/components/Icon/components/TemplateOverride.d.ts +1 -1
- package/dist/components/Icon/components/Templates.d.ts +1 -1
- package/dist/components/Icon/components/ThumbBoth.d.ts +1 -1
- package/dist/components/Icon/components/ThumbDown.d.ts +1 -1
- package/dist/components/Icon/components/ThumbDownSolid.d.ts +1 -1
- package/dist/components/Icon/components/ThumbUp.d.ts +1 -1
- package/dist/components/Icon/components/ThumbUpSolid.d.ts +1 -1
- package/dist/components/Icon/components/Tick.d.ts +1 -1
- package/dist/components/Icon/components/TickBold.d.ts +1 -1
- package/dist/components/Icon/components/Time.d.ts +1 -1
- package/dist/components/Icon/components/Transfer.d.ts +1 -1
- package/dist/components/Icon/components/TransferCancel.d.ts +1 -1
- package/dist/components/Icon/components/TransferLocked.d.ts +1 -1
- package/dist/components/Icon/components/Undo.d.ts +1 -1
- package/dist/components/Icon/components/Undock.d.ts +1 -1
- package/dist/components/Icon/components/Unreconciled.d.ts +1 -1
- package/dist/components/Icon/components/Warning.d.ts +1 -1
- package/dist/components/Icon/components/Webshop.d.ts +1 -1
- package/dist/components/Icon/components/Website.d.ts +1 -1
- package/dist/components/Icon/components/Workflow.d.ts +1 -1
- package/dist/components/Icon/components/WorkflowTemplateBasic.d.ts +1 -1
- package/dist/components/Icon/components/Zoom.d.ts +1 -1
- package/dist/components/IconButton/IconButton.d.ts +2 -2
- package/dist/components/Input/Input.d.ts +2 -2
- package/dist/components/Input/util.d.ts +1 -11
- package/dist/components/Layout/components/Sidebar.d.ts +2 -14
- package/dist/components/Layout/components/Top.d.ts +2 -2
- package/dist/components/List/List.d.ts +7 -7
- package/dist/components/List/components/Button.d.ts +1 -1
- package/dist/components/List/components/Collapsible.d.ts +1 -1
- package/dist/components/List/components/Group.d.ts +1 -1
- package/dist/components/List/components/Item.d.ts +1 -1
- package/dist/components/List/components/Link.d.ts +1 -1
- package/dist/components/List/components/Toggle.d.ts +2 -2
- package/dist/components/Listbox/Listbox.d.ts +2 -2
- package/dist/components/Listbox/ScrollableList.d.ts +1 -1
- package/dist/components/Listbox/util.d.ts +2 -2
- package/dist/components/Menu/components/Checkbox.d.ts +1 -1
- package/dist/components/Menu/components/Content.d.ts +2 -2
- package/dist/components/Menu/components/Item.d.ts +8 -8
- package/dist/components/Menu/components/Link.d.ts +1 -1
- package/dist/components/Menu/components/RadioGroup.d.ts +1 -1
- package/dist/components/Menu/components/SubMenu.d.ts +1 -1
- package/dist/components/Menu/components/Trigger.d.ts +1 -1
- package/dist/components/Navigation2/components/Group.d.ts +1 -1
- package/dist/components/Popover/Popover.d.ts +2 -2
- package/dist/components/Provider/Localization.d.ts +2 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/Report/Report.d.ts +1 -1
- package/dist/components/ScrollArea/ScrollArea.d.ts +2 -2
- package/dist/components/SearchInput/SearchInput.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select2/components/All.d.ts +2 -2
- package/dist/components/Select2/components/Collection.d.ts +1 -1
- package/dist/components/Select2/components/Create.d.ts +1 -1
- package/dist/components/Select2/components/Edit.d.ts +2 -2
- package/dist/components/Select2/components/Group.d.ts +1 -1
- package/dist/components/Select2/components/Option.d.ts +1 -1
- package/dist/components/Select2/components/Search.d.ts +3 -3
- package/dist/components/Select2/components/Trigger.d.ts +1 -1
- package/dist/components/Select2/hooks/useChildren.d.ts +2 -2
- package/dist/components/Select2/utilities.d.ts +2 -0
- package/dist/components/Shortcut/Shortcut.d.ts +1 -1
- package/dist/components/Table3/Table3.d.ts +2 -14
- package/dist/components/Table3/components/Columns/Cell/Cell.d.ts +2 -2
- package/dist/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.d.ts +1 -1
- package/dist/components/Table3/components/Columns/Cell/EditingControlCell.d.ts +2 -2
- package/dist/components/Table3/components/Columns/Internal/EditingActionsMenu.d.ts +3 -4
- package/dist/components/Table3/components/Editing/Alert.d.ts +1 -1
- package/dist/components/Table3/components/Editing/DiscardChangesConfirmationDialog.d.ts +7 -0
- package/dist/components/Table3/components/Row/Editing/CreateNewRow.d.ts +13 -0
- package/dist/components/Table3/components/Row/Editing/SaveStatus.d.ts +2 -2
- package/dist/components/Table3/components/Row/Editing/TemporaryRow.d.ts +12 -0
- package/dist/components/Table3/components/Row/Row.d.ts +2 -2
- package/dist/components/Table3/components/Toolbar/Editing/Editing.d.ts +1 -1
- package/dist/components/Table3/features/useEditingState.d.ts +29 -0
- package/dist/components/Table3/features/useTableEditing.d.ts +24 -36
- package/dist/components/Table3/types.d.ts +23 -8
- package/dist/components/Table3/useTable3.d.ts +6 -0
- package/dist/components/Table3/util/editing.d.ts +0 -1
- package/dist/components/Tag/Tag.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tour/Tour.d.ts +3 -3
- package/dist/components/Truncate/Truncate.d.ts +1 -1
- package/dist/esm/index.css +6 -2
- package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js +17 -17
- package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +6 -14
- package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +3 -3
- 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.map +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/AgreementSelector.js +3 -5
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/components/Top.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/util.js +1 -7
- package/dist/esm/packages/taco/src/components/Listbox/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +2 -2
- package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +5 -3
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +4 -4
- package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +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.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +29 -5
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Create.js +10 -11
- 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 +2 -0
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.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/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +1 -10
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/utilities.js +11 -1
- package/dist/esm/packages/taco/src/components/Select2/utilities.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/WindowedTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +21 -7
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +24 -6
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js +5 -36
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +17 -12
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js +34 -0
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +88 -0
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js +2 -14
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +93 -0
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js +5 -7
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js +7 -2
- package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +514 -0
- package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +16 -406
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +37 -32
- package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/useTable3.js +21 -7
- package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js +3 -28
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tour/Tour.js +3 -3
- package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js +20 -4
- package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js +1 -0
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Sortable/components/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +3 -4
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js +4 -4
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +9 -3
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +6 -3
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Goto.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js +2 -2
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Resizer.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/SortIndicator.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/util.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +1 -3
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/Settings.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableShortcutsListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +11 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/dom.js +7 -4
- package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
- package/dist/index.css +6 -2
- package/dist/primitives/BubbleSelect.d.ts +1 -1
- package/dist/primitives/Collection/components/Root.d.ts +3 -1
- package/dist/primitives/Sortable/components/Container.d.ts +2 -2
- package/dist/primitives/Sortable/components/Item.d.ts +1 -2
- package/dist/primitives/Sortable/components/List.d.ts +1 -1
- package/dist/primitives/Table/Core/Table.d.ts +3 -2
- package/dist/primitives/Table/Core/components/Body/Body.d.ts +1 -1
- package/dist/primitives/Table/Core/components/Body/EmptyStateBody.d.ts +1 -1
- package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Columns/Cell/Cell.d.ts +1 -1
- package/dist/primitives/Table/Core/components/Columns/Internal/Actions.d.ts +5 -3
- package/dist/primitives/Table/Core/components/Footer/Footer.d.ts +3 -3
- package/dist/primitives/Table/Core/components/Footer/Summary.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Header/Header.d.ts +1 -1
- package/dist/primitives/Table/Core/components/Header/components/Goto.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Header/components/Menu.d.ts +1 -1
- package/dist/primitives/Table/Core/components/Header/components/Resizer.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Header/components/SortIndicator.d.ts +3 -3
- package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Row/Row.d.ts +1 -1
- package/dist/primitives/Table/Core/components/Toolbar/Toolbar.d.ts +1 -1
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/Filters.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +1 -1
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Toolbar/components/Print/Print.d.ts +1 -1
- package/dist/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Toolbar/components/Search/Search.d.ts +1 -1
- package/dist/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Toolbar/components/Settings/Settings.d.ts +2 -2
- package/dist/primitives/Table/types.d.ts +1 -1
- package/dist/primitives/Table/useTableManager/useTableManager.d.ts +1 -1
- package/dist/primitives/Table/useTableManager/util/settings.d.ts +1 -1
- package/dist/taco.cjs.development.js +960 -694
- 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 +2 -1
- package/package.json +11 -11
- package/dist/components/Table3/components/Row/Editing/CreateRowButton.d.ts +0 -11
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js +0 -90
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js.map +0 -1
@@ -43,7 +43,8 @@ var set = _interopDefault(require('lodash/set'));
|
|
43
43
|
var unset = _interopDefault(require('lodash/unset'));
|
44
44
|
var compact = _interopDefault(require('lodash/compact'));
|
45
45
|
var pullAt = _interopDefault(require('lodash/pullAt'));
|
46
|
-
var
|
46
|
+
var omit = _interopDefault(require('lodash/omit'));
|
47
|
+
var setWith = _interopDefault(require('lodash/setWith'));
|
47
48
|
var TabsPrimitive = require('@radix-ui/react-tabs');
|
48
49
|
var Joyride = require('react-joyride');
|
49
50
|
var Joyride__default = _interopDefault(Joyride);
|
@@ -4037,33 +4038,25 @@ const Accordion = props => {
|
|
4037
4038
|
const context = React__default.useMemo(() => ({
|
4038
4039
|
as
|
4039
4040
|
}), [as]);
|
4040
|
-
const type = typeof defaultId === 'string' || typeof id === 'string' ? 'single' : 'multiple';
|
4041
4041
|
let valueProps;
|
4042
4042
|
if (defaultId) {
|
4043
|
-
valueProps =
|
4044
|
-
|
4045
|
-
defaultValue: defaultId
|
4046
|
-
} : {
|
4047
|
-
type: 'multiple',
|
4048
|
-
defaultValue: defaultId
|
4043
|
+
valueProps = {
|
4044
|
+
defaultValue: defaultId || undefined
|
4049
4045
|
};
|
4050
4046
|
} else {
|
4051
|
-
valueProps =
|
4052
|
-
type: 'single',
|
4053
|
-
onValueChange: onChange,
|
4054
|
-
value: id || undefined
|
4055
|
-
} : {
|
4056
|
-
type: 'multiple',
|
4047
|
+
valueProps = {
|
4057
4048
|
onValueChange: onChange,
|
4058
4049
|
value: id || undefined
|
4059
4050
|
};
|
4060
4051
|
}
|
4052
|
+
const type = typeof valueProps.defaultValue === 'string' || typeof valueProps.value === 'string' ? 'single' : 'multiple';
|
4061
4053
|
const className = cn('divide-y divide-grey-200', props.className);
|
4062
4054
|
return /*#__PURE__*/React__default.createElement(AccordionContext.Provider, {
|
4063
4055
|
value: context
|
4064
4056
|
}, /*#__PURE__*/React__default.createElement(AccordionPrimitive.Root, Object.assign({}, otherProps, valueProps, {
|
4065
4057
|
"data-taco": "accordion",
|
4066
|
-
className: className
|
4058
|
+
className: className,
|
4059
|
+
type: type
|
4067
4060
|
})));
|
4068
4061
|
};
|
4069
4062
|
Accordion.Item = Item;
|
@@ -4213,7 +4206,7 @@ const getOverlaySelector = element => {
|
|
4213
4206
|
return undefined;
|
4214
4207
|
}
|
4215
4208
|
};
|
4216
|
-
function
|
4209
|
+
function isElementTriggeredFromContainer(element, container) {
|
4217
4210
|
var _getOverlaySelector, _element$closest;
|
4218
4211
|
const selector = (_getOverlaySelector = getOverlaySelector(element)) !== null && _getOverlaySelector !== void 0 ? _getOverlaySelector : getOverlaySelector((_element$closest = element === null || element === void 0 ? void 0 : element.closest('[role=dialog],[role=menu]')) !== null && _element$closest !== void 0 ? _element$closest : null);
|
4219
4212
|
if (selector) {
|
@@ -4223,11 +4216,14 @@ function isElementInsideOrTriggeredFromContainer(element, container) {
|
|
4223
4216
|
const elementInDocument = document.querySelector(selector);
|
4224
4217
|
// if the element does exist, see if it is itself connected to somethng that was triggered from the container
|
4225
4218
|
if (elementInDocument) {
|
4226
|
-
return
|
4219
|
+
return isElementTriggeredFromContainer(elementInDocument, container);
|
4227
4220
|
}
|
4228
4221
|
return false;
|
4229
4222
|
}
|
4230
|
-
return
|
4223
|
+
return false;
|
4224
|
+
}
|
4225
|
+
function isElementInsideOrTriggeredFromContainer(element, container) {
|
4226
|
+
return isElementTriggeredFromContainer(element, container) || !!(container !== null && container !== void 0 && container.contains(element));
|
4231
4227
|
}
|
4232
4228
|
function isElementInsideOverlay(element) {
|
4233
4229
|
return !!(element !== null && element !== void 0 && element.closest('[role=dialog],[role=menu]'));
|
@@ -4721,7 +4717,9 @@ const defaultLocalisationTexts = {
|
|
4721
4717
|
tooltip: 'Edit table'
|
4722
4718
|
},
|
4723
4719
|
create: {
|
4724
|
-
label: 'New'
|
4720
|
+
label: 'New',
|
4721
|
+
disabled: 'Existing new row must be saved',
|
4722
|
+
saving: 'Saving...'
|
4725
4723
|
}
|
4726
4724
|
},
|
4727
4725
|
clearChangesConfirmationDialog: {
|
@@ -4743,8 +4741,8 @@ const defaultLocalisationTexts = {
|
|
4743
4741
|
},
|
4744
4742
|
validation: {
|
4745
4743
|
alert: {
|
4746
|
-
titleOne: '[COUNT] unsaved
|
4747
|
-
titlePlural: '[COUNT] unsaved
|
4744
|
+
titleOne: '[COUNT] unsaved row:',
|
4745
|
+
titlePlural: '[COUNT] unsaved rows:',
|
4748
4746
|
messageOne: "[COLUMN] [ROW] is incomplete and hasn't been saved.",
|
4749
4747
|
messagePlural: "[COLUMN] [ROW] are incomplete and haven't been saved.",
|
4750
4748
|
messageRow: 'Row',
|
@@ -5744,13 +5742,7 @@ const searchForString = (child, value, strategy = 'includes') => {
|
|
5744
5742
|
}
|
5745
5743
|
return searchForString((_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.children, value, strategy);
|
5746
5744
|
} else {
|
5747
|
-
|
5748
|
-
const valueLowerCase = String(value).toLowerCase();
|
5749
|
-
if (strategy === 'startsWith') {
|
5750
|
-
return childLowerCase.startsWith(valueLowerCase);
|
5751
|
-
} else {
|
5752
|
-
return childLowerCase.includes(valueLowerCase);
|
5753
|
-
}
|
5745
|
+
return child.toString().toLowerCase()[strategy](String(value).toLowerCase());
|
5754
5746
|
}
|
5755
5747
|
} catch {
|
5756
5748
|
return false;
|
@@ -6704,7 +6696,7 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
|
|
6704
6696
|
}), /*#__PURE__*/React.createElement("div", {
|
6705
6697
|
className: containerClassName,
|
6706
6698
|
"data-taco": "dialog"
|
6707
|
-
},
|
6699
|
+
}, output, dialog.draggable && (/*#__PURE__*/React.createElement("div", Object.assign({}, dragHandleProps, {
|
6708
6700
|
role: "button",
|
6709
6701
|
draggable: true,
|
6710
6702
|
"aria-grabbed": dragging,
|
@@ -6718,7 +6710,7 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
|
|
6718
6710
|
"aria-label": texts.dialog.close,
|
6719
6711
|
className: "absolute right-0 top-0 mr-2 mt-2 print:hidden",
|
6720
6712
|
icon: "close"
|
6721
|
-
}))) : null)
|
6713
|
+
}))) : null), dialog.elements.drawer, dialog.elements.extra))));
|
6722
6714
|
});
|
6723
6715
|
|
6724
6716
|
const DialogDrawer = /*#__PURE__*/React.forwardRef(function DialogDrawer(props, ref) {
|
@@ -6911,12 +6903,12 @@ const Bar = props => {
|
|
6911
6903
|
className: className
|
6912
6904
|
}));
|
6913
6905
|
};
|
6914
|
-
const Thumb =
|
6906
|
+
const Thumb = props => /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Thumb, Object.assign({}, props, {
|
6915
6907
|
className: "flex-[1] rounded bg-black opacity-50"
|
6916
|
-
});
|
6917
|
-
const Corner =
|
6908
|
+
}));
|
6909
|
+
const Corner = props => /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Corner, Object.assign({}, props, {
|
6918
6910
|
className: "bg-grey-500"
|
6919
|
-
});
|
6911
|
+
}));
|
6920
6912
|
const ScrollArea = props => {
|
6921
6913
|
const {
|
6922
6914
|
children,
|
@@ -7646,7 +7638,7 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(props, ref) {
|
|
7646
7638
|
onCheckedChange: onChange,
|
7647
7639
|
ref: ref
|
7648
7640
|
}), /*#__PURE__*/React.createElement(PrimitiveSwitch.Thumb, {
|
7649
|
-
className: "
|
7641
|
+
className: "pointer-events-none mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform will-change-transform group-disabled:opacity-50 group-aria-checked:translate-x-[1.1rem]"
|
7650
7642
|
}));
|
7651
7643
|
if (label) {
|
7652
7644
|
const labelContainerClassName = cn('flex self-start cursor-pointer', {
|
@@ -8706,10 +8698,10 @@ const ModeSwitch = /*#__PURE__*/React.forwardRef(function ModeSwitch(props, ref)
|
|
8706
8698
|
onCheckedChange: onChange,
|
8707
8699
|
ref: ref
|
8708
8700
|
}), /*#__PURE__*/React.createElement(PrimitiveSwitch.Thumb, {
|
8709
|
-
className: "
|
8701
|
+
className: "pointer-events-none flex h-6 w-6 items-center justify-center rounded-full bg-white transition-transform will-change-transform group-disabled:opacity-50 group-aria-checked:translate-x-[100%]"
|
8710
8702
|
}, /*#__PURE__*/React.createElement(Icon, {
|
8711
8703
|
name: "edit-simple",
|
8712
|
-
className: "!h-5 !w-5"
|
8704
|
+
className: "pointer-events-none !h-5 !w-5"
|
8713
8705
|
})));
|
8714
8706
|
});
|
8715
8707
|
ModeSwitch.displayName = 'ModeSwitch';
|
@@ -10412,6 +10404,15 @@ function configureReactTableOptions(options, props, localization) {
|
|
10412
10404
|
// We don't want to expose internal Tanstack Table row, so we need to wrap enableRowSelection callback into additional function,
|
10413
10405
|
// which receives the React Table Row object and passes row.original to a callback.
|
10414
10406
|
const reactTableEnableRowSelection = typeof options.enableRowSelection === 'function' ? row => options.enableRowSelection(row.original) : options.enableRowSelection;
|
10407
|
+
let getRowId;
|
10408
|
+
if (props.rowIdentityAccessor) {
|
10409
|
+
getRowId = (originalRow, index) => {
|
10410
|
+
if (originalRow) {
|
10411
|
+
return originalRow[props.rowIdentityAccessor];
|
10412
|
+
}
|
10413
|
+
return String(index);
|
10414
|
+
};
|
10415
|
+
}
|
10415
10416
|
const tableOptions = {
|
10416
10417
|
defaultColumn: {
|
10417
10418
|
enableColumnFilter: options.enableFiltering || true,
|
@@ -10430,11 +10431,13 @@ function configureReactTableOptions(options, props, localization) {
|
|
10430
10431
|
enableGrouping: true,
|
10431
10432
|
enableHiding: (_options$enableColumn2 = options.enableColumnHiding) !== null && _options$enableColumn2 !== void 0 ? _options$enableColumn2 : false,
|
10432
10433
|
enablePinning: (_options$enableColumn3 = options.enableColumnFreezing) !== null && _options$enableColumn3 !== void 0 ? _options$enableColumn3 : false,
|
10434
|
+
enableRowPinning: true,
|
10433
10435
|
enableRowSelection: reactTableEnableRowSelection !== null && reactTableEnableRowSelection !== void 0 ? reactTableEnableRowSelection : false,
|
10434
10436
|
enableSorting: (_options$enableSortin = options.enableSorting) !== null && _options$enableSortin !== void 0 ? _options$enableSortin : false,
|
10435
10437
|
// models for default features
|
10436
10438
|
getExpandedRowModel: reactTable.getExpandedRowModel(),
|
10437
10439
|
getGroupedRowModel: reactTable.getGroupedRowModel(),
|
10440
|
+
getRowId,
|
10438
10441
|
groupedColumnMode: false
|
10439
10442
|
};
|
10440
10443
|
if (tableOptions.enableColumnResizing) {
|
@@ -10978,13 +10981,13 @@ function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
|
|
10978
10981
|
}
|
10979
10982
|
|
10980
10983
|
// A type of promise-like that resolves synchronously and supports only one observer
|
10981
|
-
|
10984
|
+
var _Pact = /*#__PURE__*/function () {
|
10982
10985
|
function _Pact() {}
|
10983
10986
|
_Pact.prototype.then = function (onFulfilled, onRejected) {
|
10984
|
-
|
10985
|
-
|
10987
|
+
var result = new _Pact();
|
10988
|
+
var state = this.s;
|
10986
10989
|
if (state) {
|
10987
|
-
|
10990
|
+
var callback = state & 1 ? onFulfilled : onRejected;
|
10988
10991
|
if (callback) {
|
10989
10992
|
try {
|
10990
10993
|
_settle(result, 1, callback(this.v));
|
@@ -10998,7 +11001,7 @@ const _Pact = /*#__PURE__*/function () {
|
|
10998
11001
|
}
|
10999
11002
|
this.o = function (_this) {
|
11000
11003
|
try {
|
11001
|
-
|
11004
|
+
var value = _this.v;
|
11002
11005
|
if (_this.s & 1) {
|
11003
11006
|
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
|
11004
11007
|
} else if (onRejected) {
|
@@ -11035,7 +11038,7 @@ function _settle(pact, state, value) {
|
|
11035
11038
|
}
|
11036
11039
|
pact.s = state;
|
11037
11040
|
pact.v = value;
|
11038
|
-
|
11041
|
+
var observer = pact.o;
|
11039
11042
|
if (observer) {
|
11040
11043
|
observer(pact);
|
11041
11044
|
}
|
@@ -11075,17 +11078,13 @@ function _forTo(array, body, check) {
|
|
11075
11078
|
_cycle();
|
11076
11079
|
return pact;
|
11077
11080
|
}
|
11078
|
-
|
11081
|
+
var _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /*#__PURE__*/Symbol("Symbol.iterator")) : "@@iterator";
|
11079
11082
|
|
11080
11083
|
// Asynchronously iterate through an object's values
|
11081
11084
|
// Uses for...of if the runtime supports it, otherwise iterates until length on a copy
|
11082
11085
|
function _forOf(target, body, check) {
|
11083
11086
|
if (typeof target[_iteratorSymbol] === "function") {
|
11084
|
-
var
|
11085
|
-
step,
|
11086
|
-
pact,
|
11087
|
-
reject;
|
11088
|
-
function _cycle(result) {
|
11087
|
+
var _cycle = function _cycle(result) {
|
11089
11088
|
try {
|
11090
11089
|
while (!(step = iterator.next()).done && (!check || !check())) {
|
11091
11090
|
result = body(step.value);
|
@@ -11106,13 +11105,17 @@ function _forOf(target, body, check) {
|
|
11106
11105
|
} catch (e) {
|
11107
11106
|
_settle(pact || (pact = new _Pact()), 2, e);
|
11108
11107
|
}
|
11109
|
-
}
|
11108
|
+
};
|
11109
|
+
var iterator = target[_iteratorSymbol](),
|
11110
|
+
step,
|
11111
|
+
pact,
|
11112
|
+
reject;
|
11110
11113
|
_cycle();
|
11111
|
-
if (iterator
|
11112
|
-
var _fixup = function (value) {
|
11114
|
+
if (iterator["return"]) {
|
11115
|
+
var _fixup = function _fixup(value) {
|
11113
11116
|
try {
|
11114
11117
|
if (!step.done) {
|
11115
|
-
iterator
|
11118
|
+
iterator["return"]();
|
11116
11119
|
}
|
11117
11120
|
} catch (e) {}
|
11118
11121
|
return value;
|
@@ -11139,7 +11142,7 @@ function _forOf(target, body, check) {
|
|
11139
11142
|
return body(values[i]);
|
11140
11143
|
}, check);
|
11141
11144
|
}
|
11142
|
-
|
11145
|
+
var _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /*#__PURE__*/Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
|
11143
11146
|
|
11144
11147
|
// Asynchronously call a function and send errors to recovery continuation
|
11145
11148
|
function _catch(body, recover) {
|
@@ -11767,7 +11770,7 @@ function useTableManager(props, meta, internalColumns) {
|
|
11767
11770
|
rowDrag,
|
11768
11771
|
rowDrop: rowDrop,
|
11769
11772
|
rowExpansion: rowExpansion,
|
11770
|
-
|
11773
|
+
rowIdentityAccessor: props.rowIdentityAccessor,
|
11771
11774
|
rowGoto,
|
11772
11775
|
rowGroups: rowGroups,
|
11773
11776
|
rowHeight,
|
@@ -12135,7 +12138,7 @@ function Row(props) {
|
|
12135
12138
|
function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
|
12136
12139
|
var _table$getState$group, _virtualItems$padding, _virtualItems$padding2, _virtualItems$padding3, _ref, _virtualItems;
|
12137
12140
|
const tableMeta = table.options.meta;
|
12138
|
-
const rows = table.
|
12141
|
+
const rows = table.getCenterRows();
|
12139
12142
|
const isTableRowGrouped = !!((_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length);
|
12140
12143
|
// expanded rows
|
12141
12144
|
const {
|
@@ -12314,12 +12317,14 @@ function Actions$1(props) {
|
|
12314
12317
|
actionsLength,
|
12315
12318
|
data,
|
12316
12319
|
isActiveRow,
|
12317
|
-
rowId
|
12320
|
+
rowId,
|
12321
|
+
table
|
12318
12322
|
} = props;
|
12319
12323
|
const {
|
12320
12324
|
texts
|
12321
12325
|
} = useLocalization();
|
12322
|
-
|
12326
|
+
// we don't want to document passing table, so it isn't on the type
|
12327
|
+
const visibleActions = actions.map(action => action(data, rowId, table)).filter(action => !!action);
|
12323
12328
|
const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
|
12324
12329
|
const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
|
12325
12330
|
const className = cn('flex justify-end text-right bg-[inherit] shadow-[-6px_0px_6px_var(--table-row-actions-shadow)] print:hidden');
|
@@ -12375,7 +12380,8 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
12375
12380
|
actionsLength: actionsLength,
|
12376
12381
|
data: row.original,
|
12377
12382
|
isActiveRow: isActiveRow,
|
12378
|
-
rowId: row.id
|
12383
|
+
rowId: row.id,
|
12384
|
+
table: table
|
12379
12385
|
});
|
12380
12386
|
}
|
12381
12387
|
return null;
|
@@ -12732,7 +12738,10 @@ function GroupedCell(props) {
|
|
12732
12738
|
index,
|
12733
12739
|
isHighlighted
|
12734
12740
|
} = props;
|
12735
|
-
const
|
12741
|
+
const {
|
12742
|
+
table
|
12743
|
+
} = cell.getContext();
|
12744
|
+
const tableMeta = table.options.meta;
|
12736
12745
|
const columnMeta = cell.column.columnDef.meta;
|
12737
12746
|
const attributes = getCellAttributes(cell, index, isHighlighted);
|
12738
12747
|
const {
|
@@ -12750,7 +12759,8 @@ function GroupedCell(props) {
|
|
12750
12759
|
colSpan: colSpan,
|
12751
12760
|
rowActions: tableMeta.rowGroups.rowActionsForGroup,
|
12752
12761
|
rowId: cell.row.id,
|
12753
|
-
subRows: subRows
|
12762
|
+
subRows: subRows,
|
12763
|
+
table: table
|
12754
12764
|
}), content);
|
12755
12765
|
}
|
12756
12766
|
const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupedCell(props) {
|
@@ -12762,6 +12772,7 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
|
|
12762
12772
|
rowActions,
|
12763
12773
|
rowId,
|
12764
12774
|
subRows,
|
12775
|
+
table,
|
12765
12776
|
...attributes
|
12766
12777
|
} = props;
|
12767
12778
|
return /*#__PURE__*/React__default.createElement("td", Object.assign({}, attributes, {
|
@@ -12776,7 +12787,8 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
|
|
12776
12787
|
actionsLength: 4,
|
12777
12788
|
data: subRows,
|
12778
12789
|
isActiveRow: true,
|
12779
|
-
rowId: rowId
|
12790
|
+
rowId: rowId,
|
12791
|
+
table: table
|
12780
12792
|
})) : null);
|
12781
12793
|
});
|
12782
12794
|
|
@@ -12916,7 +12928,7 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
|
|
12916
12928
|
const expansionRef = React__default.useRef(null);
|
12917
12929
|
const isExpanded = !!attributes['data-row-expanded'];
|
12918
12930
|
useSetVirtualisedRowHeight(measureRow, ref.current, expansionRef.current, isExpanded);
|
12919
|
-
const className = cn('group/row', {
|
12931
|
+
const className = cn('group/row', otherAttributes.className, {
|
12920
12932
|
'hover:cursor-grab': tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== 'function',
|
12921
12933
|
'hover:cursor-pointer': typeof attributes.onClick === 'function'
|
12922
12934
|
});
|
@@ -13222,11 +13234,11 @@ function HeaderMenu(props) {
|
|
13222
13234
|
return Promise.reject(e);
|
13223
13235
|
}
|
13224
13236
|
};
|
13225
|
-
popoverElement = props =>
|
13237
|
+
popoverElement = props => /*#__PURE__*/React__default.createElement(GotoPopover, Object.assign({}, props, {
|
13226
13238
|
open: true,
|
13227
13239
|
onChange: handleClosePopover,
|
13228
13240
|
onGoto: goto
|
13229
|
-
}))
|
13241
|
+
}));
|
13230
13242
|
}
|
13231
13243
|
}
|
13232
13244
|
}
|
@@ -13569,10 +13581,10 @@ const FOCUS_MANAGER_OPTIONS_ARROW_KEYS = {
|
|
13569
13581
|
};
|
13570
13582
|
function useAugmentedFocusManager() {
|
13571
13583
|
const focusManager = focus.useFocusManager();
|
13572
|
-
const focusPrevious = (arrowNavigation = false) => focusManager
|
13573
|
-
const focusNext = (arrowNavigation = false) => focusManager
|
13574
|
-
const focusFirst = () => focusManager
|
13575
|
-
const focusLast = () => focusManager
|
13584
|
+
const focusPrevious = (arrowNavigation = false) => focusManager.focusPrevious(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
|
13585
|
+
const focusNext = (arrowNavigation = false) => focusManager.focusNext(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
|
13586
|
+
const focusFirst = () => focusManager.focusFirst(FOCUS_MANAGER_OPTIONS_TAB);
|
13587
|
+
const focusLast = () => focusManager.focusLast(FOCUS_MANAGER_OPTIONS_TAB);
|
13576
13588
|
return {
|
13577
13589
|
focusPrevious,
|
13578
13590
|
focusNext,
|
@@ -13710,7 +13722,7 @@ function Summary(props) {
|
|
13710
13722
|
|
13711
13723
|
function Foot(props) {
|
13712
13724
|
const nonGroupedHeaders = props.table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
|
13713
|
-
return /*#__PURE__*/React__default.createElement("tfoot", null, /*#__PURE__*/React__default.createElement("tr", null, nonGroupedHeaders.map((header, index) => (/*#__PURE__*/React__default.createElement(Footer$3, {
|
13725
|
+
return /*#__PURE__*/React__default.createElement("tfoot", null, props.children, /*#__PURE__*/React__default.createElement("tr", null, nonGroupedHeaders.map((header, index) => (/*#__PURE__*/React__default.createElement(Footer$3, {
|
13714
13726
|
key: header.id,
|
13715
13727
|
header: header,
|
13716
13728
|
index: index
|
@@ -14089,7 +14101,7 @@ function Container(externalProps) {
|
|
14089
14101
|
if (!(activeList !== null && activeList !== void 0 && activeList.id) || !(overList !== null && overList !== void 0 && overList.id) || activeList.id === overList.id) {
|
14090
14102
|
return;
|
14091
14103
|
}
|
14092
|
-
move
|
14104
|
+
move(active.id, activeList === null || activeList === void 0 ? void 0 : activeList.id, overList.id);
|
14093
14105
|
}
|
14094
14106
|
function handleDragEnd(event) {
|
14095
14107
|
const {
|
@@ -14400,12 +14412,12 @@ const getOptionsFromCollection = (collection, selector) => collection.querySelec
|
|
14400
14412
|
const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(props, ref) {
|
14401
14413
|
const {
|
14402
14414
|
querySelector,
|
14415
|
+
resetOnChange,
|
14403
14416
|
tabIndex = 0,
|
14404
14417
|
...otherProps
|
14405
14418
|
} = props;
|
14406
14419
|
const internalRef = useMergedRef(ref);
|
14407
14420
|
const [activeIndex, setActiveIndex] = React__default.useState();
|
14408
|
-
const lastLengthRef = React__default.useRef(0);
|
14409
14421
|
const setActiveOption = (index, collection, option) => {
|
14410
14422
|
var _collection$querySele;
|
14411
14423
|
(_collection$querySele = collection.querySelector(`[aria-current]`)) === null || _collection$querySele === void 0 ? void 0 : _collection$querySele.removeAttribute('aria-current');
|
@@ -14428,17 +14440,34 @@ const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(prop
|
|
14428
14440
|
}, [internalRef.current, querySelector]);
|
14429
14441
|
React__default.useEffect(() => {
|
14430
14442
|
if (internalRef.current) {
|
14431
|
-
internalRef.current.
|
14443
|
+
internalRef.current.setActiveIndexByElement = setActiveIndexByElement;
|
14432
14444
|
}
|
14433
14445
|
}, [internalRef.current]);
|
14446
|
+
React__default.useEffect(() => {
|
14447
|
+
if (internalRef.current) {
|
14448
|
+
const selected = internalRef.current.querySelectorAll(`[aria-current="true"]`);
|
14449
|
+
const options = getOptionsFromCollection(internalRef.current, querySelector);
|
14450
|
+
if (options.length && selected.length === 1) {
|
14451
|
+
const firstSelected = internalRef.current.querySelector(`[aria-selected]`);
|
14452
|
+
if (firstSelected) {
|
14453
|
+
const selectedIndex = Array.from(options).indexOf(firstSelected);
|
14454
|
+
if (selectedIndex > -1) {
|
14455
|
+
setActiveOption(selectedIndex, internalRef.current, firstSelected);
|
14456
|
+
}
|
14457
|
+
}
|
14458
|
+
}
|
14459
|
+
}
|
14460
|
+
}, [resetOnChange]);
|
14434
14461
|
React__default.useEffect(() => {
|
14435
14462
|
if (internalRef.current) {
|
14436
14463
|
const options = getOptionsFromCollection(internalRef.current, querySelector);
|
14437
|
-
if (options.length
|
14464
|
+
if (options.length) {
|
14438
14465
|
let selected = internalRef.current.querySelectorAll(`[aria-current="true"]`);
|
14466
|
+
// if nothing is current (keyboard visible), look for selected items
|
14439
14467
|
if (selected.length === 0) {
|
14440
14468
|
selected = internalRef.current.querySelectorAll(`[aria-selected]`);
|
14441
14469
|
}
|
14470
|
+
// if one item is selected, make sure it's current
|
14442
14471
|
if (selected.length === 1) {
|
14443
14472
|
if (options) {
|
14444
14473
|
const firstSelected = selected.item(0);
|
@@ -14452,7 +14481,6 @@ const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(prop
|
|
14452
14481
|
setActiveOption(0, internalRef.current, options.item(0));
|
14453
14482
|
}
|
14454
14483
|
}
|
14455
|
-
lastLengthRef.current = options.length;
|
14456
14484
|
}
|
14457
14485
|
}, [props.children]);
|
14458
14486
|
const handleClick = event => {
|
@@ -14585,6 +14613,7 @@ const Root$1 = /*#__PURE__*/React__default.forwardRef(function Listbox2(props, r
|
|
14585
14613
|
id: id,
|
14586
14614
|
querySelector: customSelector ? `${DEFAULT_SELECTOR}, ${customSelector}` : DEFAULT_SELECTOR,
|
14587
14615
|
ref: ref,
|
14616
|
+
resetOnChange: value,
|
14588
14617
|
role: "listbox"
|
14589
14618
|
}), children)));
|
14590
14619
|
});
|
@@ -14750,6 +14779,16 @@ const getFontSize = fontSize => {
|
|
14750
14779
|
return 'text-sm';
|
14751
14780
|
}
|
14752
14781
|
};
|
14782
|
+
const filterOption = (child, searchQuery) => {
|
14783
|
+
var _child$props$textValu, _child$props$descript;
|
14784
|
+
if ((_child$props$textValu = child.props.textValue) !== null && _child$props$textValu !== void 0 && _child$props$textValu.toLowerCase().includes(searchQuery.toLowerCase())) {
|
14785
|
+
return true;
|
14786
|
+
}
|
14787
|
+
if ((_child$props$descript = child.props.description) !== null && _child$props$descript !== void 0 && _child$props$descript.toLowerCase().includes(searchQuery.toLowerCase())) {
|
14788
|
+
return true;
|
14789
|
+
}
|
14790
|
+
return String(child.props.children).toLowerCase().includes(searchQuery.toLowerCase());
|
14791
|
+
};
|
14753
14792
|
|
14754
14793
|
const Select2Context = /*#__PURE__*/React__default.createContext({});
|
14755
14794
|
const useSelect2Context = () => React__default.useContext(Select2Context);
|
@@ -14908,6 +14947,7 @@ const Colours = props => {
|
|
14908
14947
|
const {
|
14909
14948
|
color,
|
14910
14949
|
onChangeColor,
|
14950
|
+
onClick,
|
14911
14951
|
onKeyDown
|
14912
14952
|
} = props;
|
14913
14953
|
const {
|
@@ -14916,6 +14956,7 @@ const Colours = props => {
|
|
14916
14956
|
return /*#__PURE__*/React__default.createElement(RadioGroupPrimitive.Root, {
|
14917
14957
|
"aria-label": texts.select2.chooseColor,
|
14918
14958
|
className: "grid grid-cols-4 gap-2 focus:outline-none",
|
14959
|
+
onClick: onClick,
|
14919
14960
|
onKeyDown: onKeyDown,
|
14920
14961
|
onValueChange: color => onChangeColor(color),
|
14921
14962
|
value: color
|
@@ -15020,7 +15061,7 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
|
|
15020
15061
|
onClick: event => {
|
15021
15062
|
var _listboxRef$current;
|
15022
15063
|
event.stopPropagation();
|
15023
|
-
listboxRef === null || listboxRef === void 0 ? void 0 : (_listboxRef$current = listboxRef.current) === null || _listboxRef$current === void 0 ? void 0 : _listboxRef$current.
|
15064
|
+
listboxRef === null || listboxRef === void 0 ? void 0 : (_listboxRef$current = listboxRef.current) === null || _listboxRef$current === void 0 ? void 0 : _listboxRef$current.setActiveIndexByElement(event.currentTarget.parentElement);
|
15024
15065
|
},
|
15025
15066
|
popover: popover,
|
15026
15067
|
tabIndex: -1
|
@@ -15435,7 +15476,7 @@ const Search$2 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(p
|
|
15435
15476
|
}
|
15436
15477
|
};
|
15437
15478
|
return /*#__PURE__*/React__default.createElement(Field, {
|
15438
|
-
className: cn('mx-1.5 mb-1.5 !min-h-fit
|
15479
|
+
className: cn('mx-1.5 mb-1.5 !min-h-fit', {
|
15439
15480
|
'!pb-0': !validationError
|
15440
15481
|
}),
|
15441
15482
|
invalid: !!validationError,
|
@@ -15501,32 +15542,21 @@ const useChildren = ({
|
|
15501
15542
|
setSearchQuery
|
15502
15543
|
};
|
15503
15544
|
};
|
15504
|
-
const filterOption = (child, searchQuery) => {
|
15505
|
-
var _child$props$textValu, _child$props$descript;
|
15506
|
-
if ((_child$props$textValu = child.props.textValue) !== null && _child$props$textValu !== void 0 && _child$props$textValu.toLowerCase().includes(searchQuery.toLowerCase())) {
|
15507
|
-
return true;
|
15508
|
-
}
|
15509
|
-
if ((_child$props$descript = child.props.description) !== null && _child$props$descript !== void 0 && _child$props$descript.toLowerCase().includes(searchQuery.toLowerCase())) {
|
15510
|
-
return true;
|
15511
|
-
}
|
15512
|
-
return String(child.props.children).toLowerCase().includes(searchQuery.toLowerCase());
|
15513
|
-
};
|
15514
15545
|
|
15515
15546
|
const getNextColor = options => {
|
15516
|
-
|
15517
|
-
|
15518
|
-
|
15519
|
-
|
15520
|
-
|
15521
|
-
|
15522
|
-
|
15523
|
-
|
15524
|
-
}, {});
|
15525
|
-
options.forEach(option => {
|
15547
|
+
let occurrences = {};
|
15548
|
+
AVAILABLE_COLORS.filter(color => color !== 'transparent').forEach(color => {
|
15549
|
+
occurrences = {
|
15550
|
+
...occurrences,
|
15551
|
+
[color]: 0
|
15552
|
+
};
|
15553
|
+
});
|
15554
|
+
options.reduce((occurrences, option) => {
|
15526
15555
|
if (option.props.color) {
|
15527
15556
|
occurrences[option.props.color] = occurrences[option.props.color] ? occurrences[option.props.color] + 1 : 1;
|
15528
15557
|
}
|
15529
|
-
|
15558
|
+
return occurrences;
|
15559
|
+
}, occurrences);
|
15530
15560
|
const colors = Object.keys(occurrences);
|
15531
15561
|
if (colors.length) {
|
15532
15562
|
return colors.sort((a, b) => occurrences[a] - occurrences[b])[0];
|
@@ -15727,6 +15757,26 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15727
15757
|
createDialog,
|
15728
15758
|
createTriggerText
|
15729
15759
|
};
|
15760
|
+
const hasInlineCreation = onCreate && !createDialog;
|
15761
|
+
const hasSearch = flattenedChildren.length > 5 || hasInlineCreation;
|
15762
|
+
const visibleChildren = searchQuery === '' ? initialChildren : filteredChildren;
|
15763
|
+
const selectOptions = searchQuery === '' ? flattenedChildren.map(child => child.props.value) : filteredChildren.map(child => isGroup(child) ? Array.isArray(child.props.children) && child.props.children.map(subChild => subChild.props.value) : child.props.value).flatMap(c => c) || [];
|
15764
|
+
// support typeahead functionality when search isn't available
|
15765
|
+
const queryTimeoutRef = React__default.useRef('');
|
15766
|
+
const typeahead = debounce(function () {
|
15767
|
+
if (!queryTimeoutRef.current) {
|
15768
|
+
return;
|
15769
|
+
}
|
15770
|
+
const matchedValueIndex = visibleChildren.findIndex(child => filterOption(child, queryTimeoutRef.current));
|
15771
|
+
if (matchedValueIndex > -1) {
|
15772
|
+
setValue(selectOptions[matchedValueIndex]);
|
15773
|
+
}
|
15774
|
+
queryTimeoutRef.current = '';
|
15775
|
+
}, 200);
|
15776
|
+
const setValueIfMatched = query => {
|
15777
|
+
queryTimeoutRef.current = queryTimeoutRef.current + query;
|
15778
|
+
typeahead();
|
15779
|
+
};
|
15730
15780
|
const handleKeyDown = event => {
|
15731
15781
|
var _listboxRef$current;
|
15732
15782
|
if (open) {
|
@@ -15735,6 +15785,9 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15735
15785
|
return;
|
15736
15786
|
} else if (!event.ctrlKey && !event.metaKey && (event.key === 'ArrowDown' || /^[a-z0-9]$/i.test(event.key))) {
|
15737
15787
|
setOpen(true);
|
15788
|
+
if (!hasSearch) {
|
15789
|
+
setValueIfMatched(event.key);
|
15790
|
+
}
|
15738
15791
|
}
|
15739
15792
|
// the focus should always remain on the input, so we forward events on to the listbox
|
15740
15793
|
(_listboxRef$current = listboxRef.current) === null || _listboxRef$current === void 0 ? void 0 : _listboxRef$current.dispatchEvent(createCustomKeyboardEvent(event));
|
@@ -15761,6 +15814,9 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15761
15814
|
if (isAriaDirectionKey(event)) {
|
15762
15815
|
setShouldPauseHoverState(true);
|
15763
15816
|
}
|
15817
|
+
if (!hasSearch && /^[a-z0-9]$/i.test(event.key)) {
|
15818
|
+
setValueIfMatched(event.key);
|
15819
|
+
}
|
15764
15820
|
};
|
15765
15821
|
const handleCloseAutoFocus = event => {
|
15766
15822
|
event.preventDefault();
|
@@ -15778,7 +15834,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15778
15834
|
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
|
15779
15835
|
}
|
15780
15836
|
};
|
15781
|
-
const selectOptions = searchQuery === '' ? flattenedChildren.map(child => child.props.value) : filteredChildren.map(child => isGroup(child) ? Array.isArray(child.props.children) && child.props.children.map(subChild => subChild.props.value) : child.props.value).flatMap(c => c) || [];
|
15782
15837
|
const areAllSelected = Array.isArray(value) && selectOptions.every(option => value.includes(option));
|
15783
15838
|
const selectAllText = React__default.useMemo(() => {
|
15784
15839
|
if (searchQuery === '') {
|
@@ -15810,8 +15865,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15810
15865
|
setValue(nextValue);
|
15811
15866
|
}
|
15812
15867
|
};
|
15813
|
-
const hasInlineCreation = onCreate && !createDialog;
|
15814
|
-
const hasSearch = flattenedChildren.length > 5 || hasInlineCreation;
|
15815
15868
|
const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md ', {
|
15816
15869
|
'focus-within:yt-focus': !hasSearch,
|
15817
15870
|
'outline-none': hasSearch
|
@@ -15878,7 +15931,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15878
15931
|
ref: listboxRef,
|
15879
15932
|
setValue: setValue,
|
15880
15933
|
value: value
|
15881
|
-
},
|
15934
|
+
}, /*#__PURE__*/React__default.createElement(Collection$1, null, visibleChildren), onCreate ? /*#__PURE__*/React__default.createElement(Create, {
|
15882
15935
|
onCreate: onCreate,
|
15883
15936
|
options: flattenedChildren
|
15884
15937
|
}) : null))))), /*#__PURE__*/React__default.createElement(ControlledHiddenField, {
|
@@ -16367,7 +16420,6 @@ function Control(props) {
|
|
16367
16420
|
} = props;
|
16368
16421
|
const controlRenderer = column === null || column === void 0 ? void 0 : (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.control;
|
16369
16422
|
const dataType = column === null || column === void 0 ? void 0 : (_column$columnDef$met3 = column.columnDef.meta) === null || _column$columnDef$met3 === void 0 ? void 0 : _column$columnDef$met3.dataType;
|
16370
|
-
const ref = React__default.useRef(null);
|
16371
16423
|
React.useEffect(() => {
|
16372
16424
|
// Set value to false only after first render of the control (when it's undefined) after setting the FilterColumn value, because we don't want to change then the value every time filter is opened
|
16373
16425
|
if (controlRenderer === 'switch' && value === undefined) {
|
@@ -16378,8 +16430,7 @@ function Control(props) {
|
|
16378
16430
|
return /*#__PURE__*/React__default.cloneElement(controlRenderer({
|
16379
16431
|
...attributes,
|
16380
16432
|
setValue: value => onChange(value),
|
16381
|
-
value
|
16382
|
-
ref
|
16433
|
+
value
|
16383
16434
|
}), {
|
16384
16435
|
['data-query-selector']: querySelector,
|
16385
16436
|
className: 'focus:yt-focus'
|
@@ -16747,6 +16798,7 @@ function TableGrid(props) {
|
|
16747
16798
|
var _table$state$grouping;
|
16748
16799
|
const {
|
16749
16800
|
enableHorizontalArrowKeyNavigation,
|
16801
|
+
rowsForFooter,
|
16750
16802
|
table,
|
16751
16803
|
...attributes
|
16752
16804
|
} = props;
|
@@ -16754,8 +16806,6 @@ function TableGrid(props) {
|
|
16754
16806
|
table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);
|
16755
16807
|
} : undefined;
|
16756
16808
|
const filterReason = getFilterReason(table);
|
16757
|
-
const searchNotApplied = !table.state.globalFilter || table.state.globalFilter === '';
|
16758
|
-
const filtersNotApplied = !table.state.columnFilters || table.state.columnFilters.length === 0;
|
16759
16809
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("style", null, table.stylesheet), /*#__PURE__*/React__default.createElement(focus.FocusScope, null, /*#__PURE__*/React__default.createElement("table", Object.assign({}, attributes, {
|
16760
16810
|
id: table.id,
|
16761
16811
|
"data-table-font-size": table.meta.fontSize.size,
|
@@ -16788,9 +16838,9 @@ function TableGrid(props) {
|
|
16788
16838
|
...table.renderer.style,
|
16789
16839
|
height: table.renderer.style.height + ROW_HEIGHT_ESTIMATES[table.meta.rowHeight.height]
|
16790
16840
|
} : table.renderer.style
|
16791
|
-
}, table.renderer.rows,
|
16841
|
+
}, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
|
16792
16842
|
table: table.instance
|
16793
|
-
}) : null)))));
|
16843
|
+
}, rowsForFooter) : null)))));
|
16794
16844
|
}
|
16795
16845
|
|
16796
16846
|
function Column$1(_) {
|
@@ -18293,33 +18343,16 @@ const useTableRowCreation = (data, tableRef) => {
|
|
18293
18343
|
|
18294
18344
|
function useTableEditingListener(table, tableRef) {
|
18295
18345
|
const tableMeta = table.options.meta;
|
18296
|
-
const completedRowsCount = tableMeta.editing.getCompletedRowsCount();
|
18297
18346
|
const localization = useLocalization();
|
18298
|
-
const saveChanges = () => {
|
18299
|
-
requestAnimationFrame(() => {
|
18300
|
-
tableMeta.editing.saveChanges();
|
18301
|
-
});
|
18302
|
-
};
|
18303
18347
|
// save when the row changes
|
18348
|
+
// store the last row active index, otherwise everytime tableMeta.editing.saveChanges changes the hook runs again
|
18349
|
+
const lastRowActiveIndexRef = React__default.useRef(tableMeta.rowActive.rowActiveIndex);
|
18304
18350
|
useLazyEffect(() => {
|
18305
|
-
if (tableMeta.editing.isEditing) {
|
18306
|
-
|
18307
|
-
|
18308
|
-
}, [tableMeta.rowActive.rowActiveIndex]);
|
18309
|
-
useLazyEffect(() => {
|
18310
|
-
if (tableMeta.editing.isEditing) {
|
18311
|
-
if (tableMeta.rowActive.rowActiveIndex === undefined) {
|
18312
|
-
tableMeta.rowActive.setRowActiveIndex(0);
|
18313
|
-
}
|
18314
|
-
} else {
|
18315
|
-
// save
|
18316
|
-
saveChanges();
|
18317
|
-
// reset detailed mode
|
18318
|
-
tableMeta.editing.toggleDetailedMode(false);
|
18319
|
-
// reset the last index back to the first focusable element, when editing gets turned off
|
18320
|
-
tableMeta.editing.setLastFocusedCellIndex(undefined);
|
18351
|
+
if (tableMeta.editing.isEditing && tableMeta.rowActive.rowActiveIndex !== lastRowActiveIndexRef.current) {
|
18352
|
+
lastRowActiveIndexRef.current = tableMeta.rowActive.rowActiveIndex;
|
18353
|
+
tableMeta.editing.saveChanges(table);
|
18321
18354
|
}
|
18322
|
-
}, [tableMeta.editing.
|
18355
|
+
}, [tableMeta.rowActive.rowActiveIndex, tableMeta.editing.saveChanges]);
|
18323
18356
|
// show a warning if the user navigates away without triggering save, such as using the browser back/forward button
|
18324
18357
|
const hasChanges = tableMeta.editing.hasChanges();
|
18325
18358
|
React__default.useEffect(() => {
|
@@ -18335,25 +18368,46 @@ function useTableEditingListener(table, tableRef) {
|
|
18335
18368
|
window.removeEventListener('beforeunload', showUnsavedChangesWarning);
|
18336
18369
|
};
|
18337
18370
|
}, [tableMeta.editing.isEditing, hasChanges]);
|
18338
|
-
|
18339
|
-
|
18371
|
+
const hasSavedChanges = tableMeta.editing.hasSaved();
|
18372
|
+
useLazyEffect(() => {
|
18373
|
+
if (hasSavedChanges) {
|
18340
18374
|
resetHighlightedColumnIndexes(table.getState().globalFilter, table, localization);
|
18341
18375
|
}
|
18342
|
-
}, [
|
18376
|
+
}, [hasSavedChanges]);
|
18343
18377
|
React__default.useEffect(() => {
|
18344
18378
|
const onClickOutside = event => {
|
18345
18379
|
if (tableMeta.editing.isEditing) {
|
18346
|
-
|
18347
|
-
const
|
18348
|
-
|
18349
|
-
if (!insideTable) {
|
18350
|
-
saveChanges();
|
18380
|
+
const element = event.target;
|
18381
|
+
const insideTable = element.getAttribute('data-taco') === 'backdrop' || element.getAttribute('data-table') === 'editing-toggle' || isElementInsideOrTriggeredFromContainer(element, tableRef.current);
|
18382
|
+
// users can click the white space below rows which could be inside the table, but a valid scenario to save
|
18383
|
+
if (!insideTable || element.tagName === 'TABLE' || element.tagName === 'TBODY') {
|
18384
|
+
tableMeta.editing.saveChanges(table);
|
18351
18385
|
}
|
18352
18386
|
}
|
18353
18387
|
};
|
18354
18388
|
document.addEventListener('click', onClickOutside);
|
18355
18389
|
return () => document.removeEventListener('click', onClickOutside);
|
18356
|
-
}, [
|
18390
|
+
}, [tableMeta.editing.isEditing, tableMeta.editing.saveChanges]);
|
18391
|
+
const rows = table.getRowModel().rows;
|
18392
|
+
// make sure pending changes are removed for rows that no longer exist
|
18393
|
+
useLazyEffect(() => {
|
18394
|
+
const pendingChanges = tableMeta.editing.getErrorsShownInAlert();
|
18395
|
+
pendingChanges.forEach(pendingChange => {
|
18396
|
+
try {
|
18397
|
+
table.getRow(pendingChange.rowId);
|
18398
|
+
} catch {
|
18399
|
+
tableMeta.editing.discardChanges(pendingChange.rowId, table);
|
18400
|
+
}
|
18401
|
+
});
|
18402
|
+
}, [rows.length]);
|
18403
|
+
useGlobalKeyDown(tableMeta.editing.isEditing ? {
|
18404
|
+
key: 's',
|
18405
|
+
meta: true,
|
18406
|
+
shift: false
|
18407
|
+
} : undefined, event => {
|
18408
|
+
event.preventDefault();
|
18409
|
+
tableMeta.editing.saveChanges(table);
|
18410
|
+
});
|
18357
18411
|
}
|
18358
18412
|
|
18359
18413
|
function willRowMove(cell, change, rowIndex, localization) {
|
@@ -18414,7 +18468,7 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
|
|
18414
18468
|
if (rowIndex < rows.length - 1) {
|
18415
18469
|
miniSortRows.push(rows[rowIndex + 1]);
|
18416
18470
|
}
|
18417
|
-
const
|
18471
|
+
const resortedRows = [...miniSortRows].sort((rowA, rowB) => {
|
18418
18472
|
const sortFn = cell.column.getSortingFn();
|
18419
18473
|
const sortUndefined = cell.column.columnDef.sortUndefined;
|
18420
18474
|
if (!table.options.manualSorting && sortUndefined) {
|
@@ -18429,451 +18483,545 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
|
|
18429
18483
|
}
|
18430
18484
|
}
|
18431
18485
|
return sortFn(rowA, rowB, cell.column.id);
|
18432
|
-
};
|
18433
|
-
const resortedRows = [...miniSortRows].sort(sortRows);
|
18486
|
+
});
|
18434
18487
|
if (cell.column.getIsSorted() === 'desc') {
|
18435
18488
|
resortedRows.reverse();
|
18436
18489
|
}
|
18437
18490
|
return ((_resortedRows$index = resortedRows[index]) === null || _resortedRows$index === void 0 ? void 0 : _resortedRows$index.id) !== cell.row.id;
|
18438
18491
|
}
|
18439
|
-
function animateCreateRow(id) {
|
18440
|
-
const templateRow = document.querySelector(`[data-row-id="${id}"]`);
|
18441
|
-
if (templateRow) {
|
18442
|
-
const firstCell = templateRow.querySelector(':first-child');
|
18443
|
-
const checkbox = firstCell === null || firstCell === void 0 ? void 0 : firstCell.querySelector('[data-taco="checkbox"]');
|
18444
|
-
firstCell === null || firstCell === void 0 ? void 0 : firstCell.focus();
|
18445
|
-
if (checkbox) {
|
18446
|
-
setDataFocusAttribute(checkbox);
|
18447
|
-
}
|
18448
|
-
templateRow.scrollIntoView();
|
18449
|
-
const keyframes = [{
|
18450
|
-
background: '#b2c7ef'
|
18451
|
-
}, {
|
18452
|
-
background: '#ebebeb'
|
18453
|
-
}];
|
18454
|
-
for (const child of templateRow.children) {
|
18455
|
-
child.animate(keyframes, {
|
18456
|
-
duration: 1000,
|
18457
|
-
easing: 'ease-out'
|
18458
|
-
});
|
18459
|
-
}
|
18460
|
-
}
|
18461
|
-
}
|
18462
18492
|
|
18463
|
-
|
18464
|
-
|
18465
|
-
|
18466
|
-
|
18467
|
-
|
18468
|
-
|
18469
|
-
|
18470
|
-
|
18471
|
-
|
18472
|
-
|
18473
|
-
|
18474
|
-
|
18475
|
-
|
18476
|
-
|
18477
|
-
|
18478
|
-
|
18479
|
-
|
18480
|
-
|
18481
|
-
|
18482
|
-
|
18483
|
-
|
18484
|
-
|
18485
|
-
|
18486
|
-
|
18487
|
-
|
18488
|
-
|
18489
|
-
|
18490
|
-
|
18491
|
-
|
18493
|
+
const TEMPORARY_ROW_ID_PREFIX = 'temp-';
|
18494
|
+
const DELAY_BEFORE_REMOVING_SAVE_STATUS = 3000;
|
18495
|
+
function reducer$2(state, action) {
|
18496
|
+
const {
|
18497
|
+
type,
|
18498
|
+
rowId,
|
18499
|
+
payload
|
18500
|
+
} = action;
|
18501
|
+
switch (type) {
|
18502
|
+
case 'setCellValue':
|
18503
|
+
{
|
18504
|
+
const {
|
18505
|
+
columnId,
|
18506
|
+
row,
|
18507
|
+
value
|
18508
|
+
} = payload;
|
18509
|
+
return {
|
18510
|
+
...state,
|
18511
|
+
changes: {
|
18512
|
+
...state.changes,
|
18513
|
+
rows: setWith(state.changes.rows, `${rowId}.${columnId}`, value, Object),
|
18514
|
+
originals: setWith(state.changes.originals, rowId, row, Object)
|
18515
|
+
}
|
18516
|
+
};
|
18517
|
+
}
|
18518
|
+
case 'removeCellValue':
|
18519
|
+
{
|
18520
|
+
const {
|
18521
|
+
columnId,
|
18522
|
+
rowIdentityAccessor
|
18523
|
+
} = payload;
|
18524
|
+
const changes = omit(state.changes.rows, `${rowId}.${columnId}`);
|
18525
|
+
// if there are no changes left, remove the row
|
18526
|
+
if (!Object.keys(changes[rowId]).length) {
|
18527
|
+
return reducer$2(state, {
|
18528
|
+
type: 'removeRow',
|
18529
|
+
rowId,
|
18530
|
+
payload: {
|
18531
|
+
rowIdentityAccessor
|
18532
|
+
}
|
18533
|
+
});
|
18534
|
+
}
|
18535
|
+
return {
|
18536
|
+
...state,
|
18537
|
+
changes: {
|
18538
|
+
...state.changes,
|
18539
|
+
rows: omit(state.changes.rows, `${rowId}.${columnId}`),
|
18540
|
+
errors: omit(state.changes.errors, `${rowId}.cells.${columnId}`),
|
18541
|
+
moveReasons: omit(state.changes.moveReasons, `${rowId}.${columnId}`)
|
18542
|
+
}
|
18543
|
+
};
|
18544
|
+
}
|
18545
|
+
case 'updateRow':
|
18546
|
+
{
|
18547
|
+
const {
|
18548
|
+
cellErrors,
|
18549
|
+
moveReasons,
|
18550
|
+
original,
|
18551
|
+
value
|
18552
|
+
} = payload;
|
18553
|
+
return {
|
18554
|
+
...state,
|
18555
|
+
changes: {
|
18556
|
+
...state.changes,
|
18557
|
+
rows: setWith(state.changes.rows, rowId, value, Object),
|
18558
|
+
errors: setWith(state.changes.errors, `${rowId}.cells`, cellErrors !== null && cellErrors !== void 0 ? cellErrors : state.changes.errors.cells[rowId], Object),
|
18559
|
+
originals: setWith(state.changes.originals, rowId, original !== null && original !== void 0 ? original : state.changes.originals[rowId], Object),
|
18560
|
+
moveReasons: setWith(state.changes.moveReasons, rowId, moveReasons !== null && moveReasons !== void 0 ? moveReasons : state.changes.moveReasons[rowId], Object),
|
18561
|
+
// status can be undefined, so don't use ??
|
18562
|
+
status: setWith(state.changes.status, rowId, undefined, Object)
|
18563
|
+
}
|
18564
|
+
};
|
18565
|
+
}
|
18566
|
+
case 'removeRow':
|
18567
|
+
{
|
18568
|
+
const {
|
18569
|
+
rowIdentityAccessor
|
18570
|
+
} = payload;
|
18571
|
+
return {
|
18572
|
+
...state,
|
18573
|
+
changes: {
|
18574
|
+
...state.changes,
|
18575
|
+
rows: omit(state.changes.rows, rowId),
|
18576
|
+
errors: omit(state.changes.errors, rowId),
|
18577
|
+
moveReasons: omit(state.changes.moveReasons, rowId),
|
18578
|
+
originals: omit(state.changes.originals, rowId),
|
18579
|
+
status: omit(state.changes.status, rowId)
|
18580
|
+
},
|
18581
|
+
temporaryRows: state.temporaryRows.filter(row => row[rowIdentityAccessor] !== rowId)
|
18582
|
+
};
|
18583
|
+
}
|
18584
|
+
case 'setRowStatus':
|
18585
|
+
{
|
18586
|
+
const {
|
18587
|
+
status
|
18588
|
+
} = payload;
|
18589
|
+
return {
|
18590
|
+
...state,
|
18591
|
+
changes: {
|
18592
|
+
...state.changes,
|
18593
|
+
status: status ? setWith(state.changes.status, rowId, status, Object) : omit(state.changes.status, rowId)
|
18594
|
+
}
|
18595
|
+
};
|
18596
|
+
}
|
18597
|
+
case 'setRowErrors':
|
18598
|
+
{
|
18599
|
+
const {
|
18600
|
+
...errors
|
18601
|
+
} = payload;
|
18602
|
+
return {
|
18603
|
+
...state,
|
18604
|
+
changes: {
|
18605
|
+
...state.changes,
|
18606
|
+
errors: setWith(state.changes.errors, rowId, errors, Object)
|
18607
|
+
}
|
18608
|
+
};
|
18609
|
+
}
|
18610
|
+
case 'createRow':
|
18611
|
+
{
|
18612
|
+
const {
|
18613
|
+
value
|
18614
|
+
} = payload;
|
18615
|
+
return {
|
18616
|
+
...state,
|
18617
|
+
temporaryRows: state.temporaryRows.concat(value),
|
18618
|
+
changes: {
|
18619
|
+
...state.changes,
|
18620
|
+
rows: setWith(state.changes.rows, rowId, value, Object),
|
18621
|
+
originals: setWith(state.changes.originals, rowId, value, Object)
|
18622
|
+
}
|
18623
|
+
};
|
18624
|
+
}
|
18625
|
+
default:
|
18626
|
+
return state;
|
18627
|
+
}
|
18492
18628
|
}
|
18493
|
-
function
|
18494
|
-
const saveChanges = function (rowId = undefined) {
|
18629
|
+
function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator) {
|
18630
|
+
const saveChanges = function (table, rowId = undefined) {
|
18495
18631
|
try {
|
18496
18632
|
let _exit = false;
|
18497
18633
|
if (!handleSave) {
|
18498
18634
|
console.warn('Tried to save, but Table has no onEditingSave handler');
|
18499
|
-
return Promise.resolve();
|
18635
|
+
return Promise.resolve(false);
|
18500
18636
|
}
|
18501
|
-
// we
|
18502
|
-
const
|
18503
|
-
[rowId]:
|
18504
|
-
} :
|
18505
|
-
|
18506
|
-
|
18507
|
-
|
18508
|
-
|
18509
|
-
|
18510
|
-
|
18511
|
-
|
18512
|
-
|
18513
|
-
|
18514
|
-
|
18515
|
-
|
18516
|
-
|
18517
|
-
|
18518
|
-
|
18519
|
-
|
18520
|
-
|
18521
|
-
|
18522
|
-
|
18523
|
-
|
18524
|
-
|
18525
|
-
|
18526
|
-
|
18527
|
-
|
18528
|
-
|
18529
|
-
|
18530
|
-
|
18531
|
-
|
18532
|
-
|
18533
|
-
|
18534
|
-
|
18535
|
-
|
18536
|
-
|
18537
|
-
return
|
18538
|
-
|
18539
|
-
|
18540
|
-
// this code handles those errors and maps them either to row errors or cell specific errors
|
18541
|
-
let rowError;
|
18542
|
-
let cellErrors;
|
18543
|
-
if (typeof error === 'string') {
|
18544
|
-
rowError = error;
|
18545
|
-
} else if (error instanceof Error) {
|
18546
|
-
var _error$response;
|
18547
|
-
rowError = error.message;
|
18548
|
-
// most of our apis return error objects within this shape
|
18549
|
-
if (typeof ((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data) === 'object') {
|
18550
|
-
var _error$response2;
|
18551
|
-
cellErrors = (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.data;
|
18637
|
+
// sometimes we only want to save one row
|
18638
|
+
const changes = rowId ? {
|
18639
|
+
[rowId]: state.changes.rows[rowId]
|
18640
|
+
} : state.changes.rows;
|
18641
|
+
let completed = true;
|
18642
|
+
const _temp9 = _forOf(Object.keys(changes), function (rowId) {
|
18643
|
+
const status = getRowStatus(rowId);
|
18644
|
+
return _catch(function () {
|
18645
|
+
var _changeSet$rowIdentit;
|
18646
|
+
function _temp8(_result) {
|
18647
|
+
return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
|
18648
|
+
// cleanup changes, we don't need them after saving
|
18649
|
+
discardChanges(rowId, table);
|
18650
|
+
// show the saved status, then remove it after a delay
|
18651
|
+
setRowStatus(rowId, 'saved');
|
18652
|
+
setTimeout(() => {
|
18653
|
+
setRowStatus(rowId, undefined);
|
18654
|
+
}, DELAY_BEFORE_REMOVING_SAVE_STATUS);
|
18655
|
+
});
|
18656
|
+
}
|
18657
|
+
// don't try to save if - already saving, or there are known errors
|
18658
|
+
if (status === 'saving' || status === 'errored') {
|
18659
|
+
return;
|
18660
|
+
}
|
18661
|
+
setRowStatus(rowId, 'saving');
|
18662
|
+
const changeSet = {
|
18663
|
+
...state.changes.originals[rowId],
|
18664
|
+
...changes[rowId]
|
18665
|
+
};
|
18666
|
+
// if we had to create a temporary id, delete it first - it's our data, not theirs
|
18667
|
+
if ((_changeSet$rowIdentit = changeSet[rowIdentityAccessor]) !== null && _changeSet$rowIdentit !== void 0 && _changeSet$rowIdentit.startsWith(TEMPORARY_ROW_ID_PREFIX)) {
|
18668
|
+
delete changeSet[rowIdentityAccessor];
|
18669
|
+
}
|
18670
|
+
// re-run validation, maybe a cell is already invalid but has never been blurred
|
18671
|
+
const _temp7 = function () {
|
18672
|
+
if (validator) {
|
18673
|
+
return Promise.resolve(validator(changeSet)).then(function (errors) {
|
18674
|
+
if (errors && Object.keys(errors).length) {
|
18675
|
+
throw errors;
|
18552
18676
|
}
|
18553
|
-
}
|
18554
|
-
|
18555
|
-
|
18556
|
-
|
18557
|
-
|
18558
|
-
|
18559
|
-
|
18560
|
-
|
18561
|
-
|
18562
|
-
|
18563
|
-
|
18564
|
-
|
18565
|
-
|
18566
|
-
|
18567
|
-
|
18677
|
+
});
|
18678
|
+
}
|
18679
|
+
}();
|
18680
|
+
return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7); // send new data to the server
|
18681
|
+
}, function (error) {
|
18682
|
+
var _error$response;
|
18683
|
+
if (error instanceof ReferenceError || error instanceof TypeError || (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) >= 500) {
|
18684
|
+
console.error(error);
|
18685
|
+
}
|
18686
|
+
// the onEditingSave handler should throw errors when something fails, e.g. validation, network errors etc
|
18687
|
+
// this code handles those errors and maps them either to row errors or cell specific errors
|
18688
|
+
let rowError;
|
18689
|
+
let cellErrors;
|
18690
|
+
if (typeof error === 'string') {
|
18691
|
+
rowError = error;
|
18692
|
+
} else if (error instanceof Error) {
|
18693
|
+
var _error$response2;
|
18694
|
+
rowError = error.message;
|
18695
|
+
// most of our apis return error objects within this shape
|
18696
|
+
if (typeof ((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.data) === 'object') {
|
18697
|
+
var _error$response3;
|
18698
|
+
cellErrors = (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data;
|
18699
|
+
}
|
18700
|
+
} else if (typeof error === 'object') {
|
18701
|
+
cellErrors = error;
|
18702
|
+
}
|
18703
|
+
if (rowError || cellErrors) {
|
18704
|
+
dispatch({
|
18705
|
+
type: 'setRowErrors',
|
18706
|
+
rowId,
|
18707
|
+
payload: {
|
18708
|
+
row: rowError,
|
18709
|
+
cells: cellErrors,
|
18710
|
+
shouldShowErrorAlert: true
|
18568
18711
|
}
|
18569
|
-
setRowSaveStatus(rowId, undefined);
|
18570
18712
|
});
|
18571
|
-
}
|
18572
|
-
|
18573
|
-
|
18574
|
-
}
|
18575
|
-
}()
|
18713
|
+
}
|
18714
|
+
setRowStatus(rowId, 'errored');
|
18715
|
+
completed = false;
|
18716
|
+
});
|
18717
|
+
}, function () {
|
18718
|
+
return _exit;
|
18719
|
+
});
|
18720
|
+
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function (_result3) {
|
18721
|
+
return _exit ? _result3 : completed;
|
18722
|
+
}) : _exit ? _temp9 : completed);
|
18576
18723
|
} catch (e) {
|
18577
18724
|
return Promise.reject(e);
|
18578
18725
|
}
|
18579
18726
|
};
|
18580
|
-
const
|
18727
|
+
const onCellChanged = function (cell, rowIndex) {
|
18581
18728
|
try {
|
18582
|
-
|
18583
|
-
|
18584
|
-
|
18585
|
-
|
18586
|
-
|
18587
|
-
|
18588
|
-
|
18589
|
-
|
18590
|
-
|
18591
|
-
|
18592
|
-
|
18593
|
-
|
18594
|
-
|
18595
|
-
|
18596
|
-
|
18597
|
-
|
18598
|
-
|
18599
|
-
|
18729
|
+
function _temp6() {
|
18730
|
+
var _state$changes$errors8;
|
18731
|
+
function _temp4() {
|
18732
|
+
// only set errors and move reasons for the cells we're currently acting on
|
18733
|
+
// why? because the UX is not good if we set them for cells the user hasn't touched yet
|
18734
|
+
const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
|
18735
|
+
const allCells = cell.row._getAllCellsByColumnId();
|
18736
|
+
cellsToActOn.forEach(accessor => {
|
18737
|
+
if (validationErrors[accessor]) {
|
18738
|
+
nextCellErrors[accessor] = validationErrors[accessor];
|
18739
|
+
// don't show move indicator for cells with errors, they aren't valid and can't be saved
|
18740
|
+
delete nextMoveReasons[accessor];
|
18741
|
+
} else {
|
18742
|
+
var _allCells$accessor;
|
18743
|
+
// there isn't any error in this run, remove any error set in state
|
18744
|
+
delete nextCellErrors[accessor];
|
18745
|
+
if ((_allCells$accessor = allCells[accessor]) !== null && _allCells$accessor !== void 0 && _allCells$accessor.column.getIsSorted()) {
|
18746
|
+
// run row move determination
|
18747
|
+
const reason = willRowMove(cell, nextChanges[accessor], rowIndex, localization);
|
18748
|
+
// if the row will move based on this change save why, otherwise delete any existing state
|
18749
|
+
if (reason) {
|
18750
|
+
nextMoveReasons[accessor] = reason;
|
18751
|
+
} else {
|
18752
|
+
delete nextMoveReasons[accessor];
|
18600
18753
|
}
|
18601
|
-
}
|
18602
|
-
|
18754
|
+
}
|
18755
|
+
}
|
18756
|
+
});
|
18757
|
+
dispatch({
|
18758
|
+
type: 'updateRow',
|
18759
|
+
rowId: cell.row.id,
|
18760
|
+
payload: {
|
18761
|
+
cellErrors: nextCellErrors,
|
18762
|
+
moveReasons: nextMoveReasons,
|
18763
|
+
value: nextChanges
|
18764
|
+
}
|
18765
|
+
});
|
18766
|
+
}
|
18767
|
+
// create a projection of the next state, so we can act against it
|
18768
|
+
const nextChanges = {
|
18769
|
+
...state.changes.rows[cell.row.id],
|
18770
|
+
...updatesForOtherCells
|
18771
|
+
};
|
18772
|
+
const nextMoveReasons = {
|
18773
|
+
...state.changes.moveReasons[cell.row.id]
|
18774
|
+
};
|
18775
|
+
const nextCellErrors = {
|
18776
|
+
...((_state$changes$errors8 = state.changes.errors[cell.row.id]) === null || _state$changes$errors8 === void 0 ? void 0 : _state$changes$errors8.cells)
|
18777
|
+
};
|
18778
|
+
// run validation
|
18779
|
+
let validationErrors = {};
|
18780
|
+
const _temp3 = function () {
|
18781
|
+
if (validator) {
|
18782
|
+
const nextRowValue = {
|
18783
|
+
...state.changes.originals[cell.row.id],
|
18784
|
+
...changes,
|
18785
|
+
...updatesForOtherCells
|
18786
|
+
};
|
18787
|
+
return Promise.resolve(validator(nextRowValue)).then(function (_validator2) {
|
18788
|
+
validationErrors = _validator2 !== null && _validator2 !== void 0 ? _validator2 : {};
|
18603
18789
|
});
|
18790
|
+
}
|
18791
|
+
}();
|
18792
|
+
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
18793
|
+
}
|
18794
|
+
const changes = state.changes.rows[cell.row.id];
|
18795
|
+
if (!changes) {
|
18796
|
+
return Promise.resolve();
|
18797
|
+
}
|
18798
|
+
let updatesForOtherCells = {};
|
18799
|
+
// run the updater handler if there is one, to see if there are any other cells to update
|
18800
|
+
const _temp5 = function () {
|
18801
|
+
if (typeof handleChange === 'function') {
|
18802
|
+
const previousRowValue = {
|
18803
|
+
...state.changes.originals[cell.row.id]
|
18804
|
+
};
|
18805
|
+
const nextRowValue = {
|
18806
|
+
...state.changes.originals[cell.row.id],
|
18807
|
+
...changes
|
18808
|
+
};
|
18809
|
+
return Promise.resolve(handleChange(cell.column.id, changes[cell.column.id], nextRowValue, previousRowValue)).then(function (_handleChange) {
|
18810
|
+
updatesForOtherCells = _handleChange !== null && _handleChange !== void 0 ? _handleChange : {};
|
18604
18811
|
});
|
18605
18812
|
}
|
18606
18813
|
}();
|
18607
|
-
return Promise.resolve(
|
18814
|
+
return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
|
18608
18815
|
} catch (e) {
|
18609
18816
|
return Promise.reject(e);
|
18610
18817
|
}
|
18611
|
-
};
|
18612
|
-
const
|
18818
|
+
}; // general
|
18819
|
+
const createRow = function (data) {
|
18613
18820
|
try {
|
18614
|
-
const
|
18615
|
-
|
18821
|
+
const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${uuid.v4()}`;
|
18822
|
+
const value = {
|
18823
|
+
...data,
|
18824
|
+
[rowIdentityAccessor]: newRowId
|
18616
18825
|
};
|
18617
|
-
|
18618
|
-
|
18619
|
-
|
18620
|
-
|
18826
|
+
dispatch({
|
18827
|
+
type: 'createRow',
|
18828
|
+
rowId: newRowId,
|
18829
|
+
payload: {
|
18830
|
+
value
|
18831
|
+
}
|
18621
18832
|
});
|
18622
|
-
|
18623
|
-
return Promise.resolve();
|
18833
|
+
return Promise.resolve(newRowId);
|
18624
18834
|
} catch (e) {
|
18625
18835
|
return Promise.reject(e);
|
18626
18836
|
}
|
18627
|
-
};
|
18628
|
-
|
18837
|
+
}; // cells
|
18838
|
+
// rows
|
18839
|
+
const setRowValue = function (rowId, original, value) {
|
18629
18840
|
try {
|
18630
|
-
|
18631
|
-
|
18632
|
-
|
18633
|
-
|
18634
|
-
|
18635
|
-
|
18636
|
-
|
18637
|
-
|
18638
|
-
...changes[cell.row.id],
|
18639
|
-
[cell.column.id]: cell.getValue(),
|
18640
|
-
_meta: {
|
18641
|
-
...((_currentChanges$cell$ = currentChanges[cell.row.id]) === null || _currentChanges$cell$ === void 0 ? void 0 : _currentChanges$cell$._meta),
|
18642
|
-
original: cell.row.original,
|
18643
|
-
moveReason: {
|
18644
|
-
...((_currentChanges$cell$2 = currentChanges[cell.row.id]) === null || _currentChanges$cell$2 === void 0 ? void 0 : _currentChanges$cell$2._meta.moveReason)
|
18645
|
-
},
|
18646
|
-
errors: {
|
18647
|
-
...((_currentChanges$cell$3 = currentChanges[cell.row.id]) === null || _currentChanges$cell$3 === void 0 ? void 0 : _currentChanges$cell$3._meta.errors)
|
18648
|
-
}
|
18649
|
-
}
|
18650
|
-
}
|
18651
|
-
};
|
18652
|
-
} else {
|
18653
|
-
return changes;
|
18841
|
+
function _temp2() {
|
18842
|
+
dispatch({
|
18843
|
+
type: 'updateRow',
|
18844
|
+
rowId,
|
18845
|
+
payload: {
|
18846
|
+
cellErrors,
|
18847
|
+
original,
|
18848
|
+
value
|
18654
18849
|
}
|
18655
|
-
}
|
18656
|
-
}
|
18657
|
-
|
18658
|
-
|
18850
|
+
});
|
18851
|
+
}
|
18852
|
+
let cellErrors;
|
18853
|
+
const _temp = function () {
|
18854
|
+
if (validator) {
|
18855
|
+
const row = {
|
18856
|
+
...original,
|
18857
|
+
...value
|
18858
|
+
};
|
18859
|
+
return Promise.resolve(validator(row)).then(function (_validator) {
|
18860
|
+
cellErrors = _validator !== null && _validator !== void 0 ? _validator : {};
|
18861
|
+
});
|
18862
|
+
}
|
18863
|
+
}();
|
18864
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
18865
|
+
} catch (e) {
|
18659
18866
|
return Promise.reject(e);
|
18660
18867
|
}
|
18661
18868
|
};
|
18662
18869
|
const localization = useLocalization();
|
18663
|
-
const [
|
18664
|
-
|
18665
|
-
|
18666
|
-
|
18667
|
-
|
18668
|
-
|
18870
|
+
const [state, dispatch] = React__default.useReducer(reducer$2, {
|
18871
|
+
changes: {
|
18872
|
+
rows: {},
|
18873
|
+
errors: {},
|
18874
|
+
moveReasons: {},
|
18875
|
+
originals: {},
|
18876
|
+
status: {}
|
18877
|
+
},
|
18878
|
+
temporaryRows: []
|
18879
|
+
});
|
18880
|
+
function getRowValue(rowId) {
|
18881
|
+
var _state$changes$rows$r, _state$changes$rows;
|
18882
|
+
return (_state$changes$rows$r = (_state$changes$rows = state.changes.rows) === null || _state$changes$rows === void 0 ? void 0 : _state$changes$rows[rowId]) !== null && _state$changes$rows$r !== void 0 ? _state$changes$rows$r : undefined;
|
18669
18883
|
}
|
18670
|
-
function
|
18671
|
-
var
|
18672
|
-
return (
|
18884
|
+
function getRowMoveReason(rowId) {
|
18885
|
+
var _Object$values$, _state$changes$moveRe, _state$changes$moveRe2;
|
18886
|
+
return (_Object$values$ = Object.values((_state$changes$moveRe = (_state$changes$moveRe2 = state.changes.moveReasons) === null || _state$changes$moveRe2 === void 0 ? void 0 : _state$changes$moveRe2[rowId]) !== null && _state$changes$moveRe !== void 0 ? _state$changes$moveRe : {})[0]) !== null && _Object$values$ !== void 0 ? _Object$values$ : undefined;
|
18673
18887
|
}
|
18674
|
-
const pendingChangesUpdater = usePendingChangesUpdater(handleChange, setPendingChanges);
|
18675
18888
|
function hasRowErrors(rowId) {
|
18676
|
-
var
|
18677
|
-
|
18678
|
-
return false;
|
18679
|
-
}
|
18680
|
-
return !!((_pendingChanges$rowId = pendingChanges[rowId]) !== null && _pendingChanges$rowId !== void 0 && (_pendingChanges$rowId2 = _pendingChanges$rowId._meta.errors) !== null && _pendingChanges$rowId2 !== void 0 && _pendingChanges$rowId2.row) || !!Object.keys((_pendingChanges$rowId3 = (_pendingChanges$rowId4 = pendingChanges[rowId]) === null || _pendingChanges$rowId4 === void 0 ? void 0 : (_pendingChanges$rowId5 = _pendingChanges$rowId4._meta.errors) === null || _pendingChanges$rowId5 === void 0 ? void 0 : _pendingChanges$rowId5.cells) !== null && _pendingChanges$rowId3 !== void 0 ? _pendingChanges$rowId3 : {}).length;
|
18681
|
-
}
|
18682
|
-
function hasRowErrorsSeen(rowId) {
|
18683
|
-
var _pendingChanges$rowId6;
|
18684
|
-
if (!isEnabled) {
|
18685
|
-
return false;
|
18686
|
-
}
|
18687
|
-
return hasRowErrors(rowId) && !!((_pendingChanges$rowId6 = pendingChanges[rowId]._meta.errors) !== null && _pendingChanges$rowId6 !== void 0 && _pendingChanges$rowId6.shouldShowErrorAlert);
|
18889
|
+
var _state$changes$errors, _state$changes$errors2, _state$changes$errors3;
|
18890
|
+
return !!((_state$changes$errors = state.changes.errors[rowId]) !== null && _state$changes$errors !== void 0 && _state$changes$errors.row) || !!Object.keys((_state$changes$errors2 = (_state$changes$errors3 = state.changes.errors[rowId]) === null || _state$changes$errors3 === void 0 ? void 0 : _state$changes$errors3.cells) !== null && _state$changes$errors2 !== void 0 ? _state$changes$errors2 : {}).length;
|
18688
18891
|
}
|
18689
|
-
function
|
18690
|
-
|
18691
|
-
|
18692
|
-
const {
|
18693
|
-
_meta,
|
18694
|
-
...pendingChange
|
18695
|
-
} = rowPendingChanges;
|
18696
|
-
return pendingChange;
|
18697
|
-
}
|
18698
|
-
return undefined;
|
18892
|
+
function hasRowErrorsShownInAlert(rowId) {
|
18893
|
+
var _state$changes$errors4;
|
18894
|
+
return hasRowErrors(rowId) && !!((_state$changes$errors4 = state.changes.errors[rowId]) !== null && _state$changes$errors4 !== void 0 && _state$changes$errors4.shouldShowErrorAlert);
|
18699
18895
|
}
|
18700
|
-
function
|
18701
|
-
|
18702
|
-
return false;
|
18703
|
-
}
|
18704
|
-
return saveStates[rowId];
|
18896
|
+
function getRowStatus(rowId) {
|
18897
|
+
return state.changes.status[rowId];
|
18705
18898
|
}
|
18706
|
-
function
|
18707
|
-
|
18708
|
-
|
18709
|
-
|
18710
|
-
|
18711
|
-
|
18712
|
-
nextStates[rowId] = status;
|
18713
|
-
} else {
|
18714
|
-
delete nextStates[rowId];
|
18899
|
+
function setRowStatus(rowId, status) {
|
18900
|
+
dispatch({
|
18901
|
+
type: 'setRowStatus',
|
18902
|
+
rowId,
|
18903
|
+
payload: {
|
18904
|
+
status
|
18715
18905
|
}
|
18716
|
-
return nextStates;
|
18717
18906
|
});
|
18718
18907
|
}
|
18719
|
-
function
|
18720
|
-
|
18721
|
-
|
18722
|
-
|
18723
|
-
|
18724
|
-
|
18725
|
-
|
18908
|
+
function setCellValue(cell, value) {
|
18909
|
+
const rowId = cell.row.id;
|
18910
|
+
const columnId = cell.column.id;
|
18911
|
+
// update if the change is different to the original value
|
18912
|
+
if (value !== cell.row.original[columnId]) {
|
18913
|
+
dispatch({
|
18914
|
+
type: 'setCellValue',
|
18915
|
+
rowId,
|
18916
|
+
payload: {
|
18917
|
+
columnId,
|
18918
|
+
row: cell.row.original,
|
18919
|
+
value
|
18920
|
+
}
|
18921
|
+
});
|
18726
18922
|
}
|
18727
|
-
|
18728
|
-
|
18729
|
-
|
18730
|
-
|
18731
|
-
|
18923
|
+
// otherwise remove any previous change - no point saving the same value
|
18924
|
+
else if (cell.row.id in state.changes.rows) {
|
18925
|
+
dispatch({
|
18926
|
+
type: 'removeCellValue',
|
18927
|
+
rowId,
|
18928
|
+
payload: {
|
18929
|
+
columnId,
|
18930
|
+
rowIdentityAccessor
|
18931
|
+
}
|
18932
|
+
});
|
18732
18933
|
}
|
18733
|
-
return !!getAlertErrors().length;
|
18734
18934
|
}
|
18735
|
-
function
|
18736
|
-
|
18935
|
+
function getCellValue(cell) {
|
18936
|
+
var _state$changes$rows2, _state$changes$rows2$;
|
18937
|
+
return (_state$changes$rows2 = state.changes.rows) === null || _state$changes$rows2 === void 0 ? void 0 : (_state$changes$rows2$ = _state$changes$rows2[cell.row.id]) === null || _state$changes$rows2$ === void 0 ? void 0 : _state$changes$rows2$[cell.column.id];
|
18938
|
+
}
|
18939
|
+
function getCellError(cell) {
|
18940
|
+
var _state$changes$errors5, _state$changes$errors6, _state$changes$errors7;
|
18941
|
+
return (_state$changes$errors5 = state.changes.errors) === null || _state$changes$errors5 === void 0 ? void 0 : (_state$changes$errors6 = _state$changes$errors5[cell.row.id]) === null || _state$changes$errors6 === void 0 ? void 0 : (_state$changes$errors7 = _state$changes$errors6.cells) === null || _state$changes$errors7 === void 0 ? void 0 : _state$changes$errors7[cell.column.id];
|
18942
|
+
}
|
18943
|
+
function getErrorsShownInAlert() {
|
18944
|
+
const rowsWithErrors = Object.keys(state.changes.errors);
|
18945
|
+
if (!rowsWithErrors.length) {
|
18946
|
+
return [];
|
18947
|
+
}
|
18948
|
+
return rowsWithErrors.filter(hasRowErrorsShownInAlert).map(rowId => ({
|
18737
18949
|
rowId,
|
18738
|
-
|
18950
|
+
changes: state.changes.rows[rowId],
|
18951
|
+
errors: state.changes.errors[rowId]
|
18739
18952
|
}));
|
18740
18953
|
}
|
18741
|
-
function
|
18742
|
-
|
18743
|
-
const nextChanges = {
|
18744
|
-
...currentChanges
|
18745
|
-
};
|
18746
|
-
delete nextChanges[rowId];
|
18747
|
-
return nextChanges;
|
18748
|
-
});
|
18954
|
+
function hasSaved() {
|
18955
|
+
return !!Object.values(state.changes.status).filter(value => value === 'saved').length;
|
18749
18956
|
}
|
18750
|
-
function
|
18751
|
-
return Object.
|
18957
|
+
function hasChanges(rowId) {
|
18958
|
+
return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;
|
18959
|
+
}
|
18960
|
+
function discardChanges(rowId, table) {
|
18961
|
+
// remove any new rows from pinned state before discarding them
|
18962
|
+
table.resetRowPinning(true);
|
18963
|
+
dispatch({
|
18964
|
+
type: 'removeRow',
|
18965
|
+
rowId,
|
18966
|
+
payload: {
|
18967
|
+
rowIdentityAccessor
|
18968
|
+
}
|
18969
|
+
});
|
18752
18970
|
}
|
18753
18971
|
return {
|
18972
|
+
// row
|
18973
|
+
setRowValue,
|
18974
|
+
getRowValue,
|
18975
|
+
getRowMoveReason,
|
18976
|
+
hasRowErrors,
|
18977
|
+
hasRowErrorsShownInAlert,
|
18978
|
+
getRowStatus,
|
18979
|
+
setRowStatus,
|
18980
|
+
// cells
|
18981
|
+
setCellValue,
|
18754
18982
|
getCellValue,
|
18755
18983
|
getCellError,
|
18756
|
-
|
18757
|
-
|
18758
|
-
|
18984
|
+
onCellChanged,
|
18985
|
+
// general
|
18986
|
+
getErrorsShownInAlert,
|
18759
18987
|
hasChanges,
|
18760
|
-
hasAlertErrors,
|
18761
|
-
getAlertErrors,
|
18762
18988
|
saveChanges,
|
18763
|
-
|
18764
|
-
|
18765
|
-
|
18766
|
-
|
18767
|
-
|
18768
|
-
setRowSaveStatus,
|
18769
|
-
getRowMoveReason,
|
18770
|
-
getCompletedRowsCount
|
18989
|
+
discardChanges,
|
18990
|
+
hasSaved,
|
18991
|
+
// new rows
|
18992
|
+
createRow,
|
18993
|
+
temporaryRows: state.temporaryRows
|
18771
18994
|
};
|
18772
18995
|
}
|
18773
|
-
|
18996
|
+
|
18997
|
+
function useTableEditing(isEnabled = false, handleSave, handleChange, rowIdentityAccessor, validator) {
|
18998
|
+
// used to switch the table into editing mode
|
18999
|
+
const [isEditing, setEditing] = React__default.useState(false);
|
19000
|
+
// used to switch the editing between "detailed" mode
|
19001
|
+
const [isDetailedMode, toggleDetailedMode] = React__default.useState(false);
|
18774
19002
|
// store the last focused cell, so that up/down arrow key navigation remains in the same column
|
18775
|
-
const
|
18776
|
-
const
|
18777
|
-
|
18778
|
-
|
18779
|
-
|
18780
|
-
|
18781
|
-
|
18782
|
-
|
18783
|
-
|
18784
|
-
|
18785
|
-
try {
|
18786
|
-
const _temp4 = function () {
|
18787
|
-
if (typeof handleChange === 'function') {
|
18788
|
-
const previousValues = {
|
18789
|
-
...cell.row.original,
|
18790
|
-
...getChangesetFromChanges(updatersRef.current[cell.row.id])
|
18791
|
-
};
|
18792
|
-
const nextValues = {
|
18793
|
-
...previousValues,
|
18794
|
-
...changes
|
18795
|
-
};
|
18796
|
-
return Promise.resolve(handleChange(cell.column.id, changes[cell.column.id], nextValues, previousValues)).then(function (updates) {
|
18797
|
-
if (updates && Object.keys(updates).length) {
|
18798
|
-
setPendingChanges(currentChanges => createPendingChangesSetter(currentChanges, cell.row, rowIndex, updates, localization));
|
18799
|
-
}
|
18800
|
-
});
|
18801
|
-
}
|
18802
|
-
}();
|
18803
|
-
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
|
18804
|
-
} catch (e) {
|
18805
|
-
return Promise.reject(e);
|
18806
|
-
}
|
18807
|
-
}, 250), []);
|
18808
|
-
function syncCellChanges(changes) {
|
18809
|
-
updatersRef.current = changes;
|
18810
|
-
}
|
18811
|
-
return {
|
18812
|
-
syncCellChanges,
|
18813
|
-
runCellUpdates
|
18814
|
-
};
|
18815
|
-
}
|
18816
|
-
function createPendingChangesSetter(currentChanges, row, rowIndex, changes, localization) {
|
18817
|
-
var _currentChanges$row$i, _currentChanges$row$i2, _currentChanges$row$i3;
|
18818
|
-
// prepare
|
18819
|
-
const nextChanges = {
|
18820
|
-
...currentChanges
|
18821
|
-
};
|
18822
|
-
const rowChanges = {
|
18823
|
-
...currentChanges[row.id],
|
18824
|
-
_meta: {
|
18825
|
-
...((_currentChanges$row$i = currentChanges[row.id]) === null || _currentChanges$row$i === void 0 ? void 0 : _currentChanges$row$i._meta),
|
18826
|
-
original: row.original,
|
18827
|
-
moveReason: {
|
18828
|
-
...((_currentChanges$row$i2 = currentChanges[row.id]) === null || _currentChanges$row$i2 === void 0 ? void 0 : _currentChanges$row$i2._meta.moveReason)
|
18829
|
-
},
|
18830
|
-
errors: {
|
18831
|
-
...((_currentChanges$row$i3 = currentChanges[row.id]) === null || _currentChanges$row$i3 === void 0 ? void 0 : _currentChanges$row$i3._meta.errors)
|
18832
|
-
}
|
18833
|
-
}
|
18834
|
-
};
|
18835
|
-
// run changes
|
18836
|
-
const cells = row._getAllCellsByColumnId();
|
18837
|
-
for (const [accessor, change] of Object.entries(changes)) {
|
18838
|
-
// update if the change is different to the original (saved) value,
|
18839
|
-
// otherwise remove any change - no point saving the same value
|
18840
|
-
if (change !== row.original[accessor]) {
|
18841
|
-
rowChanges[accessor] = change;
|
18842
|
-
// consumers sometimes include properties in onEditingChange that aren't rendered as columns, we need to guard against that.
|
18843
|
-
// eslint-disable-next-line no-prototype-builtins
|
18844
|
-
if (cells.hasOwnProperty(accessor)) {
|
18845
|
-
// determine if the row will move position based on this change, and save why it will move
|
18846
|
-
const reason = willRowMove(cells[accessor], change, rowIndex, localization);
|
18847
|
-
if (reason) {
|
18848
|
-
rowChanges._meta.moveReason[accessor] = reason;
|
18849
|
-
} else {
|
18850
|
-
delete rowChanges._meta.moveReason[accessor];
|
18851
|
-
}
|
18852
|
-
}
|
18853
|
-
} else {
|
18854
|
-
delete rowChanges[accessor];
|
18855
|
-
delete rowChanges._meta.moveReason[accessor];
|
19003
|
+
const [lastFocusedCellIndex, setLastFocusedCellIndex] = React__default.useState(undefined);
|
19004
|
+
const pendingChangesFns = usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator);
|
19005
|
+
function toggleEditing(enabled, table) {
|
19006
|
+
if (!enabled) {
|
19007
|
+
// save
|
19008
|
+
pendingChangesFns.saveChanges(table);
|
19009
|
+
// reset detailed mode
|
19010
|
+
toggleDetailedMode(false);
|
19011
|
+
// reset the last index back to the first focusable element, when editing gets turned off
|
19012
|
+
setLastFocusedCellIndex(undefined);
|
18856
19013
|
}
|
19014
|
+
setEditing(enabled);
|
18857
19015
|
}
|
18858
|
-
// set changes
|
18859
|
-
// or delete if there are no changes left, so that we don't store changes with unchanged data
|
18860
|
-
if (Object.keys(rowChanges).filter(k => k !== '_meta').length) {
|
18861
|
-
nextChanges[row.id] = rowChanges;
|
18862
|
-
} else {
|
18863
|
-
delete nextChanges[row.id];
|
18864
|
-
}
|
18865
|
-
return nextChanges;
|
18866
|
-
}
|
18867
|
-
function getChangesetFromChanges(changes) {
|
18868
|
-
// extract the original data from the row changes
|
18869
|
-
const {
|
18870
|
-
_meta,
|
18871
|
-
...changeset
|
18872
|
-
} = changes !== null && changes !== void 0 ? changes : {};
|
18873
|
-
// and mix them in with the changes, ready to send to the server
|
18874
19016
|
return {
|
18875
|
-
|
18876
|
-
|
19017
|
+
isEnabled,
|
19018
|
+
isEditing,
|
19019
|
+
isDetailedMode,
|
19020
|
+
toggleDetailedMode: isEnabled ? toggleDetailedMode : () => undefined,
|
19021
|
+
toggleEditing: isEnabled ? toggleEditing : () => undefined,
|
19022
|
+
lastFocusedCellIndex,
|
19023
|
+
setLastFocusedCellIndex,
|
19024
|
+
...pendingChangesFns
|
18877
19025
|
};
|
18878
19026
|
}
|
18879
19027
|
|
@@ -19115,13 +19263,28 @@ function EditingControlCell(props) {
|
|
19115
19263
|
const {
|
19116
19264
|
rowIndex
|
19117
19265
|
} = React__default.useContext(RowContext);
|
19118
|
-
const
|
19266
|
+
const {
|
19267
|
+
table
|
19268
|
+
} = cell.getContext();
|
19269
|
+
const tableMeta = table.options.meta;
|
19119
19270
|
const columnMeta = cell.column.columnDef.meta;
|
19120
19271
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
|
19272
|
+
const type = (_columnMeta$control = columnMeta.control) !== null && _columnMeta$control !== void 0 ? _columnMeta$control : 'input';
|
19121
19273
|
const handleFocus = useEditingCellAutofocus(props);
|
19274
|
+
// some controls, like select2, should trigger cell changed (validation, updates) as the value changes
|
19275
|
+
const hasNonTextControl = React__default.useMemo(() => {
|
19276
|
+
var _cellRef$current;
|
19277
|
+
return typeof type === 'function' && !!((_cellRef$current = cellRef.current) !== null && _cellRef$current !== void 0 && _cellRef$current.querySelector('[data-taco="Select2"],[data-taco="switch"],[data-taco="checkbox"]'));
|
19278
|
+
}, [cellRef.current]);
|
19279
|
+
const handleChange = value => {
|
19280
|
+
tableMeta.editing.setCellValue(cell, value);
|
19281
|
+
if (hasNonTextControl) {
|
19282
|
+
tableMeta.editing.onCellChanged(cell, rowIndex);
|
19283
|
+
}
|
19284
|
+
};
|
19122
19285
|
const handleBlur = () => {
|
19123
19286
|
tableMeta.editing.toggleDetailedMode(false);
|
19124
|
-
tableMeta.editing.
|
19287
|
+
tableMeta.editing.onCellChanged(cell, rowIndex);
|
19125
19288
|
};
|
19126
19289
|
// ensure that blur runs when the cell gets unmounted (when vertically arrow key navigating)
|
19127
19290
|
React__default.useEffect(() => {
|
@@ -19133,6 +19296,9 @@ function EditingControlCell(props) {
|
|
19133
19296
|
};
|
19134
19297
|
}, []);
|
19135
19298
|
const error = tableMeta.editing.getCellError(cell);
|
19299
|
+
function toggleEditing(enabled) {
|
19300
|
+
tableMeta.editing.toggleEditing(enabled, table);
|
19301
|
+
}
|
19136
19302
|
const controlProps = {
|
19137
19303
|
dataType: columnMeta.dataType,
|
19138
19304
|
fontSize: tableMeta.fontSize.size,
|
@@ -19141,13 +19307,13 @@ function EditingControlCell(props) {
|
|
19141
19307
|
isDetailedMode: tableMeta.editing.isDetailedMode,
|
19142
19308
|
isTruncated: !!columnMeta.enableTruncate,
|
19143
19309
|
onBlur: handleBlur,
|
19144
|
-
onChange:
|
19310
|
+
onChange: handleChange,
|
19145
19311
|
row: cell.row.original,
|
19146
|
-
rowPendingChanges: tableMeta.editing.
|
19312
|
+
rowPendingChanges: tableMeta.editing.getRowValue(cell.row.id),
|
19147
19313
|
tabIndex: isActiveRow ? 0 : -1,
|
19148
|
-
toggleEditing
|
19314
|
+
toggleEditing,
|
19149
19315
|
toggleDetailedMode: tableMeta.editing.toggleDetailedMode,
|
19150
|
-
type
|
19316
|
+
type,
|
19151
19317
|
value: cell.getValue()
|
19152
19318
|
};
|
19153
19319
|
const cellAttributes = {
|
@@ -19350,12 +19516,37 @@ function Cell$5(props) {
|
|
19350
19516
|
return /*#__PURE__*/React__default.createElement(DisplayCell, Object.assign({}, props));
|
19351
19517
|
}
|
19352
19518
|
|
19519
|
+
function DiscardChangesConfirmationDialog(props) {
|
19520
|
+
const {
|
19521
|
+
onDiscard: handleDiscard,
|
19522
|
+
...dialogProps
|
19523
|
+
} = props;
|
19524
|
+
const {
|
19525
|
+
texts
|
19526
|
+
} = useLocalization();
|
19527
|
+
const handleClickInsideDialogContent = event => {
|
19528
|
+
// Prevents the click event from propagating to the table, ensuring the row isn't saved when a click occurs
|
19529
|
+
// inside the dialog
|
19530
|
+
event.stopPropagation();
|
19531
|
+
};
|
19532
|
+
return /*#__PURE__*/React__default.createElement(Dialog, Object.assign({}, dialogProps), /*#__PURE__*/React__default.createElement(Dialog.Content, {
|
19533
|
+
"aria-label": texts.table3.editing.clearChangesConfirmationDialog.title,
|
19534
|
+
onClick: handleClickInsideDialogContent
|
19535
|
+
}, /*#__PURE__*/React__default.createElement(Dialog.Title, null, texts.table3.editing.clearChangesConfirmationDialog.title), /*#__PURE__*/React__default.createElement("p", null, texts.table3.editing.clearChangesConfirmationDialog.description), /*#__PURE__*/React__default.createElement(Dialog.Footer, null, /*#__PURE__*/React__default.createElement(Group, null, /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
19536
|
+
tabIndex: 0
|
19537
|
+
}, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
19538
|
+
autoFocus: true,
|
19539
|
+
tabIndex: 0,
|
19540
|
+
appearance: "primary",
|
19541
|
+
onClick: handleDiscard
|
19542
|
+
}, texts.table3.editing.clearChangesConfirmationDialog.confirm))))));
|
19543
|
+
}
|
19544
|
+
|
19353
19545
|
function EditingActionMenu(props) {
|
19354
19546
|
const {
|
19355
19547
|
hasChanges,
|
19356
19548
|
hasErrors,
|
19357
|
-
|
19358
|
-
onExit: handleExit,
|
19549
|
+
onDiscard: handleDiscard,
|
19359
19550
|
onEditingSave: handleSave,
|
19360
19551
|
isLastRow
|
19361
19552
|
} = props;
|
@@ -19389,42 +19580,13 @@ function EditingActionMenu(props) {
|
|
19389
19580
|
}, texts.table3.editing.actions.save), /*#__PURE__*/React__default.createElement(Menu$1.Item, {
|
19390
19581
|
icon: "close",
|
19391
19582
|
disabled: !hasChanges,
|
19392
|
-
dialog: props => /*#__PURE__*/React__default.createElement(
|
19393
|
-
|
19583
|
+
dialog: props => /*#__PURE__*/React__default.createElement(DiscardChangesConfirmationDialog, Object.assign({}, props, {
|
19584
|
+
onDiscard: handleDiscard
|
19394
19585
|
}))
|
19395
|
-
}, texts.table3.editing.actions.clear)
|
19396
|
-
icon: "undo",
|
19397
|
-
onClick: handleExit
|
19398
|
-
}, texts.table3.editing.actions.exit))))
|
19586
|
+
}, texts.table3.editing.actions.clear))))
|
19399
19587
|
});
|
19400
19588
|
}
|
19401
|
-
function ConfirmClearChangesDialog(props) {
|
19402
|
-
const {
|
19403
|
-
onClear: handleClear,
|
19404
|
-
...dialogProps
|
19405
|
-
} = props;
|
19406
|
-
const {
|
19407
|
-
texts
|
19408
|
-
} = useLocalization();
|
19409
|
-
const handleClickInsideDialogContent = event => {
|
19410
|
-
// Prevents the click event from propagating to the table, ensuring the row isn't saved when a click occurs
|
19411
|
-
// inside the dialog
|
19412
|
-
event.stopPropagation();
|
19413
|
-
};
|
19414
|
-
return /*#__PURE__*/React__default.createElement(Dialog, Object.assign({}, dialogProps), /*#__PURE__*/React__default.createElement(Dialog.Content, {
|
19415
|
-
"aria-label": texts.table3.editing.clearChangesConfirmationDialog.title,
|
19416
|
-
onClick: handleClickInsideDialogContent
|
19417
|
-
}, /*#__PURE__*/React__default.createElement(Dialog.Title, null, texts.table3.editing.clearChangesConfirmationDialog.title), /*#__PURE__*/React__default.createElement("p", null, texts.table3.editing.clearChangesConfirmationDialog.description), /*#__PURE__*/React__default.createElement(Dialog.Footer, null, /*#__PURE__*/React__default.createElement(Group, null, /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
19418
|
-
tabIndex: 0
|
19419
|
-
}, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
19420
|
-
autoFocus: true,
|
19421
|
-
tabIndex: 0,
|
19422
|
-
appearance: "primary",
|
19423
|
-
onClick: handleClear
|
19424
|
-
}, texts.table3.editing.clearChangesConfirmationDialog.confirm))))));
|
19425
|
-
}
|
19426
19589
|
|
19427
|
-
const COMPLETE_INDICATOR_DELAY = 3000;
|
19428
19590
|
function SaveStatus(props) {
|
19429
19591
|
const {
|
19430
19592
|
rowId,
|
@@ -19434,18 +19596,7 @@ function SaveStatus(props) {
|
|
19434
19596
|
texts
|
19435
19597
|
} = useLocalization();
|
19436
19598
|
const tableMeta = table.options.meta;
|
19437
|
-
const status = tableMeta.editing.
|
19438
|
-
React__default.useEffect(() => {
|
19439
|
-
let timeout;
|
19440
|
-
if (status === 'complete') {
|
19441
|
-
timeout = setTimeout(() => {
|
19442
|
-
tableMeta.editing.setRowSaveStatus(rowId, undefined);
|
19443
|
-
}, COMPLETE_INDICATOR_DELAY);
|
19444
|
-
}
|
19445
|
-
return () => {
|
19446
|
-
clearTimeout(timeout);
|
19447
|
-
};
|
19448
|
-
}, [status]);
|
19599
|
+
const status = tableMeta.editing.getRowStatus(rowId);
|
19449
19600
|
const className = cn('col-span-full sticky ml-auto right-0 top-0 -mb-[100%] z-10 h-8 bg-[inherit] flex items-center px-1.5 shadow-[-6px_0px_6px_var(--table-row-actions-shadow)]', {
|
19450
19601
|
'mt-0.5': tableMeta.rowHeight.height === 'short',
|
19451
19602
|
'mt-1': tableMeta.rowHeight.height === 'medium',
|
@@ -19456,7 +19607,7 @@ function SaveStatus(props) {
|
|
19456
19607
|
className: "!contents"
|
19457
19608
|
}, /*#__PURE__*/React__default.createElement("span", {
|
19458
19609
|
className: className
|
19459
|
-
}, status === '
|
19610
|
+
}, status === 'saving' ? (/*#__PURE__*/React__default.createElement(Tooltip, {
|
19460
19611
|
title: texts.table3.editing.saving.progress
|
19461
19612
|
}, /*#__PURE__*/React__default.createElement(Spinner, {
|
19462
19613
|
delay: 0,
|
@@ -19482,10 +19633,7 @@ function Row$2(props) {
|
|
19482
19633
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;
|
19483
19634
|
React__default.useEffect(() => {
|
19484
19635
|
if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {
|
19485
|
-
|
19486
|
-
if (element) {
|
19487
|
-
setDataFocusAttribute(element);
|
19488
|
-
}
|
19636
|
+
setDataFocusAttribute(focusManager.focusFirst());
|
19489
19637
|
}
|
19490
19638
|
}, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);
|
19491
19639
|
const handleFocus = React__default.useCallback(event => {
|
@@ -19497,12 +19645,13 @@ function Row$2(props) {
|
|
19497
19645
|
}
|
19498
19646
|
}
|
19499
19647
|
}, [tableMeta.editing.isEditing, isActiveRow]);
|
19648
|
+
const rowStatus = tableMeta.editing.getRowStatus(row.id);
|
19500
19649
|
const attributes = {
|
19501
|
-
'data-row-editing-invalid': tableMeta.editing.
|
19502
|
-
'data-row-editing-status':
|
19650
|
+
'data-row-editing-invalid': tableMeta.editing.hasRowErrors(row.id) ? !tableMeta.editing.hasRowErrorsShownInAlert(row.id) ? 'unseen' : true : undefined,
|
19651
|
+
'data-row-editing-status': rowStatus,
|
19503
19652
|
onFocus: handleFocus
|
19504
19653
|
};
|
19505
|
-
return /*#__PURE__*/React__default.createElement(DisplayRow, Object.assign({}, props, attributes),
|
19654
|
+
return /*#__PURE__*/React__default.createElement(DisplayRow, Object.assign({}, props, attributes), rowStatus === 'saving' || rowStatus === 'saved' ? /*#__PURE__*/React__default.createElement(SaveStatus, {
|
19506
19655
|
rowId: row.id,
|
19507
19656
|
table: table
|
19508
19657
|
}) : null);
|
@@ -19513,17 +19662,31 @@ const RENDERERS$1 = {
|
|
19513
19662
|
cell: Cell$5
|
19514
19663
|
};
|
19515
19664
|
function useTable3(props, ref) {
|
19516
|
-
const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.validator);
|
19665
|
+
const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.rowIdentityAccessor, props.validator);
|
19517
19666
|
const creationEnabled = editing.isEnabled && !!props.onEditingCreate;
|
19667
|
+
// this gives me the performance heeby jeebies, but can't think of a better way to internalise the state
|
19668
|
+
const data = React__default.useMemo(() => {
|
19669
|
+
if (editing.isEditing && editing.temporaryRows.length) {
|
19670
|
+
var _props$data;
|
19671
|
+
return editing.temporaryRows.concat((_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : []);
|
19672
|
+
}
|
19673
|
+
return props.data;
|
19674
|
+
}, [JSON.stringify(props.data), editing.temporaryRows.length]);
|
19518
19675
|
const extendedProps = {
|
19519
19676
|
...props,
|
19677
|
+
data,
|
19520
19678
|
enableRowActions: editing.isEditing ? true : props.enableRowActions,
|
19521
|
-
rowActions: editing.isEditing ? [(_, rowId) => (/*#__PURE__*/React__default.createElement(EditingActionMenu, {
|
19679
|
+
rowActions: editing.isEditing ? [(_, rowId, table) => (/*#__PURE__*/React__default.createElement(EditingActionMenu, {
|
19522
19680
|
hasChanges: editing.hasChanges(rowId),
|
19523
19681
|
hasErrors: editing.hasRowErrors(rowId),
|
19524
|
-
|
19525
|
-
onEditingSave: ()
|
19526
|
-
|
19682
|
+
onDiscard: () => editing.discardChanges(rowId, table),
|
19683
|
+
onEditingSave: function () {
|
19684
|
+
try {
|
19685
|
+
return Promise.resolve(editing.saveChanges(table, rowId)).then(function () {});
|
19686
|
+
} catch (e) {
|
19687
|
+
return Promise.reject(e);
|
19688
|
+
}
|
19689
|
+
},
|
19527
19690
|
isLastRow: !creationEnabled && table.meta.rowActive.rowActiveIndex === table.meta.length - 1
|
19528
19691
|
}))] : props.rowActions
|
19529
19692
|
};
|
@@ -19535,7 +19698,7 @@ function useTable3(props, ref) {
|
|
19535
19698
|
useTableEditingListener(table.instance, table.ref);
|
19536
19699
|
React__default.useEffect(() => {
|
19537
19700
|
if (table.ref.current) {
|
19538
|
-
table.ref.current.instance.toggleEditing = enabled => table.meta.editing.toggleEditing(enabled !== null && enabled !== void 0 ? enabled : editing => !editing);
|
19701
|
+
table.ref.current.instance.toggleEditing = enabled => table.meta.editing.toggleEditing(enabled !== null && enabled !== void 0 ? enabled : editing => !editing, table.instance);
|
19539
19702
|
}
|
19540
19703
|
}, [table.ref.current]);
|
19541
19704
|
return table;
|
@@ -19554,7 +19717,7 @@ function Alert$1(props) {
|
|
19554
19717
|
const validationTexts = texts.table3.editing.validation;
|
19555
19718
|
const tableMeta = table.options.meta;
|
19556
19719
|
const [showFilterResetDialog, setShowFilterResetDialog] = React__default.useState(false);
|
19557
|
-
const pendingChangesWithErrors = tableMeta.editing.
|
19720
|
+
const pendingChangesWithErrors = tableMeta.editing.getErrorsShownInAlert();
|
19558
19721
|
function scrollToRow(rowIndex) {
|
19559
19722
|
tableMeta.rowActive.setRowActiveIndex(rowIndex);
|
19560
19723
|
scrollToIndex(rowIndex, {
|
@@ -19573,38 +19736,43 @@ function Alert$1(props) {
|
|
19573
19736
|
const title = (pendingChangesWithErrors.length === 1 ? validationTexts.alert.titleOne : validationTexts.alert.titlePlural).replace('[COUNT]', String(pendingChangesWithErrors.length));
|
19574
19737
|
// generate links to each invalid row, to go into the error message
|
19575
19738
|
const links = [];
|
19576
|
-
const
|
19577
|
-
|
19739
|
+
const visibleColumns = table.getVisibleFlatColumns().map(c => c.id);
|
19740
|
+
const rowIdentityColumn = tableMeta.rowIdentityAccessor && visibleColumns.includes(String(tableMeta.rowIdentityAccessor)) ? table.getColumn(String(tableMeta.rowIdentityAccessor)) : undefined;
|
19741
|
+
pendingChangesWithErrors.forEach((pendingChangeWithError, index) => {
|
19578
19742
|
// if appropriate, concatenate the item with the text "and"
|
19579
19743
|
if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
|
19580
19744
|
// Add space before and after `messageAnd` text
|
19581
19745
|
links.push(` ${validationTexts.alert.messageAnd} `);
|
19582
19746
|
}
|
19583
|
-
const rowIndex = table.getRowModel().rows.findIndex(row => row.id ===
|
19747
|
+
const rowIndex = table.getRowModel().rows.findIndex(row => row.id === pendingChangeWithError.rowId);
|
19584
19748
|
const handleClick = () => {
|
19749
|
+
// if row is visible
|
19585
19750
|
if (rowIndex > -1) {
|
19586
19751
|
scrollToRow(rowIndex);
|
19587
|
-
}
|
19588
|
-
|
19752
|
+
}
|
19753
|
+
// if row is filtered out
|
19754
|
+
else {
|
19755
|
+
setShowFilterResetDialog(pendingChangeWithError.rowId);
|
19589
19756
|
}
|
19590
19757
|
};
|
19591
19758
|
let tooltip;
|
19592
|
-
if (
|
19593
|
-
tooltip =
|
19759
|
+
if (pendingChangeWithError.errors.row) {
|
19760
|
+
tooltip = pendingChangeWithError.errors.row;
|
19594
19761
|
} else {
|
19595
19762
|
var _table$getAllColumns$, _table$getAllColumns$2;
|
19596
|
-
const firstCellErrorColumnId = Object.keys(
|
19763
|
+
const firstCellErrorColumnId = Object.keys(pendingChangeWithError.errors.cells)[0];
|
19597
19764
|
const columnName = (_table$getAllColumns$ = table.getAllColumns().find(column => column.id === firstCellErrorColumnId)) === null || _table$getAllColumns$ === void 0 ? void 0 : (_table$getAllColumns$2 = _table$getAllColumns$.columnDef.meta) === null || _table$getAllColumns$2 === void 0 ? void 0 : _table$getAllColumns$2.header;
|
19598
|
-
tooltip = `${columnName}: ${
|
19765
|
+
tooltip = `${columnName}: ${pendingChangeWithError.errors.cells[firstCellErrorColumnId]}`;
|
19599
19766
|
}
|
19767
|
+
const row = table.getRow(pendingChangeWithError.rowId).original;
|
19600
19768
|
links.push(/*#__PURE__*/React__default.createElement(Tooltip, {
|
19601
|
-
key:
|
19769
|
+
key: pendingChangeWithError.rowId,
|
19602
19770
|
title: tooltip
|
19603
19771
|
}, /*#__PURE__*/React__default.createElement("span", {
|
19604
19772
|
className: "text-blue",
|
19605
19773
|
onClick: handleClick,
|
19606
19774
|
role: "button"
|
19607
|
-
}, rowIdentityColumn ?
|
19775
|
+
}, rowIdentityColumn ? row[rowIdentityColumn.id] : rowIndex + 1)));
|
19608
19776
|
// if appropriate, concatenate the item with the text ","
|
19609
19777
|
if (pendingChangesWithErrors.length > 2 && index < pendingChangesWithErrors.length - 2) {
|
19610
19778
|
links.push(', ');
|
@@ -19660,89 +19828,6 @@ function FilterResetDialog(props) {
|
|
19660
19828
|
}, texts.table3.editing.validation.resetFiltersDialog.confirm)))));
|
19661
19829
|
}
|
19662
19830
|
|
19663
|
-
function CreateNewRowButton(props) {
|
19664
|
-
const {
|
19665
|
-
onEditingCreate,
|
19666
|
-
scrollToIndex,
|
19667
|
-
table,
|
19668
|
-
tableMeta
|
19669
|
-
} = props;
|
19670
|
-
const {
|
19671
|
-
texts
|
19672
|
-
} = useLocalization();
|
19673
|
-
const rows = table.getCoreRowModel().rows.filter(row => row.original !== undefined);
|
19674
|
-
const [rowCreated, setRowCreated] = React__default.useState({
|
19675
|
-
rowFinder: undefined
|
19676
|
-
});
|
19677
|
-
const handleKeyDown = event => {
|
19678
|
-
if (!tableMeta.editing.hasChanges() && event.key === 'Tab') {
|
19679
|
-
tableMeta.editing.saveChanges();
|
19680
|
-
}
|
19681
|
-
};
|
19682
|
-
const handleCreate = function () {
|
19683
|
-
try {
|
19684
|
-
if (!onEditingCreate) {
|
19685
|
-
return Promise.resolve();
|
19686
|
-
}
|
19687
|
-
const createdRow = rows.find(row => {
|
19688
|
-
var _rowCreated$rowFinder;
|
19689
|
-
return rowCreated === null || rowCreated === void 0 ? void 0 : (_rowCreated$rowFinder = rowCreated.rowFinder) === null || _rowCreated$rowFinder === void 0 ? void 0 : _rowCreated$rowFinder.call(rowCreated, row.original);
|
19690
|
-
});
|
19691
|
-
const _temp = function () {
|
19692
|
-
if (createdRow) {
|
19693
|
-
return Promise.resolve(tableMeta.editing.saveChanges()).then(function () {
|
19694
|
-
if (!tableMeta.editing.hasRowErrors(createdRow.id)) {
|
19695
|
-
const rowFinder = onEditingCreate();
|
19696
|
-
setRowCreated({
|
19697
|
-
rowFinder
|
19698
|
-
});
|
19699
|
-
}
|
19700
|
-
});
|
19701
|
-
} else {
|
19702
|
-
const rowFinder = onEditingCreate();
|
19703
|
-
setRowCreated({
|
19704
|
-
rowFinder
|
19705
|
-
});
|
19706
|
-
}
|
19707
|
-
}();
|
19708
|
-
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
19709
|
-
} catch (e) {
|
19710
|
-
return Promise.reject(e);
|
19711
|
-
}
|
19712
|
-
};
|
19713
|
-
React__default.useEffect(() => {
|
19714
|
-
if (typeof (rowCreated === null || rowCreated === void 0 ? void 0 : rowCreated.rowFinder) === 'function') {
|
19715
|
-
const createdRow = rows.find(row => {
|
19716
|
-
var _rowCreated$rowFinder2;
|
19717
|
-
return rowCreated === null || rowCreated === void 0 ? void 0 : (_rowCreated$rowFinder2 = rowCreated.rowFinder) === null || _rowCreated$rowFinder2 === void 0 ? void 0 : _rowCreated$rowFinder2.call(rowCreated, row.original);
|
19718
|
-
});
|
19719
|
-
if (createdRow) {
|
19720
|
-
const rowInTable = table.getRowModel().rows.filter(row => row.original !== undefined).find(row => {
|
19721
|
-
var _rowCreated$rowFinder3;
|
19722
|
-
return rowCreated === null || rowCreated === void 0 ? void 0 : (_rowCreated$rowFinder3 = rowCreated.rowFinder) === null || _rowCreated$rowFinder3 === void 0 ? void 0 : _rowCreated$rowFinder3.call(rowCreated, row.original);
|
19723
|
-
});
|
19724
|
-
if (rowInTable) {
|
19725
|
-
tableMeta.editing.toggleEditing(true);
|
19726
|
-
tableMeta.rowActive.setRowActiveIndex(createdRow.index);
|
19727
|
-
scrollToIndex(createdRow.index);
|
19728
|
-
requestAnimationFrame(() => animateCreateRow(createdRow.id));
|
19729
|
-
}
|
19730
|
-
requestAnimationFrame(() => tableMeta.editing.addCreatedRowChangeset(createdRow));
|
19731
|
-
}
|
19732
|
-
}
|
19733
|
-
}, [rowCreated]);
|
19734
|
-
return /*#__PURE__*/React__default.createElement("tr", {
|
19735
|
-
onClick: handleCreate,
|
19736
|
-
className: "border-grey-300 hover:bg-grey-100 group !sticky bottom-10 left-0 z-[21] !block cursor-pointer border-t"
|
19737
|
-
}, /*#__PURE__*/React__default.createElement("td", {
|
19738
|
-
className: "!border-t-0 !bg-transparent"
|
19739
|
-
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
19740
|
-
onKeyDown: handleKeyDown,
|
19741
|
-
className: "group-hover:bg-grey-200 sticky left-0",
|
19742
|
-
appearance: "transparent"
|
19743
|
-
}, "+ ", texts.table3.editing.buttons.create.label)));
|
19744
|
-
}
|
19745
|
-
|
19746
19831
|
function Editing(props) {
|
19747
19832
|
const {
|
19748
19833
|
scrollToIndex,
|
@@ -19768,21 +19853,191 @@ function Editing(props) {
|
|
19768
19853
|
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.click();
|
19769
19854
|
});
|
19770
19855
|
const handleChange = enabled => {
|
19771
|
-
tableMeta.
|
19856
|
+
if (enabled && tableMeta.rowActive.rowActiveIndex === undefined) {
|
19857
|
+
tableMeta.rowActive.setRowActiveIndex(0);
|
19858
|
+
}
|
19772
19859
|
requestAnimationFrame(() => {
|
19773
19860
|
var _tableMeta$rowActive$;
|
19774
|
-
|
19861
|
+
// wait for an active row to be set so that we don't trigger save
|
19862
|
+
tableMeta.editing.toggleEditing(enabled, table);
|
19863
|
+
scrollToIndex((_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0);
|
19775
19864
|
});
|
19776
19865
|
};
|
19777
19866
|
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
19778
19867
|
title: tooltip
|
19779
19868
|
}, /*#__PURE__*/React__default.createElement(ModeSwitch, {
|
19869
|
+
"data-table": "editing-toggle",
|
19780
19870
|
checked: tableMeta.editing.isEditing,
|
19781
19871
|
onChange: handleChange,
|
19782
19872
|
ref: ref
|
19783
19873
|
}));
|
19784
19874
|
}
|
19785
19875
|
|
19876
|
+
function CreateNewRow(props) {
|
19877
|
+
var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum;
|
19878
|
+
const {
|
19879
|
+
buttonRef,
|
19880
|
+
onEditingCreate: handleEditingCreate,
|
19881
|
+
table,
|
19882
|
+
tableMeta
|
19883
|
+
} = props;
|
19884
|
+
const {
|
19885
|
+
texts
|
19886
|
+
} = useLocalization();
|
19887
|
+
const temporaryRows = tableMeta.editing.temporaryRows;
|
19888
|
+
const temporaryRowId = (_temporaryRows$0$tabl = (_temporaryRows$ = temporaryRows[0]) === null || _temporaryRows$ === void 0 ? void 0 : _temporaryRows$[tableMeta.rowIdentityAccessor]) !== null && _temporaryRows$0$tabl !== void 0 ? _temporaryRows$0$tabl : '';
|
19889
|
+
const isDisabled = !!table.getState().globalFilter || !!((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length) || !!temporaryRowId && !!tableMeta.editing.hasRowErrors(temporaryRowId);
|
19890
|
+
const isSaving = !!temporaryRowId && tableMeta.editing.getRowStatus(temporaryRowId) === 'saving';
|
19891
|
+
const handleCreate = function (event) {
|
19892
|
+
try {
|
19893
|
+
// prevent save being triggered by click outside - TODO: investigate why the button triggers clickoutside
|
19894
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
19895
|
+
if (!handleEditingCreate || isDisabled) {
|
19896
|
+
return Promise.resolve();
|
19897
|
+
}
|
19898
|
+
return Promise.resolve(tableMeta.editing.saveChanges(table)).then(function (saved) {
|
19899
|
+
if (!saved) {
|
19900
|
+
return;
|
19901
|
+
}
|
19902
|
+
try {
|
19903
|
+
const changeset = handleEditingCreate();
|
19904
|
+
if (changeset) {
|
19905
|
+
// change the row before reating because it triggers a save
|
19906
|
+
// saving would trigger the validation flow and immediately make the row red
|
19907
|
+
tableMeta.rowActive.setRowActiveIndex(-1);
|
19908
|
+
requestAnimationFrame(function () {
|
19909
|
+
try {
|
19910
|
+
tableMeta.editing.toggleEditing(true, table);
|
19911
|
+
return Promise.resolve(tableMeta.editing.createRow(changeset)).then(function (rowId) {
|
19912
|
+
tableMeta.editing.setLastFocusedCellIndex(0);
|
19913
|
+
try {
|
19914
|
+
const row = table.getRow(rowId);
|
19915
|
+
row.pin('bottom');
|
19916
|
+
} catch {
|
19917
|
+
//
|
19918
|
+
}
|
19919
|
+
});
|
19920
|
+
} catch (e) {
|
19921
|
+
return Promise.reject(e);
|
19922
|
+
}
|
19923
|
+
});
|
19924
|
+
}
|
19925
|
+
} catch (error) {
|
19926
|
+
console.error(error);
|
19927
|
+
}
|
19928
|
+
});
|
19929
|
+
} catch (e) {
|
19930
|
+
return Promise.reject(e);
|
19931
|
+
}
|
19932
|
+
};
|
19933
|
+
let tooltip;
|
19934
|
+
if (isSaving) {
|
19935
|
+
tooltip = texts.table3.editing.buttons.create.saving;
|
19936
|
+
} else if (isDisabled) {
|
19937
|
+
tooltip = texts.table3.editing.buttons.create.disabled;
|
19938
|
+
}
|
19939
|
+
return /*#__PURE__*/React__default.createElement("tr", {
|
19940
|
+
"data-row-create": true,
|
19941
|
+
className: "border-grey-300 group/row",
|
19942
|
+
tabIndex: -1
|
19943
|
+
}, /*#__PURE__*/React__default.createElement("td", {
|
19944
|
+
className: "!bg-grey-50 col-span-full !border-b-0 !px-1"
|
19945
|
+
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
19946
|
+
appearance: "transparent",
|
19947
|
+
className: "group-hover:bg-grey-200 sticky left-[4px]",
|
19948
|
+
disabled: isDisabled,
|
19949
|
+
onClick: handleCreate,
|
19950
|
+
ref: buttonRef,
|
19951
|
+
tooltip: tooltip
|
19952
|
+
}, /*#__PURE__*/React__default.createElement(Icon, {
|
19953
|
+
name: "circle-plus"
|
19954
|
+
}), texts.table3.editing.buttons.create.label)));
|
19955
|
+
}
|
19956
|
+
|
19957
|
+
function TemporaryRow(props) {
|
19958
|
+
var _tableRef$current, _tableRef$current2;
|
19959
|
+
const {
|
19960
|
+
buttonRef,
|
19961
|
+
rowIdentityAccessor,
|
19962
|
+
table,
|
19963
|
+
tableMeta,
|
19964
|
+
tableRef
|
19965
|
+
} = props;
|
19966
|
+
const temporaryRows = tableMeta.editing.temporaryRows;
|
19967
|
+
// discard new row
|
19968
|
+
const [showDiscardDialog, setShowDiscardDialog] = React__default.useState(false);
|
19969
|
+
function handleDiscard() {
|
19970
|
+
if (temporaryRows[0]) {
|
19971
|
+
var _buttonRef$current;
|
19972
|
+
tableMeta.editing.discardChanges(temporaryRows[0][rowIdentityAccessor], table);
|
19973
|
+
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.focus();
|
19974
|
+
}
|
19975
|
+
}
|
19976
|
+
const handleKeyDown = function (event) {
|
19977
|
+
try {
|
19978
|
+
const _temp2 = function () {
|
19979
|
+
if (event.key === 'ArrowDown') {
|
19980
|
+
event.preventDefault();
|
19981
|
+
const _temp = function () {
|
19982
|
+
if (!isElementTriggeredFromContainer(event.target, event.currentTarget)) {
|
19983
|
+
return Promise.resolve(tableMeta.editing.saveChanges(table)).then(function (saved) {
|
19984
|
+
if (saved) {
|
19985
|
+
var _buttonRef$current2;
|
19986
|
+
(_buttonRef$current2 = buttonRef.current) === null || _buttonRef$current2 === void 0 ? void 0 : _buttonRef$current2.focus();
|
19987
|
+
}
|
19988
|
+
});
|
19989
|
+
}
|
19990
|
+
}();
|
19991
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
19992
|
+
} else if (event.key === 'ArrowUp') {
|
19993
|
+
event.preventDefault();
|
19994
|
+
event.stopPropagation();
|
19995
|
+
}
|
19996
|
+
}();
|
19997
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
19998
|
+
} catch (e) {
|
19999
|
+
return Promise.reject(e);
|
20000
|
+
}
|
20001
|
+
};
|
20002
|
+
const handleKeyDownCapture = event => {
|
20003
|
+
if (event.key === 'Escape') {
|
20004
|
+
event.preventDefault();
|
20005
|
+
event.stopPropagation();
|
20006
|
+
setShowDiscardDialog(true);
|
20007
|
+
} else if (event.key === 'ArrowLeft' && tableMeta.editing.lastFocusedCellIndex === 0) {
|
20008
|
+
event.preventDefault();
|
20009
|
+
event.stopPropagation();
|
20010
|
+
} else if (event.key === 'ArrowRight' && tableMeta.editing.lastFocusedCellIndex) {
|
20011
|
+
if (tableMeta.editing.lastFocusedCellIndex === table.getVisibleFlatColumns().length - 1) {
|
20012
|
+
event.preventDefault();
|
20013
|
+
event.stopPropagation();
|
20014
|
+
}
|
20015
|
+
}
|
20016
|
+
};
|
20017
|
+
const isScrolled = tableRef.current ? ((_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.scrollHeight) > ((_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : _tableRef$current2.clientHeight) : false;
|
20018
|
+
const className = cn('group/row border-grey-300 !sticky z-[21]', {
|
20019
|
+
'bottom-20': tableMeta.footer.isEnabled,
|
20020
|
+
'bottom-10': !tableMeta.footer.isEnabled,
|
20021
|
+
'border-b border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] border-t-grey-500/[0.5]': isScrolled
|
20022
|
+
});
|
20023
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getBottomRows().map(row => (/*#__PURE__*/React__default.createElement(Row, {
|
20024
|
+
key: row.id,
|
20025
|
+
cellRenderer: RENDERERS$1.cell,
|
20026
|
+
index: -1,
|
20027
|
+
measureRow: () => null,
|
20028
|
+
renderer: RENDERERS$1.row,
|
20029
|
+
row: row,
|
20030
|
+
table: table,
|
20031
|
+
className: className,
|
20032
|
+
onKeyDown: handleKeyDown,
|
20033
|
+
onKeyDownCapture: handleKeyDownCapture
|
20034
|
+
}))), /*#__PURE__*/React__default.createElement(DiscardChangesConfirmationDialog, {
|
20035
|
+
open: showDiscardDialog,
|
20036
|
+
onChange: setShowDiscardDialog,
|
20037
|
+
onDiscard: handleDiscard
|
20038
|
+
}));
|
20039
|
+
}
|
20040
|
+
|
19786
20041
|
function Column$3(_) {
|
19787
20042
|
return null;
|
19788
20043
|
}
|
@@ -19794,12 +20049,23 @@ Group$5.displayName = 'Table3Group';
|
|
19794
20049
|
const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref) {
|
19795
20050
|
var _table3$meta$editing, _table3$meta$editing2;
|
19796
20051
|
const table3 = useTable3(props, ref);
|
20052
|
+
const buttonRef = React__default.useRef(null);
|
19797
20053
|
const gridAttributes = {
|
19798
20054
|
'data-table-editing-mode': (_table3$meta$editing = table3.meta.editing) !== null && _table3$meta$editing !== void 0 && _table3$meta$editing.isEditing ? (_table3$meta$editing2 = table3.meta.editing) !== null && _table3$meta$editing2 !== void 0 && _table3$meta$editing2.isDetailedMode ? 'detailed' : 'normal' : undefined,
|
19799
20055
|
enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing
|
19800
20056
|
};
|
19801
|
-
const hasAlertErrors = table3.meta.editing.
|
19802
|
-
const
|
20057
|
+
const hasAlertErrors = table3.meta.editing.isEditing && table3.meta.editing.getErrorsShownInAlert().length;
|
20058
|
+
const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;
|
20059
|
+
let footerRows;
|
20060
|
+
if (table3.meta.editing.isEnabled && props.onEditingCreate) {
|
20061
|
+
footerRows = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(CreateNewRow, {
|
20062
|
+
buttonRef: buttonRef,
|
20063
|
+
onEditingCreate: props.onEditingCreate,
|
20064
|
+
table: table3.instance,
|
20065
|
+
tableMeta: table3.meta,
|
20066
|
+
tableRef: table3.ref
|
20067
|
+
}));
|
20068
|
+
}
|
19803
20069
|
return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
|
19804
20070
|
table: table3
|
19805
20071
|
}, table3.meta.editing.isEnabled ? (/*#__PURE__*/React__default.createElement(Editing, {
|
@@ -19812,13 +20078,15 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
19812
20078
|
tableRef: table3.ref
|
19813
20079
|
})) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
|
19814
20080
|
"data-taco": "table3",
|
20081
|
+
rowsForFooter: footerRows,
|
19815
20082
|
table: table3
|
19816
|
-
}),
|
20083
|
+
}), hasCreateWorkflow ? (/*#__PURE__*/React__default.createElement(TemporaryRow, {
|
20084
|
+
buttonRef: buttonRef,
|
20085
|
+
rowIdentityAccessor: props.rowIdentityAccessor,
|
19817
20086
|
table: table3.instance,
|
19818
20087
|
tableMeta: table3.meta,
|
19819
|
-
|
19820
|
-
|
19821
|
-
}))));
|
20088
|
+
tableRef: table3.ref
|
20089
|
+
})) : null));
|
19822
20090
|
});
|
19823
20091
|
const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
19824
20092
|
const stringifiedChildren = String(props.children);
|
@@ -19964,7 +20232,7 @@ const Tooltip$1 = ({
|
|
19964
20232
|
icon: "close",
|
19965
20233
|
title: locale.skip,
|
19966
20234
|
"aria-label": locale.skip,
|
19967
|
-
className: "absolute
|
20235
|
+
className: "absolute top-0 right-0 mt-1 mr-1"
|
19968
20236
|
})), step.title && /*#__PURE__*/React.createElement("h5", null, step.title), step.content, /*#__PURE__*/React.createElement(Group, {
|
19969
20237
|
className: "mt-4 justify-end"
|
19970
20238
|
}, index > 0 && (/*#__PURE__*/React.createElement(Button$1, Object.assign({}, backProps, {
|
@@ -20326,15 +20594,13 @@ const AgreementDisplay = props => {
|
|
20326
20594
|
}));
|
20327
20595
|
};
|
20328
20596
|
|
20329
|
-
const Container$1 =
|
20330
|
-
children
|
20331
|
-
}) => {
|
20597
|
+
const Container$1 = props => {
|
20332
20598
|
return /*#__PURE__*/React__default.createElement("div", {
|
20333
20599
|
className: "-ml-2 flex flex-shrink-0 flex-grow-0 items-center gap-2 pr-2 xl:ml-auto xl:w-64",
|
20334
20600
|
"data-taco": "header-agreements"
|
20335
20601
|
}, /*#__PURE__*/React__default.createElement("span", {
|
20336
20602
|
className: "hidden h-8 w-px flex-shrink-0 flex-grow-0 bg-white/[0.3] xl:flex"
|
20337
|
-
}), children);
|
20603
|
+
}), props.children);
|
20338
20604
|
};
|
20339
20605
|
function AgreementSelector(props) {
|
20340
20606
|
const {
|
@@ -20406,7 +20672,7 @@ function AgreementSelector(props) {
|
|
20406
20672
|
}
|
20407
20673
|
return button;
|
20408
20674
|
})), handleAddAgreement ? (/*#__PURE__*/React__default.createElement(Button$1, {
|
20409
|
-
className: "focus-visible:!yt-focus-dark mx-2
|
20675
|
+
className: "focus-visible:!yt-focus-dark my-1 mx-2 !h-9 shrink-0 !bg-white/[0.08] !text-white hover:!bg-white/[0.16]",
|
20410
20676
|
onClick: handleAddAgreement
|
20411
20677
|
}, texts.header.addAgreement)) : null, /*#__PURE__*/React__default.createElement("hr", {
|
20412
20678
|
className: "my-0 h-px w-full bg-white/[0.08]"
|