@economic/taco 2.45.0-alpha.1 → 2.45.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (463) 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/AlertDialog.d.ts +2 -1
  4. package/dist/components/AlertDialog/components/Content.d.ts +3 -1
  5. package/dist/components/Calendar/Calendar.d.ts +1 -1
  6. package/dist/components/Datepicker/Datepicker.d.ts +1 -1
  7. package/dist/components/Dialog/components/Content.d.ts +1 -1
  8. package/dist/components/Dialog/components/DialogDrawer.d.ts +2 -2
  9. package/dist/components/Drawer/components/Content.d.ts +2 -2
  10. package/dist/components/Header/components/Agreement/Badge.d.ts +1 -1
  11. package/dist/components/Header/components/Agreement/Display.d.ts +2 -2
  12. package/dist/components/Header/components/Agreement/Item.d.ts +2 -2
  13. package/dist/components/Header/components/AgreementSelector.d.ts +2 -2
  14. package/dist/components/Header/components/Button.d.ts +1 -1
  15. package/dist/components/HoverCard/HoverCard.d.ts +1 -1
  16. package/dist/components/Icon/components/AccountPreview.d.ts +1 -1
  17. package/dist/components/Icon/components/Accounting.d.ts +1 -1
  18. package/dist/components/Icon/components/AccountingYear.d.ts +1 -1
  19. package/dist/components/Icon/components/AccountingYearCancel.d.ts +1 -1
  20. package/dist/components/Icon/components/AiChatSolid.d.ts +1 -1
  21. package/dist/components/Icon/components/AiStars.d.ts +1 -1
  22. package/dist/components/Icon/components/ArrowBottom.d.ts +1 -1
  23. package/dist/components/Icon/components/ArrowDown.d.ts +1 -1
  24. package/dist/components/Icon/components/ArrowEnd.d.ts +1 -1
  25. package/dist/components/Icon/components/ArrowLeft.d.ts +1 -1
  26. package/dist/components/Icon/components/ArrowRight.d.ts +1 -1
  27. package/dist/components/Icon/components/ArrowStart.d.ts +1 -1
  28. package/dist/components/Icon/components/ArrowTop.d.ts +1 -1
  29. package/dist/components/Icon/components/ArrowUp.d.ts +1 -1
  30. package/dist/components/Icon/components/Attach.d.ts +1 -1
  31. package/dist/components/Icon/components/AttachAuto.d.ts +1 -1
  32. package/dist/components/Icon/components/AttachCancel.d.ts +1 -1
  33. package/dist/components/Icon/components/AttachWarning.d.ts +1 -1
  34. package/dist/components/Icon/components/Autotext.d.ts +1 -1
  35. package/dist/components/Icon/components/AutotextInsert.d.ts +1 -1
  36. package/dist/components/Icon/components/Basic.d.ts +1 -1
  37. package/dist/components/Icon/components/BasicTabs.d.ts +1 -1
  38. package/dist/components/Icon/components/BellSolid.d.ts +1 -1
  39. package/dist/components/Icon/components/Book.d.ts +1 -1
  40. package/dist/components/Icon/components/Booking.d.ts +1 -1
  41. package/dist/components/Icon/components/Budget.d.ts +1 -1
  42. package/dist/components/Icon/components/Calendar.d.ts +1 -1
  43. package/dist/components/Icon/components/CashAccount.d.ts +1 -1
  44. package/dist/components/Icon/components/CashReports.d.ts +1 -1
  45. package/dist/components/Icon/components/ChartArea.d.ts +1 -1
  46. package/dist/components/Icon/components/ChartBar.d.ts +1 -1
  47. package/dist/components/Icon/components/ChartLine.d.ts +1 -1
  48. package/dist/components/Icon/components/ChartPie.d.ts +1 -1
  49. package/dist/components/Icon/components/ChartTable.d.ts +1 -1
  50. package/dist/components/Icon/components/Chat.d.ts +1 -1
  51. package/dist/components/Icon/components/ChatSolid.d.ts +1 -1
  52. package/dist/components/Icon/components/ChevronDown.d.ts +1 -1
  53. package/dist/components/Icon/components/ChevronDownDouble.d.ts +1 -1
  54. package/dist/components/Icon/components/ChevronDownSolid.d.ts +1 -1
  55. package/dist/components/Icon/components/ChevronLeft.d.ts +1 -1
  56. package/dist/components/Icon/components/ChevronLeftDouble.d.ts +1 -1
  57. package/dist/components/Icon/components/ChevronLeftSolid.d.ts +1 -1
  58. package/dist/components/Icon/components/ChevronRight.d.ts +1 -1
  59. package/dist/components/Icon/components/ChevronRightDouble.d.ts +1 -1
  60. package/dist/components/Icon/components/ChevronRightSolid.d.ts +1 -1
  61. package/dist/components/Icon/components/ChevronUp.d.ts +1 -1
  62. package/dist/components/Icon/components/ChevronUpDouble.d.ts +1 -1
  63. package/dist/components/Icon/components/ChevronUpSolid.d.ts +1 -1
  64. package/dist/components/Icon/components/CircleClose.d.ts +1 -1
  65. package/dist/components/Icon/components/CircleInformation.d.ts +1 -1
  66. package/dist/components/Icon/components/CircleMinus.d.ts +1 -1
  67. package/dist/components/Icon/components/CirclePlus.d.ts +1 -1
  68. package/dist/components/Icon/components/CircleQuestionmark.d.ts +1 -1
  69. package/dist/components/Icon/components/CircleTick.d.ts +1 -1
  70. package/dist/components/Icon/components/CircleWarning.d.ts +1 -1
  71. package/dist/components/Icon/components/Clamp.d.ts +1 -1
  72. package/dist/components/Icon/components/ClampOpen.d.ts +1 -1
  73. package/dist/components/Icon/components/Close.d.ts +1 -1
  74. package/dist/components/Icon/components/ColumnFreeze.d.ts +1 -1
  75. package/dist/components/Icon/components/ColumnUnfreeze.d.ts +1 -1
  76. package/dist/components/Icon/components/Columns.d.ts +1 -1
  77. package/dist/components/Icon/components/ConnectionEnable.d.ts +1 -1
  78. package/dist/components/Icon/components/ConnectionRevoke.d.ts +1 -1
  79. package/dist/components/Icon/components/Contacts.d.ts +1 -1
  80. package/dist/components/Icon/components/Copy.d.ts +1 -1
  81. package/dist/components/Icon/components/Courses.d.ts +1 -1
  82. package/dist/components/Icon/components/Credit.d.ts +1 -1
  83. package/dist/components/Icon/components/Delete.d.ts +1 -1
  84. package/dist/components/Icon/components/DeletePermanently.d.ts +1 -1
  85. package/dist/components/Icon/components/Depecriate.d.ts +1 -1
  86. package/dist/components/Icon/components/Developer.d.ts +1 -1
  87. package/dist/components/Icon/components/DistributionTemplate.d.ts +1 -1
  88. package/dist/components/Icon/components/Document.d.ts +1 -1
  89. package/dist/components/Icon/components/DocumentApprove.d.ts +1 -1
  90. package/dist/components/Icon/components/DocumentCreateEntry.d.ts +1 -1
  91. package/dist/components/Icon/components/DocumentCut.d.ts +1 -1
  92. package/dist/components/Icon/components/DocumentError.d.ts +1 -1
  93. package/dist/components/Icon/components/DocumentIsolatePage.d.ts +1 -1
  94. package/dist/components/Icon/components/DocumentMerge.d.ts +1 -1
  95. package/dist/components/Icon/components/DocumentMove.d.ts +1 -1
  96. package/dist/components/Icon/components/DocumentPreview.d.ts +1 -1
  97. package/dist/components/Icon/components/DocumentReceived.d.ts +1 -1
  98. package/dist/components/Icon/components/DocumentRejectedRequest.d.ts +1 -1
  99. package/dist/components/Icon/components/DocumentSigned.d.ts +1 -1
  100. package/dist/components/Icon/components/DocumentSignedSolid.d.ts +1 -1
  101. package/dist/components/Icon/components/DocumentSplit.d.ts +1 -1
  102. package/dist/components/Icon/components/DocumentTime.d.ts +1 -1
  103. package/dist/components/Icon/components/Download.d.ts +1 -1
  104. package/dist/components/Icon/components/Drag.d.ts +1 -1
  105. package/dist/components/Icon/components/ECopedia.d.ts +1 -1
  106. package/dist/components/Icon/components/Edit.d.ts +1 -1
  107. package/dist/components/Icon/components/EditSimple.d.ts +1 -1
  108. package/dist/components/Icon/components/EllipsisHorizontal.d.ts +1 -1
  109. package/dist/components/Icon/components/EllipsisVertical.d.ts +1 -1
  110. package/dist/components/Icon/components/EntriesOnAccount.d.ts +1 -1
  111. package/dist/components/Icon/components/EntriesOpen.d.ts +1 -1
  112. package/dist/components/Icon/components/EntriesWarning.d.ts +1 -1
  113. package/dist/components/Icon/components/EntryTypeCustomerInvoice.d.ts +1 -1
  114. package/dist/components/Icon/components/EntryTypeCustomerPayment.d.ts +1 -1
  115. package/dist/components/Icon/components/EntryTypeJournalEntry.d.ts +1 -1
  116. package/dist/components/Icon/components/EntryTypeManualCustomerInvoice.d.ts +1 -1
  117. package/dist/components/Icon/components/EntryTypeSupplierInvoice.d.ts +1 -1
  118. package/dist/components/Icon/components/EntryTypeSupplierPayment.d.ts +1 -1
  119. package/dist/components/Icon/components/Envelope.d.ts +1 -1
  120. package/dist/components/Icon/components/EnvelopeApproved.d.ts +1 -1
  121. package/dist/components/Icon/components/EnvelopeSolid.d.ts +1 -1
  122. package/dist/components/Icon/components/ExpandView.d.ts +1 -1
  123. package/dist/components/Icon/components/Expenses.d.ts +1 -1
  124. package/dist/components/Icon/components/Export.d.ts +1 -1
  125. package/dist/components/Icon/components/ExportToExcel.d.ts +1 -1
  126. package/dist/components/Icon/components/ExportToPdf.d.ts +1 -1
  127. package/dist/components/Icon/components/EyeOff.d.ts +1 -1
  128. package/dist/components/Icon/components/EyeOn.d.ts +1 -1
  129. package/dist/components/Icon/components/Filter.d.ts +1 -1
  130. package/dist/components/Icon/components/FilterSolid.d.ts +1 -1
  131. package/dist/components/Icon/components/FontSize.d.ts +1 -1
  132. package/dist/components/Icon/components/GraphSolid.d.ts +1 -1
  133. package/dist/components/Icon/components/Hash.d.ts +1 -1
  134. package/dist/components/Icon/components/HeightExtraTall.d.ts +1 -1
  135. package/dist/components/Icon/components/HeightMedium.d.ts +1 -1
  136. package/dist/components/Icon/components/HeightShort.d.ts +1 -1
  137. package/dist/components/Icon/components/HeightTall.d.ts +1 -1
  138. package/dist/components/Icon/components/House.d.ts +1 -1
  139. package/dist/components/Icon/components/HouseSolid.d.ts +1 -1
  140. package/dist/components/Icon/components/Id.d.ts +1 -1
  141. package/dist/components/Icon/components/Images.d.ts +1 -1
  142. package/dist/components/Icon/components/Import.d.ts +1 -1
  143. package/dist/components/Icon/components/Inbox.d.ts +1 -1
  144. package/dist/components/Icon/components/InboxEinvoicing.d.ts +1 -1
  145. package/dist/components/Icon/components/InboxScanning.d.ts +1 -1
  146. package/dist/components/Icon/components/InboxSmart.d.ts +1 -1
  147. package/dist/components/Icon/components/Info.d.ts +1 -1
  148. package/dist/components/Icon/components/Inventory.d.ts +1 -1
  149. package/dist/components/Icon/components/InventoryMatrix.d.ts +1 -1
  150. package/dist/components/Icon/components/JournalPro.d.ts +1 -1
  151. package/dist/components/Icon/components/Layout.d.ts +1 -1
  152. package/dist/components/Icon/components/LayoutBoth.d.ts +1 -1
  153. package/dist/components/Icon/components/LayoutFirst.d.ts +1 -1
  154. package/dist/components/Icon/components/LayoutLast.d.ts +1 -1
  155. package/dist/components/Icon/components/LayoutNone.d.ts +1 -1
  156. package/dist/components/Icon/components/LedgerCard.d.ts +1 -1
  157. package/dist/components/Icon/components/LedgerCardCustomerReminder.d.ts +1 -1
  158. package/dist/components/Icon/components/LedgerCardManualCustomerInvoice.d.ts +1 -1
  159. package/dist/components/Icon/components/LedgerCardObsoleteStock.d.ts +1 -1
  160. package/dist/components/Icon/components/LedgerCardOpeningEntry.d.ts +1 -1
  161. package/dist/components/Icon/components/LedgerCardReservedEntry.d.ts +1 -1
  162. package/dist/components/Icon/components/LedgerCardShrinkagePilferage.d.ts +1 -1
  163. package/dist/components/Icon/components/LedgerCardStockAdjustment.d.ts +1 -1
  164. package/dist/components/Icon/components/LedgerCardTransferredOpeningEntry.d.ts +1 -1
  165. package/dist/components/Icon/components/Lightbulb.d.ts +1 -1
  166. package/dist/components/Icon/components/Line.d.ts +1 -1
  167. package/dist/components/Icon/components/LinkExternal.d.ts +1 -1
  168. package/dist/components/Icon/components/List.d.ts +1 -1
  169. package/dist/components/Icon/components/ListBulleted.d.ts +1 -1
  170. package/dist/components/Icon/components/ListSearch.d.ts +1 -1
  171. package/dist/components/Icon/components/Location.d.ts +1 -1
  172. package/dist/components/Icon/components/Lock.d.ts +1 -1
  173. package/dist/components/Icon/components/LockOpen.d.ts +1 -1
  174. package/dist/components/Icon/components/Log.d.ts +1 -1
  175. package/dist/components/Icon/components/LogOut.d.ts +1 -1
  176. package/dist/components/Icon/components/Market.d.ts +1 -1
  177. package/dist/components/Icon/components/MastercardOs.d.ts +1 -1
  178. package/dist/components/Icon/components/MatchAmount.d.ts +1 -1
  179. package/dist/components/Icon/components/MatchEntries.d.ts +1 -1
  180. package/dist/components/Icon/components/Menu.d.ts +1 -1
  181. package/dist/components/Icon/components/Mileage.d.ts +1 -1
  182. package/dist/components/Icon/components/ModalResize.d.ts +1 -1
  183. package/dist/components/Icon/components/ModalShrink.d.ts +1 -1
  184. package/dist/components/Icon/components/More.d.ts +1 -1
  185. package/dist/components/Icon/components/MoreSolid.d.ts +1 -1
  186. package/dist/components/Icon/components/Move.d.ts +1 -1
  187. package/dist/components/Icon/components/NavigationList.d.ts +1 -1
  188. package/dist/components/Icon/components/Note.d.ts +1 -1
  189. package/dist/components/Icon/components/NoteFollowUp.d.ts +1 -1
  190. package/dist/components/Icon/components/NoteRead.d.ts +1 -1
  191. package/dist/components/Icon/components/NovemberFirst.d.ts +1 -1
  192. package/dist/components/Icon/components/Numbers.d.ts +1 -1
  193. package/dist/components/Icon/components/PartnerApi.d.ts +1 -1
  194. package/dist/components/Icon/components/PaymentPaid.d.ts +1 -1
  195. package/dist/components/Icon/components/PaymentUnpaid.d.ts +1 -1
  196. package/dist/components/Icon/components/Period.d.ts +1 -1
  197. package/dist/components/Icon/components/PersonChange.d.ts +1 -1
  198. package/dist/components/Icon/components/PersonMinus.d.ts +1 -1
  199. package/dist/components/Icon/components/PersonPlus.d.ts +1 -1
  200. package/dist/components/Icon/components/PersonTick.d.ts +1 -1
  201. package/dist/components/Icon/components/Phone.d.ts +1 -1
  202. package/dist/components/Icon/components/PhoneSolid.d.ts +1 -1
  203. package/dist/components/Icon/components/Play.d.ts +1 -1
  204. package/dist/components/Icon/components/PlusMinus.d.ts +1 -1
  205. package/dist/components/Icon/components/Print.d.ts +1 -1
  206. package/dist/components/Icon/components/ProcessPayment.d.ts +1 -1
  207. package/dist/components/Icon/components/ProductLedgerCard.d.ts +1 -1
  208. package/dist/components/Icon/components/Profile.d.ts +1 -1
  209. package/dist/components/Icon/components/ProjectCards.d.ts +1 -1
  210. package/dist/components/Icon/components/Projects.d.ts +1 -1
  211. package/dist/components/Icon/components/QuestionMark.d.ts +1 -1
  212. package/dist/components/Icon/components/QuestionMarkBold.d.ts +1 -1
  213. package/dist/components/Icon/components/Quicklinks.d.ts +1 -1
  214. package/dist/components/Icon/components/RatingBankruptcy.d.ts +1 -1
  215. package/dist/components/Icon/components/RatingPaymentProblems.d.ts +1 -1
  216. package/dist/components/Icon/components/Reconciled.d.ts +1 -1
  217. package/dist/components/Icon/components/Refresh.d.ts +1 -1
  218. package/dist/components/Icon/components/Report.d.ts +1 -1
  219. package/dist/components/Icon/components/ReportSolid.d.ts +1 -1
  220. package/dist/components/Icon/components/Restore.d.ts +1 -1
  221. package/dist/components/Icon/components/RotateLeft.d.ts +1 -1
  222. package/dist/components/Icon/components/RotateRight.d.ts +1 -1
  223. package/dist/components/Icon/components/Sales.d.ts +1 -1
  224. package/dist/components/Icon/components/Search.d.ts +1 -1
  225. package/dist/components/Icon/components/SearchBold.d.ts +1 -1
  226. package/dist/components/Icon/components/Secure.d.ts +1 -1
  227. package/dist/components/Icon/components/SecureTick.d.ts +1 -1
  228. package/dist/components/Icon/components/Settings.d.ts +1 -1
  229. package/dist/components/Icon/components/SettingsSolid.d.ts +1 -1
  230. package/dist/components/Icon/components/Shortcuts.d.ts +1 -1
  231. package/dist/components/Icon/components/ShowAll.d.ts +1 -1
  232. package/dist/components/Icon/components/ShowLess.d.ts +1 -1
  233. package/dist/components/Icon/components/ShowMore.d.ts +1 -1
  234. package/dist/components/Icon/components/ShowTemplate.d.ts +1 -1
  235. package/dist/components/Icon/components/Sliders.d.ts +1 -1
  236. package/dist/components/Icon/components/Smartpay.d.ts +1 -1
  237. package/dist/components/Icon/components/SortBy.d.ts +1 -1
  238. package/dist/components/Icon/components/Star.d.ts +1 -1
  239. package/dist/components/Icon/components/StarSolid.d.ts +1 -1
  240. package/dist/components/Icon/components/Subscriptions.d.ts +1 -1
  241. package/dist/components/Icon/components/SystemEntries.d.ts +1 -1
  242. package/dist/components/Icon/components/Tag.d.ts +1 -1
  243. package/dist/components/Icon/components/TemplateOverride.d.ts +1 -1
  244. package/dist/components/Icon/components/Templates.d.ts +1 -1
  245. package/dist/components/Icon/components/ThumbBoth.d.ts +1 -1
  246. package/dist/components/Icon/components/ThumbDown.d.ts +1 -1
  247. package/dist/components/Icon/components/ThumbDownSolid.d.ts +1 -1
  248. package/dist/components/Icon/components/ThumbUp.d.ts +1 -1
  249. package/dist/components/Icon/components/ThumbUpSolid.d.ts +1 -1
  250. package/dist/components/Icon/components/Tick.d.ts +1 -1
  251. package/dist/components/Icon/components/TickBold.d.ts +1 -1
  252. package/dist/components/Icon/components/Time.d.ts +1 -1
  253. package/dist/components/Icon/components/Transfer.d.ts +1 -1
  254. package/dist/components/Icon/components/TransferCancel.d.ts +1 -1
  255. package/dist/components/Icon/components/TransferLocked.d.ts +1 -1
  256. package/dist/components/Icon/components/Undo.d.ts +1 -1
  257. package/dist/components/Icon/components/Undock.d.ts +1 -1
  258. package/dist/components/Icon/components/Unreconciled.d.ts +1 -1
  259. package/dist/components/Icon/components/Warning.d.ts +1 -1
  260. package/dist/components/Icon/components/Webshop.d.ts +1 -1
  261. package/dist/components/Icon/components/Website.d.ts +1 -1
  262. package/dist/components/Icon/components/Workflow.d.ts +1 -1
  263. package/dist/components/Icon/components/WorkflowTemplateBasic.d.ts +1 -1
  264. package/dist/components/Icon/components/Zoom.d.ts +1 -1
  265. package/dist/components/IconButton/IconButton.d.ts +2 -2
  266. package/dist/components/Input/Input.d.ts +2 -2
  267. package/dist/components/Input/util.d.ts +1 -11
  268. package/dist/components/Layout/components/Sidebar.d.ts +2 -14
  269. package/dist/components/Layout/components/Top.d.ts +4 -4
  270. package/dist/components/List/List.d.ts +7 -7
  271. package/dist/components/List/components/Button.d.ts +1 -1
  272. package/dist/components/List/components/Collapsible.d.ts +1 -1
  273. package/dist/components/List/components/Group.d.ts +1 -1
  274. package/dist/components/List/components/Item.d.ts +1 -1
  275. package/dist/components/List/components/Link.d.ts +1 -1
  276. package/dist/components/List/components/Toggle.d.ts +2 -2
  277. package/dist/components/Listbox/Listbox.d.ts +2 -2
  278. package/dist/components/Listbox/ScrollableList.d.ts +1 -1
  279. package/dist/components/Listbox/util.d.ts +2 -2
  280. package/dist/components/Menu/components/Checkbox.d.ts +1 -1
  281. package/dist/components/Menu/components/Content.d.ts +2 -2
  282. package/dist/components/Menu/components/Item.d.ts +8 -8
  283. package/dist/components/Menu/components/Link.d.ts +1 -1
  284. package/dist/components/Menu/components/RadioGroup.d.ts +1 -1
  285. package/dist/components/Menu/components/SubMenu.d.ts +1 -1
  286. package/dist/components/Menu/components/Trigger.d.ts +1 -1
  287. package/dist/components/Navigation2/components/Group.d.ts +1 -1
  288. package/dist/components/Popover/Popover.d.ts +1 -1
  289. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  290. package/dist/components/ScrollArea/ScrollArea.d.ts +2 -2
  291. package/dist/components/SearchInput/SearchInput.d.ts +1 -1
  292. package/dist/components/Select/Select.d.ts +1 -1
  293. package/dist/components/Select2/components/All.d.ts +2 -2
  294. package/dist/components/Select2/components/Collection.d.ts +1 -1
  295. package/dist/components/Select2/components/Create.d.ts +1 -1
  296. package/dist/components/Select2/components/Edit.d.ts +2 -2
  297. package/dist/components/Select2/components/Group.d.ts +1 -1
  298. package/dist/components/Select2/components/Option.d.ts +1 -1
  299. package/dist/components/Select2/components/Search.d.ts +3 -9
  300. package/dist/components/Select2/components/Trigger.d.ts +1 -1
  301. package/dist/components/Select2/hooks/useChildren.d.ts +2 -2
  302. package/dist/components/Shortcut/Shortcut.d.ts +1 -1
  303. package/dist/components/Table3/components/Columns/Cell/Cell.d.ts +2 -2
  304. package/dist/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.d.ts +1 -1
  305. package/dist/components/Table3/components/Columns/Cell/EditingControlCell.d.ts +2 -2
  306. package/dist/components/Table3/components/Columns/Internal/EditingActionsMenu.d.ts +2 -2
  307. package/dist/components/Table3/components/Editing/Alert.d.ts +1 -1
  308. package/dist/components/Table3/components/Row/Editing/CreateRowButton.d.ts +2 -2
  309. package/dist/components/Table3/components/Row/Editing/SaveStatus.d.ts +2 -2
  310. package/dist/components/Table3/components/Row/Row.d.ts +2 -2
  311. package/dist/components/Table3/components/Toolbar/Editing/Editing.d.ts +1 -1
  312. package/dist/components/Table3/features/useTableEditing.d.ts +2 -2
  313. package/dist/components/Table3/util/editing.d.ts +1 -1
  314. package/dist/components/Tag/Tag.d.ts +2 -2
  315. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  316. package/dist/components/Tour/Tour.d.ts +3 -3
  317. package/dist/components/Truncate/Truncate.d.ts +1 -1
  318. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +6 -14
  319. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
  320. package/dist/esm/packages/taco/src/components/AlertDialog/AlertDialog.js +2 -1
  321. package/dist/esm/packages/taco/src/components/AlertDialog/AlertDialog.js.map +1 -1
  322. package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js +7 -2
  323. package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js.map +1 -1
  324. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  325. package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
  326. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +4 -3
  327. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  328. package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js.map +1 -1
  329. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +1 -0
  330. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  331. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js.map +1 -1
  332. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +3 -5
  333. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  334. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  335. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  336. package/dist/esm/packages/taco/src/components/Layout/components/Top.js +2 -2
  337. package/dist/esm/packages/taco/src/components/Layout/components/Top.js.map +1 -1
  338. package/dist/esm/packages/taco/src/components/Listbox/util.js +1 -7
  339. package/dist/esm/packages/taco/src/components/Listbox/util.js.map +1 -1
  340. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  341. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  342. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  343. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  344. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +4 -4
  345. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  346. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  347. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  348. package/dist/esm/packages/taco/src/components/Select2/Select2.js +20 -39
  349. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  350. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +10 -11
  351. package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
  352. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +2 -0
  353. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  354. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  355. package/dist/esm/packages/taco/src/components/Select2/components/Search.js +2 -12
  356. package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
  357. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +19 -1
  358. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  359. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  360. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
  361. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  362. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js.map +1 -1
  363. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +12 -0
  364. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  365. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
  366. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  367. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js.map +1 -1
  368. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js +1 -1
  369. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js.map +1 -1
  370. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js +1 -4
  371. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js.map +1 -1
  372. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  373. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +2 -3
  374. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  375. package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
  376. package/dist/esm/packages/taco/src/components/Tour/Tour.js +3 -3
  377. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  378. package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js.map +1 -1
  379. package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -1
  380. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js +18 -0
  381. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js.map +1 -1
  382. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js +0 -5
  383. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js.map +1 -1
  384. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js +1 -0
  385. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js.map +1 -1
  386. package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js +1 -1
  387. package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js.map +1 -1
  388. package/dist/esm/packages/taco/src/primitives/Sortable/components/Item.js.map +1 -1
  389. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js +4 -4
  390. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js.map +1 -1
  391. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
  392. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
  393. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Goto.js.map +1 -1
  394. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js +2 -2
  395. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
  396. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Resizer.js.map +1 -1
  397. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/SortIndicator.js.map +1 -1
  398. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/util.js.map +1 -1
  399. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.js.map +1 -1
  400. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  401. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +9 -4
  402. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
  403. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  404. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -1
  405. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/Settings.js.map +1 -1
  406. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  407. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  408. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  409. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js +3 -3
  410. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -1
  411. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +1 -1
  412. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -1
  413. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableShortcutsListener.js.map +1 -1
  414. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  415. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
  416. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
  417. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  418. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js.map +1 -1
  419. package/dist/esm/packages/taco/src/utils/dom.js +15 -9
  420. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  421. package/dist/primitives/BubbleSelect.d.ts +1 -1
  422. package/dist/primitives/Collection/components/Root.d.ts +2 -0
  423. package/dist/primitives/Sortable/components/Container.d.ts +2 -2
  424. package/dist/primitives/Sortable/components/Item.d.ts +1 -2
  425. package/dist/primitives/Sortable/components/List.d.ts +1 -1
  426. package/dist/primitives/Table/Core/Table.d.ts +2 -2
  427. package/dist/primitives/Table/Core/components/Body/Body.d.ts +1 -1
  428. package/dist/primitives/Table/Core/components/Body/EmptyStateBody.d.ts +1 -1
  429. package/dist/primitives/Table/Core/components/Body/util.d.ts +4 -4
  430. package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.d.ts +2 -2
  431. package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.d.ts +2 -2
  432. package/dist/primitives/Table/Core/components/Columns/Cell/Cell.d.ts +1 -1
  433. package/dist/primitives/Table/Core/components/Columns/Internal/Actions.d.ts +2 -2
  434. package/dist/primitives/Table/Core/components/Footer/Footer.d.ts +3 -3
  435. package/dist/primitives/Table/Core/components/Footer/Summary.d.ts +2 -2
  436. package/dist/primitives/Table/Core/components/Header/Header.d.ts +1 -1
  437. package/dist/primitives/Table/Core/components/Header/components/Goto.d.ts +2 -2
  438. package/dist/primitives/Table/Core/components/Header/components/Menu.d.ts +1 -1
  439. package/dist/primitives/Table/Core/components/Header/components/Resizer.d.ts +2 -2
  440. package/dist/primitives/Table/Core/components/Header/components/SortIndicator.d.ts +3 -3
  441. package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +2 -2
  442. package/dist/primitives/Table/Core/components/Row/Row.d.ts +1 -1
  443. package/dist/primitives/Table/Core/components/Toolbar/Toolbar.d.ts +1 -1
  444. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/Filters.d.ts +2 -2
  445. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.d.ts +2 -2
  446. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.d.ts +2 -2
  447. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +1 -1
  448. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.d.ts +2 -2
  449. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.d.ts +2 -2
  450. package/dist/primitives/Table/Core/components/Toolbar/components/Print/Print.d.ts +1 -1
  451. package/dist/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.d.ts +2 -2
  452. package/dist/primitives/Table/Core/components/Toolbar/components/Search/Search.d.ts +1 -1
  453. package/dist/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.d.ts +2 -2
  454. package/dist/primitives/Table/Core/components/Toolbar/components/Settings/Settings.d.ts +2 -2
  455. package/dist/primitives/Table/Core/features/useTableStyle.d.ts +3 -3
  456. package/dist/primitives/Table/types.d.ts +1 -1
  457. package/dist/primitives/Table/useTableManager/util/settings.d.ts +1 -1
  458. package/dist/taco.cjs.development.js +146 -133
  459. package/dist/taco.cjs.development.js.map +1 -1
  460. package/dist/taco.cjs.production.min.js +1 -1
  461. package/dist/taco.cjs.production.min.js.map +1 -1
  462. package/dist/utils/dom.d.ts +1 -1
  463. package/package.json +26 -25
@@ -1 +1 @@
1
- {"version":3,"file":"RowMoveIndicator.js","sources":["../../../../../../../../../../../src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.tsx"],"sourcesContent":["import React from 'react';\nimport { Cell as ReactTableCell, TableMeta as ReactTableMeta, ColumnMeta as ReactTableColumnMeta } from '@tanstack/react-table';\nimport { Tooltip } from '../../../../../Tooltip/Tooltip';\nimport { LocalizationTexts, useLocalization } from '../../../../../Provider/Localization';\nimport { Icon } from '../../../../../Icon/Icon';\n\ntype TableRowMoveIndicatorProps<TType = unknown> = {\n cell: ReactTableCell<TType, unknown>;\n cellRef: React.RefObject<HTMLTableCellElement>;\n isActiveRow: boolean;\n};\n\nexport function RowMoveIndicator<TType = unknown>(props: TableRowMoveIndicatorProps<TType>) {\n const { cell, cellRef, isActiveRow } = props;\n const { texts } = useLocalization();\n const [show, setShow] = React.useState(false);\n const tableMeta = cell.getContext().table.options.meta as ReactTableMeta<TType>;\n const columnMeta = (cell.column.columnDef.meta ?? {}) as ReactTableColumnMeta<TType, unknown>;\n const moveReason = tableMeta.editing.getRowMoveReason(cell.row.id);\n\n React.useEffect(() => {\n if (cellRef.current) {\n if (isActiveRow && !!moveReason) {\n const firstChild = cellRef.current.parentElement?.querySelector(`td[data-taco=\"cell-control\"]`);\n\n if (cellRef.current === firstChild) {\n setShow(true);\n cellRef.current.parentElement?.setAttribute('data-row-editing-move', 'true');\n }\n } else {\n setShow(false);\n cellRef.current.parentElement?.removeAttribute('data-row-editing-move');\n }\n }\n\n return () => {\n if (cellRef.current) {\n cellRef.current.parentElement?.removeAttribute('data-row-editing-move');\n }\n };\n }, [cellRef, isActiveRow, moveReason]);\n\n if (!show) {\n return null;\n }\n\n const className =\n 'wcag-blue-500 absolute left-0 top-full ml-1 whitespace-nowrap rounded-b-md px-1 py-1 text-xs font-bold z-10';\n\n const { title, description } = getMessageFromReason(texts, moveReason);\n\n return (\n <Tooltip placement=\"bottom\" title={description.replace('[COLUMN]', columnMeta.header)}>\n <span className={className}>\n <Icon name=\"info\" className=\"-mt-0.5 mr-1 !h-4 !w-4 rounded-full bg-white !p-0 text-blue-500\" />\n {title}\n </span>\n </Tooltip>\n );\n}\n\nfunction getMessageFromReason(texts: LocalizationTexts, reason: 'search' | 'sorting' | 'filter' | undefined) {\n let title = '';\n let description = '';\n\n switch (reason) {\n case 'filter':\n title = texts.table3.editing.rowIndicator.rowWillBeHidden;\n description = texts.table3.editing.rowIndicator.rowWillMoveReasonFilter;\n break;\n\n case 'search':\n title = texts.table3.editing.rowIndicator.rowWillBeHidden;\n description = texts.table3.editing.rowIndicator.rowWillMoveReasonSearch;\n break;\n\n case 'sorting':\n title = texts.table3.editing.rowIndicator.rowWillMove;\n description = texts.table3.editing.rowIndicator.rowWillMoveReasonSorting;\n break;\n }\n\n return { title, description };\n}\n"],"names":["RowMoveIndicator","props","cell","cellRef","isActiveRow","texts","useLocalization","show","setShow","React","useState","tableMeta","getContext","table","options","meta","columnMeta","_cell$column$columnDe","column","columnDef","moveReason","editing","getRowMoveReason","row","id","useEffect","current","_cellRef$current$pare","firstChild","parentElement","querySelector","_cellRef$current$pare2","setAttribute","_cellRef$current$pare3","removeAttribute","_cellRef$current$pare4","className","title","description","getMessageFromReason","Tooltip","placement","replace","header","Icon","name","reason","table3","rowIndicator","rowWillBeHidden","rowWillMoveReasonFilter","rowWillMoveReasonSearch","rowWillMove","rowWillMoveReasonSorting"],"mappings":";;;;;SAYgBA,gBAAgBA,CAAkBC,KAAwC;;EACtF,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAEC;GAAa,GAAGH,KAAK;EAC5C,MAAM;IAAEI;GAAO,G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B,YAAY,CAACI,WAAW;MACrDd,WAAW,GAAGjC,KAAK,CAAC0C,MAAM,CAAC1B,OAAO,CAAC2B,YAAY,CAACK,wBAAwB;MACxE;;EAGR,OAAO;IAAEhB,KAAK;IAAEC;GAAa;AACjC;;;;"}
1
+ {"version":3,"file":"RowMoveIndicator.js","sources":["../../../../../../../../../../../src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.tsx"],"sourcesContent":["import React from 'react';\nimport { Cell as ReactTableCell, TableMeta as ReactTableMeta, ColumnMeta as ReactTableColumnMeta } from '@tanstack/react-table';\nimport { Tooltip } from '../../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { Icon } from '../../../../../Icon/Icon';\n\ntype TableRowMoveIndicatorProps<TType = unknown> = {\n cell: ReactTableCell<TType, unknown>;\n cellRef: React.RefObject<HTMLTableCellElement>;\n isActiveRow: boolean;\n};\n\nexport function RowMoveIndicator<TType = unknown>(props: TableRowMoveIndicatorProps<TType>) {\n const { cell, cellRef, isActiveRow } = props;\n const { texts } = useLocalization();\n const [show, setShow] = React.useState(false);\n const tableMeta = cell.getContext().table.options.meta as ReactTableMeta<TType>;\n const columnMeta = (cell.column.columnDef.meta ?? {}) as ReactTableColumnMeta<TType, unknown>;\n const moveReason = tableMeta.editing.getRowMoveReason(cell.row.id);\n\n React.useEffect(() => {\n if (cellRef.current) {\n if (isActiveRow && !!moveReason) {\n const firstChild = cellRef.current.parentElement?.querySelector(`td[data-taco=\"cell-control\"]`);\n\n if (cellRef.current === firstChild) {\n setShow(true);\n cellRef.current.parentElement?.setAttribute('data-row-editing-move', 'true');\n }\n } else {\n setShow(false);\n cellRef.current.parentElement?.removeAttribute('data-row-editing-move');\n }\n }\n\n return () => {\n if (cellRef.current) {\n cellRef.current.parentElement?.removeAttribute('data-row-editing-move');\n }\n };\n }, [cellRef, isActiveRow, moveReason]);\n\n if (!show) {\n return null;\n }\n\n const className =\n 'wcag-blue-500 absolute left-0 top-full ml-1 whitespace-nowrap rounded-b-md px-1 py-1 text-xs font-bold z-10';\n\n const { title, description } = getMessageFromReason(texts, moveReason);\n\n return (\n <Tooltip placement=\"bottom\" title={description.replace('[COLUMN]', columnMeta.header)}>\n <span className={className}>\n <Icon name=\"info\" className=\"-mt-0.5 mr-1 !h-4 !w-4 rounded-full bg-white !p-0 text-blue-500\" />\n {title}\n </span>\n </Tooltip>\n );\n}\n\nfunction getMessageFromReason(texts, reason) {\n let title = '';\n let description = '';\n\n switch (reason) {\n case 'filter':\n title = texts.table3.editing.rowIndicator.rowWillBeHidden;\n description = texts.table3.editing.rowIndicator.rowWillMoveReasonFilter;\n break;\n\n case 'search':\n title = texts.table3.editing.rowIndicator.rowWillBeHidden;\n description = texts.table3.editing.rowIndicator.rowWillMoveReasonSearch;\n break;\n\n case 'sorting':\n title = texts.table3.editing.rowIndicator.rowWillMove;\n description = texts.table3.editing.rowIndicator.rowWillMoveReasonSorting;\n break;\n }\n\n return { title, description };\n}\n"],"names":["RowMoveIndicator","props","cell","cellRef","isActiveRow","texts","useLocalization","show","setShow","React","useState","tableMeta","getContext","table","options","meta","columnMeta","_cell$column$columnDe","column","columnDef","moveReason","editing","getRowMoveReason","row","id","useEffect","current","_cellRef$current$pare","firstChild","parentElement","querySelector","_cellRef$current$pare2","setAttribute","_cellRef$current$pare3","removeAttribute","_cellRef$current$pare4","className","title","description","getMessageFromReason","Tooltip","placement","replace","header","Icon","name","reason","table3","rowIndicator","rowWillBeHidden","rowWillMoveReasonFilter","rowWillMoveReasonSearch","rowWillMove","rowWillMoveReasonSorting"],"mappings":";;;;;SAYgBA,gBAAgBA,CAAkBC,KAAwC;;EACtF,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAEC;GAAa,GAAGH,KAAK;EAC5C,MAAM;IAAEI;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EAC7C,MAA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OAAO;IAAEhB,KAAK;IAAEC;GAAa;AACjC;;;;"}
@@ -1,6 +1,7 @@
1
1
  import React__default from 'react';
2
2
  import { isElementInsideOrTriggeredFromContainer } from '../../../../../utils/dom.js';
3
3
  import { isPressingMetaKey } from '../../../../../utils/keyboard.js';
4
+ import { Checkbox } from '../../../../Checkbox/Checkbox.js';
4
5
  import { Input } from '../../../../Input/Input.js';
5
6
  import { isDate } from 'date-fns';
6
7
  import { parse, isWeakEqual } from '../../../../../utils/date.js';
@@ -120,6 +121,13 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
120
121
  ref: controlRef
121
122
  }));
122
123
  }
124
+ if (type === 'checkbox') {
125
+ return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, commonProps, {
126
+ checked: Boolean(value),
127
+ onChange: onChange,
128
+ ref: controlRef
129
+ }));
130
+ }
123
131
  const handleInputKeyDown = event => {
124
132
  const target = event.target;
125
133
  if (target.readOnly) {
@@ -164,6 +172,10 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
164
172
  }
165
173
  return;
166
174
  }
175
+ const shortcutWhitelist = ['f', 'p', 'e']; // f = search, p = print, and e = edit
176
+ if (isPressingMetaKey(event) && !shortcutWhitelist.some(s => s === event.key)) {
177
+ event.stopPropagation();
178
+ }
167
179
  // toggle into detailed mode when actually inputting something
168
180
  if (!isPressingMetaKey(event) && (/^[a-z0-9]$/i.test(event.key) || event.key === 'Backspace')) {
169
181
  toggleDetailedMode(true);
@@ -1 +1 @@
1
- {"version":3,"file":"EditingControlCell.js","sources":["../../../../../../../../../../src/components/Table3/components/Columns/Cell/EditingControlCell.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta, ColumnMeta as ReactTableColumnMeta } from '@tanstack/react-table';\nimport { isDate } from 'date-fns';\nimport { Datepicker } from '../../../../Datepicker/Datepicker';\nimport { Switch } from '../../../../Switch/Switch';\nimport { Input } from '../../../../Input/Input';\nimport { TableColumnDataType, TableColumnRendererControl, TableFontSize } from '../../../../../primitives/Table/types';\nimport * as date from '../../../../../utils/date';\nimport { RowMoveIndicator } from './Editing/RowMoveIndicator';\nimport { TextareaWithAutosizing } from './Editing/TextareaWithAutosizing';\nimport { Field } from '../../../../Field/Field';\nimport { isElementInsideOrTriggeredFromContainer } from '../../../../../utils/dom';\nimport { TableCellRendererProps } from '../../../../../primitives/Table/Core/types';\nimport { RowContext } from '../../../../../primitives/Table/Core/components/Row/RowContext';\nimport { getCellAttributes } from '../../../../../primitives/Table/Core/components/Columns/Cell/util';\nimport { useEditingCellAutofocus } from './util';\nimport { isPressingMetaKey } from '../../../../../utils/keyboard';\n\nexport function EditingControlCell<TType = unknown>(props: TableCellRendererProps<TType>) {\n const { cell, cellRef, isHighlighted, index } = props;\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = cell.getContext().table.options.meta as ReactTableMeta<TType>;\n const columnMeta = cell.column.columnDef.meta as ReactTableColumnMeta<TType, unknown>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;\n\n const handleFocus = useEditingCellAutofocus<TType>(props);\n\n const handleBlur = () => {\n tableMeta.editing.toggleDetailedMode(false);\n tableMeta.editing.validateCell(cell);\n };\n\n // ensure that blur runs when the cell gets unmounted (when vertically arrow key navigating)\n React.useEffect(() => {\n const ref = cellRef.current;\n\n return () => {\n if (document.activeElement === ref || isElementInsideOrTriggeredFromContainer(document.activeElement, ref)) {\n handleBlur();\n }\n };\n }, []);\n\n const error = tableMeta.editing.getCellError<TType>(cell);\n\n const controlProps = {\n dataType: columnMeta.dataType,\n fontSize: tableMeta.fontSize.size,\n id: cell.column.id,\n invalid: !!error,\n isDetailedMode: tableMeta.editing.isDetailedMode,\n isTruncated: !!columnMeta.enableTruncate,\n onBlur: handleBlur,\n onChange: (value: unknown) => tableMeta.editing.setCellValue(cell, value, rowIndex),\n row: cell.row.original,\n rowPendingChanges: tableMeta.editing.getRowPendingChange(cell.row.id),\n tabIndex: isActiveRow ? 0 : -1,\n toggleEditing: tableMeta.editing.toggleEditing,\n toggleDetailedMode: tableMeta.editing.toggleDetailedMode,\n type: columnMeta.control ?? 'input',\n value: cell.getValue(),\n };\n\n const cellAttributes = {\n ...getCellAttributes(cell, index, isHighlighted),\n 'data-cell-editing-invalid': error ? true : undefined,\n 'data-taco': 'cell-control',\n onFocus: handleFocus,\n ref: cellRef,\n tabIndex: -1,\n };\n\n return (\n <td {...cellAttributes}>\n <Field invalid={!!error} message={error}>\n <MemoedEditingCell<TType> {...controlProps} />\n </Field>\n {\n // we show row move indicator here within the cell rather than the row because it is\n // an editing only feature, and we don't want to leak editing into the shared row component\n }\n <RowMoveIndicator cell={cell} cellRef={cellRef} isActiveRow={isActiveRow} />\n </td>\n );\n}\n\ntype MemoedEditingCellProps<TType = unknown, TValue = unknown> = {\n dataType?: TableColumnDataType;\n fontSize: TableFontSize;\n id: string;\n invalid: boolean;\n isDetailedMode: boolean;\n isTruncated: boolean;\n onBlur: () => void;\n onChange: (value: TValue) => void;\n row: TType;\n rowPendingChanges: Partial<TType> | undefined;\n tabIndex?: number;\n toggleEditing: (editing: React.SetStateAction<boolean>) => void;\n toggleDetailedMode: (detailed: React.SetStateAction<boolean>) => void;\n type: TableColumnRendererControl<TType>;\n value: TValue;\n};\n\nconst MemoedEditingCell = React.memo(function MemoedEditingCell<TType = unknown>(props: MemoedEditingCellProps<TType>) {\n const {\n dataType,\n fontSize,\n id,\n invalid,\n isDetailedMode,\n isTruncated,\n onBlur,\n onChange,\n row,\n rowPendingChanges,\n tabIndex = -1,\n toggleEditing,\n toggleDetailedMode,\n type = 'input',\n value,\n } = props;\n const controlRef = React.useRef<HTMLElement>(null);\n const currentValue = (row as any)[id];\n const commonProps = {\n onBlur,\n ref: controlRef,\n tabIndex,\n };\n\n if (typeof type === 'function') {\n const controlFnProps = {\n ...commonProps,\n invalid,\n setValue: onChange,\n value,\n };\n\n return type(controlFnProps, { ...row, ...rowPendingChanges });\n }\n\n if (type === 'switch') {\n return (\n <Switch\n {...commonProps}\n checked={Boolean(value)}\n onChange={onChange}\n ref={controlRef as React.RefObject<HTMLButtonElement>}\n />\n );\n }\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n const target = event.target as HTMLInputElement | HTMLTextAreaElement;\n\n if (target.readOnly) {\n return;\n }\n\n // prevent active row navigation while in detailed mode\n if (\n isDetailedMode &&\n (event.key === 'ArrowUp' || event.key === 'ArrowDown' || event.key === 'ArrowLeft' || event.key === 'ArrowRight')\n ) {\n event.stopPropagation();\n }\n\n // enter or exit detail mode when pressing enter\n if (event.key === 'Enter') {\n // textareas support shift and enter, don't prevent default in that case\n if (event.shiftKey && isDetailedMode) {\n return;\n }\n\n event.preventDefault();\n\n if (isDetailedMode) {\n target.select?.();\n } else {\n target.setSelectionRange?.(target.value?.length, target.value?.length);\n }\n\n toggleDetailedMode(editing => !editing);\n return;\n }\n\n // reset the value, or exit edit mode when pressing escape\n if (event.key === 'Escape') {\n event.preventDefault();\n\n if (isDetailedMode) {\n toggleDetailedMode(false);\n\n if (value !== currentValue) {\n props.onChange(currentValue);\n }\n\n // have to let onChange run before selecting, otherwise the value changes\n requestAnimationFrame(() => target.select?.());\n } else {\n toggleEditing(false);\n }\n\n return;\n }\n\n // toggle into detailed mode when actually inputting something\n if (!isPressingMetaKey(event) && (/^[a-z0-9]$/i.test(event.key) || event.key === 'Backspace')) {\n toggleDetailedMode(true);\n }\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (!isDetailedMode) {\n event.target.select();\n }\n };\n\n if (type === 'datepicker') {\n const valueAsDate = date.parse(value as Date | string | undefined);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newDate = (event as any).detail as Date;\n\n if (!valueAsDate || !newDate || (isDate(valueAsDate) && isDate(newDate) && !date.isWeakEqual(valueAsDate, newDate))) {\n props.onChange(newDate);\n }\n };\n\n return (\n <Datepicker\n {...commonProps}\n invalid={invalid}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleInputKeyDown}\n ref={controlRef as React.RefObject<HTMLInputElement>}\n value={valueAsDate}\n />\n );\n }\n\n if (type === 'textarea') {\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n onChange(event.target.value);\n };\n\n return (\n <TextareaWithAutosizing\n {...commonProps}\n fontSize={fontSize}\n invalid={invalid}\n isTruncated={isTruncated}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleInputKeyDown}\n ref={controlRef as React.RefObject<HTMLTextAreaElement>}\n value={String(value ?? '')}\n />\n );\n }\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange(dataType === 'number' && event.target.value ? Number.parseInt(event.target.value) : event.target.value);\n };\n\n return (\n <Input\n {...commonProps}\n invalid={invalid}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleInputKeyDown}\n ref={controlRef as React.RefObject<HTMLInputElement>}\n type={dataType === 'number' ? 'number' : undefined}\n value={dataType === 'number' ? (value as number) : String(value ?? '')}\n />\n );\n}) as <TType = unknown>(props: MemoedEditingCellProps<TType>) => JSX.Element;\n"],"names":["EditingControlCell","props","cell","cellRef","isHighlighted","index","rowIndex","React","useContext","RowContext","tableMeta","getContext","table","options","meta","columnMeta","column","columnDef","isActiveRow","rowActive","rowActiveIndex","handleFocus","useEditingCellAutofocus","handleBlur","editing","toggleDetailedMode","validateCell","useEffect","ref","current","document","activeElement","isElementInsideOrTriggeredFromContainer","error","getCellError","controlProps","dataType","fontSize","size","id","invalid","isDetailedMode","isTruncated","enableTruncate","onBlur","onChange","value","setCellValue","row","original","rowPendingChanges","getRowPendingChange","tabIndex","toggleEditing","type","_columnMeta$control","control","getValue","cellAttributes","getCellAttributes","undefined","onFocus","Field","message","MemoedEditingCell","RowMoveIndicator","memo","controlRef","useRef","currentValue","commonProps","controlFnProps","setValue","Switch","checked","Boolean","handleInputKeyDown","event","target","readOnly","key","stopPropagation","shiftKey","preventDefault","_target$select","select","call","_target$setSelectionR","_target$value","_target$value2","setSelectionRange","length","requestAnimationFrame","_target$select2","isPressingMetaKey","test","valueAsDate","date","handleChange","newDate","detail","isDate","Datepicker","onKeyDown","TextareaWithAutosizing","String","Number","parseInt","Input"],"mappings":";;;;;;;;;;;;;;;SAkBgBA,kBAAkBA,CAAkBC,KAAoC;;EACpF,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAEC,aAAa;IAAEC;GAAO,GAAGJ,KAAK;EACrD,MAAM;IAAEK;GAAU,GAAGC,cAAK,CAACC,UAAU,CAACC,UAAU,CAAC;EACjD,MAAMC,SAAS,GAAGR,IAAI,CAACS,UAAU,EAAE,CAACC,KAAK,CAACC,OAAO,CAACC,IAA6B;EAC/E,MAAMC,UAAU,GAAGb,IAAI,CAACc,MAAM,CAACC,SAAS,CAACH,IAA4C;EACrF,MAAMI,WAAW,GAAGR,SAAS,CAACS,SAAS,CAACC,cAAc,KAAKd,QAAQ;EAEnE,MAAMe,WAAW,GAAGC,uBAAuB,CAAQrB,KAAK,CAAC;EAEzD,MAAMsB,UAAU,GAAGA;IACfb,SAAS,CAACc,OAAO,CAACC,kBAAkB,CAAC,KAAK,CAAC;IAC3Cf,SAAS,CAACc,OAAO,CAACE,YAAY,CAACxB,IAAI,CAAC;GACvC;;EAGDK,cAAK,CAACoB,SAAS,CAAC;IACZ,MAAMC,GAAG,GAAGzB,OAAO,CAAC0B,OAAO;IAE3B,OAAO;MACH,IAAIC,QAAQ,CAACC,aAAa,KAAKH,GAAG,IAAII,uCAAuC,CAACF,QAAQ,CAACC,aAAa,EAAEH,GAAG,CAAC,EAAE;QACxGL,UAAU,EAAE;;KAEnB;GACJ,EAAE,EAAE,CAAC;EAEN,MAAMU,KAAK,GAAGvB,SAAS,CAACc,OAAO,CAACU,YAAY,CAAQhC,IAAI,CAAC;EAEzD,MAAMiC,YAAY,GAAG;IACjBC,QAAQ,EAAErB,UAAU,CAACq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,CAAC;KAC/B;IAED,oBACIvC,6BAACiG,sBAAsB,oBACflC,WAAW;MACfjC,QAAQ,EAAEA,QAAQ;MAClBG,OAAO,EAAEA,OAAO;MAChBE,WAAW,EAAEA,WAAW;MACxBG,QAAQ,EAAEqD,YAAY;MACtBrC,OAAO,EAAExC,WAAW;MACpBkF,SAAS,EAAE3B,kBAAkB;MAC7BhD,GAAG,EAAEuC,UAAkD;MACvDrB,KAAK,EAAE2D,MAAM,CAAC3D,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;OAC3B;;EAIV,MAAMoD,YAAY,GAAIrB,KAA0C;IAC5DhC,QAAQ,CAACT,QAAQ,KAAK,QAAQ,IAAIyC,KAAK,CAACC,MAAM,CAAChC,KAAK,GAAG4D,MAAM,CAACC,QAAQ,CAAC9B,KAAK,CAACC,MAAM,CAAChC,KAAK,CAAC,GAAG+B,KAAK,CAACC,MAAM,CAAChC,KAAK,CAAC;GACnH;EAED,oBACIvC,6BAACqG,KAAK,oBACEtC,WAAW;IACf9B,OAAO,EAAEA,OAAO;IAChBK,QAAQ,EAAEqD,YAAY;IACtBrC,OAAO,EAAExC,WAAW;IACpBkF,SAAS,EAAE3B,kBAAkB;IAC7BhD,GAAG,EAAEuC,UAA+C;IACpDb,IAAI,EAAElB,QAAQ,KAAK,QAAQ,GAAG,QAAQ,GAAGwB,SAAS;IAClDd,KAAK,EAAEV,QAAQ,KAAK,QAAQ,GAAIU,KAAgB,GAAG2D,MAAM,CAAC3D,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;KACvE;AAEV,CAAC,CAA2E;;;;"}
1
+ {"version":3,"file":"EditingControlCell.js","sources":["../../../../../../../../../../src/components/Table3/components/Columns/Cell/EditingControlCell.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta, ColumnMeta as ReactTableColumnMeta } from '@tanstack/react-table';\nimport { isDate } from 'date-fns';\nimport { Datepicker } from '../../../../Datepicker/Datepicker';\nimport { Switch } from '../../../../Switch/Switch';\nimport { Input } from '../../../../Input/Input';\nimport { TableColumnDataType, TableColumnRendererControl, TableFontSize } from '../../../../../primitives/Table/types';\nimport * as date from '../../../../../utils/date';\nimport { RowMoveIndicator } from './Editing/RowMoveIndicator';\nimport { TextareaWithAutosizing } from './Editing/TextareaWithAutosizing';\nimport { Field } from '../../../../Field/Field';\nimport { isElementInsideOrTriggeredFromContainer } from '../../../../../utils/dom';\nimport { TableCellRendererProps } from '../../../../../primitives/Table/Core/types';\nimport { RowContext } from '../../../../../primitives/Table/Core/components/Row/RowContext';\nimport { getCellAttributes } from '../../../../../primitives/Table/Core/components/Columns/Cell/util';\nimport { useEditingCellAutofocus } from './util';\nimport { isPressingMetaKey } from '../../../../../utils/keyboard';\nimport { Checkbox } from '../../../../Checkbox/Checkbox';\n\nexport function EditingControlCell<TType = unknown>(props: TableCellRendererProps<TType>) {\n const { cell, cellRef, isHighlighted, index } = props;\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = cell.getContext().table.options.meta as ReactTableMeta<TType>;\n const columnMeta = cell.column.columnDef.meta as ReactTableColumnMeta<TType, unknown>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;\n\n const handleFocus = useEditingCellAutofocus<TType>(props);\n\n const handleBlur = () => {\n tableMeta.editing.toggleDetailedMode(false);\n tableMeta.editing.validateCell(cell);\n };\n\n // ensure that blur runs when the cell gets unmounted (when vertically arrow key navigating)\n React.useEffect(() => {\n const ref = cellRef.current;\n\n return () => {\n if (document.activeElement === ref || isElementInsideOrTriggeredFromContainer(document.activeElement, ref)) {\n handleBlur();\n }\n };\n }, []);\n\n const error = tableMeta.editing.getCellError<TType>(cell);\n\n const controlProps = {\n dataType: columnMeta.dataType,\n fontSize: tableMeta.fontSize.size,\n id: cell.column.id,\n invalid: !!error,\n isDetailedMode: tableMeta.editing.isDetailedMode,\n isTruncated: !!columnMeta.enableTruncate,\n onBlur: handleBlur,\n onChange: (value: unknown) => tableMeta.editing.setCellValue(cell, value, rowIndex),\n row: cell.row.original,\n rowPendingChanges: tableMeta.editing.getRowPendingChange(cell.row.id),\n tabIndex: isActiveRow ? 0 : -1,\n toggleEditing: tableMeta.editing.toggleEditing,\n toggleDetailedMode: tableMeta.editing.toggleDetailedMode,\n type: columnMeta.control ?? 'input',\n value: cell.getValue(),\n };\n\n const cellAttributes = {\n ...getCellAttributes(cell, index, isHighlighted),\n 'data-cell-editing-invalid': error ? true : undefined,\n 'data-taco': 'cell-control',\n onFocus: handleFocus,\n ref: cellRef,\n tabIndex: -1,\n };\n\n return (\n <td {...cellAttributes}>\n <Field invalid={!!error} message={error}>\n <MemoedEditingCell<TType> {...controlProps} />\n </Field>\n {\n // we show row move indicator here within the cell rather than the row because it is\n // an editing only feature, and we don't want to leak editing into the shared row component\n }\n <RowMoveIndicator cell={cell} cellRef={cellRef} isActiveRow={isActiveRow} />\n </td>\n );\n}\n\ntype MemoedEditingCellProps<TType = unknown, TValue = unknown> = {\n dataType?: TableColumnDataType;\n fontSize: TableFontSize;\n id: string;\n invalid: boolean;\n isDetailedMode: boolean;\n isTruncated: boolean;\n onBlur: () => void;\n onChange: (value: TValue) => void;\n row: TType;\n rowPendingChanges: Partial<TType> | undefined;\n tabIndex?: number;\n toggleEditing: (editing: React.SetStateAction<boolean>) => void;\n toggleDetailedMode: (detailed: React.SetStateAction<boolean>) => void;\n type: TableColumnRendererControl<TType>;\n value: TValue;\n};\n\nconst MemoedEditingCell = React.memo(function MemoedEditingCell<TType = unknown>(props: MemoedEditingCellProps<TType>) {\n const {\n dataType,\n fontSize,\n id,\n invalid,\n isDetailedMode,\n isTruncated,\n onBlur,\n onChange,\n row,\n rowPendingChanges,\n tabIndex = -1,\n toggleEditing,\n toggleDetailedMode,\n type = 'input',\n value,\n } = props;\n const controlRef = React.useRef<HTMLElement>(null);\n const currentValue = row[id];\n const commonProps = {\n onBlur,\n ref: controlRef,\n tabIndex,\n };\n\n if (typeof type === 'function') {\n const controlFnProps = {\n ...commonProps,\n invalid,\n setValue: onChange,\n value,\n };\n\n return type(controlFnProps, { ...row, ...rowPendingChanges });\n }\n\n if (type === 'switch') {\n return (\n <Switch\n {...commonProps}\n checked={Boolean(value)}\n onChange={onChange}\n ref={controlRef as React.RefObject<HTMLButtonElement>}\n />\n );\n }\n\n if (type === 'checkbox') {\n return (\n <Checkbox\n {...commonProps}\n checked={Boolean(value)}\n onChange={onChange}\n ref={controlRef as React.RefObject<HTMLButtonElement>}\n />\n );\n }\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n const target = event.target as HTMLInputElement | HTMLTextAreaElement;\n\n if (target.readOnly) {\n return;\n }\n\n // prevent active row navigation while in detailed mode\n if (\n isDetailedMode &&\n (event.key === 'ArrowUp' || event.key === 'ArrowDown' || event.key === 'ArrowLeft' || event.key === 'ArrowRight')\n ) {\n event.stopPropagation();\n }\n\n // enter or exit detail mode when pressing enter\n if (event.key === 'Enter') {\n // textareas support shift and enter, don't prevent default in that case\n if (event.shiftKey && isDetailedMode) {\n return;\n }\n\n event.preventDefault();\n\n if (isDetailedMode) {\n target.select?.();\n } else {\n target.setSelectionRange?.(target.value?.length, target.value?.length);\n }\n\n toggleDetailedMode(editing => !editing);\n return;\n }\n\n // reset the value, or exit edit mode when pressing escape\n if (event.key === 'Escape') {\n event.preventDefault();\n\n if (isDetailedMode) {\n toggleDetailedMode(false);\n\n if (value !== currentValue) {\n props.onChange(currentValue);\n }\n\n // have to let onChange run before selecting, otherwise the value changes\n requestAnimationFrame(() => target.select?.());\n } else {\n toggleEditing(false);\n }\n\n return;\n }\n\n const shortcutWhitelist = ['f', 'p', 'e']; // f = search, p = print, and e = edit\n\n if (isPressingMetaKey(event) && !shortcutWhitelist.some(s => s === event.key)) {\n event.stopPropagation();\n }\n\n // toggle into detailed mode when actually inputting something\n if (!isPressingMetaKey(event) && (/^[a-z0-9]$/i.test(event.key) || event.key === 'Backspace')) {\n toggleDetailedMode(true);\n }\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (!isDetailedMode) {\n event.target.select();\n }\n };\n\n if (type === 'datepicker') {\n const valueAsDate = date.parse(value as Date | string | undefined);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newDate = (event as any).detail as Date;\n\n if (!valueAsDate || !newDate || (isDate(valueAsDate) && isDate(newDate) && !date.isWeakEqual(valueAsDate, newDate))) {\n props.onChange(newDate);\n }\n };\n\n return (\n <Datepicker\n {...commonProps}\n invalid={invalid}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleInputKeyDown}\n ref={controlRef as React.RefObject<HTMLInputElement>}\n value={valueAsDate}\n />\n );\n }\n\n if (type === 'textarea') {\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n onChange(event.target.value);\n };\n\n return (\n <TextareaWithAutosizing\n {...commonProps}\n fontSize={fontSize}\n invalid={invalid}\n isTruncated={isTruncated}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleInputKeyDown}\n ref={controlRef as React.RefObject<HTMLTextAreaElement>}\n value={String(value ?? '')}\n />\n );\n }\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange(dataType === 'number' && event.target.value ? Number.parseInt(event.target.value) : event.target.value);\n };\n\n return (\n <Input\n {...commonProps}\n invalid={invalid}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleInputKeyDown}\n ref={controlRef as React.RefObject<HTMLInputElement>}\n type={dataType === 'number' ? 'number' : undefined}\n value={dataType === 'number' ? (value as number) : String(value ?? '')}\n />\n );\n}) as <TType = unknown>(props: MemoedEditingCellProps<TType>) => JSX.Element;\n"],"names":["EditingControlCell","props","cell","cellRef","isHighlighted","index","rowIndex","React","useContext","RowContext","tableMeta","getContext","table","options","meta","columnMeta","column","columnDef","isActiveRow","rowActive","rowActiveIndex","handleFocus","useEditingCellAutofocus","handleBlur","editing","toggleDetailedMode","validateCell","useEffect","ref","current","document","activeElement","isElementInsideOrTriggeredFromContainer","error","getCellError","controlProps","dataType","fontSize","size","id","invalid","isDetailedMode","isTruncated","enableTruncate","onBlur","onChange","value","setCellValue","row","original","rowPendingChanges","getRowPendingChange","tabIndex","toggleEditing","type","_columnMeta$control","control","getValue","cellAttributes","getCellAttributes","undefined","onFocus","Field","message","MemoedEditingCell","RowMoveIndicator","memo","controlRef","useRef","currentValue","commonProps","controlFnProps","setValue","Switch","checked","Boolean","Checkbox","handleInputKeyDown","event","target","readOnly","key","stopPropagation","shiftKey","preventDefault","_target$select","select","call","_target$setSelectionR","_target$value","_target$value2","setSelectionRange","length","requestAnimationFrame","_target$select2","shortcutWhitelist","isPressingMetaKey","some","s","test","valueAsDate","date","handleChange","newDate","detail","isDate","Datepicker","onKeyDown","TextareaWithAutosizing","String","Number","parseInt","Input"],"mappings":";;;;;;;;;;;;;;;;SAmBgBA,kBAAkBA,CAAkBC,KAAoC;;EACpF,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAEC,aAAa;IAAEC;GAAO,GAAGJ,KAAK;EACrD,MAAM;IAAEK;GAAU,GAAGC,cAAK,CAACC,UAAU,CAACC,UAAU,CAAC;EACjD,MAAMC,SAAS,GAAGR,IAAI,CAACS,UAAU,EAAE,CAACC,KAAK,CAACC,OAAO,CAACC,IAA6B;EAC/E,MAAMC,UAAU,GAAGb,IAAI,CAACc,MAAM,CAACC,SAAS,CAACH,IAA4C;EACrF,MAAMI,WAAW,GAAGR,SAAS,CAACS,SAAS,CAACC,cAAc,KAAKd,QAAQ;EAEnE,MAAMe,WAAW,GAAGC,uBAAuB,CAAQrB,KAAK,CAAC;EAEzD,MAAMsB,UAAU,GAAGA;IACfb,SAAS,CAACc,OAAO,CAACC,kBAAkB,CAAC,KAAK,CAAC;IAC3Cf,SAAS,CAACc,OAAO,CAACE,YAAY,CAACxB,IAAI,CAAC;GACvC;;EAGDK,cAAK,CAACoB,SAAS,CAAC;IACZ,MAAMC,GAAG,GAAG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ACjC,KAAK,GAAGgE,MAAM,CAACC,QAAQ,CAACjC,KAAK,CAACC,MAAM,CAACjC,KAAK,CAAC,GAAGgC,KAAK,CAACC,MAAM,CAACjC,KAAK,CAAC;GACnH;EAED,oBACIvC,6BAACyG,KAAK,oBACE1C,WAAW;IACf9B,OAAO,EAAEA,OAAO;IAChBK,QAAQ,EAAEyD,YAAY;IACtBzC,OAAO,EAAExC,WAAW;IACpBsF,SAAS,EAAE9B,kBAAkB;IAC7BjD,GAAG,EAAEuC,UAA+C;IACpDb,IAAI,EAAElB,QAAQ,KAAK,QAAQ,GAAG,QAAQ,GAAGwB,SAAS;IAClDd,KAAK,EAAEV,QAAQ,KAAK,QAAQ,GAAIU,KAAgB,GAAG+D,MAAM,CAAC/D,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;KACvE;AAEV,CAAC,CAA2E;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditingActionsMenu.js","sources":["../../../../../../../../../../src/components/Table3/components/Columns/Internal/EditingActionsMenu.tsx"],"sourcesContent":["import React from 'react';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu } from '../../../../Menu/Menu';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Dialog, DialogProps } from '../../../../Dialog/Dialog';\nimport { Group } from '../../../../Group/Group';\nimport { Button } from '../../../../Button/Button';\n\ntype EditingActionMenuProps = {\n hasChanges: boolean;\n hasErrors: boolean;\n onClear: () => void;\n onExit: () => void;\n onEditingSave: () => Promise<void>;\n isLastRow: boolean;\n};\n\nexport function EditingActionMenu(props: EditingActionMenuProps) {\n const { hasChanges, hasErrors, onClear: handleClear, onExit: handleExit, onEditingSave: handleSave, isLastRow } = props;\n const { texts } = useLocalization();\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n // normally we handle this on change of active row, but when tabbing out of the last row the active row state stays on the last one.\n if (isLastRow && hasChanges && event.key === 'Tab') {\n handleSave();\n }\n };\n\n const handleMenuContentKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n // Stops the keyboard event from propagating to the Table when EditActionsMenu is open\n if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {\n event.stopPropagation();\n }\n };\n\n return (\n <IconButton\n appearance=\"transparent\"\n aria-label={texts.table3.editing.actions.tooltip}\n className=\"group-[[data-row-editing-status]]/row:hidden\"\n icon=\"more\"\n onKeyDown={handleKeyDown}\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content onKeyDown={handleMenuContentKeyDown}>\n <Menu.Item icon=\"tick\" disabled={!hasChanges || hasErrors} onClick={handleSave}>\n {texts.table3.editing.actions.save}\n </Menu.Item>\n <Menu.Item\n icon=\"close\"\n disabled={!hasChanges}\n dialog={props => <ConfirmClearChangesDialog {...props} onClear={handleClear} />}>\n {texts.table3.editing.actions.clear}\n </Menu.Item>\n <Menu.Item icon=\"undo\" onClick={handleExit}>\n {texts.table3.editing.actions.exit}\n </Menu.Item>\n </Menu.Content>\n </Menu>\n )}\n />\n );\n}\n\ntype ConfirmClearChangesDialogProps = Partial<DialogProps> & {\n onClear: () => void;\n};\n\nfunction ConfirmClearChangesDialog(props: ConfirmClearChangesDialogProps) {\n const { onClear: handleClear, ...dialogProps } = props;\n const { texts } = useLocalization();\n\n const handleClickInsideDialogContent = (event: React.MouseEvent) => {\n // Prevents the click event from propagating to the table, ensuring the row isn't saved when a click occurs\n // inside the dialog\n event.stopPropagation();\n };\n\n return (\n <Dialog {...dialogProps}>\n <Dialog.Content\n aria-label={texts.table3.editing.clearChangesConfirmationDialog.title}\n onClick={handleClickInsideDialogContent}>\n <Dialog.Title>{texts.table3.editing.clearChangesConfirmationDialog.title}</Dialog.Title>\n\n <p>{texts.table3.editing.clearChangesConfirmationDialog.description}</p>\n\n <Dialog.Footer>\n <Group>\n <Dialog.Close>\n <Button tabIndex={0}>{texts.table3.editing.clearChangesConfirmationDialog.cancel}</Button>\n </Dialog.Close>\n <Dialog.Close>\n <Button autoFocus tabIndex={0} appearance=\"primary\" onClick={handleClear}>\n {texts.table3.editing.clearChangesConfirmationDialog.confirm}\n </Button>\n </Dialog.Close>\n </Group>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n );\n}\n"],"names":["EditingActionMenu","props","hasChanges","hasErrors","onClear","handleClear","onExit","handleExit","onEditingSave","handleSave","isLastRow","texts","useLocalization","handleKeyDown","event","key","handleMenuContentKeyDown","stopPropagation","React","IconButton","appearance","table3","editing","actions","tooltip","className","icon","onKeyDown","menu","menuProps","Menu","Content","Item","disabled","onClick","save","dialog","ConfirmClearChangesDialog","clear","exit","dialogProps","handleClickInsideDialogContent","Dialog","clearChangesConfirmationDialog","title","Title","description","Footer","Group","Close","Button","tabIndex","cancel","autoFocus","confirm"],"mappings":";;;;;;;;SAiBgBA,iBAAiBA,CAACC,KAA6B;EAC3D,MAAM;IAAEC,UAAU;IAAEC,SAAS;IAAEC,OAAO,EAAEC,WAAW;IAAEC,MAAM,EAAEC,UAAU;IAAEC,aAAa,EAAEC,UAAU;IAAEC;GAAW,GAAGT,KAAK;EACvH,MAAM;IAAEU;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,aAAa,GAAIC,KAA0B;;IAE7C,IAAIJ,SAAS,IAAIR,UAAU,IAAIY,KAAK,CAACC,GAAG,KAAK,KAAK,EAAE;MAChDN,UAAU,EAAE;;GAEnB;EAED,MAAMO,wBAAwB,GAAIF,KAA0C;;IAExE,IAAIA,KAAK,CAACC,GAAG,KAAK,WAAW,IAAID,KAAK,CAACC,GAAG,KAAK,YAAY,EAAE;MACzDD,KAAK,CAACG,eAAe,EAAE;;GAE9B;EAED,oBACIC,6BAACC,UAAU;IACPC,UAAU,EAAC,aAAa;kBACZT,KAAK,CAACU,MAAM,CAACC,OAAO,CAACC,OAAO,CAACC,OAAO;IAChDC,SAAS,EAAC,8CAA8C;IACxDC,IAAI,EAAC,MAAM;IACXC,SAAS,EAAEd,aAAa;IACxBe,IAAI,EAAEC,SAAS,kBACXX,6BAACY,IAAI,oBA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,OAAO,CAACqB,8BAA8B,CAACG,WAAW,CAAK,eAExE5B,6BAACwB,MAAM,CAACK,MAAM,qBACV7B,6BAAC8B,KAAK,qBACF9B,6BAACwB,MAAM,CAACO,KAAK,qBACT/B,6BAACgC,MAAM;IAACC,QAAQ,EAAE;KAAIxC,KAAK,CAACU,MAAM,CAACC,OAAO,CAACqB,8BAA8B,CAACS,MAAM,CAAU,CAC/E,eACflC,6BAACwB,MAAM,CAACO,KAAK,qBACT/B,6BAACgC,MAAM;IAACG,SAAS;IAACF,QAAQ,EAAE,CAAC;IAAE/B,UAAU,EAAC,SAAS;IAACc,OAAO,EAAE7B;KACxDM,KAAK,CAACU,MAAM,CAACC,OAAO,CAACqB,8BAA8B,CAACW,OAAO,CACvD,CACE,CACX,CACI,CACH,CACZ;AAEjB;;;;"}
1
+ {"version":3,"file":"EditingActionsMenu.js","sources":["../../../../../../../../../../src/components/Table3/components/Columns/Internal/EditingActionsMenu.tsx"],"sourcesContent":["import React from 'react';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu } from '../../../../Menu/Menu';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Dialog, DialogProps } from '../../../../Dialog/Dialog';\nimport { Group } from '../../../../Group/Group';\nimport { Button } from '../../../../Button/Button';\n\ntype EditingActionMenuProps = {\n hasChanges: boolean;\n hasErrors: boolean;\n onClear: () => void;\n onExit: () => void;\n onEditingSave: () => Promise<void>;\n isLastRow: boolean;\n};\n\nexport function EditingActionMenu(props: EditingActionMenuProps) {\n const { hasChanges, hasErrors, onClear: handleClear, onExit: handleExit, onEditingSave: handleSave, isLastRow } = props;\n const { texts } = useLocalization();\n\n const handleKeyDown = event => {\n // normally we handle this on change of active row, but when tabbing out of the last row the active row state stays on the last one.\n if (isLastRow && hasChanges && event.key === 'Tab') {\n handleSave();\n }\n };\n\n const handleMenuContentKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n // Stops the keyboard event from propagating to the Table when EditActionsMenu is open\n if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {\n event.stopPropagation();\n }\n };\n\n return (\n <IconButton\n appearance=\"transparent\"\n aria-label={texts.table3.editing.actions.tooltip}\n className=\"group-[[data-row-editing-status]]/row:hidden\"\n icon=\"more\"\n onKeyDown={handleKeyDown}\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content onKeyDown={handleMenuContentKeyDown}>\n <Menu.Item icon=\"tick\" disabled={!hasChanges || hasErrors} onClick={handleSave}>\n {texts.table3.editing.actions.save}\n </Menu.Item>\n <Menu.Item\n icon=\"close\"\n disabled={!hasChanges}\n dialog={props => <ConfirmClearChangesDialog {...props} onClear={handleClear} />}>\n {texts.table3.editing.actions.clear}\n </Menu.Item>\n <Menu.Item icon=\"undo\" onClick={handleExit}>\n {texts.table3.editing.actions.exit}\n </Menu.Item>\n </Menu.Content>\n </Menu>\n )}\n />\n );\n}\n\ntype ConfirmClearChangesDialogProps = Partial<DialogProps> & {\n onClear: () => void;\n};\n\nfunction ConfirmClearChangesDialog(props: ConfirmClearChangesDialogProps) {\n const { onClear: handleClear, ...dialogProps } = props;\n const { texts } = useLocalization();\n\n const handleClickInsideDialogContent = (event: React.MouseEvent) => {\n // Prevents the click event from propagating to the table, ensuring the row isn't saved when a click occurs\n // inside the dialog\n event.stopPropagation();\n };\n\n return (\n <Dialog {...dialogProps}>\n <Dialog.Content\n aria-label={texts.table3.editing.clearChangesConfirmationDialog.title}\n onClick={handleClickInsideDialogContent}>\n <Dialog.Title>{texts.table3.editing.clearChangesConfirmationDialog.title}</Dialog.Title>\n\n <p>{texts.table3.editing.clearChangesConfirmationDialog.description}</p>\n\n <Dialog.Footer>\n <Group>\n <Dialog.Close>\n <Button tabIndex={0}>{texts.table3.editing.clearChangesConfirmationDialog.cancel}</Button>\n </Dialog.Close>\n <Dialog.Close>\n <Button autoFocus tabIndex={0} appearance=\"primary\" onClick={handleClear}>\n {texts.table3.editing.clearChangesConfirmationDialog.confirm}\n </Button>\n </Dialog.Close>\n </Group>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n );\n}\n"],"names":["EditingActionMenu","props","hasChanges","hasErrors","onClear","handleClear","onExit","handleExit","onEditingSave","handleSave","isLastRow","texts","useLocalization","handleKeyDown","event","key","handleMenuContentKeyDown","stopPropagation","React","IconButton","appearance","table3","editing","actions","tooltip","className","icon","onKeyDown","menu","menuProps","Menu","Content","Item","disabled","onClick","save","dialog","ConfirmClearChangesDialog","clear","exit","dialogProps","handleClickInsideDialogContent","Dialog","clearChangesConfirmationDialog","title","Title","description","Footer","Group","Close","Button","tabIndex","cancel","autoFocus","confirm"],"mappings":";;;;;;;;SAiBgBA,iBAAiBA,CAACC,KAA6B;EAC3D,MAAM;IAAEC,UAAU;IAAEC,SAAS;IAAEC,OAAO,EAAEC,WAAW;IAAEC,MAAM,EAAEC,UAAU;IAAEC,aAAa,EAAEC,UAAU;IAAEC;GAAW,GAAGT,KAAK;EACvH,MAAM;IAAEU;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,aAAa,GAAGC,KAAK;;IAEvB,IAAIJ,SAAS,IAAIR,UAAU,IAAIY,KAAK,CAACC,GAAG,KAAK,KAAK,EAAE;MAChDN,UAAU,EAAE;;GAEnB;EAED,MAAMO,wBAAwB,GAAIF,KAA0C;;IAExE,IAAIA,KAAK,CAACC,GAAG,KAAK,WAAW,IAAID,KAAK,CAACC,GAAG,KAAK,YAAY,EAAE;MACzDD,KAAK,CAACG,eAAe,EAAE;;GAE9B;EAED,oBACIC,6BAACC,UAAU;IACPC,UAAU,EAAC,aAAa;kBACZT,KAAK,CAACU,MAAM,CAACC,OAAO,CAACC,OAAO,CAACC,OAAO;IAChDC,SAAS,EAAC,8CAA8C;IACxDC,IAAI,EAAC,MAAM;IACXC,SAAS,EAAEd,aAAa;IACxBe,IAAI,EAAEC,SAAS,kBACXX,6BAACY,IAAI,oBAAKD,SAAS,gBACfX,6BAACY,IAAI,CAACC,OAAO;MAACJ,SAAS,EAAEX;oBAC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K,MAAM,qBACV7B,6BAAC8B,KAAK,qBACF9B,6BAACwB,MAAM,CAACO,KAAK,qBACT/B,6BAACgC,MAAM;IAACC,QAAQ,EAAE;KAAIxC,KAAK,CAACU,MAAM,CAACC,OAAO,CAACqB,8BAA8B,CAACS,MAAM,CAAU,CAC/E,eACflC,6BAACwB,MAAM,CAACO,KAAK,qBACT/B,6BAACgC,MAAM;IAACG,SAAS;IAACF,QAAQ,EAAE,CAAC;IAAE/B,UAAU,EAAC,SAAS;IAACc,OAAO,EAAE7B;KACxDM,KAAK,CAACU,MAAM,CAACC,OAAO,CAACqB,8BAA8B,CAACW,OAAO,CACvD,CACE,CACX,CACI,CACH,CACZ;AAEjB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","sources":["../../../../../../../../../src/components/Table3/components/Editing/Alert.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { ScrollToOptions as ReactVirtualScrollToOptions } from '@tanstack/react-virtual';\nimport { Alert as BaseAlert, AlertProps as BaseAlertProps } from '../../../Alert/Alert';\nimport { TableRef } from '../../../../primitives/Table/types';\nimport { Tooltip } from '../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Dialog, DialogProps } from '../../../Dialog/Dialog';\nimport { Group } from '../../../Group/Group';\nimport { Button } from '../../../Button/Button';\n\ntype AlertProps<TType = unknown> = Omit<BaseAlertProps, 'children'> & {\n scrollToIndex: (index: number, options: ReactVirtualScrollToOptions) => void;\n table: ReactTable<TType>;\n tableRef: React.RefObject<TableRef>;\n};\n\nexport function Alert<TType = unknown>(props: AlertProps<TType>) {\n const { scrollToIndex, table, tableRef, ...attributes } = props;\n const { texts } = useLocalization();\n const validationTexts = texts.table3.editing.validation;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const [showFilterResetDialog, setShowFilterResetDialog] = React.useState<string | false>(false);\n const pendingChangesWithErrors = tableMeta.editing.getAlertErrors<TType>();\n\n function scrollToRow(rowIndex: number) {\n tableMeta.rowActive.setRowActiveIndex(rowIndex);\n scrollToIndex(rowIndex, { align: 'center' });\n\n requestAnimationFrame(() => {\n const cell = tableRef.current?.querySelector(\n 'tbody > tr[data-row-active=\"true\"] > td[data-cell-editing-invalid=\"true\"]'\n );\n\n if (cell) {\n (cell as HTMLElement).focus?.();\n }\n });\n }\n\n // generate the \"N unsaved entries\" title\n const title = (\n pendingChangesWithErrors.length === 1 ? validationTexts.alert.titleOne : validationTexts.alert.titlePlural\n ).replace('[COUNT]', String(pendingChangesWithErrors.length));\n\n // generate links to each invalid row, to go into the error message\n const links: React.ReactNode[] = [];\n const rowIdentityColumn = tableMeta.rowIdentityColumnId ? table.getColumn(tableMeta.rowIdentityColumnId) : undefined;\n\n pendingChangesWithErrors.forEach((error, index) => {\n // if appropriate, concatenate the item with the text \"and\"\n if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {\n // Add space before and after `messageAnd` text\n links.push(` ${validationTexts.alert.messageAnd} `);\n }\n const rowIndex = table.getRowModel().rows.findIndex(row => row.id === error.rowId);\n\n const handleClick = () => {\n if (rowIndex > -1) {\n scrollToRow(rowIndex);\n } else {\n setShowFilterResetDialog(error.rowId);\n }\n };\n\n let tooltip;\n\n if (error.pendingChange._meta.errors.row) {\n tooltip = error.pendingChange._meta.errors.row;\n } else {\n const firstCellErrorColumnId = Object.keys(error.pendingChange._meta.errors.cells)[0];\n const columnName = table.getAllColumns().find(column => column.id === firstCellErrorColumnId)?.columnDef.meta?.header;\n tooltip = `${columnName}: ${error.pendingChange._meta.errors.cells[firstCellErrorColumnId]}`;\n }\n\n links.push(\n <Tooltip key={error.rowId} title={tooltip}>\n <span className=\"text-blue\" onClick={handleClick} role=\"button\">\n {rowIdentityColumn ? (error.pendingChange._meta.original as any)[rowIdentityColumn.id] : rowIndex + 1}\n </span>\n </Tooltip>\n );\n\n // if appropriate, concatenate the item with the text \",\"\n if (pendingChangesWithErrors.length > 2 && index < pendingChangesWithErrors.length - 2) {\n links.push(', ');\n }\n });\n\n // generate the \"Row N is incomplete and hasn't been saved\" error message\n const message = (links.length === 1 ? validationTexts.alert.messageOne : validationTexts.alert.messagePlural)\n .split(/(\\[\\w+\\])/)\n .map(part => {\n if (part === '[COLUMN]') {\n return rowIdentityColumn?.columnDef.meta?.header ?? validationTexts.alert.messageRow;\n }\n\n if (part === '[ROW]') {\n return links;\n }\n\n return part;\n });\n\n const handleResetFilters = () => {\n table.resetGlobalFilter();\n table.resetColumnFilters();\n\n requestAnimationFrame(() => {\n const rowIndex = table.getRowModel().rows.findIndex(row => row.id === showFilterResetDialog);\n\n if (rowIndex > -1) {\n scrollToRow(rowIndex);\n }\n\n setShowFilterResetDialog(false);\n });\n };\n\n return (\n <>\n <BaseAlert {...attributes} state=\"error\">\n <span className=\"font-bold\">{title}</span>&nbsp;{message}\n </BaseAlert>\n <FilterResetDialog\n open={showFilterResetDialog !== false}\n onChange={() => setShowFilterResetDialog(false)}\n onSubmit={handleResetFilters}\n />\n </>\n );\n}\n\ntype FilterResetDialogProps = Omit<DialogProps, 'children'> & {\n onSubmit: () => void;\n};\n\nfunction FilterResetDialog(props: FilterResetDialogProps) {\n const { onSubmit: handleSubmit, ...dialogProps } = props;\n const { texts } = useLocalization();\n\n return (\n <Dialog {...dialogProps} size=\"xs\">\n <Dialog.Content aria-label=\"Create a new account\">\n <Dialog.Title>{texts.table3.editing.validation.resetFiltersDialog.title}</Dialog.Title>\n\n <p>{texts.table3.editing.validation.resetFiltersDialog.description}</p>\n\n <Dialog.Footer>\n <Group>\n <Dialog.Close>\n <Button>{texts.table3.editing.validation.resetFiltersDialog.cancel}</Button>\n </Dialog.Close>\n <Button appearance=\"primary\" onClick={handleSubmit}>\n {texts.table3.editing.validation.resetFiltersDialog.confirm}\n </Button>\n </Group>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n );\n}\n"],"names":["Alert","props","scrollToIndex","table","tableRef","attributes","texts","useLocalization","validationTexts","table3","editing","validation","tableMeta","options","meta","showFilterResetDialog","setShowFilterResetDialog","React","useState","pendingChangesWithErrors","getAlertErrors","scrollToRow","rowIndex","rowActive","setRowActiveIndex","align","requestAnimationFrame","cell","_tableRef$current","current","querySelector","_cell$focus","focus","call","title","length","alert","titleOne","titlePlural","replace","String","links","rowIdentityColumn","rowIdentityColumnId","getColumn","undefined","forEach","error","index","push","messageAnd","getRowModel","rows","findIndex","row","id","rowId","handleClick","tooltip","pendingChange","_meta","errors","_table$getAllColumns$","_table$getAllColumns$2","firstCellErrorColumnId","Object","keys","cells","columnName","getAllColumns","find","column","columnDef","header","Tooltip","key","className","onClick","role","original","message","messageOne","messagePlural","split","map","part","_rowIdentityColumn$co","_rowIdentityColumn$co2","messageRow","handleResetFilters","resetGlobalFilter","resetColumnFilters","BaseAlert","state","FilterResetDialog","open","onChange","onSubmit","handleSubmit","dialogProps","Dialog","size","Content","Title","resetFiltersDialog","description","Footer","Group","Close","Button","cancel","appearance","confirm"],"mappings":";;;;;;;;SAiBgBA,KAAKA,CAAkBC,KAAwB;EAC3D,MAAM;IAAEC,aAAa;IAAEC,KAAK;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAC/D,MAAM;IAAEK;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,eAAe,GAAGF,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,UAAU;EACvD,MAAMC,SAAS,GAAGT,KAAK,CAACU,OAAO,CAACC,IAA6B;EAC7D,MAAM,CAACC,qBAAqB,EAAEC,wBAAwB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAiB,KAAK,CAAC;EAC/F,MAAMC,wBAAwB,GAAGP,SAAS,CAACF,OAAO,CAACU,cAAc,EAAS;EAE1E,SAASC,WAAWA,CAACC,QAAgB;IACjCV,SAAS,CAACW,SAAS,CAACC,iBAAiB,CAACF,QAAQ,CAAC;IAC/CpB,aAAa,CAACoB,QAAQ,EAAE;MAAEG,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O,CAChD,eACZ/D,6BAAC6E,iBAAiB;IACdC,IAAI,EAAEhF,qBAAqB,KAAK,KAAK;IACrCiF,QAAQ,EAAEA,MAAMhF,wBAAwB,CAAC,KAAK,CAAC;IAC/CiF,QAAQ,EAAER;IACZ,CACH;AAEX;AAMA,SAASK,iBAAiBA,CAAC7F,KAA6B;EACpD,MAAM;IAAEgG,QAAQ,EAAEC,YAAY;IAAE,GAAGC;GAAa,GAAGlG,KAAK;EACxD,MAAM;IAAEK;GAAO,GAAGC,eAAe,EAAE;EAEnC,oBACIU,6BAACmF,MAAM,oBAAKD,WAAW;IAAEE,IAAI,EAAC;mBAC1BpF,6BAACmF,MAAM,CAACE,OAAO;kBAAY;kBACvBrF,6BAACmF,MAAM,CAACG,KAAK,QAAEjG,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,UAAU,CAAC6F,kBAAkB,CAACtE,KAAK,CAAgB,eAEvFjB,wCAAIX,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,UAAU,CAAC6F,kBAAkB,CAACC,WAAW,CAAK,eAEvExF,6BAACmF,MAAM,CAACM,MAAM,qBACVzF,6BAAC0F,KAAK,qBACF1F,6BAACmF,MAAM,CAACQ,KAAK,qBACT3F,6BAAC4F,MAAM,QAAEvG,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,UAAU,CAAC6F,kBAAkB,CAACM,MAAM,CAAU,CACjE,eACf7F,6BAAC4F,MAAM;IAACE,UAAU,EAAC,SAAS;IAAClC,OAAO,EAAEqB;KACjC5F,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,UAAU,CAAC6F,kBAAkB,CAACQ,OAAO,CACtD,CACL,CACI,CACH,CACZ;AAEjB;;;;"}
1
+ {"version":3,"file":"Alert.js","sources":["../../../../../../../../../src/components/Table3/components/Editing/Alert.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { ScrollToOptions as ReactVirtualScrollToOptions } from '@tanstack/react-virtual';\nimport { Alert as BaseAlert, AlertProps as BaseAlertProps } from '../../../Alert/Alert';\nimport { TableRef } from '../../../../primitives/Table/types';\nimport { Tooltip } from '../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Dialog, DialogProps } from '../../../Dialog/Dialog';\nimport { Group } from '../../../Group/Group';\nimport { Button } from '../../../Button/Button';\n\ntype AlertProps<TType = unknown> = Omit<BaseAlertProps, 'children'> & {\n scrollToIndex: (index: number, options: ReactVirtualScrollToOptions) => void;\n table: ReactTable<TType>;\n tableRef: React.RefObject<TableRef>;\n};\n\nexport function Alert<TType = unknown>(props: AlertProps<TType>) {\n const { scrollToIndex, table, tableRef, ...attributes } = props;\n const { texts } = useLocalization();\n const validationTexts = texts.table3.editing.validation;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const [showFilterResetDialog, setShowFilterResetDialog] = React.useState<string | false>(false);\n const pendingChangesWithErrors = tableMeta.editing.getAlertErrors<TType>();\n\n function scrollToRow(rowIndex: number) {\n tableMeta.rowActive.setRowActiveIndex(rowIndex);\n scrollToIndex(rowIndex, { align: 'center' });\n\n requestAnimationFrame(() => {\n const cell = tableRef.current?.querySelector(\n 'tbody > tr[data-row-active=\"true\"] > td[data-cell-editing-invalid=\"true\"]'\n );\n\n if (cell) {\n (cell as HTMLElement).focus?.();\n }\n });\n }\n\n // generate the \"N unsaved entries\" title\n const title = (\n pendingChangesWithErrors.length === 1 ? validationTexts.alert.titleOne : validationTexts.alert.titlePlural\n ).replace('[COUNT]', String(pendingChangesWithErrors.length));\n\n // generate links to each invalid row, to go into the error message\n const links: React.ReactNode[] = [];\n const rowIdentityColumn = tableMeta.rowIdentityColumnId ? table.getColumn(tableMeta.rowIdentityColumnId) : undefined;\n\n pendingChangesWithErrors.forEach((error, index) => {\n // if appropriate, concatenate the item with the text \"and\"\n if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {\n // Add space before and after `messageAnd` text\n links.push(` ${validationTexts.alert.messageAnd} `);\n }\n const rowIndex = table.getRowModel().rows.findIndex(row => row.id === error.rowId);\n\n const handleClick = () => {\n if (rowIndex > -1) {\n scrollToRow(rowIndex);\n } else {\n setShowFilterResetDialog(error.rowId);\n }\n };\n\n let tooltip;\n\n if (error.pendingChange._meta.errors.row) {\n tooltip = error.pendingChange._meta.errors.row;\n } else {\n const firstCellErrorColumnId = Object.keys(error.pendingChange._meta.errors.cells)[0];\n const columnName = table.getAllColumns().find(column => column.id === firstCellErrorColumnId)?.columnDef.meta?.header;\n tooltip = `${columnName}: ${error.pendingChange._meta.errors.cells[firstCellErrorColumnId]}`;\n }\n\n links.push(\n <Tooltip key={error.rowId} title={tooltip}>\n <span className=\"text-blue\" onClick={handleClick} role=\"button\">\n {rowIdentityColumn ? error.pendingChange._meta.original[rowIdentityColumn.id] : rowIndex + 1}\n </span>\n </Tooltip>\n );\n\n // if appropriate, concatenate the item with the text \",\"\n if (pendingChangesWithErrors.length > 2 && index < pendingChangesWithErrors.length - 2) {\n links.push(', ');\n }\n });\n\n // generate the \"Row N is incomplete and hasn't been saved\" error message\n const message = (links.length === 1 ? validationTexts.alert.messageOne : validationTexts.alert.messagePlural)\n .split(/(\\[\\w+\\])/)\n .map(part => {\n if (part === '[COLUMN]') {\n return rowIdentityColumn?.columnDef.meta?.header ?? validationTexts.alert.messageRow;\n }\n\n if (part === '[ROW]') {\n return links;\n }\n\n return part;\n });\n\n const handleResetFilters = () => {\n table.resetGlobalFilter();\n table.resetColumnFilters();\n\n requestAnimationFrame(() => {\n const rowIndex = table.getRowModel().rows.findIndex(row => row.id === showFilterResetDialog);\n\n if (rowIndex > -1) {\n scrollToRow(rowIndex);\n }\n\n setShowFilterResetDialog(false);\n });\n };\n\n return (\n <>\n <BaseAlert {...attributes} state=\"error\">\n <span className=\"font-bold\">{title}</span>&nbsp;{message}\n </BaseAlert>\n <FilterResetDialog\n open={showFilterResetDialog !== false}\n onChange={() => setShowFilterResetDialog(false)}\n onSubmit={handleResetFilters}\n />\n </>\n );\n}\n\ntype FilterResetDialogProps = Omit<DialogProps, 'children'> & {\n onSubmit: () => void;\n};\n\nfunction FilterResetDialog(props: FilterResetDialogProps) {\n const { onSubmit: handleSubmit, ...dialogProps } = props;\n const { texts } = useLocalization();\n\n return (\n <Dialog {...dialogProps} size=\"xs\">\n <Dialog.Content aria-label=\"Create a new account\">\n <Dialog.Title>{texts.table3.editing.validation.resetFiltersDialog.title}</Dialog.Title>\n\n <p>{texts.table3.editing.validation.resetFiltersDialog.description}</p>\n\n <Dialog.Footer>\n <Group>\n <Dialog.Close>\n <Button>{texts.table3.editing.validation.resetFiltersDialog.cancel}</Button>\n </Dialog.Close>\n <Button appearance=\"primary\" onClick={handleSubmit}>\n {texts.table3.editing.validation.resetFiltersDialog.confirm}\n </Button>\n </Group>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n );\n}\n"],"names":["Alert","props","scrollToIndex","table","tableRef","attributes","texts","useLocalization","validationTexts","table3","editing","validation","tableMeta","options","meta","showFilterResetDialog","setShowFilterResetDialog","React","useState","pendingChangesWithErrors","getAlertErrors","scrollToRow","rowIndex","rowActive","setRowActiveIndex","align","requestAnimationFrame","cell","_tableRef$current","current","querySelector","_cell$focus","focus","call","title","length","alert","titleOne","titlePlural","replace","String","links","rowIdentityColumn","rowIdentityColumnId","getColumn","undefined","forEach","error","index","push","messageAnd","getRowModel","rows","findIndex","row","id","rowId","handleClick","tooltip","pendingChange","_meta","errors","_table$getAllColumns$","_table$getAllColumns$2","firstCellErrorColumnId","Object","keys","cells","columnName","getAllColumns","find","column","columnDef","header","Tooltip","key","className","onClick","role","original","message","messageOne","messagePlural","split","map","part","_rowIdentityColumn$co","_rowIdentityColumn$co2","messageRow","handleResetFilters","resetGlobalFilter","resetColumnFilters","BaseAlert","state","FilterResetDialog","open","onChange","onSubmit","handleSubmit","dialogProps","Dialog","size","Content","Title","resetFiltersDialog","description","Footer","Group","Close","Button","cancel","appearance","confirm"],"mappings":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AkB,CAACC,WAAW,CAAK,eAEvExF,6BAACmF,MAAM,CAACM,MAAM,qBACVzF,6BAAC0F,KAAK,qBACF1F,6BAACmF,MAAM,CAACQ,KAAK,qBACT3F,6BAAC4F,MAAM,QAAEvG,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,UAAU,CAAC6F,kBAAkB,CAACM,MAAM,CAAU,CACjE,eACf7F,6BAAC4F,MAAM;IAACE,UAAU,EAAC,SAAS;IAAClC,OAAO,EAAEqB;KACjC5F,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,UAAU,CAAC6F,kBAAkB,CAACQ,OAAO,CACtD,CACL,CACI,CACH,CACZ;AAEjB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CreateRowButton.js","sources":["../../../../../../../../../../src/components/Table3/components/Row/Editing/CreateRowButton.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { ScrollToOptions } from '@tanstack/react-virtual';\nimport { Button } from '../../../../Button/Button';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { animateCreateRow } from '../../../util/editing';\n\ntype Props<TType = unknown> = {\n table: ReactTable<TType>;\n tableMeta: ReactTableMeta<TType>;\n onEditingCreate: (() => (row: Partial<TType>) => boolean) | undefined;\n scrollToIndex: (index: number, options?: ScrollToOptions) => void;\n};\n\nexport default function CreateNewRowButton<TType = unknown>(props: Props<TType>) {\n const { onEditingCreate, scrollToIndex, table, tableMeta } = props;\n const { texts } = useLocalization();\n const rows = table.getCoreRowModel().rows.filter(row => row.original !== undefined);\n\n const [rowCreated, setRowCreated] = React.useState<{ rowFinder: ((row: Partial<TType>) => boolean) | undefined }>({\n rowFinder: undefined,\n });\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (!tableMeta.editing.hasChanges() && event.key === 'Tab') {\n tableMeta.editing.saveChanges();\n }\n };\n\n const handleCreate = async () => {\n if (!onEditingCreate) {\n return;\n }\n const createdRow = rows.find(row => rowCreated?.rowFinder?.(row.original));\n\n if (createdRow) {\n await tableMeta.editing.saveChanges();\n\n if (!tableMeta.editing.hasRowErrors(createdRow.id)) {\n const rowFinder = onEditingCreate();\n\n setRowCreated({ rowFinder });\n }\n } else {\n const rowFinder = onEditingCreate();\n setRowCreated({ rowFinder });\n }\n };\n\n React.useEffect(() => {\n if (typeof rowCreated?.rowFinder === 'function') {\n const createdRow = rows.find(row => rowCreated?.rowFinder?.(row.original));\n\n if (createdRow) {\n const rowInTable = table\n .getRowModel()\n .rows.filter(row => row.original !== undefined)\n .find(row => rowCreated?.rowFinder?.(row.original));\n if (rowInTable) {\n tableMeta.editing.toggleEditing(true);\n tableMeta.rowActive.setRowActiveIndex(createdRow.index);\n scrollToIndex(createdRow.index);\n requestAnimationFrame(() => animateCreateRow(createdRow.id));\n }\n requestAnimationFrame(() => tableMeta.editing.addCreatedRowChangeset(createdRow as any));\n }\n }\n }, [rowCreated]);\n\n return (\n <tr\n onClick={handleCreate}\n className=\"border-grey-300 hover:bg-grey-100 group !sticky bottom-10 left-0 z-[21] !block cursor-pointer border-t\">\n <td className=\"!border-t-0 !bg-transparent\">\n <Button onKeyDown={handleKeyDown} className=\"group-hover:bg-grey-200 sticky left-0\" appearance=\"transparent\">\n + {texts.table3.editing.buttons.create.label}\n </Button>\n </td>\n </tr>\n );\n}\n"],"names":["CreateNewRowButton","props","onEditingCreate","scrollToIndex","table","tableMeta","texts","useLocalization","rows","getCoreRowModel","filter","row","original","undefined","rowCreated","setRowCreated","React","useState","rowFinder","handleKeyDown","event","editing","hasChanges","key","saveChanges","handleCreate","Promise","resolve","createdRow","find","_rowCreated$rowFinder","call","_temp","then","hasRowErrors","id","e","reject","useEffect","_rowCreated$rowFinder2","rowInTable","getRowModel","_rowCreated$rowFinder3","toggleEditing","rowActive","setRowActiveIndex","index","requestAnimationFrame","animateCreateRow","addCreatedRowChangeset","onClick","className","Button","onKeyDown","appearance","table3","buttons","create","label"],"mappings":";;;;;SAcwBA,k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BAAqB,CAAC,MAAMC,gBAAgB,CAACpB,UAAU,CAACO,EAAE,CAAC,CAAC;;QAEhEY,qBAAqB,CAAC,MAAM1C,SAAS,CAACgB,OAAO,CAAC4B,sBAAsB,CAACrB,UAAiB,CAAC,CAAC;;;GAGnG,EAAE,CAACd,UAAU,CAAC,CAAC;EAEhB,oBACIE;IACIkC,OAAO,EAAEzB,YAAY;IACrB0B,SAAS,EAAC;kBACVnC;IAAImC,SAAS,EAAC;kBACVnC,6BAACoC,MAAM;IAACC,SAAS,EAAElC,aAAa;IAAEgC,SAAS,EAAC,uCAAuC;IAACG,UAAU,EAAC;WACxFhD,KAAK,CAACiD,MAAM,CAAClC,OAAO,CAACmC,OAAO,CAACC,MAAM,CAACC,KAAK,CACvC,CACR,CACJ;AAEb;;;;"}
1
+ {"version":3,"file":"CreateRowButton.js","sources":["../../../../../../../../../../src/components/Table3/components/Row/Editing/CreateRowButton.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { ScrollToOptions } from '@tanstack/react-virtual';\nimport { Button } from '../../../../Button/Button';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { animateCreateRow } from '../../../util/editing';\n\ntype Props<TType = unknown> = {\n table: ReactTable<TType>;\n tableMeta: ReactTableMeta<TType>;\n onEditingCreate: (() => (row: Partial<TType>) => boolean) | undefined;\n scrollToIndex: (index: number, options?: ScrollToOptions) => void;\n};\n\nexport default function CreateNewRowButton<TType = unknown>(props: Props<TType>) {\n const { onEditingCreate, scrollToIndex, table, tableMeta } = props;\n const { texts } = useLocalization();\n const rows = table.getCoreRowModel().rows.filter(row => row.original !== undefined);\n\n const [rowCreated, setRowCreated] = React.useState<{ rowFinder: ((row: Partial<TType>) => boolean) | undefined }>({\n rowFinder: undefined,\n });\n\n const handleKeyDown = event => {\n if (!tableMeta.editing.hasChanges() && event.key === 'Tab') {\n tableMeta.editing.saveChanges();\n }\n };\n\n const handleCreate = async () => {\n if (!onEditingCreate) {\n return;\n }\n const createdRow = rows.find(row => rowCreated?.rowFinder?.(row.original));\n\n if (createdRow) {\n await tableMeta.editing.saveChanges();\n\n if (!tableMeta.editing.hasRowErrors(createdRow.id)) {\n const rowFinder = onEditingCreate();\n\n setRowCreated({ rowFinder });\n }\n } else {\n const rowFinder = onEditingCreate();\n setRowCreated({ rowFinder });\n }\n };\n\n React.useEffect(() => {\n if (typeof rowCreated?.rowFinder === 'function') {\n const createdRow = rows.find(row => rowCreated?.rowFinder?.(row.original));\n\n if (createdRow) {\n const rowInTable = table\n .getRowModel()\n .rows.filter(row => row.original !== undefined)\n .find(row => rowCreated?.rowFinder?.(row.original));\n if (rowInTable) {\n tableMeta.editing.toggleEditing(true);\n tableMeta.rowActive.setRowActiveIndex(createdRow.index);\n scrollToIndex(createdRow.index);\n requestAnimationFrame(() => animateCreateRow(createdRow.id));\n }\n requestAnimationFrame(() => tableMeta.editing.addCreatedRowChangeset(createdRow));\n }\n }\n }, [rowCreated]);\n\n return (\n <tr\n onClick={handleCreate}\n className=\"border-grey-300 hover:bg-grey-100 group !sticky bottom-10 left-0 z-[21] !block cursor-pointer border-t\">\n <td className=\"!border-t-0 !bg-transparent\">\n <Button onKeyDown={handleKeyDown} className=\"group-hover:bg-grey-200 sticky left-0\" appearance=\"transparent\">\n + {texts.table3.editing.buttons.create.label}\n </Button>\n </td>\n </tr>\n );\n}\n"],"names":["CreateNewRowButton","props","onEditingCreate","scrollToIndex","table","tableMeta","texts","useLocalization","rows","getCoreRowModel","filter","row","original","undefined","rowCreated","setRowCreated","React","useState","rowFinder","handleKeyDown","event","editing","hasChanges","key","saveChanges","handleCreate","Promise","resolve","createdRow","find","_rowCreated$rowFinder","call","_temp","then","hasRowErrors","id","e","reject","useEffect","_rowCreated$rowFinder2","rowInTable","getRowModel","_rowCreated$rowFinder3","toggleEditing","rowActive","setRowActiveIndex","index","requestAnimationFrame","animateCreateRow","addCreatedRowChangeset","onClick","className","Button","onKeyDown","app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B,UAAU,CAACkB,KAAK,CAAC;UAC/BC,qBAAqB,CAAC,MAAMC,gBAAgB,CAACpB,UAAU,CAACO,EAAE,CAAC,CAAC;;QAEhEY,qBAAqB,CAAC,MAAM1C,SAAS,CAACgB,OAAO,CAAC4B,sBAAsB,CAACrB,UAAU,CAAC,CAAC;;;GAG5F,EAAE,CAACd,UAAU,CAAC,CAAC;EAEhB,oBACIE;IACIkC,OAAO,EAAEzB,YAAY;IACrB0B,SAAS,EAAC;kBACVnC;IAAImC,SAAS,EAAC;kBACVnC,6BAACoC,MAAM;IAACC,SAAS,EAAElC,aAAa;IAAEgC,SAAS,EAAC,uCAAuC;IAACG,UAAU,EAAC;WACxFhD,KAAK,CAACiD,MAAM,CAAClC,OAAO,CAACmC,OAAO,CAACC,MAAM,CAACC,KAAK,CACvC,CACR,CACJ;AAEb;;;;"}
@@ -19,7 +19,7 @@ function SaveStatus(props) {
19
19
  React__default.useEffect(() => {
20
20
  let timeout;
21
21
  if (status === 'complete') {
22
- timeout = window.setTimeout(() => {
22
+ timeout = setTimeout(() => {
23
23
  tableMeta.editing.setRowSaveStatus(rowId, undefined);
24
24
  }, COMPLETE_INDICATOR_DELAY);
25
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SaveStatus.js","sources":["../../../../../../../../../../src/components/Table3/components/Row/Editing/SaveStatus.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport clsx from 'clsx';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { BadgeIcon } from '../../../../BadgeIcon/BadgeIcon';\nimport { Spinner } from '../../../../Spinner/Spinner';\n\nconst COMPLETE_INDICATOR_DELAY = 3000;\n\ntype SaveStatusProps<TType = unknown> = {\n rowId: string;\n table: ReactTable<TType>;\n};\n\nexport function SaveStatus<TType = unknown>(props: SaveStatusProps<TType>) {\n const { rowId, table } = props;\n const { texts } = useLocalization();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const status = tableMeta.editing.getRowSaveStatus(rowId);\n\n React.useEffect(() => {\n let timeout: number;\n\n if (status === 'complete') {\n timeout = window.setTimeout(() => {\n tableMeta.editing.setRowSaveStatus(rowId, undefined);\n }, COMPLETE_INDICATOR_DELAY);\n }\n\n return () => {\n clearTimeout(timeout);\n };\n }, [status]);\n\n const className = clsx(\n '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)]',\n {\n 'mt-0.5': tableMeta.rowHeight.height === 'short',\n 'mt-1': tableMeta.rowHeight.height === 'medium',\n 'mt-1.5': tableMeta.rowHeight.height === 'tall',\n 'mt-2': tableMeta.rowHeight.height === 'extra-tall',\n }\n );\n\n return (\n <td className=\"!contents\">\n <span className={className}>\n {status === 'pending' ? (\n <Tooltip title={texts.table3.editing.saving.progress}>\n <Spinner delay={0} className=\"mr-1 !h-5 !w-5\" />\n </Tooltip>\n ) : (\n <Tooltip title={texts.table3.editing.saving.complete}>\n <BadgeIcon icon=\"tick\" color=\"green\" subtle className=\"mr-1\" />\n </Tooltip>\n )}\n </span>\n </td>\n );\n}\n"],"names":["COMPLETE_INDICATOR_DELAY","SaveStatus","props","rowId","table","texts","useLocalization","tableMeta","options","meta","status","editing","getRowSaveStatus","React","useEffect","timeout","window","setTimeout","setRowSaveStatus","undefined","clearTimeout","className","clsx","rowHeight","height","Tooltip","title","table3","saving","progress","Spinner","delay","complete","BadgeIcon","icon","color","subtle"],"mappings":";;;;;;;AAQA,MAAMA,wBAAwB,GAAG,IAAI;SAOrBC,UAAUA,CAAkBC,KAA6B;EACrE,MAAM;IAAEC,KAAK;IAAEC;GAAO,GAAGF,KAAK;EAC9B,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,SAAS,GAAGH,KAAK,CAACI,OAAO,CAACC,IAA6B;EAC7D,MAAMC,MAA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../../../../../../../../src/components/Table3/components/Row/Editing/SaveStatus.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport clsx from 'clsx';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { BadgeIcon } from '../../../../BadgeIcon/BadgeIcon';\nimport { Spinner } from '../../../../Spinner/Spinner';\n\nconst COMPLETE_INDICATOR_DELAY = 3000;\n\ntype SaveStatusProps<TType = unknown> = {\n rowId: string;\n table: ReactTable<TType>;\n};\n\nexport function SaveStatus<TType = unknown>(props: SaveStatusProps<TType>) {\n const { rowId, table } = props;\n const { texts } = useLocalization();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const status = tableMeta.editing.getRowSaveStatus(rowId);\n\n React.useEffect(() => {\n let timeout;\n\n if (status === 'complete') {\n timeout = setTimeout(() => {\n tableMeta.editing.setRowSaveStatus(rowId, undefined);\n }, COMPLETE_INDICATOR_DELAY);\n }\n\n return () => {\n clearTimeout(timeout);\n };\n }, [status]);\n\n const className = clsx(\n '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)]',\n {\n 'mt-0.5': tableMeta.rowHeight.height === 'short',\n 'mt-1': tableMeta.rowHeight.height === 'medium',\n 'mt-1.5': tableMeta.rowHeight.height === 'tall',\n 'mt-2': tableMeta.rowHeight.height === 'extra-tall',\n }\n );\n\n return (\n <td className=\"!contents\">\n <span className={className}>\n {status === 'pending' ? (\n <Tooltip title={texts.table3.editing.saving.progress}>\n <Spinner delay={0} className=\"mr-1 !h-5 !w-5\" />\n </Tooltip>\n ) : (\n <Tooltip title={texts.table3.editing.saving.complete}>\n <BadgeIcon icon=\"tick\" color=\"green\" subtle className=\"mr-1\" />\n </Tooltip>\n )}\n </span>\n </td>\n );\n}\n"],"names":["COMPLETE_INDICATOR_DELAY","SaveStatus","props","rowId","table","texts","useLocalization","tableMeta","options","meta","status","editing","getRowSaveStatus","React","useEffect","timeout","setTimeout","setRowSaveStatus","undefined","clearTimeout","className","clsx","rowHeight","height","Tooltip","title","table3","saving","progress","Spinner","delay","complete","BadgeIcon","icon","color","subtle"],"mappings":";;;;;;;AAQA,MAAMA,wBAAwB,GAAG,IAAI;SAOrBC,UAAUA,CAAkBC,KAA6B;EACrE,MAAM;IAAEC,KAAK;IAAEC;GAAO,GAAGF,KAAK;EAC9B,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,SAAS,GAAGH,KAAK,CAACI,OAAO,CAACC,IAA6B;EAC7D,MAAMC,MAAM,GAAGH,SAAS,CAACI,OAAO,CAACC,gBAAgB,CAACT,KAAK,CAAC;EAExDU,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIC,OAAO;IAEX,IAAIL,MAAM,KAAK,UAAU,EAAE;MACvBK,OAAO,GAAGC,UAAU,CAAC;QACjBT,SAAS,CAACI,OAAO,CAACM,gBAAgB,CAACd,KAAK,EAAEe,SAAS,CAAC;OACvD,EAAElB,wBAAwB,CAAC;;IAGhC,OAAO;MACHmB,YAAY,CAACJ,OAAO,CAAC;KACxB;GACJ,EAAE,CAACL,MAAM,CAAC,CAAC;EAEZ,MAAMU,SAAS,GAAGC,EAAI,CAClB,4JAA4J,EAC5J;IACI,QAAQ,EAAEd,SAAS,CAACe,SAAS,CAACC,MAAM,KAAK,OAAO;IAChD,MAAM,EAAEhB,SAAS,CAACe,SAAS,CAACC,MAAM,KAAK,QAAQ;IAC/C,QAAQ,EAAEhB,SAAS,CAACe,SAAS,CAACC,MAAM,KAAK,MAAM;IAC/C,MAAM,EAAEhB,SAAS,CAACe,SAAS,CAACC,MAAM,KAAK;GAC1C,CACJ;EAED,oBACIV;IAAIO,SAAS,EAAC;kBACVP;IAAMO,SAAS,EAAEA;KACZV,MAAM,KAAK,SAAS,iBACjBG,6BAACW,OAAO;IAACC,KAAK,EAAEpB,KAAK,CAACqB,MAAM,CAACf,OAAO,CAACgB,MAAM,CAACC;kBACxCf,6BAACgB,OAAO;IAACC,KAAK,EAAE,CAAC;IAAEV,SAAS,EAAC;IAAmB,CAC1C,kBAEVP,6BAACW,OAAO;IAACC,KAAK,EAAEpB,KAAK,CAACqB,MAAM,CAACf,OAAO,CAACgB,MAAM,CAACI;kBACxClB,6BAACmB,SAAS;IAACC,IAAI,EAAC,MAAM;IAACC,KAAK,EAAC,OAAO;IAACC,MAAM;IAACf,SAAS,EAAC;IAAS,CACzD,CACb,CACE,CACN;AAEb;;;;"}
@@ -15,10 +15,7 @@ function Row(props) {
15
15
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;
16
16
  React__default.useEffect(() => {
17
17
  if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {
18
- const element = focusManager.focusFirst();
19
- if (element) {
20
- setDataFocusAttribute(element);
21
- }
18
+ setDataFocusAttribute(focusManager.focusFirst());
22
19
  }
23
20
  }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);
24
21
  const handleFocus = React__default.useCallback(event => {
@@ -1 +1 @@
1
- {"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/Row/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { DisplayRow, DisplayRowProps } from '../../../../primitives/Table/Core/components/Row/BuiltIns/DisplayRow';\nimport { SaveStatus } from './Editing/SaveStatus';\nimport { useAugmentedFocusManager } from '../../../../primitives/Table/Core/components/Body/util';\nimport { setDataFocusAttribute } from '../../../../utils/dom';\n\nexport function Row<TType = unknown>(props: DisplayRowProps<TType>) {\n const { row, index, table } = props;\n const focusManager = useAugmentedFocusManager();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;\n\n React.useEffect(() => {\n if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {\n const element = focusManager.focusFirst();\n if (element) {\n setDataFocusAttribute(element);\n }\n }\n }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLTableRowElement>) => {\n if (tableMeta.editing.isEditing) {\n const cellIndex = Number(event.target.closest('td')?.getAttribute('data-cell-index') ?? undefined);\n\n if (!isNaN(cellIndex)) {\n tableMeta.editing.setLastFocusedCellIndex(Number(cellIndex));\n }\n }\n },\n [tableMeta.editing.isEditing, isActiveRow]\n );\n\n const attributes = {\n 'data-row-editing-invalid':\n tableMeta.editing.isEnabled && tableMeta.editing.hasRowErrors(row.id)\n ? !tableMeta.editing.hasRowErrorsSeen(row.id)\n ? 'unseen'\n : true\n : undefined,\n 'data-row-editing-status':\n tableMeta.editing.isEnabled && tableMeta.editing.getRowSaveStatus(row.id)\n ? tableMeta.editing.getRowSaveStatus(row.id)\n : undefined,\n onFocus: handleFocus,\n };\n\n return (\n <DisplayRow<TType> {...props} {...attributes}>\n {tableMeta.editing.getRowSaveStatus(row.id) ? <SaveStatus rowId={row.id} table={table} /> : null}\n </DisplayRow>\n );\n}\n"],"names":["Row","props","row","index","table","focusManager","useAugmentedFocusManager","tableMeta","options","meta","isActiveRow","rowActive","rowActiveIndex","React","useEffect","editing","isEditing","lastFocusedCellIndex","undefined","element","focusFirst","setDataFocusAttribute","handleFocus","useCallback","event","_event$target$closest","_event$target$closest2","cellIndex","Number","target","closest","getAttribute","isNaN","setLastFocusedCellIndex","attributes","isEnabled","hasRowErrors","id","hasRowErrorsSeen","getRowSaveStatus","onFocus","DisplayRow","SaveStatus","rowId"],"mappings":";;;;;;SAOgBA,GAAGA,CAAkBC,KAA6B;EAC9D,MAAM;IAAEC,GAAG;IAAEC,KAAK;IAAEC;GAAO,GAAGH,KAAK;EACnC,MAAMI,YAAY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,CAACQ,OAAO,CAACqB,YAAY,CAAClC,GAAG,CAACmC,EAAE,CAAC,GAC/D,CAAC9B,SAAS,CAACQ,OAAO,CAACuB,gBAAgB,CAACpC,GAAG,CAACmC,EAAE,CAAC,GACvC,QAAQ,GACR,IAAI,GACRnB,SAAS;IACnB,yBAAyB,EACrBX,SAAS,CAACQ,OAAO,CAACoB,SAAS,IAAI5B,SAAS,CAACQ,OAAO,CAACwB,gBAAgB,CAACrC,GAAG,CAACmC,EAAE,CAAC,GACnE9B,SAAS,CAACQ,OAAO,CAACwB,gBAAgB,CAACrC,GAAG,CAACmC,EAAE,CAAC,GAC1CnB,SAAS;IACnBsB,OAAO,EAAElB;GACZ;EAED,oBACIT,6BAAC4B,UAAU,oBAAYxC,KAAK,EAAMiC,UAAU,GACvC3B,SAAS,CAACQ,OAAO,CAACwB,gBAAgB,CAACrC,GAAG,CAACmC,EAAE,CAAC,gBAAGxB,6BAAC6B,UAAU;IAACC,KAAK,EAAEzC,GAAG,CAACmC,EAAE;IAAEjC,KAAK,EAAEA;IAAS,GAAG,IAAI,CACvF;AAErB;;;;"}
1
+ {"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/Row/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { DisplayRow, DisplayRowProps } from '../../../../primitives/Table/Core/components/Row/BuiltIns/DisplayRow';\nimport { SaveStatus } from './Editing/SaveStatus';\nimport { useAugmentedFocusManager } from '../../../../primitives/Table/Core/components/Body/util';\nimport { setDataFocusAttribute } from '../../../../utils/dom';\n\nexport function Row<TType = unknown>(props: DisplayRowProps<TType>) {\n const { row, index, table } = props;\n const focusManager = useAugmentedFocusManager();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;\n\n React.useEffect(() => {\n if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {\n setDataFocusAttribute(focusManager.focusFirst());\n }\n }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLTableRowElement>) => {\n if (tableMeta.editing.isEditing) {\n const cellIndex = Number(event.target.closest('td')?.getAttribute('data-cell-index') ?? undefined);\n\n if (!isNaN(cellIndex)) {\n tableMeta.editing.setLastFocusedCellIndex(Number(cellIndex));\n }\n }\n },\n [tableMeta.editing.isEditing, isActiveRow]\n );\n\n const attributes = {\n 'data-row-editing-invalid':\n tableMeta.editing.isEnabled && tableMeta.editing.hasRowErrors(row.id)\n ? !tableMeta.editing.hasRowErrorsSeen(row.id)\n ? 'unseen'\n : true\n : undefined,\n 'data-row-editing-status':\n tableMeta.editing.isEnabled && tableMeta.editing.getRowSaveStatus(row.id)\n ? tableMeta.editing.getRowSaveStatus(row.id)\n : undefined,\n onFocus: handleFocus,\n };\n\n return (\n <DisplayRow<TType> {...props} {...attributes}>\n {tableMeta.editing.getRowSaveStatus(row.id) ? <SaveStatus rowId={row.id} table={table} /> : null}\n </DisplayRow>\n );\n}\n"],"names":["Row","props","row","index","table","focusManager","useAugmentedFocusManager","tableMeta","options","meta","isActiveRow","rowActive","rowActiveIndex","React","useEffect","editing","isEditing","lastFocusedCellIndex","undefined","setDataFocusAttribute","focusFirst","handleFocus","useCallback","event","_event$target$closest","_event$target$closest2","cellIndex","Number","target","closest","getAttribute","isNaN","setLastFocusedCellIndex","attributes","isEnabled","hasRowErrors","id","hasRowErrorsSeen","getRowSaveStatus","onFocus","DisplayRow","SaveStatus","rowId"],"mappings":";;;;;;SAOgBA,GAAGA,CAAkBC,KAA6B;EAC9D,MAAM;IAAEC,GAAG;IAAEC,KAAK;IAAEC;GAAO,GAAGH,KAAK;EACnC,MAAMI,YAAY,GAAGC,wBAAwB,EAAE;EAC/C,MAAMC,SAAS,GAAGH,KAAK,CAACI,OAAO,CAACC,IAA6B;EAC7D,MAA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QAAQ,GACR,IAAI,GACRlB,SAAS;IACnB,yBAAyB,EACrBX,SAAS,CAACQ,OAAO,CAACmB,SAAS,IAAI3B,SAAS,CAACQ,OAAO,CAACuB,gBAAgB,CAACpC,GAAG,CAACkC,EAAE,CAAC,GACnE7B,SAAS,CAACQ,OAAO,CAACuB,gBAAgB,CAACpC,GAAG,CAACkC,EAAE,CAAC,GAC1ClB,SAAS;IACnBqB,OAAO,EAAElB;GACZ;EAED,oBACIR,6BAAC2B,UAAU,oBAAYvC,KAAK,EAAMgC,UAAU,GACvC1B,SAAS,CAACQ,OAAO,CAACuB,gBAAgB,CAACpC,GAAG,CAACkC,EAAE,CAAC,gBAAGvB,6BAAC4B,UAAU;IAACC,KAAK,EAAExC,GAAG,CAACkC,EAAE;IAAEhC,KAAK,EAAEA;IAAS,GAAG,IAAI,CACvF;AAErB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTableEditing.js","sources":["../../../../../../../../src/components/Table3/features/useTableEditing.ts"],"sourcesContent":["import React from 'react';\nimport { Cell as ReactTableCell, Row as ReactTableRow } from '@tanstack/react-table';\nimport { Table3EditingChangeHandler, Table3EditingSaveHandler, Table3EditingValidatorFn } from '../types';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\nimport { willRowMove } from '../util/editing';\nimport { debounce } from 'lodash';\nimport { Localization, useLocalization } from '../../Provider/Localization';\n\nexport function useTableEditing<TType = unknown>(\n isEnabled = false,\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n // used to switch the table into editing mode\n const [isEditing, toggleEditing] = React.useState(false);\n\n // used to switch the editing between \"detailed\" mode\n const [isDetailedMode, toggleDetailedMode] = React.useState(false);\n\n // store the last focused cell, so that up/down arrow key navigation remains in the same column\n const [lastFocusedCellIndex, setLastFocusedCellIndex] = useLastFocusedCellIndex();\n\n // store pending changes for each row\n // changes are saved as soon as the active row changes, so in most cases this will only contain the active row's changes\n // but not always - if validation or server requests fail when saving, those rows remain until the failure is resolved\n const pendingChangesFns = usePendingChanges<TType>(isEnabled, handleSave, handleChange, validator);\n\n useGlobalKeyDown(isEnabled && isEditing ? { key: 's', meta: true, shift: false } : undefined, event => {\n event.preventDefault();\n pendingChangesFns.saveChanges();\n });\n\n return {\n isEnabled,\n isEditing,\n isDetailedMode,\n toggleDetailedMode: isEnabled ? toggleDetailedMode : () => undefined,\n toggleEditing: isEnabled ? toggleEditing : () => undefined,\n lastFocusedCellIndex,\n setLastFocusedCellIndex,\n ...pendingChangesFns,\n };\n}\n\ntype SaveState = 'pending' | 'complete';\nexport type PendingChange<TType = unknown> = Partial<TType> & {\n _meta: {\n original: TType;\n moveReason: Record<string, 'search' | 'sorting' | 'filter'>;\n errors: {\n row: string;\n cells: Record<string, string>;\n shouldShowErrorAlert: boolean;\n };\n status?: SaveState;\n };\n};\n\ntype PendingChanges<TType = unknown> = Record<string, PendingChange<TType>>;\nfunction usePendingChanges<TType = unknown>(\n isEnabled: boolean,\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n const localization = useLocalization();\n const [pendingChanges, setPendingChanges] = React.useState<PendingChanges<TType>>({});\n // we maintain save status as separate state because 'complete' needs to briefly show after pendingChanges are deleted\n const [saveStates, setSaveState] = React.useState<Record<string, SaveState>>({});\n\n function getCellValue<T extends TType>(cell: ReactTableCell<T, unknown>): unknown | undefined {\n return pendingChanges[cell.row.id]?.[cell.column.id];\n }\n\n function getCellError<T extends TType>(cell: ReactTableCell<T, unknown>): string | undefined {\n return pendingChanges[cell.row.id]?._meta.errors?.cells?.[cell.column.id];\n }\n\n async function addCreatedRowChangeset(row: ReactTableRow<unknown>) {\n const cells = row.getAllCells();\n\n setPendingChanges((currentChanges: any) => {\n return cells.reduce((changes, cell) => {\n if (cell.getValue()) {\n return {\n ...changes,\n [cell.row.id]: {\n ...changes[cell.row.id],\n [cell.column.id]: cell.getValue(),\n _meta: {\n ...currentChanges[cell.row.id]?._meta,\n original: cell.row.original,\n moveReason: {\n ...currentChanges[cell.row.id]?._meta.moveReason,\n },\n errors: {\n ...currentChanges[cell.row.id]?._meta.errors,\n },\n },\n },\n };\n } else {\n return changes;\n }\n }, currentChanges);\n });\n }\n const pendingChangesUpdater = usePendingChangesUpdater(handleChange, setPendingChanges);\n\n async function setCellValue<T extends TType>(cell: ReactTableCell<T, unknown>, change: unknown, rowIndex: number) {\n const changes = {\n [cell.column.id]: change,\n } as Partial<T>;\n\n setPendingChanges(currentChanges => {\n const nextChanges = createPendingChangesSetter<T>(\n currentChanges as PendingChanges<T>,\n cell.row,\n rowIndex,\n changes,\n localization\n );\n pendingChangesUpdater.syncCellChanges(nextChanges);\n return nextChanges;\n });\n pendingChangesUpdater.runCellUpdates<T>(changes, cell, rowIndex);\n }\n\n async function validateCell<T extends TType>(cell: ReactTableCell<T, unknown>) {\n if (!validator || !isEnabled) {\n return;\n }\n\n const changeSet: any = getChangesetFromChanges(pendingChanges[cell.row.id]);\n\n // only validate if the cell being blurred actually has any changes\n if (cell.column.id in changeSet) {\n const errors = ((await validator(changeSet)) ?? {}) as Record<string, string>;\n\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n nextChanges[cell.row.id]._meta = {\n ...nextChanges[cell.row.id]._meta,\n errors: {\n ...nextChanges[cell.row.id]._meta.errors,\n cells: errors,\n shouldShowErrorAlert: !Object.keys(errors).length\n ? false\n : nextChanges[cell.row.id]._meta.errors.shouldShowErrorAlert,\n },\n };\n return nextChanges;\n });\n }\n }\n\n function hasRowErrors(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return (\n !!pendingChanges[rowId]?._meta.errors?.row || !!Object.keys(pendingChanges[rowId]?._meta.errors?.cells ?? {}).length\n );\n }\n\n function hasRowErrorsSeen(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return hasRowErrors(rowId) && !!pendingChanges[rowId]._meta.errors?.shouldShowErrorAlert;\n }\n function getRowPendingChange(rowId: string) {\n const rowPendingChanges = pendingChanges[rowId];\n\n if (rowPendingChanges) {\n const { _meta, ...pendingChange } = rowPendingChanges;\n\n return pendingChange;\n }\n\n return undefined;\n }\n\n function getRowSaveStatus(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return saveStates[rowId];\n }\n\n function setRowSaveStatus(rowId: string, status: 'pending' | 'complete' | undefined) {\n setSaveState(currentStates => {\n const nextStates = { ...currentStates };\n\n if (status) {\n nextStates[rowId] = status;\n } else {\n delete nextStates[rowId];\n }\n\n return nextStates;\n });\n }\n\n function getRowMoveReason(rowId: string) {\n return pendingChanges[rowId]?._meta.moveReason ? Object.values(pendingChanges[rowId]._meta.moveReason)[0] : undefined;\n }\n\n function hasChanges(rowId?: string) {\n if (!isEnabled) {\n return false;\n }\n\n return rowId ? !!pendingChanges[rowId] : !!Object.keys(pendingChanges).length;\n }\n\n function hasAlertErrors() {\n if (!isEnabled) {\n return false;\n }\n return !!getAlertErrors().length;\n }\n\n function getAlertErrors<T extends TType>() {\n return Object.keys(pendingChanges)\n .filter(hasRowErrorsSeen)\n .map(rowId => ({ rowId, pendingChange: pendingChanges[rowId] as PendingChange<T> }));\n }\n\n function resetChanges(rowId: string) {\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n delete nextChanges[rowId];\n return nextChanges;\n });\n }\n\n async function saveChanges(rowId: string | undefined = undefined) {\n if (!handleSave) {\n console.warn('Tried to save, but Table has no onEditingSave handler');\n return;\n }\n\n // we save back to pendingChanges, so make a copy of it's state when save was triggered\n const changesToSave = rowId ? { [rowId]: pendingChanges[rowId] } : { ...pendingChanges };\n const changes = Object.keys(changesToSave);\n\n if (changes.length) {\n for (const rowId of changes) {\n const pendingChange = changesToSave[rowId];\n\n const changeSet = getChangesetFromChanges(pendingChange);\n try {\n if (getRowSaveStatus(rowId) === 'pending') return;\n\n // set saving = true\n setRowSaveStatus(rowId, 'pending');\n\n // re-run validation, maybe a cell is already invalid but has never been blurred\n if (validator) {\n const errors = await validator(changeSet);\n\n if (errors && Object.keys(errors).length) {\n throw errors;\n }\n }\n // send new data to the server\n await handleSave(changeSet);\n\n // cleanup changes, we don't need them after saving\n resetChanges(rowId);\n setRowSaveStatus(rowId, 'complete');\n } catch (error) {\n // the onEditingSave handler should throw errors when something fails, e.g. validation, network errors etc\n // this code handles those errors and maps them either to row errors or cell specific errors\n let rowError: any;\n let cellErrors: any;\n\n if (typeof error === 'string') {\n rowError = error;\n } else if (error instanceof Error) {\n rowError = error.message;\n\n // most of our apis return error objects within this shape\n if (typeof (error as any).response?.data === 'object') {\n cellErrors = (error as any).response?.data;\n }\n } else if (typeof error === 'object') {\n cellErrors = error;\n }\n\n if (rowError || cellErrors) {\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n nextChanges[rowId]._meta.errors = {\n row: rowError,\n cells: cellErrors,\n shouldShowErrorAlert: true,\n };\n return nextChanges;\n });\n }\n\n setRowSaveStatus(rowId, undefined);\n }\n }\n }\n }\n\n function getCompletedRowsCount() {\n return Object.values(saveStates).filter(value => value === 'complete').length;\n }\n\n return {\n getCellValue,\n getCellError,\n setCellValue,\n validateCell,\n addCreatedRowChangeset,\n hasChanges,\n hasAlertErrors,\n getAlertErrors,\n saveChanges,\n resetChanges,\n hasRowErrors,\n hasRowErrorsSeen,\n getRowPendingChange,\n getRowSaveStatus,\n setRowSaveStatus,\n getRowMoveReason,\n getCompletedRowsCount,\n };\n}\n\nfunction useLastFocusedCellIndex(): [number | undefined, (index: number | undefined) => void] {\n // store the last focused cell, so that up/down arrow key navigation remains in the same column\n const lastFocusedCellIndexRef = React.useRef<number | undefined>(undefined);\n const setLastFocusedCellIndex = React.useCallback((index: number | undefined) => {\n lastFocusedCellIndexRef.current = index;\n }, []);\n\n return [lastFocusedCellIndexRef.current, setLastFocusedCellIndex];\n}\n\nfunction usePendingChangesUpdater<TType = unknown>(\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n setPendingChanges: React.Dispatch<React.SetStateAction<PendingChanges<TType>>>\n) {\n const localization = useLocalization();\n const updatersRef = React.useRef<PendingChanges<TType>>({});\n\n const runCellUpdates = React.useCallback(\n debounce(async function <T extends TType>(changes: Partial<T>, cell: ReactTableCell<T, unknown>, rowIndex: number) {\n if (typeof handleChange === 'function') {\n const previousValues = {\n ...cell.row.original,\n ...getChangesetFromChanges(updatersRef.current[cell.row.id]),\n };\n const nextValues = {\n ...previousValues,\n ...changes,\n };\n const updates = await handleChange(cell.column.id, (changes as any)[cell.column.id], nextValues, previousValues);\n\n if (updates && Object.keys(updates).length) {\n setPendingChanges(currentChanges =>\n createPendingChangesSetter(\n currentChanges,\n cell.row as unknown as ReactTableRow<TType>,\n rowIndex,\n updates,\n localization\n )\n );\n }\n }\n }, 250),\n []\n ) as unknown as <T extends TType>(changes: Partial<T>, cell: ReactTableCell<T, unknown>, rowIndex: number) => Promise<void>;\n\n function syncCellChanges<T extends TType>(changes: PendingChanges<T>) {\n updatersRef.current = changes;\n }\n\n return {\n syncCellChanges,\n runCellUpdates,\n };\n}\n\nfunction createPendingChangesSetter<TType = unknown>(\n currentChanges: PendingChanges<TType>,\n row: ReactTableRow<TType>,\n rowIndex: number,\n changes: Partial<TType>,\n localization: Localization\n) {\n // prepare\n const nextChanges: PendingChanges<TType> = { ...currentChanges };\n const rowChanges = {\n ...currentChanges[row.id],\n _meta: {\n ...currentChanges[row.id]?._meta,\n original: row.original,\n moveReason: {\n ...currentChanges[row.id]?._meta.moveReason,\n },\n errors: {\n ...currentChanges[row.id]?._meta.errors,\n },\n },\n } as PendingChange<TType>;\n\n // run changes\n const cells = row._getAllCellsByColumnId();\n\n for (const [accessor, change] of Object.entries(changes)) {\n // update if the change is different to the original (saved) value,\n // otherwise remove any change - no point saving the same value\n if (change !== (row.original as any)[accessor]) {\n (rowChanges as PendingChange)[accessor] = change;\n\n // consumers sometimes include properties in onEditingChange that aren't rendered as columns, we need to guard against that.\n // eslint-disable-next-line no-prototype-builtins\n if (cells.hasOwnProperty(accessor)) {\n // determine if the row will move position based on this change, and save why it will move\n const reason = willRowMove(cells[accessor], change, rowIndex, localization);\n\n if (reason) {\n rowChanges._meta.moveReason[accessor] = reason;\n } else {\n delete rowChanges._meta.moveReason[accessor];\n }\n }\n } else {\n delete rowChanges[accessor];\n delete rowChanges._meta.moveReason[accessor];\n }\n }\n\n // set changes\n // or delete if there are no changes left, so that we don't store changes with unchanged data\n if (Object.keys(rowChanges).filter(k => k !== '_meta').length) {\n nextChanges[row.id] = rowChanges;\n } else {\n delete nextChanges[row.id];\n }\n\n return nextChanges;\n}\n\nfunction getChangesetFromChanges<TType = unknown>(changes: PendingChange<TType>): TType {\n // extract the original data from the row changes\n const { _meta, ...changeset } = changes ?? {};\n // and mix them in with the changes, ready to send to the server\n return { ..._meta?.original, ...changeset };\n}\n"],"names":["useTableEditing","isEnabled","handleSave","handleChange","validator","isEditing","toggleEditing","React","useState","isDetailedMode","toggleDetailedMode","lastFocusedCellIndex","setLastFocusedCellIndex","useLastFocusedCellIndex","pendingChangesFns","usePendingChanges","useGlobalKeyDown","key","meta","shift","undefined","event","preventDefault","saveChanges","rowId","console","warn","Promise","resolve","changesToSave","pendingChanges","changes","Object","keys","length","_forOf","pendingChange","changeSet","getChangesetFromChanges","_catch","_temp3","_result","_exit","then","resetChanges","setRowSaveStatus","getRowSaveStatus","_temp2","errors","error","rowError","cellErrors","Error","_error$response","message","response","data","_error$response2","setPendingChanges","currentChanges","nextChanges","_meta","row","cells","shouldShowErrorAlert","e","reject","validateCell","cell","id","_temp","column","setCellValue","change","rowIndex","createPendingChangesSetter","localization","pendingChangesUpdater","syncCellChanges","runCellUpdates","addCreatedRowChangeset","getAllCells","reduce","getValue","_currentChanges$cell$","_currentChanges$cell$2","_currentChanges$cell$3","original","moveReason","useLocalization","saveStates","setSaveState","getCellValue","_pendingChanges$cell$","getCellError","_pendingChanges$cell$2","_pendingChanges$cell$3","_pendingChanges$cell$4","usePendingChangesUpdater","hasRowErrors","_pendingChanges$rowId","_pendingChanges$rowId2","_pendingChanges$rowId3","_pendingChanges$rowId4","_pendingChanges$rowId5","hasRowErrorsSeen","_pendingChanges$rowId6","getRowPendingChange","rowPendingChanges","status","currentStates","nextStates","getRowMoveReason","_pendingChanges$rowId7","values","hasChanges","hasAlertErrors","getAlertErrors","filter","map","getCompletedRowsCount","value","lastFocusedCellIndexRef","useRef","useCallback","index","current","updatersRef","debounce","previousValues","nextValues","updates","_temp4","rowChanges","_currentChanges$row$i","_currentChanges$row$i2","_currentChanges$row$i3","_getAllCellsByColumnId","accessor","entries","hasOwnProperty","reason","willRowMove","k","changeset"],"mappings":";;;;;;;SAQgBA,eAAeA,CAC3BC,SAAS,GAAG,KAAK,EACjBC,UAAuD,EACvDC,YAA2D,EAC3DC,SAAsD;;EAGtD,MAAM,CAACC,SAAS,EAAEC,aAAa,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;EAGxD,MAAM,CAACC,cAAc,EAAEC,kBAAkB,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;EAGlE,MAAM,CAACG,oBAAoB,EAAEC,uBAAuB,CAAC,GAAGC,uBAAuB,EAAE;;;;EAKjF,MAAMC,iBAAiB,GAAGC,iBAAiB,CAAQd,SAAS,EAAEC,UAAU,EAAEC,YAAY,EAAEC,SAAS,CAAC;EAElGY,gBAAgB,CAACf,SAAS,IAAII,SAAS,GAAG;IAAEY,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE,IAAI;IAAEC,KAAK,EAAE;GAAO,GAAGC,SAAS,EAAEC,KAAK;IAC/FA,KAAK,CAACC,cAAc,EAAE;IACtBR,iBAAiB,CAACS,WAAW,EAAE;GAClC,CAAC;EAEF,OAAO;IACHtB,SAAS;IACTI,SAAS;IACTI,cAAc;IACdC,kBAAkB,EAAET,SAAS,GAAGS,kBAAkB,GAAG,MAAMU,SAAS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pD,IAAI1G,MAAM,CAACC,IAAI,CAACoG,UAAU,CAAC,CAACf,MAAM,CAACyB,CAAC,IAAIA,CAAC,KAAK,OAAO,CAAC,CAAC7G,MAAM,EAAE;IAC3D0B,WAAW,CAACE,GAAG,CAACO,EAAE,CAAC,GAAGgE,UAAU;GACnC,MAAM;IACH,OAAOzE,WAAW,CAACE,GAAG,CAACO,EAAE,CAAC;;EAG9B,OAAOT,WAAW;AACtB;AAEA,SAAStB,uBAAuBA,CAAkBP,OAA6B;;EAE3E,MAAM;IAAE8B,KAAK;IAAE,GAAGmF;GAAW,GAAGjH,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,EAAE;;EAE7C,OAAO;IAAE,IAAG8B,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAE0B,QAAQ;IAAE,GAAGyD;GAAW;AAC/C;;;;"}
1
+ {"version":3,"file":"useTableEditing.js","sources":["../../../../../../../../src/components/Table3/features/useTableEditing.ts"],"sourcesContent":["import React from 'react';\nimport { Cell as ReactTableCell, Row as ReactTableRow } from '@tanstack/react-table';\nimport { Table3EditingChangeHandler, Table3EditingSaveHandler, Table3EditingValidatorFn } from '../types';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\nimport { willRowMove } from '../util/editing';\nimport { debounce } from 'lodash';\nimport { Localization, useLocalization } from '../../Provider/Localization';\n\nexport function useTableEditing<TType = unknown>(\n isEnabled = false,\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n // used to switch the table into editing mode\n const [isEditing, toggleEditing] = React.useState(false);\n\n // used to switch the editing between \"detailed\" mode\n const [isDetailedMode, toggleDetailedMode] = React.useState(false);\n\n // store the last focused cell, so that up/down arrow key navigation remains in the same column\n const [lastFocusedCellIndex, setLastFocusedCellIndex] = useLastFocusedCellIndex();\n\n // store pending changes for each row\n // changes are saved as soon as the active row changes, so in most cases this will only contain the active row's changes\n // but not always - if validation or server requests fail when saving, those rows remain until the failure is resolved\n const pendingChangesFns = usePendingChanges<TType>(isEnabled, handleSave, handleChange, validator);\n\n useGlobalKeyDown(isEnabled && isEditing ? { key: 's', meta: true, shift: false } : undefined, event => {\n event.preventDefault();\n pendingChangesFns.saveChanges();\n });\n\n return {\n isEnabled,\n isEditing,\n isDetailedMode,\n toggleDetailedMode: isEnabled ? toggleDetailedMode : () => undefined,\n toggleEditing: isEnabled ? toggleEditing : () => undefined,\n lastFocusedCellIndex,\n setLastFocusedCellIndex,\n ...pendingChangesFns,\n };\n}\n\ntype SaveState = 'pending' | 'complete';\nexport type PendingChange<TType = unknown> = Partial<TType> & {\n _meta: {\n original: TType;\n moveReason: Record<string, 'search' | 'sorting' | 'filter'>;\n errors: {\n row: string;\n cells: Record<string, string>;\n shouldShowErrorAlert: boolean;\n };\n status?: SaveState;\n };\n};\n\ntype PendingChanges<TType = unknown> = Record<string, PendingChange<TType>>;\nfunction usePendingChanges<TType = unknown>(\n isEnabled: boolean,\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n const localization = useLocalization();\n const [pendingChanges, setPendingChanges] = React.useState<PendingChanges<TType>>({});\n // we maintain save status as separate state because 'complete' needs to briefly show after pendingChanges are deleted\n const [saveStates, setSaveState] = React.useState<Record<string, SaveState>>({});\n\n function getCellValue<T extends TType>(cell: ReactTableCell<T, unknown>): unknown | undefined {\n return pendingChanges[cell.row.id]?.[cell.column.id];\n }\n\n function getCellError<T extends TType>(cell: ReactTableCell<T, unknown>): string | undefined {\n return pendingChanges[cell.row.id]?._meta.errors?.cells?.[cell.column.id];\n }\n\n async function addCreatedRowChangeset(row) {\n const cells = row.getAllCells();\n\n setPendingChanges(currentChanges => {\n return cells.reduce((changes, cell) => {\n if (cell.getValue()) {\n return {\n ...changes,\n [cell.row.id]: {\n ...changes[cell.row.id],\n [cell.column.id]: cell.getValue(),\n _meta: {\n ...currentChanges[cell.row.id]?._meta,\n original: cell.row.original,\n moveReason: {\n ...currentChanges[cell.row.id]?._meta.moveReason,\n },\n errors: {\n ...currentChanges[cell.row.id]?._meta.errors,\n },\n },\n },\n };\n } else {\n return changes;\n }\n }, currentChanges);\n });\n }\n const pendingChangesUpdater = usePendingChangesUpdater(handleChange, setPendingChanges);\n\n async function setCellValue<T extends TType>(cell: ReactTableCell<T, unknown>, change: unknown, rowIndex: number) {\n const changes = {\n [cell.column.id]: change,\n } as Partial<T>;\n\n setPendingChanges(currentChanges => {\n const nextChanges = createPendingChangesSetter<T>(\n currentChanges as PendingChanges<T>,\n cell.row,\n rowIndex,\n changes,\n localization\n );\n pendingChangesUpdater.syncCellChanges(nextChanges);\n return nextChanges;\n });\n pendingChangesUpdater.runCellUpdates<T>(changes, cell, rowIndex);\n }\n\n async function validateCell<T extends TType>(cell: ReactTableCell<T, unknown>) {\n if (!validator || !isEnabled) {\n return;\n }\n\n const changeSet = getChangesetFromChanges(pendingChanges[cell.row.id]);\n\n // only validate if the cell being blurred actually has any changes\n if (cell.column.id in changeSet) {\n const errors = ((await validator(changeSet)) ?? {}) as Record<string, string>;\n\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n nextChanges[cell.row.id]._meta = {\n ...nextChanges[cell.row.id]._meta,\n errors: {\n ...nextChanges[cell.row.id]._meta.errors,\n cells: errors,\n shouldShowErrorAlert: !Object.keys(errors).length\n ? false\n : nextChanges[cell.row.id]._meta.errors.shouldShowErrorAlert,\n },\n };\n return nextChanges;\n });\n }\n }\n\n function hasRowErrors(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return (\n !!pendingChanges[rowId]?._meta.errors?.row || !!Object.keys(pendingChanges[rowId]?._meta.errors?.cells ?? {}).length\n );\n }\n\n function hasRowErrorsSeen(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return hasRowErrors(rowId) && !!pendingChanges[rowId]._meta.errors?.shouldShowErrorAlert;\n }\n function getRowPendingChange(rowId: string) {\n const rowPendingChanges = pendingChanges[rowId];\n\n if (rowPendingChanges) {\n const { _meta, ...pendingChange } = rowPendingChanges;\n\n return pendingChange;\n }\n\n return undefined;\n }\n\n function getRowSaveStatus(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return saveStates[rowId];\n }\n\n function setRowSaveStatus(rowId: string, status: 'pending' | 'complete' | undefined) {\n setSaveState(currentStates => {\n const nextStates = { ...currentStates };\n\n if (status) {\n nextStates[rowId] = status;\n } else {\n delete nextStates[rowId];\n }\n\n return nextStates;\n });\n }\n\n function getRowMoveReason(rowId: string) {\n return pendingChanges[rowId]?._meta.moveReason ? Object.values(pendingChanges[rowId]._meta.moveReason)[0] : undefined;\n }\n\n function hasChanges(rowId?: string) {\n if (!isEnabled) {\n return false;\n }\n\n return rowId ? !!pendingChanges[rowId] : !!Object.keys(pendingChanges).length;\n }\n\n function hasAlertErrors() {\n if (!isEnabled) {\n return false;\n }\n return !!getAlertErrors().length;\n }\n\n function getAlertErrors<T extends TType>() {\n return Object.keys(pendingChanges)\n .filter(hasRowErrorsSeen)\n .map(rowId => ({ rowId, pendingChange: pendingChanges[rowId] as PendingChange<T> }));\n }\n\n function resetChanges(rowId: string) {\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n delete nextChanges[rowId];\n return nextChanges;\n });\n }\n\n async function saveChanges(rowId: string | undefined = undefined) {\n if (!handleSave) {\n console.warn('Tried to save, but Table has no onEditingSave handler');\n return;\n }\n\n // we save back to pendingChanges, so make a copy of it's state when save was triggered\n const changesToSave = rowId ? { [rowId]: pendingChanges[rowId] } : { ...pendingChanges };\n const changes = Object.keys(changesToSave);\n\n if (changes.length) {\n for (const rowId of changes) {\n const pendingChange = changesToSave[rowId];\n\n const changeSet = getChangesetFromChanges(pendingChange);\n try {\n if (getRowSaveStatus(rowId) === 'pending') return;\n\n // set saving = true\n setRowSaveStatus(rowId, 'pending');\n\n // re-run validation, maybe a cell is already invalid but has never been blurred\n if (validator) {\n const errors = await validator(changeSet);\n\n if (errors && Object.keys(errors).length) {\n throw errors;\n }\n }\n // send new data to the server\n await handleSave(changeSet);\n\n // cleanup changes, we don't need them after saving\n resetChanges(rowId);\n setRowSaveStatus(rowId, 'complete');\n } catch (error) {\n // the onEditingSave handler should throw errors when something fails, e.g. validation, network errors etc\n // this code handles those errors and maps them either to row errors or cell specific errors\n let rowError;\n let cellErrors;\n\n if (typeof error === 'string') {\n rowError = error;\n } else if (error instanceof Error) {\n rowError = error.message;\n\n // most of our apis return error objects within this shape\n if (typeof (error as any).response?.data === 'object') {\n cellErrors = (error as any).response?.data;\n }\n } else if (typeof error === 'object') {\n cellErrors = error;\n }\n\n if (rowError || cellErrors) {\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n nextChanges[rowId]._meta.errors = {\n row: rowError,\n cells: cellErrors,\n shouldShowErrorAlert: true,\n };\n return nextChanges;\n });\n }\n\n setRowSaveStatus(rowId, undefined);\n }\n }\n }\n }\n\n function getCompletedRowsCount() {\n return Object.values(saveStates).filter(value => value === 'complete').length;\n }\n\n return {\n getCellValue,\n getCellError,\n setCellValue,\n validateCell,\n addCreatedRowChangeset,\n hasChanges,\n hasAlertErrors,\n getAlertErrors,\n saveChanges,\n resetChanges,\n hasRowErrors,\n hasRowErrorsSeen,\n getRowPendingChange,\n getRowSaveStatus,\n setRowSaveStatus,\n getRowMoveReason,\n getCompletedRowsCount,\n };\n}\n\nfunction useLastFocusedCellIndex(): [number | undefined, (index: number | undefined) => void] {\n // store the last focused cell, so that up/down arrow key navigation remains in the same column\n const lastFocusedCellIndexRef = React.useRef<number | undefined>(undefined);\n const setLastFocusedCellIndex = React.useCallback((index: number | undefined) => {\n lastFocusedCellIndexRef.current = index;\n }, []);\n\n return [lastFocusedCellIndexRef.current, setLastFocusedCellIndex];\n}\n\nfunction usePendingChangesUpdater<TType = unknown>(\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n setPendingChanges: React.Dispatch<React.SetStateAction<PendingChanges<TType>>>\n) {\n const localization = useLocalization();\n const updatersRef = React.useRef<PendingChanges<TType>>({});\n\n const runCellUpdates = React.useCallback(\n debounce(async function <T extends TType>(changes: Partial<T>, cell: ReactTableCell<T, unknown>, rowIndex: number) {\n if (typeof handleChange === 'function') {\n const previousValues = {\n ...cell.row.original,\n ...getChangesetFromChanges(updatersRef.current[cell.row.id]),\n };\n const nextValues = {\n ...previousValues,\n ...changes,\n };\n const updates = await handleChange(cell.column.id, changes[cell.column.id], nextValues, previousValues);\n\n if (updates && Object.keys(updates).length) {\n setPendingChanges(currentChanges =>\n createPendingChangesSetter(currentChanges, cell.row, rowIndex, updates, localization)\n );\n }\n }\n }, 250),\n []\n ) as unknown as <T extends TType>(changes: Partial<T>, cell: ReactTableCell<T, unknown>, rowIndex: number) => Promise<void>;\n\n function syncCellChanges<T extends TType>(changes: PendingChanges<T>) {\n updatersRef.current = changes;\n }\n\n return {\n syncCellChanges,\n runCellUpdates,\n };\n}\n\nfunction createPendingChangesSetter<TType = unknown>(\n currentChanges: PendingChanges<TType>,\n row: ReactTableRow<TType>,\n rowIndex: number,\n changes: Partial<TType>,\n localization: Localization\n) {\n // prepare\n const nextChanges: PendingChanges<TType> = { ...currentChanges };\n const rowChanges = {\n ...currentChanges[row.id],\n _meta: {\n ...currentChanges[row.id]?._meta,\n original: row.original,\n moveReason: {\n ...currentChanges[row.id]?._meta.moveReason,\n },\n errors: {\n ...currentChanges[row.id]?._meta.errors,\n },\n },\n } as PendingChange<TType>;\n\n // run changes\n const cells = row._getAllCellsByColumnId();\n\n for (const [accessor, change] of Object.entries(changes)) {\n // update if the change is different to the original (saved) value,\n // otherwise remove any change - no point saving the same value\n if (change !== row.original[accessor]) {\n rowChanges[accessor] = change;\n\n // consumers sometimes include properties in onEditingChange that aren't rendered as columns, we need to guard against that.\n // eslint-disable-next-line no-prototype-builtins\n if (cells.hasOwnProperty(accessor)) {\n // determine if the row will move position based on this change, and save why it will move\n const reason = willRowMove(cells[accessor], change, rowIndex, localization);\n\n if (reason) {\n rowChanges._meta.moveReason[accessor] = reason;\n } else {\n delete rowChanges._meta.moveReason[accessor];\n }\n }\n } else {\n delete rowChanges[accessor];\n delete rowChanges._meta.moveReason[accessor];\n }\n }\n\n // set changes\n // or delete if there are no changes left, so that we don't store changes with unchanged data\n if (Object.keys(rowChanges).filter(k => k !== '_meta').length) {\n nextChanges[row.id] = rowChanges;\n } else {\n delete nextChanges[row.id];\n }\n\n return nextChanges;\n}\n\nfunction getChangesetFromChanges<TType = unknown>(changes: PendingChange<TType>): TType {\n // extract the original data from the row changes\n const { _meta, ...changeset } = changes ?? {};\n // and mix them in with the changes, ready to send to the server\n return { ..._meta?.original, ...changeset };\n}\n"],"names":["useTableEditing","isEnabled","handleSave","handleChange","validator","isEditing","toggleEditing","React","useState","isDetailedMode","toggleDetailedMode","lastFocusedCellIndex","setLastFocusedCellIndex","useLastFocusedCellIndex","pendingChangesFns","usePendingChanges","useGlobalKeyDown","key","meta","shift","undefined","event","preventDefault","saveChanges","rowId","console","warn","Promise","resolve","changesToSave","pendingChanges","changes","Object","keys","length","_forOf","pendingChange","changeSet","getChangesetFromChanges","_catch","_temp3","_result","_exit","then","resetChanges","setRowSaveStatus","getRowSaveStatus","_temp2","errors","error","rowError","cellErrors","Error","_error$response","message","response","data","_error$response2","setPendingChanges","currentChanges","nextChanges","_meta","row","cells","shouldShowErrorAlert","e","reject","validateCell","cell","id","_temp","column","setCellValue","change","rowIndex","createPendingChangesSetter","localization","pendingChangesUpdater","syncCellChanges","runCellUpdates","addCreatedRowChangeset","getAllCells","reduce","getValue","_currentChanges$cell$","_currentChanges$cell$2","_currentChanges$cell$3","original","moveReason","useLocalization","saveStates","setSaveState","getCellValue","_pendingChanges$cell$","getCellError","_pendingChanges$cell$2","_pendingChanges$cell$3","_pendingChanges$cell$4","usePendingChangesUpdater","hasRowErrors","_pendingChanges$rowId","_pendingChanges$rowId2","_pendingChanges$rowId3","_pendingChanges$rowId4","_pendingChanges$rowId5","hasRowErrorsSeen","_pendingChanges$rowId6","getRowPendingChange","rowPendingChanges","status","currentStates","nextStates","getRowMoveReason","_pendingChanges$rowId7","values","hasChanges","hasAlertErrors","getAlertErrors","filter","map","getCompletedRowsCount","value","lastFocusedCellIndexRef","useRef","useCallback","index","current","updatersRef","debounce","previousValues","nextValues","updates","_temp4","rowChanges","_currentChanges$row$i","_currentChanges$row$i2","_currentChanges$row$i3","_getAllCellsByColumnId","accessor","entries","hasOwnProperty","reason","willRowMove","k","changeset"],"mappings":";;;;;;;SAQgBA,eAAeA,CAC3BC,SAAS,GAAG,KAAK,EACjBC,UAAuD,EACvDC,YAA2D,EAC3DC,SAAsD;;EAGtD,MAAM,CAACC,SAAS,EAAEC,aAAa,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;EAGxD,MAAM,CAACC,cAAc,EAAEC,kBAAkB,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;EAGlE,MAAM,CAACG,oBAAoB,EAAEC,uBAAuB,CAAC,GAAGC,uBAAuB,EAAE;;;;EAKjF,MAAMC,iBAAiB,GAAGC,iBAAiB,CAAQd,SAAS,EAAEC,UAAU,EAAEC,YAAY,EAAEC,SAAS,CAAC;EAElGY,gBAAgB,CAACf,SAAS,IAAII,SAAS,GAAG;IAAEY,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE,IAAI;IAAEC,KAAK,EAAE;GAAO,GAAGC,SAAS,EAAEC,KAAK;IAC/FA,KAAK,CAACC,cAAc,EAAE;IACtBR,iBAAiB,CAACS,WAAW,EAAE;GAClC,CAAC;EAEF,OAAO;IACHtB,SAAS;IACTI,SAAS;IACTI,cAAc;IACdC,kBAAkB,EAAET,SAAS,GAAGS,kBAAkB,GAAG,MAAMU,SAAS;IACpEd,aAAa,EAAEL,SAAS,GAAGK,aAAa,GAAG,MAAMc,SAAS;IAC1DT,oBAAoB;IACpBC,uBAAuB;IACvB,GAA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AC7G,MAAM,EAAE;IAC3D0B,WAAW,CAACE,GAAG,CAACO,EAAE,CAAC,GAAGgE,UAAU;GACnC,MAAM;IACH,OAAOzE,WAAW,CAACE,GAAG,CAACO,EAAE,CAAC;;EAG9B,OAAOT,WAAW;AACtB;AAEA,SAAStB,uBAAuBA,CAAkBP,OAA6B;;EAE3E,MAAM;IAAE8B,KAAK;IAAE,GAAGmF;GAAW,GAAGjH,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,EAAE;;EAE7C,OAAO;IAAE,IAAG8B,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAE0B,QAAQ;IAAE,GAAGyD;GAAW;AAC/C;;;;"}
@@ -60,7 +60,7 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
60
60
  if (rowIndex < rows.length - 1) {
61
61
  miniSortRows.push(rows[rowIndex + 1]);
62
62
  }
63
- const sortRows = (rowA, rowB) => {
63
+ const resortedRows = [...miniSortRows].sort((rowA, rowB) => {
64
64
  const sortFn = cell.column.getSortingFn();
65
65
  const sortUndefined = cell.column.columnDef.sortUndefined;
66
66
  if (!table.options.manualSorting && sortUndefined) {
@@ -75,8 +75,7 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
75
75
  }
76
76
  }
77
77
  return sortFn(rowA, rowB, cell.column.id);
78
- };
79
- const resortedRows = [...miniSortRows].sort(sortRows);
78
+ });
80
79
  if (cell.column.getIsSorted() === 'desc') {
81
80
  resortedRows.reverse();
82
81
  }