@economic/taco 2.45.0-alpha.1 → 2.45.0-create.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (505) hide show
  1. package/dist/components/Accordion/Accordion.d.ts +2 -2
  2. package/dist/components/Alert/Alert.d.ts +1 -1
  3. package/dist/components/AlertDialog/components/Content.d.ts +1 -1
  4. package/dist/components/Calendar/Calendar.d.ts +1 -1
  5. package/dist/components/Datepicker/Datepicker.d.ts +1 -1
  6. package/dist/components/Dialog/components/Content.d.ts +1 -1
  7. package/dist/components/Dialog/components/DialogDrawer.d.ts +2 -2
  8. package/dist/components/Drawer/components/Content.d.ts +2 -2
  9. package/dist/components/Header/components/Agreement/Badge.d.ts +1 -1
  10. package/dist/components/Header/components/Agreement/Display.d.ts +2 -2
  11. package/dist/components/Header/components/Agreement/Item.d.ts +2 -2
  12. package/dist/components/Header/components/AgreementSelector.d.ts +2 -2
  13. package/dist/components/Header/components/Button.d.ts +1 -1
  14. package/dist/components/HoverCard/HoverCard.d.ts +1 -1
  15. package/dist/components/Icon/components/AccountPreview.d.ts +1 -1
  16. package/dist/components/Icon/components/Accounting.d.ts +1 -1
  17. package/dist/components/Icon/components/AccountingYear.d.ts +1 -1
  18. package/dist/components/Icon/components/AccountingYearCancel.d.ts +1 -1
  19. package/dist/components/Icon/components/AiChatSolid.d.ts +1 -1
  20. package/dist/components/Icon/components/AiStars.d.ts +1 -1
  21. package/dist/components/Icon/components/ArrowBottom.d.ts +1 -1
  22. package/dist/components/Icon/components/ArrowDown.d.ts +1 -1
  23. package/dist/components/Icon/components/ArrowEnd.d.ts +1 -1
  24. package/dist/components/Icon/components/ArrowLeft.d.ts +1 -1
  25. package/dist/components/Icon/components/ArrowRight.d.ts +1 -1
  26. package/dist/components/Icon/components/ArrowStart.d.ts +1 -1
  27. package/dist/components/Icon/components/ArrowTop.d.ts +1 -1
  28. package/dist/components/Icon/components/ArrowUp.d.ts +1 -1
  29. package/dist/components/Icon/components/Attach.d.ts +1 -1
  30. package/dist/components/Icon/components/AttachAuto.d.ts +1 -1
  31. package/dist/components/Icon/components/AttachCancel.d.ts +1 -1
  32. package/dist/components/Icon/components/AttachWarning.d.ts +1 -1
  33. package/dist/components/Icon/components/Autotext.d.ts +1 -1
  34. package/dist/components/Icon/components/AutotextInsert.d.ts +1 -1
  35. package/dist/components/Icon/components/Basic.d.ts +1 -1
  36. package/dist/components/Icon/components/BasicTabs.d.ts +1 -1
  37. package/dist/components/Icon/components/BellSolid.d.ts +1 -1
  38. package/dist/components/Icon/components/Book.d.ts +1 -1
  39. package/dist/components/Icon/components/Booking.d.ts +1 -1
  40. package/dist/components/Icon/components/Budget.d.ts +1 -1
  41. package/dist/components/Icon/components/Calendar.d.ts +1 -1
  42. package/dist/components/Icon/components/CashAccount.d.ts +1 -1
  43. package/dist/components/Icon/components/CashReports.d.ts +1 -1
  44. package/dist/components/Icon/components/ChartArea.d.ts +1 -1
  45. package/dist/components/Icon/components/ChartBar.d.ts +1 -1
  46. package/dist/components/Icon/components/ChartLine.d.ts +1 -1
  47. package/dist/components/Icon/components/ChartPie.d.ts +1 -1
  48. package/dist/components/Icon/components/ChartTable.d.ts +1 -1
  49. package/dist/components/Icon/components/Chat.d.ts +1 -1
  50. package/dist/components/Icon/components/ChatSolid.d.ts +1 -1
  51. package/dist/components/Icon/components/ChevronDown.d.ts +1 -1
  52. package/dist/components/Icon/components/ChevronDownDouble.d.ts +1 -1
  53. package/dist/components/Icon/components/ChevronDownSolid.d.ts +1 -1
  54. package/dist/components/Icon/components/ChevronLeft.d.ts +1 -1
  55. package/dist/components/Icon/components/ChevronLeftDouble.d.ts +1 -1
  56. package/dist/components/Icon/components/ChevronLeftSolid.d.ts +1 -1
  57. package/dist/components/Icon/components/ChevronRight.d.ts +1 -1
  58. package/dist/components/Icon/components/ChevronRightDouble.d.ts +1 -1
  59. package/dist/components/Icon/components/ChevronRightSolid.d.ts +1 -1
  60. package/dist/components/Icon/components/ChevronUp.d.ts +1 -1
  61. package/dist/components/Icon/components/ChevronUpDouble.d.ts +1 -1
  62. package/dist/components/Icon/components/ChevronUpSolid.d.ts +1 -1
  63. package/dist/components/Icon/components/CircleClose.d.ts +1 -1
  64. package/dist/components/Icon/components/CircleInformation.d.ts +1 -1
  65. package/dist/components/Icon/components/CircleMinus.d.ts +1 -1
  66. package/dist/components/Icon/components/CirclePlus.d.ts +1 -1
  67. package/dist/components/Icon/components/CircleQuestionmark.d.ts +1 -1
  68. package/dist/components/Icon/components/CircleTick.d.ts +1 -1
  69. package/dist/components/Icon/components/CircleWarning.d.ts +1 -1
  70. package/dist/components/Icon/components/Clamp.d.ts +1 -1
  71. package/dist/components/Icon/components/ClampOpen.d.ts +1 -1
  72. package/dist/components/Icon/components/Close.d.ts +1 -1
  73. package/dist/components/Icon/components/ColumnFreeze.d.ts +1 -1
  74. package/dist/components/Icon/components/ColumnUnfreeze.d.ts +1 -1
  75. package/dist/components/Icon/components/Columns.d.ts +1 -1
  76. package/dist/components/Icon/components/ConnectionEnable.d.ts +1 -1
  77. package/dist/components/Icon/components/ConnectionRevoke.d.ts +1 -1
  78. package/dist/components/Icon/components/Contacts.d.ts +1 -1
  79. package/dist/components/Icon/components/Copy.d.ts +1 -1
  80. package/dist/components/Icon/components/Courses.d.ts +1 -1
  81. package/dist/components/Icon/components/Credit.d.ts +1 -1
  82. package/dist/components/Icon/components/Delete.d.ts +1 -1
  83. package/dist/components/Icon/components/DeletePermanently.d.ts +1 -1
  84. package/dist/components/Icon/components/Depecriate.d.ts +1 -1
  85. package/dist/components/Icon/components/Developer.d.ts +1 -1
  86. package/dist/components/Icon/components/DistributionTemplate.d.ts +1 -1
  87. package/dist/components/Icon/components/Document.d.ts +1 -1
  88. package/dist/components/Icon/components/DocumentApprove.d.ts +1 -1
  89. package/dist/components/Icon/components/DocumentCreateEntry.d.ts +1 -1
  90. package/dist/components/Icon/components/DocumentCut.d.ts +1 -1
  91. package/dist/components/Icon/components/DocumentError.d.ts +1 -1
  92. package/dist/components/Icon/components/DocumentIsolatePage.d.ts +1 -1
  93. package/dist/components/Icon/components/DocumentMerge.d.ts +1 -1
  94. package/dist/components/Icon/components/DocumentMove.d.ts +1 -1
  95. package/dist/components/Icon/components/DocumentPreview.d.ts +1 -1
  96. package/dist/components/Icon/components/DocumentReceived.d.ts +1 -1
  97. package/dist/components/Icon/components/DocumentRejectedRequest.d.ts +1 -1
  98. package/dist/components/Icon/components/DocumentSigned.d.ts +1 -1
  99. package/dist/components/Icon/components/DocumentSignedSolid.d.ts +1 -1
  100. package/dist/components/Icon/components/DocumentSplit.d.ts +1 -1
  101. package/dist/components/Icon/components/DocumentTime.d.ts +1 -1
  102. package/dist/components/Icon/components/Download.d.ts +1 -1
  103. package/dist/components/Icon/components/Drag.d.ts +1 -1
  104. package/dist/components/Icon/components/ECopedia.d.ts +1 -1
  105. package/dist/components/Icon/components/Edit.d.ts +1 -1
  106. package/dist/components/Icon/components/EditSimple.d.ts +1 -1
  107. package/dist/components/Icon/components/EllipsisHorizontal.d.ts +1 -1
  108. package/dist/components/Icon/components/EllipsisVertical.d.ts +1 -1
  109. package/dist/components/Icon/components/EntriesOnAccount.d.ts +1 -1
  110. package/dist/components/Icon/components/EntriesOpen.d.ts +1 -1
  111. package/dist/components/Icon/components/EntriesWarning.d.ts +1 -1
  112. package/dist/components/Icon/components/EntryTypeCustomerInvoice.d.ts +1 -1
  113. package/dist/components/Icon/components/EntryTypeCustomerPayment.d.ts +1 -1
  114. package/dist/components/Icon/components/EntryTypeJournalEntry.d.ts +1 -1
  115. package/dist/components/Icon/components/EntryTypeManualCustomerInvoice.d.ts +1 -1
  116. package/dist/components/Icon/components/EntryTypeSupplierInvoice.d.ts +1 -1
  117. package/dist/components/Icon/components/EntryTypeSupplierPayment.d.ts +1 -1
  118. package/dist/components/Icon/components/Envelope.d.ts +1 -1
  119. package/dist/components/Icon/components/EnvelopeApproved.d.ts +1 -1
  120. package/dist/components/Icon/components/EnvelopeSolid.d.ts +1 -1
  121. package/dist/components/Icon/components/ExpandView.d.ts +1 -1
  122. package/dist/components/Icon/components/Expenses.d.ts +1 -1
  123. package/dist/components/Icon/components/Export.d.ts +1 -1
  124. package/dist/components/Icon/components/ExportToExcel.d.ts +1 -1
  125. package/dist/components/Icon/components/ExportToPdf.d.ts +1 -1
  126. package/dist/components/Icon/components/EyeOff.d.ts +1 -1
  127. package/dist/components/Icon/components/EyeOn.d.ts +1 -1
  128. package/dist/components/Icon/components/Filter.d.ts +1 -1
  129. package/dist/components/Icon/components/FilterSolid.d.ts +1 -1
  130. package/dist/components/Icon/components/FontSize.d.ts +1 -1
  131. package/dist/components/Icon/components/GraphSolid.d.ts +1 -1
  132. package/dist/components/Icon/components/Hash.d.ts +1 -1
  133. package/dist/components/Icon/components/HeightExtraTall.d.ts +1 -1
  134. package/dist/components/Icon/components/HeightMedium.d.ts +1 -1
  135. package/dist/components/Icon/components/HeightShort.d.ts +1 -1
  136. package/dist/components/Icon/components/HeightTall.d.ts +1 -1
  137. package/dist/components/Icon/components/House.d.ts +1 -1
  138. package/dist/components/Icon/components/HouseSolid.d.ts +1 -1
  139. package/dist/components/Icon/components/Id.d.ts +1 -1
  140. package/dist/components/Icon/components/Images.d.ts +1 -1
  141. package/dist/components/Icon/components/Import.d.ts +1 -1
  142. package/dist/components/Icon/components/Inbox.d.ts +1 -1
  143. package/dist/components/Icon/components/InboxEinvoicing.d.ts +1 -1
  144. package/dist/components/Icon/components/InboxScanning.d.ts +1 -1
  145. package/dist/components/Icon/components/InboxSmart.d.ts +1 -1
  146. package/dist/components/Icon/components/Info.d.ts +1 -1
  147. package/dist/components/Icon/components/Inventory.d.ts +1 -1
  148. package/dist/components/Icon/components/InventoryMatrix.d.ts +1 -1
  149. package/dist/components/Icon/components/JournalPro.d.ts +1 -1
  150. package/dist/components/Icon/components/Layout.d.ts +1 -1
  151. package/dist/components/Icon/components/LayoutBoth.d.ts +1 -1
  152. package/dist/components/Icon/components/LayoutFirst.d.ts +1 -1
  153. package/dist/components/Icon/components/LayoutLast.d.ts +1 -1
  154. package/dist/components/Icon/components/LayoutNone.d.ts +1 -1
  155. package/dist/components/Icon/components/LedgerCard.d.ts +1 -1
  156. package/dist/components/Icon/components/LedgerCardCustomerReminder.d.ts +1 -1
  157. package/dist/components/Icon/components/LedgerCardManualCustomerInvoice.d.ts +1 -1
  158. package/dist/components/Icon/components/LedgerCardObsoleteStock.d.ts +1 -1
  159. package/dist/components/Icon/components/LedgerCardOpeningEntry.d.ts +1 -1
  160. package/dist/components/Icon/components/LedgerCardReservedEntry.d.ts +1 -1
  161. package/dist/components/Icon/components/LedgerCardShrinkagePilferage.d.ts +1 -1
  162. package/dist/components/Icon/components/LedgerCardStockAdjustment.d.ts +1 -1
  163. package/dist/components/Icon/components/LedgerCardTransferredOpeningEntry.d.ts +1 -1
  164. package/dist/components/Icon/components/Lightbulb.d.ts +1 -1
  165. package/dist/components/Icon/components/Line.d.ts +1 -1
  166. package/dist/components/Icon/components/LinkExternal.d.ts +1 -1
  167. package/dist/components/Icon/components/List.d.ts +1 -1
  168. package/dist/components/Icon/components/ListBulleted.d.ts +1 -1
  169. package/dist/components/Icon/components/ListSearch.d.ts +1 -1
  170. package/dist/components/Icon/components/Location.d.ts +1 -1
  171. package/dist/components/Icon/components/Lock.d.ts +1 -1
  172. package/dist/components/Icon/components/LockOpen.d.ts +1 -1
  173. package/dist/components/Icon/components/Log.d.ts +1 -1
  174. package/dist/components/Icon/components/LogOut.d.ts +1 -1
  175. package/dist/components/Icon/components/Market.d.ts +1 -1
  176. package/dist/components/Icon/components/MastercardOs.d.ts +1 -1
  177. package/dist/components/Icon/components/MatchAmount.d.ts +1 -1
  178. package/dist/components/Icon/components/MatchEntries.d.ts +1 -1
  179. package/dist/components/Icon/components/Menu.d.ts +1 -1
  180. package/dist/components/Icon/components/Mileage.d.ts +1 -1
  181. package/dist/components/Icon/components/ModalResize.d.ts +1 -1
  182. package/dist/components/Icon/components/ModalShrink.d.ts +1 -1
  183. package/dist/components/Icon/components/More.d.ts +1 -1
  184. package/dist/components/Icon/components/MoreSolid.d.ts +1 -1
  185. package/dist/components/Icon/components/Move.d.ts +1 -1
  186. package/dist/components/Icon/components/NavigationList.d.ts +1 -1
  187. package/dist/components/Icon/components/Note.d.ts +1 -1
  188. package/dist/components/Icon/components/NoteFollowUp.d.ts +1 -1
  189. package/dist/components/Icon/components/NoteRead.d.ts +1 -1
  190. package/dist/components/Icon/components/NovemberFirst.d.ts +1 -1
  191. package/dist/components/Icon/components/Numbers.d.ts +1 -1
  192. package/dist/components/Icon/components/PartnerApi.d.ts +1 -1
  193. package/dist/components/Icon/components/PaymentPaid.d.ts +1 -1
  194. package/dist/components/Icon/components/PaymentUnpaid.d.ts +1 -1
  195. package/dist/components/Icon/components/Period.d.ts +1 -1
  196. package/dist/components/Icon/components/PersonChange.d.ts +1 -1
  197. package/dist/components/Icon/components/PersonMinus.d.ts +1 -1
  198. package/dist/components/Icon/components/PersonPlus.d.ts +1 -1
  199. package/dist/components/Icon/components/PersonTick.d.ts +1 -1
  200. package/dist/components/Icon/components/Phone.d.ts +1 -1
  201. package/dist/components/Icon/components/PhoneSolid.d.ts +1 -1
  202. package/dist/components/Icon/components/Play.d.ts +1 -1
  203. package/dist/components/Icon/components/PlusMinus.d.ts +1 -1
  204. package/dist/components/Icon/components/Print.d.ts +1 -1
  205. package/dist/components/Icon/components/ProcessPayment.d.ts +1 -1
  206. package/dist/components/Icon/components/ProductLedgerCard.d.ts +1 -1
  207. package/dist/components/Icon/components/Profile.d.ts +1 -1
  208. package/dist/components/Icon/components/ProjectCards.d.ts +1 -1
  209. package/dist/components/Icon/components/Projects.d.ts +1 -1
  210. package/dist/components/Icon/components/QuestionMark.d.ts +1 -1
  211. package/dist/components/Icon/components/QuestionMarkBold.d.ts +1 -1
  212. package/dist/components/Icon/components/Quicklinks.d.ts +1 -1
  213. package/dist/components/Icon/components/RatingBankruptcy.d.ts +1 -1
  214. package/dist/components/Icon/components/RatingPaymentProblems.d.ts +1 -1
  215. package/dist/components/Icon/components/Reconciled.d.ts +1 -1
  216. package/dist/components/Icon/components/Refresh.d.ts +1 -1
  217. package/dist/components/Icon/components/Report.d.ts +1 -1
  218. package/dist/components/Icon/components/ReportSolid.d.ts +1 -1
  219. package/dist/components/Icon/components/Restore.d.ts +1 -1
  220. package/dist/components/Icon/components/RotateLeft.d.ts +1 -1
  221. package/dist/components/Icon/components/RotateRight.d.ts +1 -1
  222. package/dist/components/Icon/components/Sales.d.ts +1 -1
  223. package/dist/components/Icon/components/Search.d.ts +1 -1
  224. package/dist/components/Icon/components/SearchBold.d.ts +1 -1
  225. package/dist/components/Icon/components/Secure.d.ts +1 -1
  226. package/dist/components/Icon/components/SecureTick.d.ts +1 -1
  227. package/dist/components/Icon/components/Settings.d.ts +1 -1
  228. package/dist/components/Icon/components/SettingsSolid.d.ts +1 -1
  229. package/dist/components/Icon/components/Shortcuts.d.ts +1 -1
  230. package/dist/components/Icon/components/ShowAll.d.ts +1 -1
  231. package/dist/components/Icon/components/ShowLess.d.ts +1 -1
  232. package/dist/components/Icon/components/ShowMore.d.ts +1 -1
  233. package/dist/components/Icon/components/ShowTemplate.d.ts +1 -1
  234. package/dist/components/Icon/components/Sliders.d.ts +1 -1
  235. package/dist/components/Icon/components/Smartpay.d.ts +1 -1
  236. package/dist/components/Icon/components/SortBy.d.ts +1 -1
  237. package/dist/components/Icon/components/Star.d.ts +1 -1
  238. package/dist/components/Icon/components/StarSolid.d.ts +1 -1
  239. package/dist/components/Icon/components/Subscriptions.d.ts +1 -1
  240. package/dist/components/Icon/components/SystemEntries.d.ts +1 -1
  241. package/dist/components/Icon/components/Tag.d.ts +1 -1
  242. package/dist/components/Icon/components/TemplateOverride.d.ts +1 -1
  243. package/dist/components/Icon/components/Templates.d.ts +1 -1
  244. package/dist/components/Icon/components/ThumbBoth.d.ts +1 -1
  245. package/dist/components/Icon/components/ThumbDown.d.ts +1 -1
  246. package/dist/components/Icon/components/ThumbDownSolid.d.ts +1 -1
  247. package/dist/components/Icon/components/ThumbUp.d.ts +1 -1
  248. package/dist/components/Icon/components/ThumbUpSolid.d.ts +1 -1
  249. package/dist/components/Icon/components/Tick.d.ts +1 -1
  250. package/dist/components/Icon/components/TickBold.d.ts +1 -1
  251. package/dist/components/Icon/components/Time.d.ts +1 -1
  252. package/dist/components/Icon/components/Transfer.d.ts +1 -1
  253. package/dist/components/Icon/components/TransferCancel.d.ts +1 -1
  254. package/dist/components/Icon/components/TransferLocked.d.ts +1 -1
  255. package/dist/components/Icon/components/Undo.d.ts +1 -1
  256. package/dist/components/Icon/components/Undock.d.ts +1 -1
  257. package/dist/components/Icon/components/Unreconciled.d.ts +1 -1
  258. package/dist/components/Icon/components/Warning.d.ts +1 -1
  259. package/dist/components/Icon/components/Webshop.d.ts +1 -1
  260. package/dist/components/Icon/components/Website.d.ts +1 -1
  261. package/dist/components/Icon/components/Workflow.d.ts +1 -1
  262. package/dist/components/Icon/components/WorkflowTemplateBasic.d.ts +1 -1
  263. package/dist/components/Icon/components/Zoom.d.ts +1 -1
  264. package/dist/components/IconButton/IconButton.d.ts +2 -2
  265. package/dist/components/Input/Input.d.ts +2 -2
  266. package/dist/components/Input/util.d.ts +1 -11
  267. package/dist/components/Layout/components/Sidebar.d.ts +2 -14
  268. package/dist/components/Layout/components/Top.d.ts +4 -4
  269. package/dist/components/List/List.d.ts +7 -7
  270. package/dist/components/List/components/Button.d.ts +1 -1
  271. package/dist/components/List/components/Collapsible.d.ts +1 -1
  272. package/dist/components/List/components/Group.d.ts +1 -1
  273. package/dist/components/List/components/Item.d.ts +1 -1
  274. package/dist/components/List/components/Link.d.ts +1 -1
  275. package/dist/components/List/components/Toggle.d.ts +2 -2
  276. package/dist/components/Listbox/Listbox.d.ts +2 -2
  277. package/dist/components/Listbox/ScrollableList.d.ts +1 -1
  278. package/dist/components/Listbox/util.d.ts +2 -2
  279. package/dist/components/Menu/components/Checkbox.d.ts +1 -1
  280. package/dist/components/Menu/components/Content.d.ts +2 -2
  281. package/dist/components/Menu/components/Item.d.ts +8 -8
  282. package/dist/components/Menu/components/Link.d.ts +1 -1
  283. package/dist/components/Menu/components/RadioGroup.d.ts +1 -1
  284. package/dist/components/Menu/components/SubMenu.d.ts +1 -1
  285. package/dist/components/Menu/components/Trigger.d.ts +1 -1
  286. package/dist/components/Navigation2/components/Group.d.ts +1 -1
  287. package/dist/components/Popover/Popover.d.ts +2 -2
  288. package/dist/components/Provider/Localization.d.ts +2 -0
  289. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  290. package/dist/components/Report/Report.d.ts +1 -1
  291. package/dist/components/ScrollArea/ScrollArea.d.ts +2 -2
  292. package/dist/components/SearchInput/SearchInput.d.ts +1 -1
  293. package/dist/components/Select/Select.d.ts +1 -1
  294. package/dist/components/Select2/components/All.d.ts +2 -2
  295. package/dist/components/Select2/components/Collection.d.ts +1 -1
  296. package/dist/components/Select2/components/Create.d.ts +1 -1
  297. package/dist/components/Select2/components/Edit.d.ts +2 -2
  298. package/dist/components/Select2/components/Group.d.ts +1 -1
  299. package/dist/components/Select2/components/Option.d.ts +1 -1
  300. package/dist/components/Select2/components/Search.d.ts +3 -3
  301. package/dist/components/Select2/components/Trigger.d.ts +1 -1
  302. package/dist/components/Select2/hooks/useChildren.d.ts +2 -2
  303. package/dist/components/Shortcut/Shortcut.d.ts +1 -1
  304. package/dist/components/Table3/Table3.d.ts +2 -14
  305. package/dist/components/Table3/components/Columns/Cell/Cell.d.ts +2 -2
  306. package/dist/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.d.ts +1 -1
  307. package/dist/components/Table3/components/Columns/Cell/EditingControlCell.d.ts +2 -2
  308. package/dist/components/Table3/components/Columns/Internal/EditingActionsMenu.d.ts +3 -4
  309. package/dist/components/Table3/components/Editing/Alert.d.ts +1 -1
  310. package/dist/components/Table3/components/Editing/DiscardChangesConfirmationDialog.d.ts +7 -0
  311. package/dist/components/Table3/components/Row/Editing/CreateNewRow.d.ts +13 -0
  312. package/dist/components/Table3/components/Row/Editing/SaveStatus.d.ts +2 -2
  313. package/dist/components/Table3/components/Row/Editing/TemporaryRow.d.ts +12 -0
  314. package/dist/components/Table3/components/Row/Row.d.ts +2 -2
  315. package/dist/components/Table3/components/Toolbar/Editing/Editing.d.ts +1 -1
  316. package/dist/components/Table3/features/useEditingState.d.ts +29 -0
  317. package/dist/components/Table3/features/useTableEditing.d.ts +24 -36
  318. package/dist/components/Table3/types.d.ts +23 -8
  319. package/dist/components/Table3/useTable3.d.ts +6 -0
  320. package/dist/components/Table3/util/editing.d.ts +0 -1
  321. package/dist/components/Tag/Tag.d.ts +2 -2
  322. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  323. package/dist/components/Tour/Tour.d.ts +3 -3
  324. package/dist/components/Truncate/Truncate.d.ts +1 -1
  325. package/dist/esm/index.css +6 -2
  326. package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js +17 -17
  327. package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js.map +1 -1
  328. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +6 -14
  329. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
  330. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  331. package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
  332. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +3 -3
  333. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  334. package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js.map +1 -1
  335. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js.map +1 -1
  336. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +3 -5
  337. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  338. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  339. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  340. package/dist/esm/packages/taco/src/components/Layout/components/Top.js +2 -2
  341. package/dist/esm/packages/taco/src/components/Layout/components/Top.js.map +1 -1
  342. package/dist/esm/packages/taco/src/components/Listbox/util.js +1 -7
  343. package/dist/esm/packages/taco/src/components/Listbox/util.js.map +1 -1
  344. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  345. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +2 -2
  346. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
  347. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  348. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  349. package/dist/esm/packages/taco/src/components/Provider/Localization.js +5 -3
  350. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  351. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  352. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +4 -4
  353. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  354. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  355. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  356. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  357. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +10 -11
  358. package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
  359. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +2 -0
  360. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  361. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  362. package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
  363. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  364. package/dist/esm/packages/taco/src/components/Switch/Switch.js +1 -1
  365. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  366. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  367. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
  368. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  369. package/dist/esm/packages/taco/src/components/Table3/Table3.js +21 -7
  370. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  371. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js.map +1 -1
  372. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +24 -6
  373. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  374. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js +5 -36
  375. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
  376. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +17 -12
  377. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  378. package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js +34 -0
  379. package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js.map +1 -0
  380. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +88 -0
  381. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -0
  382. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js +2 -14
  383. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js.map +1 -1
  384. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +93 -0
  385. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -0
  386. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js +5 -7
  387. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js.map +1 -1
  388. package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js +7 -2
  389. package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
  390. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +514 -0
  391. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +1 -0
  392. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +16 -406
  393. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  394. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +37 -32
  395. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
  396. package/dist/esm/packages/taco/src/components/Table3/useTable3.js +21 -7
  397. package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
  398. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +3 -28
  399. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  400. package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
  401. package/dist/esm/packages/taco/src/components/Tour/Tour.js +3 -3
  402. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  403. package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js.map +1 -1
  404. package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -1
  405. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js +18 -0
  406. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js.map +1 -1
  407. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js +0 -1
  408. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js.map +1 -1
  409. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js +1 -0
  410. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js.map +1 -1
  411. package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js +1 -1
  412. package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js.map +1 -1
  413. package/dist/esm/packages/taco/src/primitives/Sortable/components/Item.js.map +1 -1
  414. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +3 -4
  415. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  416. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js +4 -4
  417. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js.map +1 -1
  418. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +9 -3
  419. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
  420. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +6 -3
  421. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
  422. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
  423. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +1 -1
  424. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  425. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
  426. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Goto.js.map +1 -1
  427. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js +2 -2
  428. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
  429. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Resizer.js.map +1 -1
  430. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/SortIndicator.js.map +1 -1
  431. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/util.js.map +1 -1
  432. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +1 -1
  433. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
  434. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.js.map +1 -1
  435. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  436. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +1 -3
  437. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
  438. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  439. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -1
  440. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/Settings.js.map +1 -1
  441. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +1 -1
  442. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  443. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  444. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  445. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js +3 -3
  446. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -1
  447. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +1 -1
  448. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -1
  449. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableShortcutsListener.js.map +1 -1
  450. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +1 -1
  451. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  452. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
  453. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
  454. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +11 -0
  455. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  456. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js.map +1 -1
  457. package/dist/esm/packages/taco/src/utils/dom.js +9 -7
  458. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  459. package/dist/index.css +6 -2
  460. package/dist/primitives/BubbleSelect.d.ts +1 -1
  461. package/dist/primitives/Collection/components/Root.d.ts +2 -0
  462. package/dist/primitives/Sortable/components/Container.d.ts +2 -2
  463. package/dist/primitives/Sortable/components/Item.d.ts +1 -2
  464. package/dist/primitives/Sortable/components/List.d.ts +1 -1
  465. package/dist/primitives/Table/Core/Table.d.ts +3 -2
  466. package/dist/primitives/Table/Core/components/Body/Body.d.ts +1 -1
  467. package/dist/primitives/Table/Core/components/Body/EmptyStateBody.d.ts +1 -1
  468. package/dist/primitives/Table/Core/components/Body/util.d.ts +4 -4
  469. package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.d.ts +2 -2
  470. package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.d.ts +2 -2
  471. package/dist/primitives/Table/Core/components/Columns/Cell/Cell.d.ts +1 -1
  472. package/dist/primitives/Table/Core/components/Columns/Internal/Actions.d.ts +5 -3
  473. package/dist/primitives/Table/Core/components/Footer/Footer.d.ts +3 -3
  474. package/dist/primitives/Table/Core/components/Footer/Summary.d.ts +2 -2
  475. package/dist/primitives/Table/Core/components/Header/Header.d.ts +1 -1
  476. package/dist/primitives/Table/Core/components/Header/components/Goto.d.ts +2 -2
  477. package/dist/primitives/Table/Core/components/Header/components/Menu.d.ts +1 -1
  478. package/dist/primitives/Table/Core/components/Header/components/Resizer.d.ts +2 -2
  479. package/dist/primitives/Table/Core/components/Header/components/SortIndicator.d.ts +3 -3
  480. package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +2 -2
  481. package/dist/primitives/Table/Core/components/Row/Row.d.ts +1 -1
  482. package/dist/primitives/Table/Core/components/Toolbar/Toolbar.d.ts +1 -1
  483. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/Filters.d.ts +2 -2
  484. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.d.ts +2 -2
  485. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.d.ts +2 -2
  486. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +1 -1
  487. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.d.ts +2 -2
  488. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.d.ts +2 -2
  489. package/dist/primitives/Table/Core/components/Toolbar/components/Print/Print.d.ts +1 -1
  490. package/dist/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.d.ts +2 -2
  491. package/dist/primitives/Table/Core/components/Toolbar/components/Search/Search.d.ts +1 -1
  492. package/dist/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.d.ts +2 -2
  493. package/dist/primitives/Table/Core/components/Toolbar/components/Settings/Settings.d.ts +2 -2
  494. package/dist/primitives/Table/types.d.ts +1 -1
  495. package/dist/primitives/Table/useTableManager/useTableManager.d.ts +1 -1
  496. package/dist/primitives/Table/useTableManager/util/settings.d.ts +1 -1
  497. package/dist/taco.cjs.development.js +925 -682
  498. package/dist/taco.cjs.development.js.map +1 -1
  499. package/dist/taco.cjs.production.min.js +1 -1
  500. package/dist/taco.cjs.production.min.js.map +1 -1
  501. package/dist/utils/dom.d.ts +2 -1
  502. package/package.json +12 -12
  503. package/dist/components/Table3/components/Row/Editing/CreateRowButton.d.ts +0 -11
  504. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js +0 -90
  505. 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 lodash = require('lodash');
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 = type === 'single' ? {
4044
- type: 'single',
4045
- defaultValue: defaultId
4046
- } : {
4047
- type: 'multiple',
4048
- defaultValue: defaultId
4043
+ valueProps = {
4044
+ defaultValue: defaultId || undefined
4049
4045
  };
4050
4046
  } else {
4051
- valueProps = type === 'single' ? {
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,22 +4206,24 @@ const getOverlaySelector = element => {
4213
4206
  return undefined;
4214
4207
  }
4215
4208
  };
4216
- function isElementInsideOrTriggeredFromContainer(element, container) {
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) {
4220
- const escapedSelector = CSS.escape(selector);
4221
- if (container !== null && container !== void 0 && container.querySelector(escapedSelector)) {
4213
+ if (container !== null && container !== void 0 && container.querySelector(selector)) {
4222
4214
  return true;
4223
4215
  }
4224
- const elementInDocument = document.querySelector(escapedSelector);
4216
+ const elementInDocument = document.querySelector(selector);
4225
4217
  // if the element does exist, see if it is itself connected to somethng that was triggered from the container
4226
4218
  if (elementInDocument) {
4227
- return isElementInsideOrTriggeredFromContainer(elementInDocument, container);
4219
+ return isElementTriggeredFromContainer(elementInDocument, container);
4228
4220
  }
4229
4221
  return false;
4230
4222
  }
4231
- return !!(container !== null && container !== void 0 && container.contains(element));
4223
+ return false;
4224
+ }
4225
+ function isElementInsideOrTriggeredFromContainer(element, container) {
4226
+ return isElementTriggeredFromContainer(element, container) || !!(container !== null && container !== void 0 && container.contains(element));
4232
4227
  }
4233
4228
  function isElementInsideOverlay(element) {
4234
4229
  return !!(element !== null && element !== void 0 && element.closest('[role=dialog],[role=menu]'));
@@ -4722,7 +4717,9 @@ const defaultLocalisationTexts = {
4722
4717
  tooltip: 'Edit table'
4723
4718
  },
4724
4719
  create: {
4725
- label: 'New'
4720
+ label: 'New',
4721
+ disabled: 'Existing new row must be saved',
4722
+ saving: 'Saving...'
4726
4723
  }
4727
4724
  },
4728
4725
  clearChangesConfirmationDialog: {
@@ -4744,8 +4741,8 @@ const defaultLocalisationTexts = {
4744
4741
  },
4745
4742
  validation: {
4746
4743
  alert: {
4747
- titleOne: '[COUNT] unsaved entry:',
4748
- titlePlural: '[COUNT] unsaved entries:',
4744
+ titleOne: '[COUNT] unsaved row:',
4745
+ titlePlural: '[COUNT] unsaved rows:',
4749
4746
  messageOne: "[COLUMN] [ROW] is incomplete and hasn't been saved.",
4750
4747
  messagePlural: "[COLUMN] [ROW] are incomplete and haven't been saved.",
4751
4748
  messageRow: 'Row',
@@ -5745,13 +5742,7 @@ const searchForString = (child, value, strategy = 'includes') => {
5745
5742
  }
5746
5743
  return searchForString((_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.children, value, strategy);
5747
5744
  } else {
5748
- const childLowerCase = child.toString().toLowerCase();
5749
- const valueLowerCase = String(value).toLowerCase();
5750
- if (strategy === 'startsWith') {
5751
- return childLowerCase.startsWith(valueLowerCase);
5752
- } else {
5753
- return childLowerCase.includes(valueLowerCase);
5754
- }
5745
+ return child.toString().toLowerCase()[strategy](String(value).toLowerCase());
5755
5746
  }
5756
5747
  } catch {
5757
5748
  return false;
@@ -6705,7 +6696,7 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
6705
6696
  }), /*#__PURE__*/React.createElement("div", {
6706
6697
  className: containerClassName,
6707
6698
  "data-taco": "dialog"
6708
- }, /*#__PURE__*/React.createElement(React.Fragment, null, output, dialog.draggable && (/*#__PURE__*/React.createElement("div", Object.assign({}, dragHandleProps, {
6699
+ }, output, dialog.draggable && (/*#__PURE__*/React.createElement("div", Object.assign({}, dragHandleProps, {
6709
6700
  role: "button",
6710
6701
  draggable: true,
6711
6702
  "aria-grabbed": dragging,
@@ -6719,7 +6710,7 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
6719
6710
  "aria-label": texts.dialog.close,
6720
6711
  className: "absolute right-0 top-0 mr-2 mt-2 print:hidden",
6721
6712
  icon: "close"
6722
- }))) : null)), dialog.elements.drawer, dialog.elements.extra))));
6713
+ }))) : null), dialog.elements.drawer, dialog.elements.extra))));
6723
6714
  });
6724
6715
 
6725
6716
  const DialogDrawer = /*#__PURE__*/React.forwardRef(function DialogDrawer(props, ref) {
@@ -6912,12 +6903,12 @@ const Bar = props => {
6912
6903
  className: className
6913
6904
  }));
6914
6905
  };
6915
- const Thumb = () => /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Thumb, {
6906
+ const Thumb = props => /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Thumb, Object.assign({}, props, {
6916
6907
  className: "flex-[1] rounded bg-black opacity-50"
6917
- });
6918
- const Corner = () => /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Corner, {
6908
+ }));
6909
+ const Corner = props => /*#__PURE__*/React__default.createElement(ScrollAreaPrimitive.Corner, Object.assign({}, props, {
6919
6910
  className: "bg-grey-500"
6920
- });
6911
+ }));
6921
6912
  const ScrollArea = props => {
6922
6913
  const {
6923
6914
  children,
@@ -7647,7 +7638,7 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(props, ref) {
7647
7638
  onCheckedChange: onChange,
7648
7639
  ref: ref
7649
7640
  }), /*#__PURE__*/React.createElement(PrimitiveSwitch.Thumb, {
7650
- className: "'will-change-transform mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform group-disabled:opacity-50 group-aria-checked:translate-x-[1.1rem]"
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]"
7651
7642
  }));
7652
7643
  if (label) {
7653
7644
  const labelContainerClassName = cn('flex self-start cursor-pointer', {
@@ -8707,10 +8698,10 @@ const ModeSwitch = /*#__PURE__*/React.forwardRef(function ModeSwitch(props, ref)
8707
8698
  onCheckedChange: onChange,
8708
8699
  ref: ref
8709
8700
  }), /*#__PURE__*/React.createElement(PrimitiveSwitch.Thumb, {
8710
- className: "'will-change-transform flex h-6 w-6 items-center justify-center rounded-full bg-white transition-transform group-disabled:opacity-50 group-aria-checked:translate-x-[100%]"
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%]"
8711
8702
  }, /*#__PURE__*/React.createElement(Icon, {
8712
8703
  name: "edit-simple",
8713
- className: "!h-5 !w-5"
8704
+ className: "pointer-events-none !h-5 !w-5"
8714
8705
  })));
8715
8706
  });
8716
8707
  ModeSwitch.displayName = 'ModeSwitch';
@@ -10413,6 +10404,15 @@ function configureReactTableOptions(options, props, localization) {
10413
10404
  // We don't want to expose internal Tanstack Table row, so we need to wrap enableRowSelection callback into additional function,
10414
10405
  // which receives the React Table Row object and passes row.original to a callback.
10415
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
+ }
10416
10416
  const tableOptions = {
10417
10417
  defaultColumn: {
10418
10418
  enableColumnFilter: options.enableFiltering || true,
@@ -10431,11 +10431,13 @@ function configureReactTableOptions(options, props, localization) {
10431
10431
  enableGrouping: true,
10432
10432
  enableHiding: (_options$enableColumn2 = options.enableColumnHiding) !== null && _options$enableColumn2 !== void 0 ? _options$enableColumn2 : false,
10433
10433
  enablePinning: (_options$enableColumn3 = options.enableColumnFreezing) !== null && _options$enableColumn3 !== void 0 ? _options$enableColumn3 : false,
10434
+ enableRowPinning: true,
10434
10435
  enableRowSelection: reactTableEnableRowSelection !== null && reactTableEnableRowSelection !== void 0 ? reactTableEnableRowSelection : false,
10435
10436
  enableSorting: (_options$enableSortin = options.enableSorting) !== null && _options$enableSortin !== void 0 ? _options$enableSortin : false,
10436
10437
  // models for default features
10437
10438
  getExpandedRowModel: reactTable.getExpandedRowModel(),
10438
10439
  getGroupedRowModel: reactTable.getGroupedRowModel(),
10440
+ getRowId,
10439
10441
  groupedColumnMode: false
10440
10442
  };
10441
10443
  if (tableOptions.enableColumnResizing) {
@@ -10956,10 +10958,10 @@ function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
10956
10958
  // react-table doesn't re-render when options.enableGlobalFilter changes, so for now we force it
10957
10959
  const currentFilter = instance.getState().globalFilter;
10958
10960
  if (currentFilter) {
10959
- instance.resetGlobalFilter(true);
10960
- window.requestAnimationFrame(() => {
10961
+ setTimeout(() => {
10962
+ instance.setGlobalFilter('');
10961
10963
  instance.setGlobalFilter(currentFilter);
10962
- });
10964
+ }, 1);
10963
10965
  }
10964
10966
  }
10965
10967
  // highlighting
@@ -10979,13 +10981,13 @@ function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
10979
10981
  }
10980
10982
 
10981
10983
  // A type of promise-like that resolves synchronously and supports only one observer
10982
- const _Pact = /*#__PURE__*/function () {
10984
+ var _Pact = /*#__PURE__*/function () {
10983
10985
  function _Pact() {}
10984
10986
  _Pact.prototype.then = function (onFulfilled, onRejected) {
10985
- const result = new _Pact();
10986
- const state = this.s;
10987
+ var result = new _Pact();
10988
+ var state = this.s;
10987
10989
  if (state) {
10988
- const callback = state & 1 ? onFulfilled : onRejected;
10990
+ var callback = state & 1 ? onFulfilled : onRejected;
10989
10991
  if (callback) {
10990
10992
  try {
10991
10993
  _settle(result, 1, callback(this.v));
@@ -10999,7 +11001,7 @@ const _Pact = /*#__PURE__*/function () {
10999
11001
  }
11000
11002
  this.o = function (_this) {
11001
11003
  try {
11002
- const value = _this.v;
11004
+ var value = _this.v;
11003
11005
  if (_this.s & 1) {
11004
11006
  _settle(result, 1, onFulfilled ? onFulfilled(value) : value);
11005
11007
  } else if (onRejected) {
@@ -11036,7 +11038,7 @@ function _settle(pact, state, value) {
11036
11038
  }
11037
11039
  pact.s = state;
11038
11040
  pact.v = value;
11039
- const observer = pact.o;
11041
+ var observer = pact.o;
11040
11042
  if (observer) {
11041
11043
  observer(pact);
11042
11044
  }
@@ -11076,17 +11078,13 @@ function _forTo(array, body, check) {
11076
11078
  _cycle();
11077
11079
  return pact;
11078
11080
  }
11079
- const _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /*#__PURE__*/Symbol("Symbol.iterator")) : "@@iterator";
11081
+ var _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /*#__PURE__*/Symbol("Symbol.iterator")) : "@@iterator";
11080
11082
 
11081
11083
  // Asynchronously iterate through an object's values
11082
11084
  // Uses for...of if the runtime supports it, otherwise iterates until length on a copy
11083
11085
  function _forOf(target, body, check) {
11084
11086
  if (typeof target[_iteratorSymbol] === "function") {
11085
- var iterator = target[_iteratorSymbol](),
11086
- step,
11087
- pact,
11088
- reject;
11089
- function _cycle(result) {
11087
+ var _cycle = function _cycle(result) {
11090
11088
  try {
11091
11089
  while (!(step = iterator.next()).done && (!check || !check())) {
11092
11090
  result = body(step.value);
@@ -11107,13 +11105,17 @@ function _forOf(target, body, check) {
11107
11105
  } catch (e) {
11108
11106
  _settle(pact || (pact = new _Pact()), 2, e);
11109
11107
  }
11110
- }
11108
+ };
11109
+ var iterator = target[_iteratorSymbol](),
11110
+ step,
11111
+ pact,
11112
+ reject;
11111
11113
  _cycle();
11112
- if (iterator.return) {
11113
- var _fixup = function (value) {
11114
+ if (iterator["return"]) {
11115
+ var _fixup = function _fixup(value) {
11114
11116
  try {
11115
11117
  if (!step.done) {
11116
- iterator.return();
11118
+ iterator["return"]();
11117
11119
  }
11118
11120
  } catch (e) {}
11119
11121
  return value;
@@ -11140,7 +11142,7 @@ function _forOf(target, body, check) {
11140
11142
  return body(values[i]);
11141
11143
  }, check);
11142
11144
  }
11143
- const _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /*#__PURE__*/Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
11145
+ var _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /*#__PURE__*/Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
11144
11146
 
11145
11147
  // Asynchronously call a function and send errors to recovery continuation
11146
11148
  function _catch(body, recover) {
@@ -11768,7 +11770,7 @@ function useTableManager(props, meta, internalColumns) {
11768
11770
  rowDrag,
11769
11771
  rowDrop: rowDrop,
11770
11772
  rowExpansion: rowExpansion,
11771
- rowIdentityColumnId: props.rowIdentityColumnId,
11773
+ rowIdentityAccessor: props.rowIdentityAccessor,
11772
11774
  rowGoto,
11773
11775
  rowGroups: rowGroups,
11774
11776
  rowHeight,
@@ -12136,7 +12138,7 @@ function Row(props) {
12136
12138
  function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
12137
12139
  var _table$getState$group, _virtualItems$padding, _virtualItems$padding2, _virtualItems$padding3, _ref, _virtualItems;
12138
12140
  const tableMeta = table.options.meta;
12139
- const rows = table.getRowModel().rows;
12141
+ const rows = table.getCenterRows();
12140
12142
  const isTableRowGrouped = !!((_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length);
12141
12143
  // expanded rows
12142
12144
  const {
@@ -12315,12 +12317,14 @@ function Actions$1(props) {
12315
12317
  actionsLength,
12316
12318
  data,
12317
12319
  isActiveRow,
12318
- rowId
12320
+ rowId,
12321
+ table
12319
12322
  } = props;
12320
12323
  const {
12321
12324
  texts
12322
12325
  } = useLocalization();
12323
- const visibleActions = actions.map(action => action(data, rowId)).filter(action => !!action);
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);
12324
12328
  const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
12325
12329
  const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
12326
12330
  const className = cn('flex justify-end text-right bg-[inherit] shadow-[-6px_0px_6px_var(--table-row-actions-shadow)] print:hidden');
@@ -12376,7 +12380,8 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
12376
12380
  actionsLength: actionsLength,
12377
12381
  data: row.original,
12378
12382
  isActiveRow: isActiveRow,
12379
- rowId: row.id
12383
+ rowId: row.id,
12384
+ table: table
12380
12385
  });
12381
12386
  }
12382
12387
  return null;
@@ -12733,7 +12738,10 @@ function GroupedCell(props) {
12733
12738
  index,
12734
12739
  isHighlighted
12735
12740
  } = props;
12736
- const tableMeta = cell.getContext().table.options.meta;
12741
+ const {
12742
+ table
12743
+ } = cell.getContext();
12744
+ const tableMeta = table.options.meta;
12737
12745
  const columnMeta = cell.column.columnDef.meta;
12738
12746
  const attributes = getCellAttributes(cell, index, isHighlighted);
12739
12747
  const {
@@ -12751,7 +12759,8 @@ function GroupedCell(props) {
12751
12759
  colSpan: colSpan,
12752
12760
  rowActions: tableMeta.rowGroups.rowActionsForGroup,
12753
12761
  rowId: cell.row.id,
12754
- subRows: subRows
12762
+ subRows: subRows,
12763
+ table: table
12755
12764
  }), content);
12756
12765
  }
12757
12766
  const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupedCell(props) {
@@ -12763,6 +12772,7 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
12763
12772
  rowActions,
12764
12773
  rowId,
12765
12774
  subRows,
12775
+ table,
12766
12776
  ...attributes
12767
12777
  } = props;
12768
12778
  return /*#__PURE__*/React__default.createElement("td", Object.assign({}, attributes, {
@@ -12777,7 +12787,8 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
12777
12787
  actionsLength: 4,
12778
12788
  data: subRows,
12779
12789
  isActiveRow: true,
12780
- rowId: rowId
12790
+ rowId: rowId,
12791
+ table: table
12781
12792
  })) : null);
12782
12793
  });
12783
12794
 
@@ -12917,7 +12928,7 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
12917
12928
  const expansionRef = React__default.useRef(null);
12918
12929
  const isExpanded = !!attributes['data-row-expanded'];
12919
12930
  useSetVirtualisedRowHeight(measureRow, ref.current, expansionRef.current, isExpanded);
12920
- const className = cn('group/row', {
12931
+ const className = cn('group/row', otherAttributes.className, {
12921
12932
  'hover:cursor-grab': tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== 'function',
12922
12933
  'hover:cursor-pointer': typeof attributes.onClick === 'function'
12923
12934
  });
@@ -13223,11 +13234,11 @@ function HeaderMenu(props) {
13223
13234
  return Promise.reject(e);
13224
13235
  }
13225
13236
  };
13226
- popoverElement = props => (/*#__PURE__*/React__default.createElement(GotoPopover, Object.assign({}, props, {
13237
+ popoverElement = props => /*#__PURE__*/React__default.createElement(GotoPopover, Object.assign({}, props, {
13227
13238
  open: true,
13228
13239
  onChange: handleClosePopover,
13229
13240
  onGoto: goto
13230
- })));
13241
+ }));
13231
13242
  }
13232
13243
  }
13233
13244
  }
@@ -13570,10 +13581,10 @@ const FOCUS_MANAGER_OPTIONS_ARROW_KEYS = {
13570
13581
  };
13571
13582
  function useAugmentedFocusManager() {
13572
13583
  const focusManager = focus.useFocusManager();
13573
- const focusPrevious = (arrowNavigation = false) => focusManager === null || focusManager === void 0 ? void 0 : focusManager.focusPrevious(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
13574
- const focusNext = (arrowNavigation = false) => focusManager === null || focusManager === void 0 ? void 0 : focusManager.focusNext(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
13575
- const focusFirst = () => focusManager === null || focusManager === void 0 ? void 0 : focusManager.focusFirst(FOCUS_MANAGER_OPTIONS_TAB);
13576
- const focusLast = () => focusManager === null || focusManager === void 0 ? void 0 : focusManager.focusLast(FOCUS_MANAGER_OPTIONS_TAB);
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);
13577
13588
  return {
13578
13589
  focusPrevious,
13579
13590
  focusNext,
@@ -13711,7 +13722,7 @@ function Summary(props) {
13711
13722
 
13712
13723
  function Foot(props) {
13713
13724
  const nonGroupedHeaders = props.table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
13714
- 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, {
13715
13726
  key: header.id,
13716
13727
  header: header,
13717
13728
  index: index
@@ -14090,7 +14101,7 @@ function Container(externalProps) {
14090
14101
  if (!(activeList !== null && activeList !== void 0 && activeList.id) || !(overList !== null && overList !== void 0 && overList.id) || activeList.id === overList.id) {
14091
14102
  return;
14092
14103
  }
14093
- move === null || move === void 0 ? void 0 : move(active.id, activeList === null || activeList === void 0 ? void 0 : activeList.id, overList.id);
14104
+ move(active.id, activeList === null || activeList === void 0 ? void 0 : activeList.id, overList.id);
14094
14105
  }
14095
14106
  function handleDragEnd(event) {
14096
14107
  const {
@@ -14401,6 +14412,7 @@ const getOptionsFromCollection = (collection, selector) => collection.querySelec
14401
14412
  const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(props, ref) {
14402
14413
  const {
14403
14414
  querySelector,
14415
+ resetOnChange,
14404
14416
  tabIndex = 0,
14405
14417
  ...otherProps
14406
14418
  } = props;
@@ -14431,14 +14443,31 @@ const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(prop
14431
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
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);
@@ -14584,6 +14613,7 @@ const Root$1 = /*#__PURE__*/React__default.forwardRef(function Listbox2(props, r
14584
14613
  id: id,
14585
14614
  querySelector: customSelector ? `${DEFAULT_SELECTOR}, ${customSelector}` : DEFAULT_SELECTOR,
14586
14615
  ref: ref,
14616
+ resetOnChange: value,
14587
14617
  role: "listbox"
14588
14618
  }), children)));
14589
14619
  });
@@ -14656,7 +14686,6 @@ const Option = /*#__PURE__*/React__default.forwardRef(function Listbox2Option(pr
14656
14686
  return /*#__PURE__*/React__default.createElement("div", Object.assign({}, otherProps, {
14657
14687
  "aria-disabled": listboxDisabled || disabled ? 'true' : undefined,
14658
14688
  "aria-selected": selected ? 'true' : undefined,
14659
- key: `${value}_${String(selected)}`,
14660
14689
  id: id,
14661
14690
  onClick: handleClick,
14662
14691
  onKeyDown: handleKeyDown,
@@ -14918,6 +14947,7 @@ const Colours = props => {
14918
14947
  const {
14919
14948
  color,
14920
14949
  onChangeColor,
14950
+ onClick,
14921
14951
  onKeyDown
14922
14952
  } = props;
14923
14953
  const {
@@ -14926,6 +14956,7 @@ const Colours = props => {
14926
14956
  return /*#__PURE__*/React__default.createElement(RadioGroupPrimitive.Root, {
14927
14957
  "aria-label": texts.select2.chooseColor,
14928
14958
  className: "grid grid-cols-4 gap-2 focus:outline-none",
14959
+ onClick: onClick,
14929
14960
  onKeyDown: onKeyDown,
14930
14961
  onValueChange: color => onChangeColor(color),
14931
14962
  value: color
@@ -15513,20 +15544,19 @@ const useChildren = ({
15513
15544
  };
15514
15545
 
15515
15546
  const getNextColor = options => {
15516
- const occurrences = AVAILABLE_COLORS.reduce((prev, color) => {
15517
- if (color !== 'transparent') {
15518
- return {
15519
- ...prev,
15520
- [color]: 0
15521
- };
15522
- }
15523
- return prev;
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];
@@ -16390,7 +16420,6 @@ function Control(props) {
16390
16420
  } = props;
16391
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;
16392
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;
16393
- const ref = React__default.useRef(null);
16394
16423
  React.useEffect(() => {
16395
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
16396
16425
  if (controlRenderer === 'switch' && value === undefined) {
@@ -16401,8 +16430,7 @@ function Control(props) {
16401
16430
  return /*#__PURE__*/React__default.cloneElement(controlRenderer({
16402
16431
  ...attributes,
16403
16432
  setValue: value => onChange(value),
16404
- value,
16405
- ref
16433
+ value
16406
16434
  }), {
16407
16435
  ['data-query-selector']: querySelector,
16408
16436
  className: 'focus:yt-focus'
@@ -16770,6 +16798,7 @@ function TableGrid(props) {
16770
16798
  var _table$state$grouping;
16771
16799
  const {
16772
16800
  enableHorizontalArrowKeyNavigation,
16801
+ rowsForFooter,
16773
16802
  table,
16774
16803
  ...attributes
16775
16804
  } = props;
@@ -16777,8 +16806,6 @@ function TableGrid(props) {
16777
16806
  table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);
16778
16807
  } : undefined;
16779
16808
  const filterReason = getFilterReason(table);
16780
- const searchNotApplied = !table.state.globalFilter || table.state.globalFilter === '';
16781
- const filtersNotApplied = !table.state.columnFilters || table.state.columnFilters.length === 0;
16782
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, {
16783
16810
  id: table.id,
16784
16811
  "data-table-font-size": table.meta.fontSize.size,
@@ -16811,9 +16838,9 @@ function TableGrid(props) {
16811
16838
  ...table.renderer.style,
16812
16839
  height: table.renderer.style.height + ROW_HEIGHT_ESTIMATES[table.meta.rowHeight.height]
16813
16840
  } : table.renderer.style
16814
- }, table.renderer.rows, searchNotApplied && filtersNotApplied && props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
16841
+ }, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
16815
16842
  table: table.instance
16816
- }) : null)))));
16843
+ }, rowsForFooter) : null)))));
16817
16844
  }
16818
16845
 
16819
16846
  function Column$1(_) {
@@ -18316,33 +18343,16 @@ const useTableRowCreation = (data, tableRef) => {
18316
18343
 
18317
18344
  function useTableEditingListener(table, tableRef) {
18318
18345
  const tableMeta = table.options.meta;
18319
- const completedRowsCount = tableMeta.editing.getCompletedRowsCount();
18320
18346
  const localization = useLocalization();
18321
- const saveChanges = () => {
18322
- requestAnimationFrame(() => {
18323
- tableMeta.editing.saveChanges();
18324
- });
18325
- };
18326
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);
18327
18350
  useLazyEffect(() => {
18328
- if (tableMeta.editing.isEditing) {
18329
- saveChanges();
18330
- }
18331
- }, [tableMeta.rowActive.rowActiveIndex]);
18332
- useLazyEffect(() => {
18333
- if (tableMeta.editing.isEditing) {
18334
- if (tableMeta.rowActive.rowActiveIndex === undefined) {
18335
- tableMeta.rowActive.setRowActiveIndex(0);
18336
- }
18337
- } else {
18338
- // save
18339
- saveChanges();
18340
- // reset detailed mode
18341
- tableMeta.editing.toggleDetailedMode(false);
18342
- // reset the last index back to the first focusable element, when editing gets turned off
18343
- 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);
18344
18354
  }
18345
- }, [tableMeta.editing.isEditing]);
18355
+ }, [tableMeta.rowActive.rowActiveIndex, tableMeta.editing.saveChanges]);
18346
18356
  // show a warning if the user navigates away without triggering save, such as using the browser back/forward button
18347
18357
  const hasChanges = tableMeta.editing.hasChanges();
18348
18358
  React__default.useEffect(() => {
@@ -18358,25 +18368,46 @@ function useTableEditingListener(table, tableRef) {
18358
18368
  window.removeEventListener('beforeunload', showUnsavedChangesWarning);
18359
18369
  };
18360
18370
  }, [tableMeta.editing.isEditing, hasChanges]);
18361
- React__default.useEffect(() => {
18362
- if (completedRowsCount > 0) {
18371
+ const hasSavedChanges = tableMeta.editing.hasSaved();
18372
+ useLazyEffect(() => {
18373
+ if (hasSavedChanges) {
18363
18374
  resetHighlightedColumnIndexes(table.getState().globalFilter, table, localization);
18364
18375
  }
18365
- }, [completedRowsCount]);
18376
+ }, [hasSavedChanges]);
18366
18377
  React__default.useEffect(() => {
18367
18378
  const onClickOutside = event => {
18368
18379
  if (tableMeta.editing.isEditing) {
18369
- var _event$target$getAttr, _event$target;
18370
- const element = (_event$target$getAttr = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.getAttribute('data-taco')) !== null && _event$target$getAttr !== void 0 ? _event$target$getAttr : '';
18371
- const insideTable = isElementInsideOrTriggeredFromContainer(event.target, tableRef.current) || element === 'backdrop';
18372
- if (!insideTable) {
18373
- 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);
18374
18385
  }
18375
18386
  }
18376
18387
  };
18377
18388
  document.addEventListener('click', onClickOutside);
18378
18389
  return () => document.removeEventListener('click', onClickOutside);
18379
- }, [saveChanges, tableMeta.editing.isEditing]);
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
+ });
18380
18411
  }
18381
18412
 
18382
18413
  function willRowMove(cell, change, rowIndex, localization) {
@@ -18437,7 +18468,7 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
18437
18468
  if (rowIndex < rows.length - 1) {
18438
18469
  miniSortRows.push(rows[rowIndex + 1]);
18439
18470
  }
18440
- const sortRows = (rowA, rowB) => {
18471
+ const resortedRows = [...miniSortRows].sort((rowA, rowB) => {
18441
18472
  const sortFn = cell.column.getSortingFn();
18442
18473
  const sortUndefined = cell.column.columnDef.sortUndefined;
18443
18474
  if (!table.options.manualSorting && sortUndefined) {
@@ -18452,451 +18483,545 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
18452
18483
  }
18453
18484
  }
18454
18485
  return sortFn(rowA, rowB, cell.column.id);
18455
- };
18456
- const resortedRows = [...miniSortRows].sort(sortRows);
18486
+ });
18457
18487
  if (cell.column.getIsSorted() === 'desc') {
18458
18488
  resortedRows.reverse();
18459
18489
  }
18460
18490
  return ((_resortedRows$index = resortedRows[index]) === null || _resortedRows$index === void 0 ? void 0 : _resortedRows$index.id) !== cell.row.id;
18461
18491
  }
18462
- function animateCreateRow(id) {
18463
- const templateRow = document.querySelector(`[data-row-id="${id}"]`);
18464
- if (templateRow) {
18465
- const firstCell = templateRow.querySelector(':first-child');
18466
- const checkbox = firstCell === null || firstCell === void 0 ? void 0 : firstCell.querySelector('[data-taco="checkbox"]');
18467
- firstCell === null || firstCell === void 0 ? void 0 : firstCell.focus();
18468
- if (checkbox) {
18469
- setDataFocusAttribute(checkbox);
18470
- }
18471
- templateRow.scrollIntoView();
18472
- const keyframes = [{
18473
- background: '#b2c7ef'
18474
- }, {
18475
- background: '#ebebeb'
18476
- }];
18477
- for (const child of templateRow.children) {
18478
- child.animate(keyframes, {
18479
- duration: 1000,
18480
- easing: 'ease-out'
18481
- });
18482
- }
18483
- }
18484
- }
18485
18492
 
18486
- function useTableEditing(isEnabled = false, handleSave, handleChange, validator) {
18487
- // used to switch the table into editing mode
18488
- const [isEditing, toggleEditing] = React__default.useState(false);
18489
- // used to switch the editing between "detailed" mode
18490
- const [isDetailedMode, toggleDetailedMode] = React__default.useState(false);
18491
- // store the last focused cell, so that up/down arrow key navigation remains in the same column
18492
- const [lastFocusedCellIndex, setLastFocusedCellIndex] = useLastFocusedCellIndex();
18493
- // store pending changes for each row
18494
- // changes are saved as soon as the active row changes, so in most cases this will only contain the active row's changes
18495
- // but not always - if validation or server requests fail when saving, those rows remain until the failure is resolved
18496
- const pendingChangesFns = usePendingChanges(isEnabled, handleSave, handleChange, validator);
18497
- useGlobalKeyDown(isEnabled && isEditing ? {
18498
- key: 's',
18499
- meta: true,
18500
- shift: false
18501
- } : undefined, event => {
18502
- event.preventDefault();
18503
- pendingChangesFns.saveChanges();
18504
- });
18505
- return {
18506
- isEnabled,
18507
- isEditing,
18508
- isDetailedMode,
18509
- toggleDetailedMode: isEnabled ? toggleDetailedMode : () => undefined,
18510
- toggleEditing: isEnabled ? toggleEditing : () => undefined,
18511
- lastFocusedCellIndex,
18512
- setLastFocusedCellIndex,
18513
- ...pendingChangesFns
18514
- };
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
+ }
18515
18628
  }
18516
- function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
18517
- const saveChanges = function (rowId = undefined) {
18629
+ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator) {
18630
+ const saveChanges = function (table, rowId = undefined) {
18518
18631
  try {
18519
18632
  let _exit = false;
18520
18633
  if (!handleSave) {
18521
18634
  console.warn('Tried to save, but Table has no onEditingSave handler');
18522
- return Promise.resolve();
18635
+ return Promise.resolve(false);
18523
18636
  }
18524
- // we save back to pendingChanges, so make a copy of it's state when save was triggered
18525
- const changesToSave = rowId ? {
18526
- [rowId]: pendingChanges[rowId]
18527
- } : {
18528
- ...pendingChanges
18529
- };
18530
- const changes = Object.keys(changesToSave);
18531
- return Promise.resolve(function () {
18532
- if (changes.length) {
18533
- return _forOf(changes, function (rowId) {
18534
- const pendingChange = changesToSave[rowId];
18535
- const changeSet = getChangesetFromChanges(pendingChange);
18536
- return _catch(function () {
18537
- function _temp3(_result) {
18538
- return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
18539
- // cleanup changes, we don't need them after saving
18540
- resetChanges(rowId);
18541
- setRowSaveStatus(rowId, 'complete');
18542
- });
18543
- }
18544
- if (getRowSaveStatus(rowId) === 'pending') {
18545
- _exit = true;
18546
- return;
18547
- }
18548
- // set saving = true
18549
- setRowSaveStatus(rowId, 'pending');
18550
- // re-run validation, maybe a cell is already invalid but has never been blurred
18551
- const _temp2 = function () {
18552
- if (validator) {
18553
- return Promise.resolve(validator(changeSet)).then(function (errors) {
18554
- if (errors && Object.keys(errors).length) {
18555
- throw errors;
18556
- }
18557
- });
18558
- }
18559
- }();
18560
- return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2); // send new data to the server
18561
- }, function (error) {
18562
- // the onEditingSave handler should throw errors when something fails, e.g. validation, network errors etc
18563
- // this code handles those errors and maps them either to row errors or cell specific errors
18564
- let rowError;
18565
- let cellErrors;
18566
- if (typeof error === 'string') {
18567
- rowError = error;
18568
- } else if (error instanceof Error) {
18569
- var _error$response;
18570
- rowError = error.message;
18571
- // most of our apis return error objects within this shape
18572
- if (typeof ((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data) === 'object') {
18573
- var _error$response2;
18574
- 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;
18575
18676
  }
18576
- } else if (typeof error === 'object') {
18577
- cellErrors = error;
18578
- }
18579
- if (rowError || cellErrors) {
18580
- setPendingChanges(currentChanges => {
18581
- const nextChanges = {
18582
- ...currentChanges
18583
- };
18584
- nextChanges[rowId]._meta.errors = {
18585
- row: rowError,
18586
- cells: cellErrors,
18587
- shouldShowErrorAlert: true
18588
- };
18589
- return nextChanges;
18590
- });
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
18591
18711
  }
18592
- setRowSaveStatus(rowId, undefined);
18593
18712
  });
18594
- }, function () {
18595
- return _exit;
18596
- });
18597
- }
18598
- }());
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);
18599
18723
  } catch (e) {
18600
18724
  return Promise.reject(e);
18601
18725
  }
18602
18726
  };
18603
- const validateCell = function (cell) {
18727
+ const onCellChanged = function (cell, rowIndex) {
18604
18728
  try {
18605
- if (!validator || !isEnabled) {
18606
- return Promise.resolve();
18607
- }
18608
- const changeSet = getChangesetFromChanges(pendingChanges[cell.row.id]);
18609
- // only validate if the cell being blurred actually has any changes
18610
- const _temp = function () {
18611
- if (cell.column.id in changeSet) {
18612
- return Promise.resolve(validator(changeSet)).then(function (errors) {
18613
- setPendingChanges(currentChanges => {
18614
- const nextChanges = {
18615
- ...currentChanges
18616
- };
18617
- nextChanges[cell.row.id]._meta = {
18618
- ...nextChanges[cell.row.id]._meta,
18619
- errors: {
18620
- ...nextChanges[cell.row.id]._meta.errors,
18621
- cells: errors,
18622
- shouldShowErrorAlert: !Object.keys(errors).length ? false : nextChanges[cell.row.id]._meta.errors.shouldShowErrorAlert
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];
18623
18753
  }
18624
- };
18625
- return nextChanges;
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 : {};
18626
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 : {};
18627
18811
  });
18628
18812
  }
18629
18813
  }();
18630
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
18814
+ return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
18631
18815
  } catch (e) {
18632
18816
  return Promise.reject(e);
18633
18817
  }
18634
- };
18635
- const setCellValue = function (cell, change, rowIndex) {
18818
+ }; // general
18819
+ const createRow = function (data) {
18636
18820
  try {
18637
- const changes = {
18638
- [cell.column.id]: change
18821
+ const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${uuid.v4()}`;
18822
+ const value = {
18823
+ ...data,
18824
+ [rowIdentityAccessor]: newRowId
18639
18825
  };
18640
- setPendingChanges(currentChanges => {
18641
- const nextChanges = createPendingChangesSetter(currentChanges, cell.row, rowIndex, changes, localization);
18642
- pendingChangesUpdater.syncCellChanges(nextChanges);
18643
- return nextChanges;
18826
+ dispatch({
18827
+ type: 'createRow',
18828
+ rowId: newRowId,
18829
+ payload: {
18830
+ value
18831
+ }
18644
18832
  });
18645
- pendingChangesUpdater.runCellUpdates(changes, cell, rowIndex);
18646
- return Promise.resolve();
18833
+ return Promise.resolve(newRowId);
18647
18834
  } catch (e) {
18648
18835
  return Promise.reject(e);
18649
18836
  }
18650
- };
18651
- const addCreatedRowChangeset = function (row) {
18837
+ }; // cells
18838
+ // rows
18839
+ const setRowValue = function (rowId, original, value) {
18652
18840
  try {
18653
- const cells = row.getAllCells();
18654
- setPendingChanges(currentChanges => {
18655
- return cells.reduce((changes, cell) => {
18656
- if (cell.getValue()) {
18657
- var _currentChanges$cell$, _currentChanges$cell$2, _currentChanges$cell$3;
18658
- return {
18659
- ...changes,
18660
- [cell.row.id]: {
18661
- ...changes[cell.row.id],
18662
- [cell.column.id]: cell.getValue(),
18663
- _meta: {
18664
- ...((_currentChanges$cell$ = currentChanges[cell.row.id]) === null || _currentChanges$cell$ === void 0 ? void 0 : _currentChanges$cell$._meta),
18665
- original: cell.row.original,
18666
- moveReason: {
18667
- ...((_currentChanges$cell$2 = currentChanges[cell.row.id]) === null || _currentChanges$cell$2 === void 0 ? void 0 : _currentChanges$cell$2._meta.moveReason)
18668
- },
18669
- errors: {
18670
- ...((_currentChanges$cell$3 = currentChanges[cell.row.id]) === null || _currentChanges$cell$3 === void 0 ? void 0 : _currentChanges$cell$3._meta.errors)
18671
- }
18672
- }
18673
- }
18674
- };
18675
- } else {
18676
- return changes;
18841
+ function _temp2() {
18842
+ dispatch({
18843
+ type: 'updateRow',
18844
+ rowId,
18845
+ payload: {
18846
+ cellErrors,
18847
+ original,
18848
+ value
18677
18849
  }
18678
- }, currentChanges);
18679
- });
18680
- return Promise.resolve();
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));
18681
18865
  } catch (e) {
18682
18866
  return Promise.reject(e);
18683
18867
  }
18684
18868
  };
18685
18869
  const localization = useLocalization();
18686
- const [pendingChanges, setPendingChanges] = React__default.useState({});
18687
- // we maintain save status as separate state because 'complete' needs to briefly show after pendingChanges are deleted
18688
- const [saveStates, setSaveState] = React__default.useState({});
18689
- function getCellValue(cell) {
18690
- var _pendingChanges$cell$;
18691
- return (_pendingChanges$cell$ = pendingChanges[cell.row.id]) === null || _pendingChanges$cell$ === void 0 ? void 0 : _pendingChanges$cell$[cell.column.id];
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;
18692
18883
  }
18693
- function getCellError(cell) {
18694
- var _pendingChanges$cell$2, _pendingChanges$cell$3, _pendingChanges$cell$4;
18695
- return (_pendingChanges$cell$2 = pendingChanges[cell.row.id]) === null || _pendingChanges$cell$2 === void 0 ? void 0 : (_pendingChanges$cell$3 = _pendingChanges$cell$2._meta.errors) === null || _pendingChanges$cell$3 === void 0 ? void 0 : (_pendingChanges$cell$4 = _pendingChanges$cell$3.cells) === null || _pendingChanges$cell$4 === void 0 ? void 0 : _pendingChanges$cell$4[cell.column.id];
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;
18696
18887
  }
18697
- const pendingChangesUpdater = usePendingChangesUpdater(handleChange, setPendingChanges);
18698
18888
  function hasRowErrors(rowId) {
18699
- var _pendingChanges$rowId, _pendingChanges$rowId2, _pendingChanges$rowId3, _pendingChanges$rowId4, _pendingChanges$rowId5;
18700
- if (!isEnabled) {
18701
- return false;
18702
- }
18703
- 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;
18704
- }
18705
- function hasRowErrorsSeen(rowId) {
18706
- var _pendingChanges$rowId6;
18707
- if (!isEnabled) {
18708
- return false;
18709
- }
18710
- 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;
18711
18891
  }
18712
- function getRowPendingChange(rowId) {
18713
- const rowPendingChanges = pendingChanges[rowId];
18714
- if (rowPendingChanges) {
18715
- const {
18716
- _meta,
18717
- ...pendingChange
18718
- } = rowPendingChanges;
18719
- return pendingChange;
18720
- }
18721
- 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);
18722
18895
  }
18723
- function getRowSaveStatus(rowId) {
18724
- if (!isEnabled) {
18725
- return false;
18726
- }
18727
- return saveStates[rowId];
18896
+ function getRowStatus(rowId) {
18897
+ return state.changes.status[rowId];
18728
18898
  }
18729
- function setRowSaveStatus(rowId, status) {
18730
- setSaveState(currentStates => {
18731
- const nextStates = {
18732
- ...currentStates
18733
- };
18734
- if (status) {
18735
- nextStates[rowId] = status;
18736
- } else {
18737
- delete nextStates[rowId];
18899
+ function setRowStatus(rowId, status) {
18900
+ dispatch({
18901
+ type: 'setRowStatus',
18902
+ rowId,
18903
+ payload: {
18904
+ status
18738
18905
  }
18739
- return nextStates;
18740
18906
  });
18741
18907
  }
18742
- function getRowMoveReason(rowId) {
18743
- var _pendingChanges$rowId7;
18744
- return (_pendingChanges$rowId7 = pendingChanges[rowId]) !== null && _pendingChanges$rowId7 !== void 0 && _pendingChanges$rowId7._meta.moveReason ? Object.values(pendingChanges[rowId]._meta.moveReason)[0] : undefined;
18745
- }
18746
- function hasChanges(rowId) {
18747
- if (!isEnabled) {
18748
- return false;
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
+ });
18749
18922
  }
18750
- return rowId ? !!pendingChanges[rowId] : !!Object.keys(pendingChanges).length;
18751
- }
18752
- function hasAlertErrors() {
18753
- if (!isEnabled) {
18754
- return false;
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
+ });
18755
18933
  }
18756
- return !!getAlertErrors().length;
18757
18934
  }
18758
- function getAlertErrors() {
18759
- return Object.keys(pendingChanges).filter(hasRowErrorsSeen).map(rowId => ({
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 => ({
18760
18949
  rowId,
18761
- pendingChange: pendingChanges[rowId]
18950
+ changes: state.changes.rows[rowId],
18951
+ errors: state.changes.errors[rowId]
18762
18952
  }));
18763
18953
  }
18764
- function resetChanges(rowId) {
18765
- setPendingChanges(currentChanges => {
18766
- const nextChanges = {
18767
- ...currentChanges
18768
- };
18769
- delete nextChanges[rowId];
18770
- return nextChanges;
18771
- });
18954
+ function hasSaved() {
18955
+ return !!Object.values(state.changes.status).filter(value => value === 'saved').length;
18956
+ }
18957
+ function hasChanges(rowId) {
18958
+ return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;
18772
18959
  }
18773
- function getCompletedRowsCount() {
18774
- return Object.values(saveStates).filter(value => value === 'complete').length;
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
+ });
18775
18970
  }
18776
18971
  return {
18972
+ // row
18973
+ setRowValue,
18974
+ getRowValue,
18975
+ getRowMoveReason,
18976
+ hasRowErrors,
18977
+ hasRowErrorsShownInAlert,
18978
+ getRowStatus,
18979
+ setRowStatus,
18980
+ // cells
18981
+ setCellValue,
18777
18982
  getCellValue,
18778
18983
  getCellError,
18779
- setCellValue,
18780
- validateCell,
18781
- addCreatedRowChangeset,
18984
+ onCellChanged,
18985
+ // general
18986
+ getErrorsShownInAlert,
18782
18987
  hasChanges,
18783
- hasAlertErrors,
18784
- getAlertErrors,
18785
18988
  saveChanges,
18786
- resetChanges,
18787
- hasRowErrors,
18788
- hasRowErrorsSeen,
18789
- getRowPendingChange,
18790
- getRowSaveStatus,
18791
- setRowSaveStatus,
18792
- getRowMoveReason,
18793
- getCompletedRowsCount
18989
+ discardChanges,
18990
+ hasSaved,
18991
+ // new rows
18992
+ createRow,
18993
+ temporaryRows: state.temporaryRows
18794
18994
  };
18795
18995
  }
18796
- function useLastFocusedCellIndex() {
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);
18797
19002
  // store the last focused cell, so that up/down arrow key navigation remains in the same column
18798
- const lastFocusedCellIndexRef = React__default.useRef(undefined);
18799
- const setLastFocusedCellIndex = React__default.useCallback(index => {
18800
- lastFocusedCellIndexRef.current = index;
18801
- }, []);
18802
- return [lastFocusedCellIndexRef.current, setLastFocusedCellIndex];
18803
- }
18804
- function usePendingChangesUpdater(handleChange, setPendingChanges) {
18805
- const localization = useLocalization();
18806
- const updatersRef = React__default.useRef({});
18807
- const runCellUpdates = React__default.useCallback(lodash.debounce(function (changes, cell, rowIndex) {
18808
- try {
18809
- const _temp4 = function () {
18810
- if (typeof handleChange === 'function') {
18811
- const previousValues = {
18812
- ...cell.row.original,
18813
- ...getChangesetFromChanges(updatersRef.current[cell.row.id])
18814
- };
18815
- const nextValues = {
18816
- ...previousValues,
18817
- ...changes
18818
- };
18819
- return Promise.resolve(handleChange(cell.column.id, changes[cell.column.id], nextValues, previousValues)).then(function (updates) {
18820
- if (updates && Object.keys(updates).length) {
18821
- setPendingChanges(currentChanges => createPendingChangesSetter(currentChanges, cell.row, rowIndex, updates, localization));
18822
- }
18823
- });
18824
- }
18825
- }();
18826
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
18827
- } catch (e) {
18828
- return Promise.reject(e);
18829
- }
18830
- }, 250), []);
18831
- function syncCellChanges(changes) {
18832
- updatersRef.current = changes;
18833
- }
18834
- return {
18835
- syncCellChanges,
18836
- runCellUpdates
18837
- };
18838
- }
18839
- function createPendingChangesSetter(currentChanges, row, rowIndex, changes, localization) {
18840
- var _currentChanges$row$i, _currentChanges$row$i2, _currentChanges$row$i3;
18841
- // prepare
18842
- const nextChanges = {
18843
- ...currentChanges
18844
- };
18845
- const rowChanges = {
18846
- ...currentChanges[row.id],
18847
- _meta: {
18848
- ...((_currentChanges$row$i = currentChanges[row.id]) === null || _currentChanges$row$i === void 0 ? void 0 : _currentChanges$row$i._meta),
18849
- original: row.original,
18850
- moveReason: {
18851
- ...((_currentChanges$row$i2 = currentChanges[row.id]) === null || _currentChanges$row$i2 === void 0 ? void 0 : _currentChanges$row$i2._meta.moveReason)
18852
- },
18853
- errors: {
18854
- ...((_currentChanges$row$i3 = currentChanges[row.id]) === null || _currentChanges$row$i3 === void 0 ? void 0 : _currentChanges$row$i3._meta.errors)
18855
- }
18856
- }
18857
- };
18858
- // run changes
18859
- const cells = row._getAllCellsByColumnId();
18860
- for (const [accessor, change] of Object.entries(changes)) {
18861
- // update if the change is different to the original (saved) value,
18862
- // otherwise remove any change - no point saving the same value
18863
- if (change !== row.original[accessor]) {
18864
- rowChanges[accessor] = change;
18865
- // consumers sometimes include properties in onEditingChange that aren't rendered as columns, we need to guard against that.
18866
- // eslint-disable-next-line no-prototype-builtins
18867
- if (cells.hasOwnProperty(accessor)) {
18868
- // determine if the row will move position based on this change, and save why it will move
18869
- const reason = willRowMove(cells[accessor], change, rowIndex, localization);
18870
- if (reason) {
18871
- rowChanges._meta.moveReason[accessor] = reason;
18872
- } else {
18873
- delete rowChanges._meta.moveReason[accessor];
18874
- }
18875
- }
18876
- } else {
18877
- delete rowChanges[accessor];
18878
- 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);
18879
19013
  }
19014
+ setEditing(enabled);
18880
19015
  }
18881
- // set changes
18882
- // or delete if there are no changes left, so that we don't store changes with unchanged data
18883
- if (Object.keys(rowChanges).filter(k => k !== '_meta').length) {
18884
- nextChanges[row.id] = rowChanges;
18885
- } else {
18886
- delete nextChanges[row.id];
18887
- }
18888
- return nextChanges;
18889
- }
18890
- function getChangesetFromChanges(changes) {
18891
- // extract the original data from the row changes
18892
- const {
18893
- _meta,
18894
- ...changeset
18895
- } = changes !== null && changes !== void 0 ? changes : {};
18896
- // and mix them in with the changes, ready to send to the server
18897
19016
  return {
18898
- ...(_meta === null || _meta === void 0 ? void 0 : _meta.original),
18899
- ...changeset
19017
+ isEnabled,
19018
+ isEditing,
19019
+ isDetailedMode,
19020
+ toggleDetailedMode: isEnabled ? toggleDetailedMode : () => undefined,
19021
+ toggleEditing: isEnabled ? toggleEditing : () => undefined,
19022
+ lastFocusedCellIndex,
19023
+ setLastFocusedCellIndex,
19024
+ ...pendingChangesFns
18900
19025
  };
18901
19026
  }
18902
19027
 
@@ -19138,13 +19263,28 @@ function EditingControlCell(props) {
19138
19263
  const {
19139
19264
  rowIndex
19140
19265
  } = React__default.useContext(RowContext);
19141
- const tableMeta = cell.getContext().table.options.meta;
19266
+ const {
19267
+ table
19268
+ } = cell.getContext();
19269
+ const tableMeta = table.options.meta;
19142
19270
  const columnMeta = cell.column.columnDef.meta;
19143
19271
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
19272
+ const type = (_columnMeta$control = columnMeta.control) !== null && _columnMeta$control !== void 0 ? _columnMeta$control : 'input';
19144
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
+ };
19145
19285
  const handleBlur = () => {
19146
19286
  tableMeta.editing.toggleDetailedMode(false);
19147
- tableMeta.editing.validateCell(cell);
19287
+ tableMeta.editing.onCellChanged(cell, rowIndex);
19148
19288
  };
19149
19289
  // ensure that blur runs when the cell gets unmounted (when vertically arrow key navigating)
19150
19290
  React__default.useEffect(() => {
@@ -19156,6 +19296,9 @@ function EditingControlCell(props) {
19156
19296
  };
19157
19297
  }, []);
19158
19298
  const error = tableMeta.editing.getCellError(cell);
19299
+ function toggleEditing(enabled) {
19300
+ tableMeta.editing.toggleEditing(enabled, table);
19301
+ }
19159
19302
  const controlProps = {
19160
19303
  dataType: columnMeta.dataType,
19161
19304
  fontSize: tableMeta.fontSize.size,
@@ -19164,13 +19307,13 @@ function EditingControlCell(props) {
19164
19307
  isDetailedMode: tableMeta.editing.isDetailedMode,
19165
19308
  isTruncated: !!columnMeta.enableTruncate,
19166
19309
  onBlur: handleBlur,
19167
- onChange: value => tableMeta.editing.setCellValue(cell, value, rowIndex),
19310
+ onChange: handleChange,
19168
19311
  row: cell.row.original,
19169
- rowPendingChanges: tableMeta.editing.getRowPendingChange(cell.row.id),
19312
+ rowPendingChanges: tableMeta.editing.getRowValue(cell.row.id),
19170
19313
  tabIndex: isActiveRow ? 0 : -1,
19171
- toggleEditing: tableMeta.editing.toggleEditing,
19314
+ toggleEditing,
19172
19315
  toggleDetailedMode: tableMeta.editing.toggleDetailedMode,
19173
- type: (_columnMeta$control = columnMeta.control) !== null && _columnMeta$control !== void 0 ? _columnMeta$control : 'input',
19316
+ type,
19174
19317
  value: cell.getValue()
19175
19318
  };
19176
19319
  const cellAttributes = {
@@ -19373,12 +19516,37 @@ function Cell$5(props) {
19373
19516
  return /*#__PURE__*/React__default.createElement(DisplayCell, Object.assign({}, props));
19374
19517
  }
19375
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
+
19376
19545
  function EditingActionMenu(props) {
19377
19546
  const {
19378
19547
  hasChanges,
19379
19548
  hasErrors,
19380
- onClear: handleClear,
19381
- onExit: handleExit,
19549
+ onDiscard: handleDiscard,
19382
19550
  onEditingSave: handleSave,
19383
19551
  isLastRow
19384
19552
  } = props;
@@ -19412,42 +19580,13 @@ function EditingActionMenu(props) {
19412
19580
  }, texts.table3.editing.actions.save), /*#__PURE__*/React__default.createElement(Menu$1.Item, {
19413
19581
  icon: "close",
19414
19582
  disabled: !hasChanges,
19415
- dialog: props => /*#__PURE__*/React__default.createElement(ConfirmClearChangesDialog, Object.assign({}, props, {
19416
- onClear: handleClear
19583
+ dialog: props => /*#__PURE__*/React__default.createElement(DiscardChangesConfirmationDialog, Object.assign({}, props, {
19584
+ onDiscard: handleDiscard
19417
19585
  }))
19418
- }, texts.table3.editing.actions.clear), /*#__PURE__*/React__default.createElement(Menu$1.Item, {
19419
- icon: "undo",
19420
- onClick: handleExit
19421
- }, texts.table3.editing.actions.exit))))
19586
+ }, texts.table3.editing.actions.clear))))
19422
19587
  });
19423
19588
  }
19424
- function ConfirmClearChangesDialog(props) {
19425
- const {
19426
- onClear: handleClear,
19427
- ...dialogProps
19428
- } = props;
19429
- const {
19430
- texts
19431
- } = useLocalization();
19432
- const handleClickInsideDialogContent = event => {
19433
- // Prevents the click event from propagating to the table, ensuring the row isn't saved when a click occurs
19434
- // inside the dialog
19435
- event.stopPropagation();
19436
- };
19437
- return /*#__PURE__*/React__default.createElement(Dialog, Object.assign({}, dialogProps), /*#__PURE__*/React__default.createElement(Dialog.Content, {
19438
- "aria-label": texts.table3.editing.clearChangesConfirmationDialog.title,
19439
- onClick: handleClickInsideDialogContent
19440
- }, /*#__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, {
19441
- tabIndex: 0
19442
- }, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
19443
- autoFocus: true,
19444
- tabIndex: 0,
19445
- appearance: "primary",
19446
- onClick: handleClear
19447
- }, texts.table3.editing.clearChangesConfirmationDialog.confirm))))));
19448
- }
19449
19589
 
19450
- const COMPLETE_INDICATOR_DELAY = 3000;
19451
19590
  function SaveStatus(props) {
19452
19591
  const {
19453
19592
  rowId,
@@ -19457,18 +19596,7 @@ function SaveStatus(props) {
19457
19596
  texts
19458
19597
  } = useLocalization();
19459
19598
  const tableMeta = table.options.meta;
19460
- const status = tableMeta.editing.getRowSaveStatus(rowId);
19461
- React__default.useEffect(() => {
19462
- let timeout;
19463
- if (status === 'complete') {
19464
- timeout = window.setTimeout(() => {
19465
- tableMeta.editing.setRowSaveStatus(rowId, undefined);
19466
- }, COMPLETE_INDICATOR_DELAY);
19467
- }
19468
- return () => {
19469
- clearTimeout(timeout);
19470
- };
19471
- }, [status]);
19599
+ const status = tableMeta.editing.getRowStatus(rowId);
19472
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)]', {
19473
19601
  'mt-0.5': tableMeta.rowHeight.height === 'short',
19474
19602
  'mt-1': tableMeta.rowHeight.height === 'medium',
@@ -19479,7 +19607,7 @@ function SaveStatus(props) {
19479
19607
  className: "!contents"
19480
19608
  }, /*#__PURE__*/React__default.createElement("span", {
19481
19609
  className: className
19482
- }, status === 'pending' ? (/*#__PURE__*/React__default.createElement(Tooltip, {
19610
+ }, status === 'saving' ? (/*#__PURE__*/React__default.createElement(Tooltip, {
19483
19611
  title: texts.table3.editing.saving.progress
19484
19612
  }, /*#__PURE__*/React__default.createElement(Spinner, {
19485
19613
  delay: 0,
@@ -19505,10 +19633,7 @@ function Row$2(props) {
19505
19633
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;
19506
19634
  React__default.useEffect(() => {
19507
19635
  if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {
19508
- const element = focusManager.focusFirst();
19509
- if (element) {
19510
- setDataFocusAttribute(element);
19511
- }
19636
+ setDataFocusAttribute(focusManager.focusFirst());
19512
19637
  }
19513
19638
  }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);
19514
19639
  const handleFocus = React__default.useCallback(event => {
@@ -19520,12 +19645,13 @@ function Row$2(props) {
19520
19645
  }
19521
19646
  }
19522
19647
  }, [tableMeta.editing.isEditing, isActiveRow]);
19648
+ const rowStatus = tableMeta.editing.getRowStatus(row.id);
19523
19649
  const attributes = {
19524
- 'data-row-editing-invalid': tableMeta.editing.isEnabled && tableMeta.editing.hasRowErrors(row.id) ? !tableMeta.editing.hasRowErrorsSeen(row.id) ? 'unseen' : true : undefined,
19525
- 'data-row-editing-status': tableMeta.editing.isEnabled && tableMeta.editing.getRowSaveStatus(row.id) ? tableMeta.editing.getRowSaveStatus(row.id) : undefined,
19650
+ 'data-row-editing-invalid': tableMeta.editing.hasRowErrors(row.id) ? !tableMeta.editing.hasRowErrorsShownInAlert(row.id) ? 'unseen' : true : undefined,
19651
+ 'data-row-editing-status': rowStatus,
19526
19652
  onFocus: handleFocus
19527
19653
  };
19528
- return /*#__PURE__*/React__default.createElement(DisplayRow, Object.assign({}, props, attributes), tableMeta.editing.getRowSaveStatus(row.id) ? /*#__PURE__*/React__default.createElement(SaveStatus, {
19654
+ return /*#__PURE__*/React__default.createElement(DisplayRow, Object.assign({}, props, attributes), rowStatus === 'saving' || rowStatus === 'saved' ? /*#__PURE__*/React__default.createElement(SaveStatus, {
19529
19655
  rowId: row.id,
19530
19656
  table: table
19531
19657
  }) : null);
@@ -19536,17 +19662,31 @@ const RENDERERS$1 = {
19536
19662
  cell: Cell$5
19537
19663
  };
19538
19664
  function useTable3(props, ref) {
19539
- 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);
19540
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]);
19541
19675
  const extendedProps = {
19542
19676
  ...props,
19677
+ data,
19543
19678
  enableRowActions: editing.isEditing ? true : props.enableRowActions,
19544
- rowActions: editing.isEditing ? [(_, rowId) => (/*#__PURE__*/React__default.createElement(EditingActionMenu, {
19679
+ rowActions: editing.isEditing ? [(_, rowId, table) => (/*#__PURE__*/React__default.createElement(EditingActionMenu, {
19545
19680
  hasChanges: editing.hasChanges(rowId),
19546
19681
  hasErrors: editing.hasRowErrors(rowId),
19547
- onClear: () => editing.resetChanges(rowId),
19548
- onEditingSave: () => editing.saveChanges(rowId),
19549
- onExit: () => editing.toggleEditing(false),
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
+ },
19550
19690
  isLastRow: !creationEnabled && table.meta.rowActive.rowActiveIndex === table.meta.length - 1
19551
19691
  }))] : props.rowActions
19552
19692
  };
@@ -19558,7 +19698,7 @@ function useTable3(props, ref) {
19558
19698
  useTableEditingListener(table.instance, table.ref);
19559
19699
  React__default.useEffect(() => {
19560
19700
  if (table.ref.current) {
19561
- 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);
19562
19702
  }
19563
19703
  }, [table.ref.current]);
19564
19704
  return table;
@@ -19577,7 +19717,7 @@ function Alert$1(props) {
19577
19717
  const validationTexts = texts.table3.editing.validation;
19578
19718
  const tableMeta = table.options.meta;
19579
19719
  const [showFilterResetDialog, setShowFilterResetDialog] = React__default.useState(false);
19580
- const pendingChangesWithErrors = tableMeta.editing.getAlertErrors();
19720
+ const pendingChangesWithErrors = tableMeta.editing.getErrorsShownInAlert();
19581
19721
  function scrollToRow(rowIndex) {
19582
19722
  tableMeta.rowActive.setRowActiveIndex(rowIndex);
19583
19723
  scrollToIndex(rowIndex, {
@@ -19596,38 +19736,43 @@ function Alert$1(props) {
19596
19736
  const title = (pendingChangesWithErrors.length === 1 ? validationTexts.alert.titleOne : validationTexts.alert.titlePlural).replace('[COUNT]', String(pendingChangesWithErrors.length));
19597
19737
  // generate links to each invalid row, to go into the error message
19598
19738
  const links = [];
19599
- const rowIdentityColumn = tableMeta.rowIdentityColumnId ? table.getColumn(tableMeta.rowIdentityColumnId) : undefined;
19600
- pendingChangesWithErrors.forEach((error, index) => {
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) => {
19601
19742
  // if appropriate, concatenate the item with the text "and"
19602
19743
  if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
19603
19744
  // Add space before and after `messageAnd` text
19604
19745
  links.push(` ${validationTexts.alert.messageAnd} `);
19605
19746
  }
19606
- const rowIndex = table.getRowModel().rows.findIndex(row => row.id === error.rowId);
19747
+ const rowIndex = table.getRowModel().rows.findIndex(row => row.id === pendingChangeWithError.rowId);
19607
19748
  const handleClick = () => {
19749
+ // if row is visible
19608
19750
  if (rowIndex > -1) {
19609
19751
  scrollToRow(rowIndex);
19610
- } else {
19611
- setShowFilterResetDialog(error.rowId);
19752
+ }
19753
+ // if row is filtered out
19754
+ else {
19755
+ setShowFilterResetDialog(pendingChangeWithError.rowId);
19612
19756
  }
19613
19757
  };
19614
19758
  let tooltip;
19615
- if (error.pendingChange._meta.errors.row) {
19616
- tooltip = error.pendingChange._meta.errors.row;
19759
+ if (pendingChangeWithError.errors.row) {
19760
+ tooltip = pendingChangeWithError.errors.row;
19617
19761
  } else {
19618
19762
  var _table$getAllColumns$, _table$getAllColumns$2;
19619
- const firstCellErrorColumnId = Object.keys(error.pendingChange._meta.errors.cells)[0];
19763
+ const firstCellErrorColumnId = Object.keys(pendingChangeWithError.errors.cells)[0];
19620
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;
19621
- tooltip = `${columnName}: ${error.pendingChange._meta.errors.cells[firstCellErrorColumnId]}`;
19765
+ tooltip = `${columnName}: ${pendingChangeWithError.errors.cells[firstCellErrorColumnId]}`;
19622
19766
  }
19767
+ const row = table.getRow(pendingChangeWithError.rowId).original;
19623
19768
  links.push(/*#__PURE__*/React__default.createElement(Tooltip, {
19624
- key: error.rowId,
19769
+ key: pendingChangeWithError.rowId,
19625
19770
  title: tooltip
19626
19771
  }, /*#__PURE__*/React__default.createElement("span", {
19627
19772
  className: "text-blue",
19628
19773
  onClick: handleClick,
19629
19774
  role: "button"
19630
- }, rowIdentityColumn ? error.pendingChange._meta.original[rowIdentityColumn.id] : rowIndex + 1)));
19775
+ }, rowIdentityColumn ? row[rowIdentityColumn.id] : rowIndex + 1)));
19631
19776
  // if appropriate, concatenate the item with the text ","
19632
19777
  if (pendingChangesWithErrors.length > 2 && index < pendingChangesWithErrors.length - 2) {
19633
19778
  links.push(', ');
@@ -19683,89 +19828,6 @@ function FilterResetDialog(props) {
19683
19828
  }, texts.table3.editing.validation.resetFiltersDialog.confirm)))));
19684
19829
  }
19685
19830
 
19686
- function CreateNewRowButton(props) {
19687
- const {
19688
- onEditingCreate,
19689
- scrollToIndex,
19690
- table,
19691
- tableMeta
19692
- } = props;
19693
- const {
19694
- texts
19695
- } = useLocalization();
19696
- const rows = table.getCoreRowModel().rows.filter(row => row.original !== undefined);
19697
- const [rowCreated, setRowCreated] = React__default.useState({
19698
- rowFinder: undefined
19699
- });
19700
- const handleKeyDown = event => {
19701
- if (!tableMeta.editing.hasChanges() && event.key === 'Tab') {
19702
- tableMeta.editing.saveChanges();
19703
- }
19704
- };
19705
- const handleCreate = function () {
19706
- try {
19707
- if (!onEditingCreate) {
19708
- return Promise.resolve();
19709
- }
19710
- const createdRow = rows.find(row => {
19711
- var _rowCreated$rowFinder;
19712
- 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);
19713
- });
19714
- const _temp = function () {
19715
- if (createdRow) {
19716
- return Promise.resolve(tableMeta.editing.saveChanges()).then(function () {
19717
- if (!tableMeta.editing.hasRowErrors(createdRow.id)) {
19718
- const rowFinder = onEditingCreate();
19719
- setRowCreated({
19720
- rowFinder
19721
- });
19722
- }
19723
- });
19724
- } else {
19725
- const rowFinder = onEditingCreate();
19726
- setRowCreated({
19727
- rowFinder
19728
- });
19729
- }
19730
- }();
19731
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
19732
- } catch (e) {
19733
- return Promise.reject(e);
19734
- }
19735
- };
19736
- React__default.useEffect(() => {
19737
- if (typeof (rowCreated === null || rowCreated === void 0 ? void 0 : rowCreated.rowFinder) === 'function') {
19738
- const createdRow = rows.find(row => {
19739
- var _rowCreated$rowFinder2;
19740
- 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);
19741
- });
19742
- if (createdRow) {
19743
- const rowInTable = table.getRowModel().rows.filter(row => row.original !== undefined).find(row => {
19744
- var _rowCreated$rowFinder3;
19745
- 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);
19746
- });
19747
- if (rowInTable) {
19748
- tableMeta.editing.toggleEditing(true);
19749
- tableMeta.rowActive.setRowActiveIndex(createdRow.index);
19750
- scrollToIndex(createdRow.index);
19751
- requestAnimationFrame(() => animateCreateRow(createdRow.id));
19752
- }
19753
- requestAnimationFrame(() => tableMeta.editing.addCreatedRowChangeset(createdRow));
19754
- }
19755
- }
19756
- }, [rowCreated]);
19757
- return /*#__PURE__*/React__default.createElement("tr", {
19758
- onClick: handleCreate,
19759
- className: "border-grey-300 hover:bg-grey-100 group !sticky bottom-10 left-0 z-[21] !block cursor-pointer border-t"
19760
- }, /*#__PURE__*/React__default.createElement("td", {
19761
- className: "!border-t-0 !bg-transparent"
19762
- }, /*#__PURE__*/React__default.createElement(Button$1, {
19763
- onKeyDown: handleKeyDown,
19764
- className: "group-hover:bg-grey-200 sticky left-0",
19765
- appearance: "transparent"
19766
- }, "+ ", texts.table3.editing.buttons.create.label)));
19767
- }
19768
-
19769
19831
  function Editing(props) {
19770
19832
  const {
19771
19833
  scrollToIndex,
@@ -19791,21 +19853,191 @@ function Editing(props) {
19791
19853
  (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.click();
19792
19854
  });
19793
19855
  const handleChange = enabled => {
19794
- tableMeta.editing.toggleEditing(enabled);
19856
+ if (enabled && tableMeta.rowActive.rowActiveIndex === undefined) {
19857
+ tableMeta.rowActive.setRowActiveIndex(0);
19858
+ }
19795
19859
  requestAnimationFrame(() => {
19796
19860
  var _tableMeta$rowActive$;
19797
- return scrollToIndex((_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0);
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);
19798
19864
  });
19799
19865
  };
19800
19866
  return /*#__PURE__*/React__default.createElement(Tooltip, {
19801
19867
  title: tooltip
19802
19868
  }, /*#__PURE__*/React__default.createElement(ModeSwitch, {
19869
+ "data-table": "editing-toggle",
19803
19870
  checked: tableMeta.editing.isEditing,
19804
19871
  onChange: handleChange,
19805
19872
  ref: ref
19806
19873
  }));
19807
19874
  }
19808
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
+
19809
20041
  function Column$3(_) {
19810
20042
  return null;
19811
20043
  }
@@ -19817,12 +20049,23 @@ Group$5.displayName = 'Table3Group';
19817
20049
  const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref) {
19818
20050
  var _table3$meta$editing, _table3$meta$editing2;
19819
20051
  const table3 = useTable3(props, ref);
20052
+ const buttonRef = React__default.useRef(null);
19820
20053
  const gridAttributes = {
19821
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,
19822
20055
  enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing
19823
20056
  };
19824
- const hasAlertErrors = table3.meta.editing.hasAlertErrors();
19825
- const showCreateRowButton = table3.meta.editing.isEnabled && props.onEditingCreate;
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
+ }
19826
20069
  return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
19827
20070
  table: table3
19828
20071
  }, table3.meta.editing.isEnabled ? (/*#__PURE__*/React__default.createElement(Editing, {
@@ -19835,13 +20078,15 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
19835
20078
  tableRef: table3.ref
19836
20079
  })) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
19837
20080
  "data-taco": "table3",
20081
+ rowsForFooter: footerRows,
19838
20082
  table: table3
19839
- }), showCreateRowButton && (/*#__PURE__*/React__default.createElement(CreateNewRowButton, {
20083
+ }), hasCreateWorkflow ? (/*#__PURE__*/React__default.createElement(TemporaryRow, {
20084
+ buttonRef: buttonRef,
20085
+ rowIdentityAccessor: props.rowIdentityAccessor,
19840
20086
  table: table3.instance,
19841
20087
  tableMeta: table3.meta,
19842
- onEditingCreate: props.onEditingCreate,
19843
- scrollToIndex: table3.renderer.scrollToIndex
19844
- }))));
20088
+ tableRef: table3.ref
20089
+ })) : null));
19845
20090
  });
19846
20091
  const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
19847
20092
  const stringifiedChildren = String(props.children);
@@ -19987,7 +20232,7 @@ const Tooltip$1 = ({
19987
20232
  icon: "close",
19988
20233
  title: locale.skip,
19989
20234
  "aria-label": locale.skip,
19990
- className: "absolute right-0 top-0 mr-1 mt-1"
20235
+ className: "absolute top-0 right-0 mt-1 mr-1"
19991
20236
  })), step.title && /*#__PURE__*/React.createElement("h5", null, step.title), step.content, /*#__PURE__*/React.createElement(Group, {
19992
20237
  className: "mt-4 justify-end"
19993
20238
  }, index > 0 && (/*#__PURE__*/React.createElement(Button$1, Object.assign({}, backProps, {
@@ -20349,15 +20594,13 @@ const AgreementDisplay = props => {
20349
20594
  }));
20350
20595
  };
20351
20596
 
20352
- const Container$1 = ({
20353
- children
20354
- }) => {
20597
+ const Container$1 = props => {
20355
20598
  return /*#__PURE__*/React__default.createElement("div", {
20356
20599
  className: "-ml-2 flex flex-shrink-0 flex-grow-0 items-center gap-2 pr-2 xl:ml-auto xl:w-64",
20357
20600
  "data-taco": "header-agreements"
20358
20601
  }, /*#__PURE__*/React__default.createElement("span", {
20359
20602
  className: "hidden h-8 w-px flex-shrink-0 flex-grow-0 bg-white/[0.3] xl:flex"
20360
- }), children);
20603
+ }), props.children);
20361
20604
  };
20362
20605
  function AgreementSelector(props) {
20363
20606
  const {
@@ -20429,7 +20672,7 @@ function AgreementSelector(props) {
20429
20672
  }
20430
20673
  return button;
20431
20674
  })), handleAddAgreement ? (/*#__PURE__*/React__default.createElement(Button$1, {
20432
- className: "focus-visible:!yt-focus-dark mx-2 my-1 !h-9 shrink-0 !bg-white/[0.08] !text-white hover:!bg-white/[0.16]",
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]",
20433
20676
  onClick: handleAddAgreement
20434
20677
  }, texts.header.addAgreement)) : null, /*#__PURE__*/React__default.createElement("hr", {
20435
20678
  className: "my-0 h-px w-full bg-white/[0.08]"
@@ -20595,9 +20838,9 @@ const Top = props => {
20595
20838
  setSidebarOpen
20596
20839
  } = React__default.useContext(LayoutContext);
20597
20840
  const toggleSidebar = () => setSidebarOpen(open => !open);
20598
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, typeof props.children === 'function' ? props.children({
20841
+ return typeof props.children === 'function' ? props.children({
20599
20842
  toggleSidebar
20600
- }) : props.children);
20843
+ }) : props.children;
20601
20844
  };
20602
20845
 
20603
20846
  const Page = /*#__PURE__*/React__default.forwardRef(function LayoutPage(props, ref) {