@economic/taco 2.41.4 → 2.42.1-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (470) 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 -0
  4. package/dist/components/AlertDialog/components/Content.d.ts +1 -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 +1 -1
  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 +11 -1
  268. package/dist/components/Layout/components/Sidebar.d.ts +14 -2
  269. package/dist/components/Layout/components/Top.d.ts +2 -2
  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 +2 -2
  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 -3
  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 +3 -2
  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 +14 -6
  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.map +1 -1
  321. package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js +31 -3
  322. package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js.map +1 -1
  323. package/dist/esm/packages/taco/src/components/Card/Card.js +7 -5
  324. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  325. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  326. package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
  327. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +3 -3
  328. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  329. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js.map +1 -1
  330. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +5 -3
  331. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  332. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  333. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  334. package/dist/esm/packages/taco/src/components/Layout/components/Top.js.map +1 -1
  335. package/dist/esm/packages/taco/src/components/Listbox/util.js +7 -1
  336. package/dist/esm/packages/taco/src/components/Listbox/util.js.map +1 -1
  337. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  338. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  339. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  340. package/dist/esm/packages/taco/src/components/Popover/Primitives.js +2 -1
  341. package/dist/esm/packages/taco/src/components/Popover/Primitives.js.map +1 -1
  342. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  343. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +4 -4
  344. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  345. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  346. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  347. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  348. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +11 -10
  349. package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
  350. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +0 -2
  351. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  352. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  353. package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
  354. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  355. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  356. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
  357. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  358. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js.map +1 -1
  359. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  360. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
  361. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  362. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js.map +1 -1
  363. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js.map +1 -1
  364. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js +4 -1
  365. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js.map +1 -1
  366. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +7 -4
  367. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  368. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +9 -7
  369. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  370. package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
  371. package/dist/esm/packages/taco/src/components/Tour/Tour.js +3 -3
  372. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  373. package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js.map +1 -1
  374. package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -1
  375. package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js +1 -1
  376. package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js.map +1 -1
  377. package/dist/esm/packages/taco/src/primitives/Sortable/components/Item.js.map +1 -1
  378. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js +4 -4
  379. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js.map +1 -1
  380. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/util.js +3 -1
  381. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/util.js.map +1 -1
  382. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
  383. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js +1 -1
  384. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
  385. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Goto.js.map +1 -1
  386. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js +2 -2
  387. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
  388. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Resizer.js.map +1 -1
  389. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/SortIndicator.js.map +1 -1
  390. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/util.js.map +1 -1
  391. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.js.map +1 -1
  392. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js +1 -1
  393. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  394. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +3 -1
  395. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
  396. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/util.js +5 -7
  397. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/util.js.map +1 -1
  398. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  399. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -1
  400. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/Settings.js.map +1 -1
  401. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  402. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  403. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  404. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +1 -1
  405. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +3 -1
  406. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
  407. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -1
  408. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableShortcutsListener.js.map +1 -1
  409. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +4 -2
  410. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  411. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js +4 -17
  412. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -1
  413. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js +62 -0
  414. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js.map +1 -0
  415. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/filtering.js +1 -15
  416. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/filtering.js.map +1 -1
  417. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js +37 -7
  418. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
  419. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
  420. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +22 -8
  421. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  422. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js +4 -6
  423. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js.map +1 -1
  424. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  425. package/dist/primitives/BubbleSelect.d.ts +1 -1
  426. package/dist/primitives/Sortable/components/Container.d.ts +2 -2
  427. package/dist/primitives/Sortable/components/Item.d.ts +2 -1
  428. package/dist/primitives/Sortable/components/List.d.ts +1 -1
  429. package/dist/primitives/Table/Core/Table.d.ts +2 -2
  430. package/dist/primitives/Table/Core/components/Body/Body.d.ts +1 -1
  431. package/dist/primitives/Table/Core/components/Body/EmptyStateBody.d.ts +1 -1
  432. package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.d.ts +2 -2
  433. package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.d.ts +2 -2
  434. package/dist/primitives/Table/Core/components/Columns/Cell/Cell.d.ts +1 -1
  435. package/dist/primitives/Table/Core/components/Columns/Internal/Actions.d.ts +2 -2
  436. package/dist/primitives/Table/Core/components/Footer/Footer.d.ts +3 -3
  437. package/dist/primitives/Table/Core/components/Footer/Summary.d.ts +2 -2
  438. package/dist/primitives/Table/Core/components/Header/Header.d.ts +1 -1
  439. package/dist/primitives/Table/Core/components/Header/components/Goto.d.ts +2 -2
  440. package/dist/primitives/Table/Core/components/Header/components/Menu.d.ts +1 -1
  441. package/dist/primitives/Table/Core/components/Header/components/Resizer.d.ts +2 -2
  442. package/dist/primitives/Table/Core/components/Header/components/SortIndicator.d.ts +3 -3
  443. package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +2 -2
  444. package/dist/primitives/Table/Core/components/Row/Row.d.ts +1 -1
  445. package/dist/primitives/Table/Core/components/Toolbar/Toolbar.d.ts +1 -1
  446. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/Filters.d.ts +2 -2
  447. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.d.ts +2 -2
  448. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.d.ts +2 -2
  449. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +1 -1
  450. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.d.ts +2 -2
  451. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.d.ts +2 -2
  452. package/dist/primitives/Table/Core/components/Toolbar/components/Print/Print.d.ts +1 -1
  453. package/dist/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.d.ts +2 -2
  454. package/dist/primitives/Table/Core/components/Toolbar/components/Search/Search.d.ts +1 -1
  455. package/dist/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.d.ts +2 -2
  456. package/dist/primitives/Table/Core/components/Toolbar/components/Settings/Settings.d.ts +2 -2
  457. package/dist/primitives/Table/types.d.ts +1 -1
  458. package/dist/primitives/Table/useTableManager/util/columns.d.ts +2 -2
  459. package/dist/primitives/Table/useTableManager/util/dataTypes.d.ts +12 -0
  460. package/dist/primitives/Table/useTableManager/util/filtering.d.ts +0 -2
  461. package/dist/primitives/Table/useTableManager/util/search.d.ts +6 -2
  462. package/dist/primitives/Table/useTableManager/util/settings.d.ts +1 -1
  463. package/dist/primitives/Table/useTableManager/util/setup.d.ts +3 -2
  464. package/dist/primitives/Table/useTableManager/util/sorting.d.ts +2 -1
  465. package/dist/taco.cjs.development.js +380 -259
  466. package/dist/taco.cjs.development.js.map +1 -1
  467. package/dist/taco.cjs.production.min.js +1 -1
  468. package/dist/taco.cjs.production.min.js.map +1 -1
  469. package/dist/utils/dom.d.ts +1 -1
  470. package/package.json +10 -12
@@ -1,13 +1,15 @@
1
1
  import React__default from 'react';
2
+ import { useLocalization } from '../../../../components/Provider/Localization.js';
2
3
  import { resetHighlightedColumnIndexes } from '../util/search.js';
3
4
 
4
5
  function useTableSearchListener(table, onChangeSearch) {
5
6
  const meta = table.options.meta;
7
+ const localization = useLocalization();
6
8
  // recalculates highlighted indexes whenever something important changes
7
9
  React__default.useEffect(() => {
8
10
  if (meta.search.isEnabled) {
9
11
  const query = table.getState().globalFilter;
10
- resetHighlightedColumnIndexes(query, table);
12
+ resetHighlightedColumnIndexes(query, table, localization);
11
13
  if (typeof onChangeSearch === 'function') {
12
14
  onChangeSearch(query);
13
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useTableSearchListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableSearchListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { resetHighlightedColumnIndexes } from '../util/search';\nimport { TableSearchHandler } from '../../types';\n\nexport function useTableSearchListener<TType = unknown>(table: ReactTable<TType>, onChangeSearch?: TableSearchHandler) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n\n // recalculates highlighted indexes whenever something important changes\n React.useEffect(() => {\n if (meta.search.isEnabled) {\n const query = table.getState().globalFilter;\n resetHighlightedColumnIndexes(query, table);\n\n if (typeof onChangeSearch === 'function') {\n onChangeSearch(query);\n }\n }\n }, [\n meta.server.loadAllStatus,\n meta.search.isEnabled,\n meta.search.enableGlobalFilter,\n table.getRowModel().rows.length,\n table.getState().globalFilter,\n JSON.stringify(table.getState().sorting),\n JSON.stringify(table.getState().columnVisibility),\n onChangeSearch,\n ]);\n}\n"],"names":["useTableSearchListener","table","onChangeSearch","meta","options","React","useEffect","search","isEnabled","query","getState","globalFilter","resetHighlightedColumnIndexes","server","loadAllStatus","enableGlobalFilter","getRowModel","rows","length","JSON","stringify","sorting","columnVisibility"],"mappings":";;;SAKgBA,sBAAsBA,CAAkBC,KAAwB,EAAEC,cAAmC;EACjH,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAACD,IAA6B;;EAGxDE,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIH,IAAI,CAACI,MAAM,CAACC,SAAS,EAAE;MACvB,MAAMC,KAAK,GAAGR,KAAK,CAACS,QAAQ,EAAE,CAACC,YAAY;MAC3CC,6BAA6B,CAACH,KAAK,EAAER,KAAK,CAAC;MAE3C,IAAI,OAAOC,cAAc,KAAK,UAAU,EAAE;QACtCA,cAAc,CAACO,KAAK,CAAC;;;GAGhC,EAAE,CACCN,IAAI,CAACU,MAAM,CAACC,aAAa,EACzBX,IAAI,CAACI,MAAM,CAACC,SAAS,EACrBL,IAAI,CAACI,MAAM,CAACQ,kBAAkB,EAC9Bd,KAAK,CAACe,WAAW,EAAE,CAACC,IAAI,CAACC,MAAM,EAC/BjB,KAAK,CAACS,QAAQ,EAAE,CAACC,YAAY,EAC7BQ,IAAI,CAACC,SAAS,CAACnB,KAAK,CAACS,QAAQ,EAAE,CAACW,OAAO,CAAC,EACxCF,IAAI,CAACC,SAAS,CAACnB,KAAK,CAACS,QAAQ,EAAE,CAACY,gBAAgB,CAAC,EACjDpB,cAAc,CACjB,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"useTableSearchListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableSearchListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { resetHighlightedColumnIndexes } from '../util/search';\nimport { TableSearchHandler } from '../../types';\nimport { useLocalization } from '../../../../components/Provider/Localization';\n\nexport function useTableSearchListener<TType = unknown>(table: ReactTable<TType>, onChangeSearch?: TableSearchHandler) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const localization = useLocalization();\n\n // recalculates highlighted indexes whenever something important changes\n React.useEffect(() => {\n if (meta.search.isEnabled) {\n const query = table.getState().globalFilter;\n resetHighlightedColumnIndexes(query, table, localization);\n\n if (typeof onChangeSearch === 'function') {\n onChangeSearch(query);\n }\n }\n }, [\n meta.server.loadAllStatus,\n meta.search.isEnabled,\n meta.search.enableGlobalFilter,\n table.getRowModel().rows.length,\n table.getState().globalFilter,\n JSON.stringify(table.getState().sorting),\n JSON.stringify(table.getState().columnVisibility),\n onChangeSearch,\n ]);\n}\n"],"names":["useTableSearchListener","table","onChangeSearch","meta","options","localization","useLocalization","React","useEffect","search","isEnabled","query","getState","globalFilter","resetHighlightedColumnIndexes","server","loadAllStatus","enableGlobalFilter","getRowModel","rows","length","JSON","stringify","sorting","columnVisibility"],"mappings":";;;;SAMgBA,sBAAsBA,CAAkBC,KAAwB,EAAEC,cAAmC;EACjH,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAACD,IAA6B;EACxD,MAAME,YAAY,GAAGC,eAAe,EAAE;;EAGtCC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIL,IAAI,CAACM,MAAM,CAACC,SAAS,EAAE;MACvB,MAAMC,KAAK,GAAGV,KAAK,CAACW,QAAQ,EAAE,CAACC,YAAY;MAC3CC,6BAA6B,CAACH,KAAK,EAAEV,KAAK,EAAEI,YAAY,CAAC;MAEzD,IAAI,OAAOH,cAAc,KAAK,UAAU,EAAE;QACtCA,cAAc,CAACS,KAAK,CAAC;;;GAGhC,EAAE,CACCR,IAAI,CAACY,MAAM,CAACC,aAAa,EACzBb,IAAI,CAACM,MAAM,CAACC,SAAS,EACrBP,IAAI,CAACM,MAAM,CAACQ,kBAAkB,EAC9BhB,KAAK,CAACiB,WAAW,EAAE,CAACC,IAAI,CAACC,MAAM,EAC/BnB,KAAK,CAACW,QAAQ,EAAE,CAACC,YAAY,EAC7BQ,IAAI,CAACC,SAAS,CAACrB,KAAK,CAACW,QAAQ,EAAE,CAACW,OAAO,CAAC,EACxCF,IAAI,CAACC,SAAS,CAACrB,KAAK,CAACW,QAAQ,EAAE,CAACY,gBAAgB,CAAC,EACjDtB,cAAc,CACjB,CAAC;AACN;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTableSettingsListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableSettingsListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { TableSettingsHandler } from '../../types';\nimport { getSettings } from '../util/settings';\n\nexport function useTableSettingsListener<TType = unknown>(\n table: ReactTable<TType>,\n onChangeSettings: TableSettingsHandler | undefined\n) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const state = table.getState();\n\n React.useEffect(() => {\n let handler;\n\n if (typeof onChangeSettings === 'function') {\n handler = setTimeout(() => {\n // some settings shouldn't be persisted, but we comment them out here to highlight the intention\n onChangeSettings(getSettings(table));\n }, 250);\n }\n\n return () => clearTimeout(handler);\n }, [\n //state.columnFilters,\n state.columnOrder,\n state.columnPinning,\n state.columnSizing,\n state.columnVisibility,\n table.options.enableGlobalFilter,\n meta.fontSize.size,\n //state.grouping,\n meta.rowHeight.height,\n //state.globalFilter,\n state.sorting,\n ]);\n}\n"],"names":["useTableSettingsListener","table","onChangeSettings","meta","options","state","getState","React","useEffect","handler","setTimeout","getSettings","clearTimeout","columnOrder","columnPinning","columnSizing","columnVisibility","enableGlobalFilter","fontSize","size","rowHeight","height","sorting"],"mappings":";;;SAKgBA,wBAAwBA,CACpCC,KAAwB,EACxBC,gBAAkD;EAElD,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAACD,IAA6B;EACxD,MAAME,KAAK,GAAGJ,KAAK,CAACK,QAAQ,EAAE;EAE9BC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIC,OAAO;IAEX,IAAI,OAAOP,gBAAgB,KAAK,UAAU,EAAE;MACxCO,OAAO,GAAGC,UAAU,CAAC;;QAEjBR,gBAAgB,CAACS,WAAW,CAACV,KAAK,CAAC,CAAC;OACvC,EAAE,GAAG,CAAC;;IAGX,OAAO,MAAMW,YAAY,CAACH,OAAO,CAAC;GACrC,EAAE;;EAECJ,KAAK,CAACQ,WAAW,EACjBR,KAAK,CAACS,aAAa,EACnBT,KAAK,CAACU,YAAY,EAClBV,KAAK,CAACW,gBAAgB,EACtBf,KAAK,CAACG,OAAO,CAACa,kBAAkB,EAChCd,IAAI,CAACe,QAAQ,CAACC,IAAI;;EAElBhB,IAAI,CAACiB,SAAS,CAACC,MAAM;;EAErBhB,KAAK,CAACiB,OAAO,CAChB,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"useTableSettingsListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableSettingsListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { TableSettingsHandler } from '../../types';\nimport { getSettings } from '../util/settings';\n\nexport function useTableSettingsListener<TType = unknown>(\n table: ReactTable<TType>,\n onChangeSettings: TableSettingsHandler | undefined\n) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const state = table.getState();\n\n React.useEffect(() => {\n let handler: NodeJS.Timeout;\n\n if (typeof onChangeSettings === 'function') {\n handler = setTimeout(() => {\n // some settings shouldn't be persisted, but we comment them out here to highlight the intention\n onChangeSettings(getSettings(table));\n }, 250);\n }\n\n return () => clearTimeout(handler);\n }, [\n //state.columnFilters,\n state.columnOrder,\n state.columnPinning,\n state.columnSizing,\n state.columnVisibility,\n table.options.enableGlobalFilter,\n meta.fontSize.size,\n //state.grouping,\n meta.rowHeight.height,\n //state.globalFilter,\n state.sorting,\n ]);\n}\n"],"names":["useTableSettingsListener","table","onChangeSettings","meta","options","state","getState","React","useEffect","handler","setTimeout","getSettings","clearTimeout","columnOrder","columnPinning","columnSizing","columnVisibility","enableGlobalFilter","fontSize","size","rowHeight","height","sorting"],"mappings":";;;SAKgBA,wBAAwBA,CACpCC,KAAwB,EACxBC,gBAAkD;EAElD,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAACD,IAA6B;EACxD,MAAME,KAAK,GAAGJ,KAAK,CAACK,QAAQ,EAAE;EAE9BC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIC,OAAuB;IAE3B,IAAI,OAAOP,gBAAgB,KAAK,UAAU,EAAE;MACxCO,OAAO,GAAGC,UAAU,CAAC;;QAEjBR,gBAAgB,CAACS,WAAW,CAACV,KAAK,CAAC,CAAC;OACvC,EAAE,GAAG,CAAC;;IAGX,OAAO,MAAMW,YAAY,CAACH,OAAO,CAAC;GACrC,EAAE;;EAECJ,KAAK,CAACQ,WAAW,EACjBR,KAAK,CAACS,aAAa,EACnBT,KAAK,CAACU,YAAY,EAClBV,KAAK,CAACW,gBAAgB,EACtBf,KAAK,CAACG,OAAO,CAACa,kBAAkB,EAChCd,IAAI,CAACe,QAAQ,CAACC,IAAI;;EAElBhB,IAAI,CAACiB,SAAS,CAACC,MAAM;;EAErBhB,KAAK,CAACiB,OAAO,CAChB,CAAC;AACN;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTableShortcutsListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableShortcutsListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { KeyDownHandlerOptions, createShortcutKeyDownHandler } from '../../../../utils/keyboard';\nimport { TableShortcutHandlerObject, TableShortcuts } from '../../types';\n\nexport function useTableShortcutsListener<TType = unknown>(\n table: ReactTable<TType>,\n shortcuts: TableShortcuts<TType> | undefined\n) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n\n React.useEffect(() => {\n const shortcutKeys = Object.keys(shortcuts ?? {});\n const globalHandlers: Array<(event: KeyboardEvent) => void> = [];\n\n // convert the shortcut into the correct format to register it\n if (shortcuts && shortcutKeys.length && meta.rowActive.rowActiveIndex !== undefined) {\n const rowActive = rows[meta.rowActive.rowActiveIndex];\n\n shortcutKeys.forEach(key => {\n const handler = shortcuts[key];\n\n let keyDownHandler;\n let keyDownHandlerOptions: KeyDownHandlerOptions;\n\n if (typeof handler === 'function') {\n keyDownHandler = handler;\n keyDownHandlerOptions = {\n key,\n };\n } else {\n const handlerObject = handler as TableShortcutHandlerObject<TType>;\n keyDownHandler = handlerObject.handler;\n keyDownHandlerOptions = {\n key,\n meta: handlerObject.meta,\n shift: handlerObject.shift,\n };\n }\n\n globalHandlers.push(\n createShortcutKeyDownHandler(keyDownHandlerOptions, event => {\n event.preventDefault();\n keyDownHandler(rowActive?.original);\n })\n );\n });\n }\n\n globalHandlers.forEach(handler => {\n document.addEventListener('keydown', handler);\n });\n\n return () => {\n globalHandlers.forEach(handler => {\n document.removeEventListener('keydown', handler);\n });\n };\n }, [shortcuts, meta.rowActive.rowActiveIndex, rows.length]);\n}\n"],"names":["useTableShortcutsListener","table","shortcuts","meta","options","rows","getRowModel","React","useEffect","shortcutKeys","Object","keys","globalHandlers","length","rowActive","rowActiveIndex","undefined","forEach","key","handler","keyDownHandler","keyDownHandlerOptions","handlerObject","shift","push","createShortcutKeyDownHandler","event","preventDefault","original","document","addEventListener","removeEventListener"],"mappings":";;;SAKgBA,yBAAyBA,CACrCC,KAAwB,EACxBC,SAA4C;EAE5C,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAACD,IAA6B;EACxD,MAAME,IAAI,GAAGJ,KAAK,CAACK,WAAW,EAAE,CAACD,IAAI;EAErCE,cAAK,CAACC,SAAS,CAAC;IACZ,MAAMC,YAAY,GAAGC,MAAM,CAACC,IAAI,CAACT,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI,EAAE,CAAC;IACjD,MAAMU,cAAc,GAA0C,EAAE;;IAGhE,IAAIV,SAAS,IAAIO,YAAY,CAACI,MAAM,IAAIV,IAAI,CAACW,SAAS,CAACC,cAAc,KAAKC,SAAS,EAAE;MACjF,MAAMF,SAAS,GAAGT,IAAI,CAACF,IAAI,CAACW,SAAS,CAACC,cAAc,CAAC;MAErDN,YAAY,CAACQ,OAAO,CAACC,GAAG;QACpB,MAAMC,OAAO,GAAGjB,SAAS,CAACgB,GAAG,CAAC;QAE9B,IAAIE,cAAc;QAClB,IAAIC,qBAA4C;QAEhD,IAAI,OAAOF,OAAO,KAAK,UAAU,EAAE;UAC/BC,cAAc,GAAGD,OAAO;UACxBE,qBAAqB,GAAG;YACpBH;WACH;SACJ,MAAM;UACH,MAAMI,aAAa,GAAGH,OAA4C;UAClEC,cAAc,GAAGE,aAAa,CAACH,OAAO;UACtCE,qBAAqB,GAAG;YACpBH,GAAG;YACHf,IAAI,EAAEmB,aAAa,CAACnB,IAAI;YACxBoB,KAAK,EAAED,aAAa,CAACC;WACxB;;QAGLX,cAAc,CAACY,IAAI,CACfC,4BAA4B,CAACJ,qBAAqB,EAAEK,KAAK;UACrDA,KAAK,CAACC,cAAc,EAAE;UACtBP,cAAc,CAACN,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEc,QAAQ,CAAC;SACtC,CAAC,CACL;OACJ,CAAC;;IAGNhB,cAAc,CAACK,OAAO,CAACE,OAAO;MAC1BU,QAAQ,CAACC,gBAAgB,CAAC,SAAS,EAAEX,OAAO,CAAC;KAChD,CAAC;IAEF,OAAO;MACHP,cAAc,CAACK,OAAO,CAACE,OAAO;QAC1BU,QAAQ,CAACE,mBAAmB,CAAC,SAAS,EAAEZ,OAAO,CAAC;OACnD,CAAC;KACL;GACJ,EAAE,CAACjB,SAAS,EAAEC,IAAI,CAACW,SAAS,CAACC,cAAc,EAAEV,IAAI,CAACQ,MAAM,CAAC,CAAC;AAC/D;;;;"}
1
+ {"version":3,"file":"useTableShortcutsListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableShortcutsListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { KeyDownHandlerOptions, createShortcutKeyDownHandler } from '../../../../utils/keyboard';\nimport { TableShortcutHandlerFn, TableShortcutHandlerObject, TableShortcuts } from '../../types';\n\nexport function useTableShortcutsListener<TType = unknown>(\n table: ReactTable<TType>,\n shortcuts: TableShortcuts<TType> | undefined\n) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n\n React.useEffect(() => {\n const shortcutKeys = Object.keys(shortcuts ?? {});\n const globalHandlers: Array<(event: KeyboardEvent) => void> = [];\n\n // convert the shortcut into the correct format to register it\n if (shortcuts && shortcutKeys.length && meta.rowActive.rowActiveIndex !== undefined) {\n const rowActive = rows[meta.rowActive.rowActiveIndex];\n\n shortcutKeys.forEach(key => {\n const handler = shortcuts[key];\n\n let keyDownHandler: TableShortcutHandlerFn<TType>;\n let keyDownHandlerOptions: KeyDownHandlerOptions;\n\n if (typeof handler === 'function') {\n keyDownHandler = handler;\n keyDownHandlerOptions = {\n key,\n };\n } else {\n const handlerObject = handler as TableShortcutHandlerObject<TType>;\n keyDownHandler = handlerObject.handler;\n keyDownHandlerOptions = {\n key,\n meta: handlerObject.meta,\n shift: handlerObject.shift,\n };\n }\n\n globalHandlers.push(\n createShortcutKeyDownHandler(keyDownHandlerOptions, event => {\n event.preventDefault();\n keyDownHandler(rowActive?.original);\n })\n );\n });\n }\n\n globalHandlers.forEach(handler => {\n document.addEventListener('keydown', handler);\n });\n\n return () => {\n globalHandlers.forEach(handler => {\n document.removeEventListener('keydown', handler);\n });\n };\n }, [shortcuts, meta.rowActive.rowActiveIndex, rows.length]);\n}\n"],"names":["useTableShortcutsListener","table","shortcuts","meta","options","rows","getRowModel","React","useEffect","shortcutKeys","Object","keys","globalHandlers","length","rowActive","rowActiveIndex","undefined","forEach","key","handler","keyDownHandler","keyDownHandlerOptions","handlerObject","shift","push","createShortcutKeyDownHandler","event","preventDefault","original","document","addEventListener","removeEventListener"],"mappings":";;;SAKgBA,yBAAyBA,CACrCC,KAAwB,EACxBC,SAA4C;EAE5C,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAACD,IAA6B;EACxD,MAAME,IAAI,GAAGJ,KAAK,CAACK,WAAW,EAAE,CAACD,IAAI;EAErCE,cAAK,CAACC,SAAS,CAAC;IACZ,MAAMC,YAAY,GAAGC,MAAM,CAACC,IAAI,CAACT,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI,EAAE,CAAC;IACjD,MAAMU,cAAc,GAA0C,EAAE;;IAGhE,IAAIV,SAAS,IAAIO,YAAY,CAACI,MAAM,IAAIV,IAAI,CAACW,SAAS,CAACC,cAAc,KAAKC,SAAS,EAAE;MACjF,MAAMF,SAAS,GAAGT,IAAI,CAACF,IAAI,CAACW,SAAS,CAACC,cAAc,CAAC;MAErDN,YAAY,CAACQ,OAAO,CAACC,GAAG;QACpB,MAAMC,OAAO,GAAGjB,SAAS,CAACgB,GAAG,CAAC;QAE9B,IAAIE,cAA6C;QACjD,IAAIC,qBAA4C;QAEhD,IAAI,OAAOF,OAAO,KAAK,UAAU,EAAE;UAC/BC,cAAc,GAAGD,OAAO;UACxBE,qBAAqB,GAAG;YACpBH;WACH;SACJ,MAAM;UACH,MAAMI,aAAa,GAAGH,OAA4C;UAClEC,cAAc,GAAGE,aAAa,CAACH,OAAO;UACtCE,qBAAqB,GAAG;YACpBH,GAAG;YACHf,IAAI,EAAEmB,aAAa,CAACnB,IAAI;YACxBoB,KAAK,EAAED,aAAa,CAACC;WACxB;;QAGLX,cAAc,CAACY,IAAI,CACfC,4BAA4B,CAACJ,qBAAqB,EAAEK,KAAK;UACrDA,KAAK,CAACC,cAAc,EAAE;UACtBP,cAAc,CAACN,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEc,QAAQ,CAAC;SACtC,CAAC,CACL;OACJ,CAAC;;IAGNhB,cAAc,CAACK,OAAO,CAACE,OAAO;MAC1BU,QAAQ,CAACC,gBAAgB,CAAC,SAAS,EAAEX,OAAO,CAAC;KAChD,CAAC;IAEF,OAAO;MACHP,cAAc,CAACK,OAAO,CAACE,OAAO;QAC1BU,QAAQ,CAACE,mBAAmB,CAAC,SAAS,EAAEZ,OAAO,CAAC;OACnD,CAAC;KACL;GACJ,EAAE,CAACjB,SAAS,EAAEC,IAAI,CAACW,SAAS,CAACC,cAAc,EAAEV,IAAI,CAACQ,MAAM,CAAC,CAAC;AAC/D;;;;"}
@@ -1,3 +1,4 @@
1
+ import { useLocalization } from '../../../components/Provider/Localization.js';
1
2
  import { useReactTable, getCoreRowModel } from '@tanstack/react-table';
2
3
  import { mapTableChildrenToColumns, useReactTableInitialState, configureReactTableOptions } from './util/setup.js';
3
4
  import { getTableFeaturePreset } from './util/presets.js';
@@ -34,6 +35,7 @@ import { useTableRowDrop } from './features/useTableRowDrop.js';
34
35
  const DEFAULT_EMPTY_ARRAY = [];
35
36
  function useTableManager(props, meta, internalColumns) {
36
37
  var _props$data, _props$length, _meta$editing, _instance$options$met;
38
+ const localization = useLocalization();
37
39
  // CSS.escape would be best here, but it doesn't seem to work very well
38
40
  const safeId = props.id.replace('.', '_');
39
41
  // configure table options, merging props with presets
@@ -66,7 +68,7 @@ function useTableManager(props, meta, internalColumns) {
66
68
  const {
67
69
  columns,
68
70
  ...defaultState
69
- } = mapTableChildrenToColumns(props, settings, options, internalColumns);
71
+ } = mapTableChildrenToColumns(props, settings, options, internalColumns, localization);
70
72
  // configure initial table state
71
73
  const initialState = useReactTableInitialState(props, columns, settings, defaultState);
72
74
  // create a react-table instance
@@ -77,7 +79,7 @@ function useTableManager(props, meta, internalColumns) {
77
79
  initialState,
78
80
  getCoreRowModel: getCoreRowModel(),
79
81
  // configure react-table built-in features
80
- ...configureReactTableOptions(options, props),
82
+ ...configureReactTableOptions(options, props, localization),
81
83
  // settings that can be toggled by the user, and therefore require our own state
82
84
  enableGlobalFilter: search.enableGlobalFilter,
83
85
  // custom context
@@ -1 +1 @@
1
- {"version":3,"file":"useTableManager.js","sources":["../../../../../../../../src/primitives/Table/useTableManager/useTableManager.ts"],"sourcesContent":["import { useReactTable, TableMeta as ReactTableMeta, RowData, getCoreRowModel } from '@tanstack/react-table';\nimport {\n TableColumnAlignment,\n TableColumnClassNameHandler,\n TableColumnDataType,\n TableColumnMenu,\n TableColumnRenderer,\n TableColumnRendererControl,\n TableFilterComparator,\n TableProps,\n} from '../types';\nimport { useReactTableInitialState, configureReactTableOptions, mapTableChildrenToColumns } from './util/setup';\nimport { getTableFeaturePreset } from './util/presets';\nimport { useTableColumnFreezing } from './features/useTableColumnFreezing';\nimport { useTableColumnOrdering } from './features/useTableColumnOrdering';\nimport { useTableFooter } from './features/useTableFooter';\nimport { useTableFontSize } from './features/useTableFontSize';\nimport { useTablePrinting } from './features/useTablePrinting';\nimport { useTableRowActions } from './features/useTableRowActions';\nimport { useTableRowActive } from './features/useTableRowActive';\nimport { useTableRowClick } from './features/useTableRowClick';\nimport { useTableRowExpansion } from './features/useTableRowExpansion';\nimport { useTableRowGoto } from './features/useTableRowGoto';\nimport { useTableRowGroups } from './features/useTableRowGroups';\nimport { useTableRowHeight } from './features/useTableRowHeight';\nimport { useTableRowSelection } from './features/useTableRowSelection';\nimport { useTableSearch } from './features/useTableSearch';\nimport { useTableServerLoading } from './features/useTableServerLoading';\nimport { useTableSettings } from './features/useTableSettings';\nimport { useTableDataListener } from './listeners/useTableDataListener';\nimport { useTableFilterListener } from './listeners/useTableFilterListener';\nimport { useTableFontSizeListener } from './listeners/useTableFontSizeListener';\nimport { useTableRowHeightListener } from './listeners/useTableRowHeightListener';\nimport { useTableRowSelectionListener } from './listeners/useTableRowSelectionListener';\nimport { useTableSearchListener } from './listeners/useTableSearchListener';\nimport { useTableSettingsListener } from './listeners/useTableSettingsListener';\nimport { useTableShortcutsListener } from './listeners/useTableShortcutsListener';\nimport { useTableSortingListener } from './listeners/useTableSortingListener';\nimport { useTableServerLoadingListener } from './listeners/useTableServerLoadingListener';\nimport { useTableManagerInternalColumns } from './types';\nimport { useTableRowDrag } from './features/useTableRowDrag';\nimport { useTableRowDrop } from './features/useTableRowDrop';\n\n/*\n EDITING THIS FILE? READ ME FIRST!\n\n This is a shared, common hook for multiple tables. It's feature set is specifically chosen to support features\n common across those tables. If you are adding a new feature or changing an existing one, before writing any code\n in this file ask yourself the question - is this specific to a given table, or is it common to all of them.\n If you are unsure, ask your team first.\n*/\n\ndeclare module '@tanstack/table-core' {\n interface TableMeta<TData extends RowData> {\n columnFreezing: ReturnType<typeof useTableColumnFreezing>;\n columnOrdering: ReturnType<typeof useTableColumnOrdering>;\n fontSize: ReturnType<typeof useTableFontSize>;\n footer: ReturnType<typeof useTableFooter>;\n length: number;\n printing: ReturnType<typeof useTablePrinting>;\n rowActions: ReturnType<typeof useTableRowActions>;\n rowActive: ReturnType<typeof useTableRowActive>;\n rowClick: ReturnType<typeof useTableRowClick>;\n rowDrag: ReturnType<typeof useTableRowDrag>;\n rowDrop: ReturnType<typeof useTableRowDrop>;\n rowExpansion: ReturnType<typeof useTableRowExpansion>;\n rowGoto: ReturnType<typeof useTableRowGoto>;\n rowGroups: ReturnType<typeof useTableRowGroups>;\n rowHeight: ReturnType<typeof useTableRowHeight>;\n rowIdentityColumnId?: string;\n rowSelection: ReturnType<typeof useTableRowSelection>;\n search: ReturnType<typeof useTableSearch>;\n server: ReturnType<typeof useTableServerLoading>;\n }\n\n interface ColumnMeta<TData extends RowData, TValue> {\n align?: TableColumnAlignment;\n className?: TableColumnClassNameHandler<TData>;\n control?: TableColumnRendererControl<TData>;\n dataType?: TableColumnDataType;\n defaultWidth?: number;\n enableEditing?: boolean;\n enableOrdering?: boolean;\n enablePrinting?: boolean;\n enableSearch?: boolean;\n enableTruncate?: boolean;\n filters?: TableFilterComparator[];\n header: string;\n headerClassName?: string;\n menu?: TableColumnMenu;\n renderer?: TableColumnRenderer<TValue, TData>;\n tooltip?: string;\n }\n}\n\n// Placed this array outside the hook to avoid creating a new array reference on each hook re-render\nconst DEFAULT_EMPTY_ARRAY = [];\n\nexport function useTableManager<TType = unknown, TMeta = {}>(\n props: TableProps<TType>,\n meta?: Partial<ReactTableMeta<TType>> & TMeta,\n internalColumns?: useTableManagerInternalColumns<TType>\n) {\n // CSS.escape would be best here, but it doesn't seem to work very well\n const safeId = props.id.replace('.', '_');\n // configure table options, merging props with presets\n const options = getTableFeaturePreset(props);\n\n // load any persisted table settings and merge them with any defaults\n const [settings, setSettings] = useTableSettings(\n options.enableSaveSettings,\n safeId,\n props.defaultSettings,\n props.onChangeSettings\n );\n\n // ensure data is always valid\n const data = props.data ?? DEFAULT_EMPTY_ARRAY;\n const length = props.length ?? data.length;\n\n // configure common custom features\n const columnFreezing = useTableColumnFreezing(options.enableColumnFreezing);\n const columnOrdering = useTableColumnOrdering(options.enableColumnOrdering);\n const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);\n const footer = useTableFooter(options.enableFooter);\n const printing = useTablePrinting(options.enablePrinting, safeId);\n const rowActive = useTableRowActive(options.enableRowActive, props.defaultRowActiveIndex);\n const rowActions = useTableRowActions<TType>(options.enableRowActions, props.rowActions, props.rowActionsLength);\n const rowClick = useTableRowClick<TType>(options.enableRowClick, props.onRowClick);\n const rowDrag = useTableRowDrag<TType>(options.enableRowDrag && !meta?.editing?.isEditing, props.onRowDrag);\n const rowDrop = useTableRowDrop<TType>(options.enableRowDrop, props.onRowDrop);\n const rowExpansion = useTableRowExpansion<TType>(options.enableRowExpansion, props.rowExpansionRenderer);\n const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);\n const rowGroups = useTableRowGroups(props.rowActionsForGroup);\n const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);\n const rowSelection = useTableRowSelection(!!options.enableRowSelection);\n const search = useTableSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);\n const server = useTableServerLoading(props.loadPage, props.loadAll, props.pageSize);\n\n // TODO: memoise\n // convert jsx column components into valid table columns\n const { columns, ...defaultState } = mapTableChildrenToColumns<TType>(props, settings, options, internalColumns);\n\n // configure initial table state\n const initialState = useReactTableInitialState<TType>(props, columns, settings, defaultState);\n\n // create a react-table instance\n const instance = useReactTable<TType>({\n data,\n columns,\n // configure initial table state\n initialState,\n getCoreRowModel: getCoreRowModel<TType>(),\n // configure react-table built-in features\n ...configureReactTableOptions<TType>(options, props),\n // settings that can be toggled by the user, and therefore require our own state\n enableGlobalFilter: search.enableGlobalFilter,\n // custom context\n meta: {\n // spread features from specific implementations\n ...meta,\n columnFreezing,\n columnOrdering,\n fontSize,\n footer,\n length,\n printing,\n rowActions: rowActions as any, // no other way around ReturnType<typeof X> not supporting generics\n rowActive,\n rowClick: rowClick as any, // no other way around ReturnType<typeof X> not supporting generics\n rowDrag,\n rowDrop: rowDrop as any, // no other way around ReturnType<typeof X> not supporting generics\n rowExpansion: rowExpansion as any, // no other way around ReturnType<typeof X> not supporting generics\n rowIdentityColumnId: props.rowIdentityColumnId,\n rowGoto,\n rowGroups: rowGroups as any, // no other way around ReturnType<typeof X> not supporting generics\n rowHeight,\n rowSelection,\n search,\n server,\n } as ReactTableMeta<TType> & TMeta,\n });\n\n // state listeners - we have these so that we don't have to control state outside the table\n useTableDataListener(instance);\n useTableFilterListener(instance, props.onChangeFilter);\n useTableFontSizeListener(instance);\n useTableRowHeightListener(instance);\n useTableRowSelectionListener(instance, props.onRowSelect);\n useTableSearchListener(instance, props.onChangeSearch);\n useTableServerLoadingListener(instance, server.loadPage);\n useTableSettingsListener(instance, setSettings);\n useTableShortcutsListener(instance, props.shortcuts);\n useTableSortingListener(instance, props.onChangeSort);\n\n return {\n id: safeId,\n instance,\n meta: (instance.options.meta ?? {}) as ReactTableMeta<TType> & TMeta,\n state: instance.getState(),\n };\n}\n"],"names":["DEFAULT_EMPTY_ARRAY","useTableManager","props","meta","internalColumns","safeId","id","replace","options","getTableFeaturePreset","settings","setSettings","useTableSettings","enableSaveSettings","defaultSettings","onChangeSettings","data","_props$data","length","_props$length","columnFreezing","useTableColumnFreezing","enableColumnFreezing","columnOrdering","useTableColumnOrdering","enableColumnOrdering","fontSize","useTableFontSize","enableFontSize","footer","useTableFooter","enableFooter","printing","useTablePrinting","enablePrinting","rowActive","useTableRowActive","enableRowActive","defaultRowActiveIndex","rowActions","useTableRowActions","enableRowActions","rowActionsLength","rowClick","useTableRowClick","enableRowClick","onRowClick","rowDrag","useTableRowDrag","enableRowDrag","_meta$editing","editing","isEditing","onRowDrag","rowDrop","useTableRowDrop","enableRowDrop","onRowDrop","rowExpansion","useTableRowExpansion","enableRowExpansion","rowExpansionRenderer","rowGoto","useTableRowGoto","enableRowGoto","onRowGoto","rowGroups","useTableRowGroups","rowActionsForGroup","rowHeight","useTableRowHeight","enableRowHeight","rowSelection","useTableRowSelection","enableRowSelection","search","useTableSearch","enableSearch","excludeUnmatchedRecordsInSearch","server","useTableServerLoading","loadPage","loadAll","pageSize","columns","defaultState","mapTableChildrenToColumns","initialState","useReactTableInitialState","instance","useReactTable","getCoreRowModel","configureReactTableOptions","enableGlobalFilter","rowIdentityColumnId","useTableDataListener","useTableFilterListener","onChangeFilter","useTableFontSizeListener","useTableRowHeightListener","useTableRowSelectionListener","onRowSelect","useTableSearchListener","onChangeSearch","useTableServerLoadingListener","useTableSettingsListener","useTableShortcutsListener","shortcuts","useTableSortingListener","onChangeSort","_instance$options$met","state","getState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA;AACA,MAAMA,mBAAmB,GAAG,EAAE;SAEdC,eAAeA,CAC3BC,KAAwB,EACxBC,IAA6C,EAC7CC,eAAuD;;;EAGvD,MAAMC,MAAM,GAAGH,KAAK,CAACI,EAAE,CAACC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;;EAEzC,MAAMC,OAAO,GAAGC,qBAAqB,CAACP,KAAK,CAAC;;EAG5C,MAAM,CAACQ,QAAQ,EAAEC,WAAW,CAAC,GAAGC,gBAAgB,CAC5CJ,OAAO,CAACK,kBAAkB,EAC1BR,MAAM,EACNH,KAAK,CAACY,eAAe,EACrBZ,KAAK,CAACa,gBAAgB,CACzB;;EAGD,MAAMC,IAAI,IAAAC,WAAA,GAAGf,KAAK,CAACc,IAAI,cAAAC,WAAA,cAAAA,WAAA,GAAIjB,mBAAmB;EAC9C,MAAMkB,MAAM,IAAAC,aAAA,GAAGjB,KAAK,CAACgB,MAAM,cAAAC,aAAA,cAAAA,aAAA,GAAIH,IAAI,CAACE,MAAM;;EAG1C,MAAME,cAAc,GAAGC,sBAAsB,CAACb,OAAO,CAACc,oBAAoB,CAAC;EAC3E,MAAMC,cAAc,GAAGC,sBAAsB,CAAChB,OAAO,CAACiB,oBAAoB,CAAC;EAC3E,MAAMC,QAAQ,GAAGC,gBAAgB,CAACnB,OAAO,CAACoB,cAAc,EAAElB,QAAQ,CAACgB,QAAQ,CAAC;EAC5E,MAAMG,MAAM,GAAGC,cAAc,CAACtB,OAAO,CAACuB,YAAY,CAAC;EACnD,MAAMC,QAAQ,GAAGC,gBAAgB,CAACzB,OAAO,CAAC0B,cAAc,EAAE7B,MAAM,CAAC;EACjE,MAAM8B,SAAS,GAAGC,iBAAiB,CAAC5B,OAAO,CAAC6B,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;EACxDwB,wBAAwB,CAAChB,QAAQ,EAAE9E,WAAW,CAAC;EAC/C+F,yBAAyB,CAACjB,QAAQ,EAAEvF,KAAK,CAACyG,SAAS,CAAC;EACpDC,uBAAuB,CAACnB,QAAQ,EAAEvF,KAAK,CAAC2G,YAAY,CAAC;EAErD,OAAO;IACHvG,EAAE,EAAED,MAAM;IACVoF,QAAQ;IACRtF,IAAI,GAAA2G,qBAAA,GAAGrB,QAAQ,CAACjF,OAAO,CAACL,IAAI,cAAA2G,qBAAA,cAAAA,qBAAA,GAAI,EAAoC;IACpEC,KAAK,EAAEtB,QAAQ,CAACuB,QAAQ;GAC3B;AACL;;;;"}
1
+ {"version":3,"file":"useTableManager.js","sources":["../../../../../../../../src/primitives/Table/useTableManager/useTableManager.ts"],"sourcesContent":["import { useReactTable, TableMeta as ReactTableMeta, RowData, getCoreRowModel } from '@tanstack/react-table';\nimport {\n TableColumnAlignment,\n TableColumnClassNameHandler,\n TableColumnDataType,\n TableColumnMenu,\n TableColumnRenderer,\n TableColumnRendererControl,\n TableFilterComparator,\n TableProps,\n} from '../types';\nimport { useReactTableInitialState, configureReactTableOptions, mapTableChildrenToColumns } from './util/setup';\nimport { getTableFeaturePreset } from './util/presets';\nimport { useTableColumnFreezing } from './features/useTableColumnFreezing';\nimport { useTableColumnOrdering } from './features/useTableColumnOrdering';\nimport { useTableFooter } from './features/useTableFooter';\nimport { useTableFontSize } from './features/useTableFontSize';\nimport { useTablePrinting } from './features/useTablePrinting';\nimport { useTableRowActions } from './features/useTableRowActions';\nimport { useTableRowActive } from './features/useTableRowActive';\nimport { useTableRowClick } from './features/useTableRowClick';\nimport { useTableRowExpansion } from './features/useTableRowExpansion';\nimport { useTableRowGoto } from './features/useTableRowGoto';\nimport { useTableRowGroups } from './features/useTableRowGroups';\nimport { useTableRowHeight } from './features/useTableRowHeight';\nimport { useTableRowSelection } from './features/useTableRowSelection';\nimport { useTableSearch } from './features/useTableSearch';\nimport { useTableServerLoading } from './features/useTableServerLoading';\nimport { useTableSettings } from './features/useTableSettings';\nimport { useTableDataListener } from './listeners/useTableDataListener';\nimport { useTableFilterListener } from './listeners/useTableFilterListener';\nimport { useTableFontSizeListener } from './listeners/useTableFontSizeListener';\nimport { useTableRowHeightListener } from './listeners/useTableRowHeightListener';\nimport { useTableRowSelectionListener } from './listeners/useTableRowSelectionListener';\nimport { useTableSearchListener } from './listeners/useTableSearchListener';\nimport { useTableSettingsListener } from './listeners/useTableSettingsListener';\nimport { useTableShortcutsListener } from './listeners/useTableShortcutsListener';\nimport { useTableSortingListener } from './listeners/useTableSortingListener';\nimport { useTableServerLoadingListener } from './listeners/useTableServerLoadingListener';\nimport { useTableManagerInternalColumns } from './types';\nimport { useTableRowDrag } from './features/useTableRowDrag';\nimport { useTableRowDrop } from './features/useTableRowDrop';\nimport { useLocalization } from '../../../components/Provider/Localization';\n\n/*\n EDITING THIS FILE? READ ME FIRST!\n\n This is a shared, common hook for multiple tables. It's feature set is specifically chosen to support features\n common across those tables. If you are adding a new feature or changing an existing one, before writing any code\n in this file ask yourself the question - is this specific to a given table, or is it common to all of them.\n If you are unsure, ask your team first.\n*/\n\ndeclare module '@tanstack/table-core' {\n interface TableMeta<TData extends RowData> {\n columnFreezing: ReturnType<typeof useTableColumnFreezing>;\n columnOrdering: ReturnType<typeof useTableColumnOrdering>;\n fontSize: ReturnType<typeof useTableFontSize>;\n footer: ReturnType<typeof useTableFooter>;\n length: number;\n printing: ReturnType<typeof useTablePrinting>;\n rowActions: ReturnType<typeof useTableRowActions>;\n rowActive: ReturnType<typeof useTableRowActive>;\n rowClick: ReturnType<typeof useTableRowClick>;\n rowDrag: ReturnType<typeof useTableRowDrag>;\n rowDrop: ReturnType<typeof useTableRowDrop>;\n rowExpansion: ReturnType<typeof useTableRowExpansion>;\n rowGoto: ReturnType<typeof useTableRowGoto>;\n rowGroups: ReturnType<typeof useTableRowGroups>;\n rowHeight: ReturnType<typeof useTableRowHeight>;\n rowIdentityColumnId?: string;\n rowSelection: ReturnType<typeof useTableRowSelection>;\n search: ReturnType<typeof useTableSearch>;\n server: ReturnType<typeof useTableServerLoading>;\n }\n\n interface ColumnMeta<TData extends RowData, TValue> {\n align?: TableColumnAlignment;\n className?: TableColumnClassNameHandler<TData>;\n control?: TableColumnRendererControl<TData>;\n dataType?: TableColumnDataType;\n defaultWidth?: number;\n enableEditing?: boolean;\n enableOrdering?: boolean;\n enablePrinting?: boolean;\n enableSearch?: boolean;\n enableTruncate?: boolean;\n filters?: TableFilterComparator[];\n header: string;\n headerClassName?: string;\n menu?: TableColumnMenu;\n renderer?: TableColumnRenderer<TValue, TData>;\n tooltip?: string;\n }\n}\n\n// Placed this array outside the hook to avoid creating a new array reference on each hook re-render\nconst DEFAULT_EMPTY_ARRAY: any[] = [];\n\nexport function useTableManager<TType = unknown, TMeta = {}>(\n props: TableProps<TType>,\n meta?: Partial<ReactTableMeta<TType>> & TMeta,\n internalColumns?: useTableManagerInternalColumns<TType>\n) {\n const localization = useLocalization();\n // CSS.escape would be best here, but it doesn't seem to work very well\n const safeId = props.id.replace('.', '_');\n // configure table options, merging props with presets\n const options = getTableFeaturePreset(props);\n\n // load any persisted table settings and merge them with any defaults\n const [settings, setSettings] = useTableSettings(\n options.enableSaveSettings,\n safeId,\n props.defaultSettings,\n props.onChangeSettings\n );\n\n // ensure data is always valid\n const data = props.data ?? DEFAULT_EMPTY_ARRAY;\n const length = props.length ?? data.length;\n\n // configure common custom features\n const columnFreezing = useTableColumnFreezing(options.enableColumnFreezing);\n const columnOrdering = useTableColumnOrdering(options.enableColumnOrdering);\n const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);\n const footer = useTableFooter(options.enableFooter);\n const printing = useTablePrinting(options.enablePrinting, safeId);\n const rowActive = useTableRowActive(options.enableRowActive, props.defaultRowActiveIndex);\n const rowActions = useTableRowActions<TType>(options.enableRowActions, props.rowActions, props.rowActionsLength);\n const rowClick = useTableRowClick<TType>(options.enableRowClick, props.onRowClick);\n const rowDrag = useTableRowDrag<TType>(options.enableRowDrag && !meta?.editing?.isEditing, props.onRowDrag);\n const rowDrop = useTableRowDrop<TType>(options.enableRowDrop, props.onRowDrop);\n const rowExpansion = useTableRowExpansion<TType>(options.enableRowExpansion, props.rowExpansionRenderer);\n const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);\n const rowGroups = useTableRowGroups(props.rowActionsForGroup);\n const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);\n const rowSelection = useTableRowSelection(!!options.enableRowSelection);\n const search = useTableSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);\n const server = useTableServerLoading(props.loadPage, props.loadAll, props.pageSize);\n\n // TODO: memoise\n // convert jsx column components into valid table columns\n const { columns, ...defaultState } = mapTableChildrenToColumns<TType>(\n props,\n settings,\n options,\n internalColumns,\n localization\n );\n\n // configure initial table state\n const initialState = useReactTableInitialState<TType>(props, columns, settings, defaultState);\n\n // create a react-table instance\n const instance = useReactTable<TType>({\n data,\n columns,\n // configure initial table state\n initialState,\n getCoreRowModel: getCoreRowModel<TType>(),\n // configure react-table built-in features\n ...configureReactTableOptions<TType>(options, props, localization),\n // settings that can be toggled by the user, and therefore require our own state\n enableGlobalFilter: search.enableGlobalFilter,\n // custom context\n meta: {\n // spread features from specific implementations\n ...meta,\n columnFreezing,\n columnOrdering,\n fontSize,\n footer,\n length,\n printing,\n rowActions: rowActions as any, // no other way around ReturnType<typeof X> not supporting generics\n rowActive,\n rowClick: rowClick as any, // no other way around ReturnType<typeof X> not supporting generics\n rowDrag,\n rowDrop: rowDrop as any, // no other way around ReturnType<typeof X> not supporting generics\n rowExpansion: rowExpansion as any, // no other way around ReturnType<typeof X> not supporting generics\n rowIdentityColumnId: props.rowIdentityColumnId,\n rowGoto,\n rowGroups: rowGroups as any, // no other way around ReturnType<typeof X> not supporting generics\n rowHeight,\n rowSelection,\n search,\n server,\n } as ReactTableMeta<TType> & TMeta,\n });\n\n // state listeners - we have these so that we don't have to control state outside the table\n useTableDataListener(instance);\n useTableFilterListener(instance, props.onChangeFilter);\n useTableFontSizeListener(instance);\n useTableRowHeightListener(instance);\n useTableRowSelectionListener(instance, props.onRowSelect);\n useTableSearchListener(instance, props.onChangeSearch);\n useTableServerLoadingListener(instance, server.loadPage);\n useTableSettingsListener(instance, setSettings);\n useTableShortcutsListener(instance, props.shortcuts);\n useTableSortingListener(instance, props.onChangeSort);\n\n return {\n id: safeId,\n instance,\n meta: (instance.options.meta ?? {}) as ReactTableMeta<TType> & TMeta,\n state: instance.getState(),\n };\n}\n"],"names":["DEFAULT_EMPTY_ARRAY","useTableManager","props","meta","internalColumns","localization","useLocalization","safeId","id","replace","options","getTableFeaturePreset","settings","setSettings","useTableSettings","enableSaveSettings","defaultSettings","onChangeSettings","data","_props$data","length","_props$length","columnFreezing","useTableColumnFreezing","enableColumnFreezing","columnOrdering","useTableColumnOrdering","enableColumnOrdering","fontSize","useTableFontSize","enableFontSize","footer","useTableFooter","enableFooter","printing","useTablePrinting","enablePrinting","rowActive","useTableRowActive","enableRowActive","defaultRowActiveIndex","rowActions","useTableRowActions","enableRowActions","rowActionsLength","rowClick","useTableRowClick","enableRowClick","onRowClick","rowDrag","useTableRowDrag","enableRowDrag","_meta$editing","editing","isEditing","onRowDrag","rowDrop","useTableRowDrop","enableRowDrop","onRowDrop","rowExpansion","useTableRowExpansion","enableRowExpansion","rowExpansionRenderer","rowGoto","useTableRowGoto","enableRowGoto","onRowGoto","rowGroups","useTableRowGroups","rowActionsForGroup","rowHeight","useTableRowHeight","enableRowHeight","rowSelection","useTableRowSelection","enableRowSelection","search","useTableSearch","enableSearch","excludeUnmatchedRecordsInSearch","server","useTableServerLoading","loadPage","loadAll","pageSize","columns","defaultState","mapTableChildrenToColumns","initialState","useReactTableInitialState","instance","useReactTable","getCoreRowModel","configureReactTableOptions","enableGlobalFilter","rowIdentityColumnId","useTableDataListener","useTableFilterListener","onChangeFilter","useTableFontSizeListener","useTableRowHeightListener","useTableRowSelectionListener","onRowSelect","useTableSearchListener","onChangeSearch","useTableServerLoadingListener","useTableSettingsListener","useTableShortcutsListener","shortcuts","useTableSortingListener","onChangeSort","_instance$options$met","state","getState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGA;AACA,MAAMA,mBAAmB,GAAU,EAAE;SAErBC,eAAeA,CAC3BC,KAAwB,EACxBC,IAA6C,EAC7CC,eAAuD;;EAEvD,MAAMC,YAAY,GAAGC,eAAe,EAAE;;EAEtC,MAAMC,MAAM,GAAGL,KAAK,CAACM,EAAE,CAACC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;;EAEzC,MAAMC,OAAO,GAAGC,qBAAqB,CAACT,KAAK,CAAC;;EAG5C,MAAM,CAACU,QAAQ,EAAEC,WAAW,CAAC,GAAGC,gBAAgB,CAC5CJ,OAAO,CAACK,kBAAkB,EAC1BR,MAAM,EACNL,KAAK,CAACc,eAAe,EACrBd,KAAK,CAACe,gBAAgB,CACzB;;EAGD,MAAMC,IAAI,IAAAC,WAAA,GAAGjB,KAAK,CAACgB,IAAI,cAAAC,WAAA,cAAAA,WAAA,GAAInB,mBAAmB;EAC9C,MAAMoB,MAAM,IAAAC,aAAA,GAAGnB,KAAK,CAACkB,MAAM,cAAAC,aAAA,cAAAA,aAAA,GAAIH,IAAI,CAACE,MAAM;;EAG1C,MAAME,cAAc,GAAGC,sBAAsB,CAACb,OAAO,CAACc,oBAAoB,CAAC;EAC3E,MAAMC,cAAc,GAAGC,sBAAsB,CAAChB,OAAO,CAACiB,oBAAoB,CAAC;EAC3E,MAAMC,QAAQ,GAAGC,gBAAgB,CAACnB,OAAO,CAACoB,cAAc,EAAElB,QAAQ,CAACgB,QAAQ,CAAC;EAC5E,MAAMG,MAAM,GAAGC,cAAc,CAACtB,OAAO,CAACuB,YAAY,CAAC;EACnD,MAAMC,QAAQ,GAAGC,gBAAgB,CAACzB,OAAO,CAAC0B,cAAc,EAAE7B,MAAM,CAAC;EACjE,MAAM8B,SAAS,GAAGC,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,QAAQ,EAAEV,MAAM,CAACE,QAAQ,CAAC;EACxDwB,wBAAwB,CAAChB,QAAQ,EAAE9E,WAAW,CAAC;EAC/C+F,yBAAyB,CAACjB,QAAQ,EAAEzF,KAAK,CAAC2G,SAAS,CAAC;EACpDC,uBAAuB,CAACnB,QAAQ,EAAEzF,KAAK,CAAC6G,YAAY,CAAC;EAErD,OAAO;IACHvG,EAAE,EAAED,MAAM;IACVoF,QAAQ;IACRxF,IAAI,GAAA6G,qBAAA,GAAGrB,QAAQ,CAACjF,OAAO,CAACP,IAAI,cAAA6G,qBAAA,cAAAA,qBAAA,GAAI,EAAoC;IACpEC,KAAK,EAAEtB,QAAQ,CAACuB,QAAQ;GAC3B;AACL;;;;"}
@@ -1,6 +1,5 @@
1
- import { isDate } from 'date-fns';
2
- import { format, parseFromISOString } from '../../../../utils/date.js';
3
1
  import { FontSizes } from '../../../../types.js';
2
+ import { isMatched } from './search.js';
4
3
 
5
4
  function isInternalColumn(id) {
6
5
  return id === null || id === void 0 ? void 0 : id.startsWith('__');
@@ -18,23 +17,11 @@ const getCellMinWidth = (fontSize = 'medium') => {
18
17
  }
19
18
  };
20
19
  // highlighting
21
- function isCellHighlighted(query, value, dataType) {
20
+ function isCellHighlighted(query, value, dataType, localization) {
22
21
  if (value === undefined || value === null) {
23
22
  return false;
24
23
  }
25
- return String(getCellValueAsString(value, dataType)).toLocaleLowerCase().includes(query.toLocaleLowerCase());
26
- }
27
- function getCellValueAsString(value, dataType) {
28
- if (value === undefined || value === null) {
29
- return '';
30
- } else if (isDate(value)) {
31
- var _format;
32
- return (_format = format(value)) !== null && _format !== void 0 ? _format : '';
33
- } else if (dataType === 'datetime' && typeof value === 'string') {
34
- var _format2;
35
- return (_format2 = format(parseFromISOString(value))) !== null && _format2 !== void 0 ? _format2 : '';
36
- }
37
- return String(value);
24
+ return isMatched(query, value, dataType, localization);
38
25
  }
39
26
  function orderColumn(column, {
40
27
  orderingDisabled,
@@ -116,5 +103,5 @@ function freezeUptoExternalColumn(index, columns) {
116
103
  return columns.slice(0, index + 1);
117
104
  }
118
105
 
119
- export { ensureOrdering, freezeUptoExternalColumn, getCellMinWidth, getCellValueAsString, isCellHighlighted, isInternalColumn, unfreezeAllExternalColumns };
106
+ export { ensureOrdering, freezeUptoExternalColumn, getCellMinWidth, isCellHighlighted, isInternalColumn, unfreezeAllExternalColumns };
120
107
  //# sourceMappingURL=columns.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"columns.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/columns.ts"],"sourcesContent":["import { ColumnDef as ReactTableColumnDef, GroupColumnDef as ReactTableGroupColumnDef } from '@tanstack/react-table';\nimport { isDate } from 'date-fns';\nimport { FontSize, FontSizes } from '../../../../types';\nimport { format, parseFromISOString } from '../../../../utils/date';\nimport { TableColumnDataType } from '../../types';\n\nexport function isInternalColumn(id: string | undefined) {\n return id?.startsWith('__');\n}\n\n// column widths\nexport const getCellMinWidth = (fontSize: FontSize = 'medium') => {\n switch (fontSize) {\n case FontSizes.small:\n return 57;\n\n case FontSizes.large:\n return 83;\n\n default:\n case FontSizes.medium:\n return 72;\n }\n};\n\n// highlighting\nexport function isCellHighlighted(query: string, value: unknown, dataType?: TableColumnDataType) {\n if (value === undefined || value === null) {\n return false;\n }\n\n return String(getCellValueAsString(value, dataType)).toLocaleLowerCase().includes(query.toLocaleLowerCase());\n}\n\nexport function getCellValueAsString(value: unknown, dataType?: TableColumnDataType): string {\n if (value === undefined || value === null) {\n return '';\n } else if (isDate(value)) {\n return format(value as Date) ?? '';\n } else if (dataType === 'datetime' && typeof value === 'string') {\n return format(parseFromISOString(value as string)) ?? '';\n }\n\n return String(value);\n}\n\nfunction orderColumn<TType = unknown>(\n column: ReactTableColumnDef<TType>,\n { orderingDisabled, orderingEnabled }: { orderingDisabled: string[]; orderingEnabled: string[] }\n) {\n const groupedColumn = column as ReactTableGroupColumnDef<TType>;\n\n if (Array.isArray(groupedColumn.columns) && groupedColumn.columns.length > 0) {\n groupedColumn.columns.forEach((subcolumn: ReactTableColumnDef<TType>) =>\n orderColumn(subcolumn, { orderingDisabled, orderingEnabled })\n );\n } else {\n if (column.meta?.enableOrdering) {\n orderingEnabled.push(column.id as string);\n } else {\n orderingDisabled.push(column.id as string);\n }\n }\n}\n\n// ordering\nexport function ensureOrdering<TType = unknown>(\n columns: ReactTableColumnDef<TType>[],\n settingsOrder: string[] | undefined,\n pinnedOrder: string[] | undefined = [],\n internalColumnsPinnedToTheRight: string[] = ['__actions']\n): string[] {\n // internal columns come with a defined order\n const internalColumns = columns\n .filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id)))\n .map(column => column.id) as string[];\n\n // columns with ordering disabled should be moved to the front\n const orderingDisabled: string[] = [];\n let orderingEnabled: string[] = [];\n\n let orderedColumns = columns;\n\n // if settings is defined, make sure the columns that are actual children are sorted by it\n if (Array.isArray(settingsOrder)) {\n orderedColumns = columns.slice().sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (settingsOrder.indexOf(a.id as string) >>> 0) - (settingsOrder.indexOf(b.id as string) >>> 0)\n );\n }\n\n orderedColumns.forEach(column => {\n if (isInternalColumn(column.id)) {\n return;\n }\n\n orderColumn(column, { orderingDisabled, orderingEnabled });\n });\n\n if (settingsOrder && settingsOrder.length > 0) {\n const columnsAbsentInSettingsOrder: string[] = [];\n\n orderingEnabled = orderingEnabled\n .reduce((acc, column) => {\n const index = settingsOrder.indexOf(column);\n if (index > -1) {\n acc[index] = column;\n } else {\n columnsAbsentInSettingsOrder.push(column);\n }\n\n return acc;\n }, [] as string[])\n .filter(column => !!column)\n // Append absent columns at the end\n .concat(columnsAbsentInSettingsOrder);\n }\n\n // if pinned columns are defined, make sure they are sorted first, this ensures state matches the freezing \"upto\" behaviour\n if (Array.isArray(pinnedOrder)) {\n orderingEnabled.sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (pinnedOrder.indexOf(a as string) >>> 0) - (pinnedOrder.indexOf(b as string) >>> 0)\n );\n }\n\n const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];\n\n // actions should always be last, enforce that\n internalColumnsPinnedToTheRight.forEach(id => {\n if (columns.findIndex(column => column.id === id) > -1) {\n order.push(id);\n }\n });\n\n return order;\n}\n\n// freezing - we use the react-table pinning state, but that requires some mapping between them\nexport function unfreezeAllExternalColumns(leftPinnedState?: string[]): string[] {\n return leftPinnedState?.filter(id => isInternalColumn(id) && id !== '__actions') ?? [];\n}\n\nexport function freezeUptoExternalColumn(index: number, columns: string[]): string[] {\n return columns.slice(0, index + 1);\n}\n"],"names":["isInternalColumn","id","startsWith","getCellMinWidth","fontSize","FontSizes","small","large","medium","isCellHighlighted","query","value","dataType","undefined","String","getCellValueAsString","toLocaleLowerCase","includes","isDate","_format","format","_format2","parseFromISOString","orderColumn","column","orderingDisabled","orderingEnabled","groupedColumn","Array","isArray","columns","length","forEach","subcolumn","_column$meta","meta","enableOrdering","push","ensureOrdering","settingsOrder","pinnedOrder","internalColumnsPinnedToTheRight","internalColumns","filter","map","orderedColumns","slice","sort","a","b","indexOf","columnsAbsentInSettingsOrder","reduce","acc","index","concat","order","findIndex","unfreezeAllExternalColumns","leftPinnedState","_leftPinnedState$filt","freezeUptoExternalColumn"],"mappings":";;;;SAMgBA,gBAAgBA,CAACC,EAAsB;EACnD,OAAOA,EAAE,aAAFA,EAAE,uBAAFA,EAAE,CAAEC,UAAU,CAAC,IAAI,CAAC;AAC/B;AAEA;MACaC,eAAe,GAAGA,CAACC,WAAqB,QAAQ;EACzD,QAAQA,QAAQ;IACZ,KAAKC,SAAS,CAACC,KAAK;MAChB,OAAO,EAAE;IAEb,KAAKD,SAAS,CAACE,KAAK;MAChB,OAAO,EAAE;IAEb;IACA,KAAKF,SAAS,CAACG,MAAM;MACjB,OAAO,EAAE;;AAErB;AAEA;SACgBC,iBAAiBA,CAACC,KAAa,EAAEC,KAAc,EAAEC,Q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,qBAAA,GAAI,EAAE;AAC1F;SAEgBC,wBAAwBA,CAACP,KAAa,EAAExB,OAAiB;EACrE,OAAOA,OAAO,CAACgB,KAAK,CAAC,CAAC,EAAEQ,KAAK,GAAG,CAAC,CAAC;AACtC;;;;"}
1
+ {"version":3,"file":"columns.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/columns.ts"],"sourcesContent":["import { ColumnDef as ReactTableColumnDef, GroupColumnDef as ReactTableGroupColumnDef } from '@tanstack/react-table';\nimport { FontSize, FontSizes } from '../../../../types';\nimport { TableColumnDataType } from '../../types';\nimport { isMatched } from './search';\nimport { Localization } from '../../../../components/Provider/Localization';\n\nexport function isInternalColumn(id: string | undefined) {\n return id?.startsWith('__');\n}\n\n// column widths\nexport const getCellMinWidth = (fontSize: FontSize = 'medium') => {\n switch (fontSize) {\n case FontSizes.small:\n return 57;\n\n case FontSizes.large:\n return 83;\n\n default:\n case FontSizes.medium:\n return 72;\n }\n};\n\n// highlighting\nexport function isCellHighlighted(\n query: string,\n value: unknown,\n dataType: TableColumnDataType | undefined,\n localization: Localization\n) {\n if (value === undefined || value === null) {\n return false;\n }\n\n return isMatched(query, value, dataType, localization);\n}\n\nfunction orderColumn<TType = unknown>(\n column: ReactTableColumnDef<TType>,\n { orderingDisabled, orderingEnabled }: { orderingDisabled: string[]; orderingEnabled: string[] }\n) {\n const groupedColumn = column as ReactTableGroupColumnDef<TType>;\n\n if (Array.isArray(groupedColumn.columns) && groupedColumn.columns.length > 0) {\n groupedColumn.columns.forEach((subcolumn: ReactTableColumnDef<TType>) =>\n orderColumn(subcolumn, { orderingDisabled, orderingEnabled })\n );\n } else {\n if (column.meta?.enableOrdering) {\n orderingEnabled.push(column.id as string);\n } else {\n orderingDisabled.push(column.id as string);\n }\n }\n}\n\n// ordering\nexport function ensureOrdering<TType = unknown>(\n columns: ReactTableColumnDef<TType>[],\n settingsOrder: string[] | undefined,\n pinnedOrder: string[] | undefined = [],\n internalColumnsPinnedToTheRight: string[] = ['__actions']\n): string[] {\n // internal columns come with a defined order\n const internalColumns = columns\n .filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id)))\n .map(column => column.id) as string[];\n\n // columns with ordering disabled should be moved to the front\n const orderingDisabled: string[] = [];\n let orderingEnabled: string[] = [];\n\n let orderedColumns = columns;\n\n // if settings is defined, make sure the columns that are actual children are sorted by it\n if (Array.isArray(settingsOrder)) {\n orderedColumns = columns.slice().sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (settingsOrder.indexOf(a.id as string) >>> 0) - (settingsOrder.indexOf(b.id as string) >>> 0)\n );\n }\n\n orderedColumns.forEach(column => {\n if (isInternalColumn(column.id)) {\n return;\n }\n\n orderColumn(column, { orderingDisabled, orderingEnabled });\n });\n\n if (settingsOrder && settingsOrder.length > 0) {\n const columnsAbsentInSettingsOrder: string[] = [];\n\n orderingEnabled = orderingEnabled\n .reduce((acc, column) => {\n const index = settingsOrder.indexOf(column);\n if (index > -1) {\n acc[index] = column;\n } else {\n columnsAbsentInSettingsOrder.push(column);\n }\n\n return acc;\n }, [] as string[])\n .filter(column => !!column)\n // Append absent columns at the end\n .concat(columnsAbsentInSettingsOrder);\n }\n\n // if pinned columns are defined, make sure they are sorted first, this ensures state matches the freezing \"upto\" behaviour\n if (Array.isArray(pinnedOrder)) {\n orderingEnabled.sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (pinnedOrder.indexOf(a as string) >>> 0) - (pinnedOrder.indexOf(b as string) >>> 0)\n );\n }\n\n const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];\n\n // actions should always be last, enforce that\n internalColumnsPinnedToTheRight.forEach(id => {\n if (columns.findIndex(column => column.id === id) > -1) {\n order.push(id);\n }\n });\n\n return order;\n}\n\n// freezing - we use the react-table pinning state, but that requires some mapping between them\nexport function unfreezeAllExternalColumns(leftPinnedState?: string[]): string[] {\n return leftPinnedState?.filter(id => isInternalColumn(id) && id !== '__actions') ?? [];\n}\n\nexport function freezeUptoExternalColumn(index: number, columns: string[]): string[] {\n return columns.slice(0, index + 1);\n}\n"],"names":["isInternalColumn","id","startsWith","getCellMinWidth","fontSize","FontSizes","small","large","medium","isCellHighlighted","query","value","dataType","localization","undefined","isMatched","orderColumn","column","orderingDisabled","orderingEnabled","groupedColumn","Array","isArray","columns","length","forEach","subcolumn","_column$meta","meta","enableOrdering","push","ensureOrdering","settingsOrder","pinnedOrder","internalColumnsPinnedToTheRight","internalColumns","filter","includes","String","map","orderedColumns","slice","sort","a","b","indexOf","columnsAbsentInSettingsOrder","reduce","acc","index","concat","order","findIndex","unfreezeAllExternalColumns","leftPinnedState","_leftPinnedState$filt","freezeUptoExternalColumn"],"mappings":";;;SAMgBA,gBAAgBA,CAACC,EAAsB;EACnD,OAAOA,EAAE,aAAFA,EAAE,uBAAFA,EAAE,CAAEC,UAAU,CAAC,IAAI,CAAC;AAC/B;AAEA;MACaC,eAAe,GAAGA,CAACC,WAAqB,QAAQ;EACzD,QAAQA,QAAQ;IACZ,KAAKC,SAAS,CAACC,KAAK;MAChB,OAAO,EAAE;IAEb,KAAKD,SAAS,CAACE,KAAK;MAChB,OAAO,EAAE;IAEb;IACA,KAAKF,SAAS,CAACG,MAAM;MACjB,OAAO,EAAE;;AAErB;AAEA;SACgBC,iBAAiBA,CAC7BC,KAAa,EACbC,KAAc,EACdC,QAAyC,EACzCC,YAA0B;EAE1B,IAAIF,KAAK,KAAKG,SAAS,IAAIH,KAAK,KAAK,IAAI,EAAE;IACvC,OAAO,KAAK;;EAGhB,OAAOI,SAAS,CAACL,KAAK,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,YAAY,CAAC;AAC1D;AAEA,SAASG,WAAWA,CAChBC,MAAkC,EAClC;EAAEC,gBAAgB;EAAEC;CAA4E;EAEhG,MAAMC,aAAa,GAAGH,MAAyC;EAE/D,IAAII,KAAK,CAACC,OAAO,CAACF,aAAa,CAACG,OAAO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;MACpDkD,KAAK,CAACrB,IAAI,CAAC7B,EAAE,CAAC;;GAErB,CAAC;EAEF,OAAOkD,KAAK;AAChB;AAEA;SACgBE,0BAA0BA,CAACC,eAA0B;;EACjE,QAAAC,qBAAA,GAAOD,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAElB,MAAM,CAACnC,EAAE,IAAID,gBAAgB,CAACC,EAAE,CAAC,IAAIA,EAAE,KAAK,WAAW,CAAC,cAAAsD,qBAAA,cAAAA,qBAAA,GAAI,EAAE;AAC1F;SAEgBC,wBAAwBA,CAACP,KAAa,EAAE1B,OAAiB;EACrE,OAAOA,OAAO,CAACkB,KAAK,CAAC,CAAC,EAAEQ,KAAK,GAAG,CAAC,CAAC;AACtC;;;;"}
@@ -0,0 +1,62 @@
1
+ import { isDate } from 'date-fns';
2
+ import { format, parseFromISOString } from '../../../../utils/date.js';
3
+ import { TableFilterComparator } from '../../types.js';
4
+
5
+ const dataTypes = {
6
+ auto: {
7
+ sortingFn: 'auto',
8
+ filterComparators: [TableFilterComparator.Contains, TableFilterComparator.DoesNotContain, TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo, TableFilterComparator.IsEmpty, TableFilterComparator.IsNotEmpty]
9
+ },
10
+ // base
11
+ text: {
12
+ sortingFn: 'alphanumeric',
13
+ filterComparators: [TableFilterComparator.Contains, TableFilterComparator.DoesNotContain, TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo, TableFilterComparator.IsEmpty, TableFilterComparator.IsNotEmpty]
14
+ },
15
+ number: {
16
+ sortingFn: 'basic',
17
+ filterComparators: [TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo, TableFilterComparator.IsGreaterThan, TableFilterComparator.IsLessThan, TableFilterComparator.IsGreaterThanOrEqualTo, TableFilterComparator.IsLessThanOrEqualTo, TableFilterComparator.IsBetween, TableFilterComparator.IsEmpty, TableFilterComparator.IsNotEmpty]
18
+ },
19
+ datetime: {
20
+ sortingFn: 'datetime',
21
+ filterComparators: [TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo, TableFilterComparator.IsGreaterThan, TableFilterComparator.IsLessThan, TableFilterComparator.IsGreaterThanOrEqualTo, TableFilterComparator.IsLessThanOrEqualTo, TableFilterComparator.IsBetween, TableFilterComparator.IsEmpty, TableFilterComparator.IsNotEmpty],
22
+ getDisplayValue: (value, options) => {
23
+ if (value === undefined) {
24
+ return '';
25
+ }
26
+ if (isDate(value)) {
27
+ var _format, _options$localization;
28
+ return (_format = format(value, options === null || options === void 0 ? void 0 : (_options$localization = options.localization) === null || _options$localization === void 0 ? void 0 : _options$localization.formatting.date)) !== null && _format !== void 0 ? _format : '';
29
+ } else if (typeof value === 'string') {
30
+ var _format2, _options$localization2;
31
+ return (_format2 = format(parseFromISOString(value), options === null || options === void 0 ? void 0 : (_options$localization2 = options.localization) === null || _options$localization2 === void 0 ? void 0 : _options$localization2.formatting.date)) !== null && _format2 !== void 0 ? _format2 : '';
32
+ }
33
+ return String(value);
34
+ }
35
+ },
36
+ boolean: {
37
+ sortingFn: 'basic',
38
+ filterComparators: [TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo]
39
+ },
40
+ // advanced
41
+ amount: {
42
+ align: 'right',
43
+ sortingFn: 'basic',
44
+ filterComparators: [TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo, TableFilterComparator.IsGreaterThan, TableFilterComparator.IsLessThan, TableFilterComparator.IsGreaterThanOrEqualTo, TableFilterComparator.IsLessThanOrEqualTo, TableFilterComparator.IsBetween, TableFilterComparator.IsEmpty, TableFilterComparator.IsNotEmpty],
45
+ getDisplayValue: (value, options) => {
46
+ var _options$localization3;
47
+ if (value === undefined) {
48
+ return '';
49
+ }
50
+ return new Intl.NumberFormat(options === null || options === void 0 ? void 0 : (_options$localization3 = options.localization) === null || _options$localization3 === void 0 ? void 0 : _options$localization3.locale, {
51
+ minimumFractionDigits: 2
52
+ }).format(Number(value));
53
+ }
54
+ }
55
+ };
56
+ function getDataTypeProperties(dataType) {
57
+ var _dataTypes;
58
+ return (_dataTypes = dataTypes[dataType !== null && dataType !== void 0 ? dataType : 'text']) !== null && _dataTypes !== void 0 ? _dataTypes : dataTypes.text;
59
+ }
60
+
61
+ export { getDataTypeProperties };
62
+ //# sourceMappingURL=dataTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataTypes.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/dataTypes.ts"],"sourcesContent":["import { SortingFnOption as ReactTableSortingFnOption } from '@tanstack/react-table';\nimport { isDate } from 'date-fns';\nimport { format, parseFromISOString } from '../../../../utils/date';\nimport { TableColumnAlignment, TableColumnDataType, TableFilterComparator } from '../../types';\nimport { Localization } from '../../../../components/Provider/Localization';\n\nexport type TableDataType<TType = unknown> = {\n align?: TableColumnAlignment;\n sortingFn: ReactTableSortingFnOption<TType>;\n filterComparators: TableFilterComparator[];\n getDisplayValue?: (value: any, options?: { localization: Localization }) => string;\n};\n\nconst dataTypes: Record<TableColumnDataType | 'auto', TableDataType> = {\n auto: {\n sortingFn: 'auto',\n filterComparators: [\n TableFilterComparator.Contains,\n TableFilterComparator.DoesNotContain,\n TableFilterComparator.IsEqualTo,\n TableFilterComparator.IsNotEqualTo,\n TableFilterComparator.IsEmpty,\n TableFilterComparator.IsNotEmpty,\n ],\n },\n // base\n text: {\n sortingFn: 'alphanumeric',\n filterComparators: [\n TableFilterComparator.Contains,\n TableFilterComparator.DoesNotContain,\n TableFilterComparator.IsEqualTo,\n TableFilterComparator.IsNotEqualTo,\n TableFilterComparator.IsEmpty,\n TableFilterComparator.IsNotEmpty,\n ],\n },\n number: {\n sortingFn: 'basic',\n filterComparators: [\n TableFilterComparator.IsEqualTo,\n TableFilterComparator.IsNotEqualTo,\n TableFilterComparator.IsGreaterThan,\n TableFilterComparator.IsLessThan,\n TableFilterComparator.IsGreaterThanOrEqualTo,\n TableFilterComparator.IsLessThanOrEqualTo,\n TableFilterComparator.IsBetween,\n TableFilterComparator.IsEmpty,\n TableFilterComparator.IsNotEmpty,\n ],\n },\n datetime: {\n sortingFn: 'datetime',\n filterComparators: [\n TableFilterComparator.IsEqualTo,\n TableFilterComparator.IsNotEqualTo,\n TableFilterComparator.IsGreaterThan,\n TableFilterComparator.IsLessThan,\n TableFilterComparator.IsGreaterThanOrEqualTo,\n TableFilterComparator.IsLessThanOrEqualTo,\n TableFilterComparator.IsBetween,\n TableFilterComparator.IsEmpty,\n TableFilterComparator.IsNotEmpty,\n ],\n getDisplayValue: (value: string | Date, options) => {\n if (value === undefined) {\n return '';\n }\n\n if (isDate(value)) {\n return format(value as Date, options?.localization?.formatting.date) ?? '';\n } else if (typeof value === 'string') {\n return format(parseFromISOString(value as string), options?.localization?.formatting.date) ?? '';\n }\n\n return String(value);\n },\n },\n boolean: {\n sortingFn: 'basic',\n filterComparators: [TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo],\n },\n // advanced\n amount: {\n align: 'right',\n sortingFn: 'basic',\n filterComparators: [\n TableFilterComparator.IsEqualTo,\n TableFilterComparator.IsNotEqualTo,\n TableFilterComparator.IsGreaterThan,\n TableFilterComparator.IsLessThan,\n TableFilterComparator.IsGreaterThanOrEqualTo,\n TableFilterComparator.IsLessThanOrEqualTo,\n TableFilterComparator.IsBetween,\n TableFilterComparator.IsEmpty,\n TableFilterComparator.IsNotEmpty,\n ],\n getDisplayValue: (value: number | bigint | string, options) => {\n if (value === undefined) {\n return '';\n }\n\n return new Intl.NumberFormat(options?.localization?.locale, { minimumFractionDigits: 2 }).format(Number(value));\n },\n },\n};\n\nexport function getDataTypeProperties<TType = unknown>(dataType: TableColumnDataType | undefined): TableDataType<TType> {\n return (dataTypes[dataType ?? 'text'] ?? dataTypes.text) as TableDataType<TType>;\n}\n"],"names":["dataTypes","auto","sortingFn","filterComparators","TableFilterComparator","Contains","DoesNotContain","IsEqualTo","IsNotEqualTo","IsEmpty","IsNotEmpty","text","number","IsGreaterThan","IsLessThan","IsGreaterThanOrEqualTo","IsLessThanOrEqualTo","IsBetween","datetime","getDisplayValue","value","options","undefined","isDate","_format","_options$localization","format","localization","formatting","date","_format2","_options$localization2","parseFromISOString","String","boolean","amount","align","Intl","NumberFormat","_options$localization3","locale","minimumFractionDigits","Number","getDataTypeProperties","dataType","_dataTypes"],"mappings":";;;;AAaA,MAAMA,SAAS,GAAwD;EACnEC,IAAI,EAAE;IACFC,SAAS,EAAE,MAAM;IACjBC,iBAAiB,EAAE,CACfC,qBAAqB,CAACC,QAAQ,EAC9BD,qBAAqB,CAACE,cAAc,EACpCF,qBAAqB,CAACG,SAAS,EAC/BH,qBAAqB,CAACI,YAAY,EAClCJ,qBAAqB,CAACK,OAAO,EAC7BL,qBAAqB,CAACM,UAAU;GAEvC;;EAEDC,IAAI,EAAE;IACFT,SAAS,EAAE,cAAc;IACzBC,iBAAiB,EAAE,CACfC,qBAAqB,CAACC,QAAQ,EAC9BD,qBAAqB,CAACE,cAAc,EACpCF,qBAAqB,CAACG,SAAS,EAC/BH,qBAAqB,CAACI,YAAY,EAClCJ,qBAAqB,CAACK,OAAO,EAC7BL,qBAAqB,CAACM,UAAU;GAEvC;EACDE,MAAM,EAAE;IACJV,SAAS,EAAE,OAAO;IAClBC,iBAAiB,EAAE,CACfC,qBAAqB,CAACG,SAAS,EAC/BH,qBAAqB,CAACI,YAAY,EAClCJ,qBAAqB,CAACS,aAAa,EACnCT,qBAAqB,CAACU,UAAU,EAChCV,qBAAqB,CAACW,sBAAsB,EAC5CX,qBAAqB,CAACY,mBAAmB,EACzCZ,qBAAqB,CAACa,SAAS,EAC/Bb,qBAAqB,CAACK,OAAO,EAC7BL,qBAAqB,CAACM,UAAU;GAEvC;EACDQ,QAAQ,EAAE;IACNhB,SAAS,EAAE,UAAU;IACrBC,iBAAiB,EAAE,CACfC,qBAAqB,CAACG,SAAS,EAC/BH,qBAAqB,CAACI,YAAY,EAClCJ,qBAAqB,CAACS,aAAa,EACnCT,qBAAqB,CAACU,UAAU,EAChCV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,CAACU,UAAU,EAChCV,qBAAqB,CAACW,sBAAsB,EAC5CX,qBAAqB,CAACY,mBAAmB,EACzCZ,qBAAqB,CAACa,SAAS,EAC/Bb,qBAAqB,CAACK,OAAO,EAC7BL,qBAAqB,CAACM,UAAU,CACnC;IACDS,eAAe,EAAEA,CAACC,KAA+B,EAAEC,OAAO;;MACtD,IAAID,KAAK,KAAKE,SAAS,EAAE;QACrB,OAAO,EAAE;;MAGb,OAAO,IAAIe,IAAI,CAACC,YAAY,CAACjB,OAAO,aAAPA,OAAO,wBAAAkB,sBAAA,GAAPlB,OAAO,CAAEM,YAAY,cAAAY,sBAAA,uBAArBA,sBAAA,CAAuBC,MAAM,EAAE;QAAEC,qBAAqB,EAAE;OAAG,CAAC,CAACf,MAAM,CAACgB,MAAM,CAACtB,KAAK,CAAC,CAAC;;;CAG1H;SAEeuB,qBAAqBA,CAAkBC,QAAyC;;EAC5F,QAAAC,UAAA,GAAQ7C,SAAS,CAAC4C,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAI,MAAM,CAAC,cAAAC,UAAA,cAAAA,UAAA,GAAI7C,SAAS,CAACW,IAAI;AAC3D;;;;"}
@@ -1,6 +1,5 @@
1
1
  import { isDate, isBefore, isAfter, isEqual } from 'date-fns';
2
2
  import { isWeakEqual as isWeakEqual$1 } from '../../../../utils/date.js';
3
- import { getCellValueAsString } from './columns.js';
4
3
  import { TableFilterComparator } from '../../types.js';
5
4
 
6
5
  const toLowerCase = value => String(value !== null && value !== void 0 ? value : '').toLocaleLowerCase();
@@ -113,19 +112,6 @@ function columnFilterFn(value, filter) {
113
112
  return true;
114
113
  }
115
114
  }
116
- function globalFilterFn(row, columnId, searchQuery) {
117
- try {
118
- if (row.original) {
119
- var _row$_getAllCellsByCo, _row$_getAllCellsByCo2;
120
- const dataType = (_row$_getAllCellsByCo = row._getAllCellsByColumnId()[columnId]) === null || _row$_getAllCellsByCo === void 0 ? void 0 : (_row$_getAllCellsByCo2 = _row$_getAllCellsByCo.column.columnDef.meta) === null || _row$_getAllCellsByCo2 === void 0 ? void 0 : _row$_getAllCellsByCo2.dataType;
121
- const cellValue = getCellValueAsString(row.original[columnId], dataType);
122
- return isWeakContains(cellValue, searchQuery);
123
- }
124
- } catch {
125
- // we don't care, just fail silently and return no results
126
- }
127
- return false;
128
- }
129
115
 
130
- export { columnFilterFn, globalFilterFn, isWeakContains, isWeakEqual, toLowerCase };
116
+ export { columnFilterFn, isWeakContains, isWeakEqual, toLowerCase };
131
117
  //# sourceMappingURL=filtering.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filtering.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/filtering.ts"],"sourcesContent":["import { Row as ReactTableRow } from '@tanstack/react-table';\nimport { isDate, isAfter as isAfterDate, isBefore as isBeforeDate, isEqual as isEqualDate } from 'date-fns';\nimport { isWeakEqual as isWeakEqualDate } from '../../../../utils/date';\nimport { TableFilterValue, TableFilterComparator } from '../../types';\nimport { getCellValueAsString } from './columns';\n\nexport const toLowerCase = (value: string | number) => String(value ?? '').toLocaleLowerCase();\nexport const isWeakContains = (left: string | number, right: string | number) => toLowerCase(left).includes(toLowerCase(right));\nexport const isWeakEqual = (left: string | number, right: string | number) => toLowerCase(left) === toLowerCase(right);\n\n// the filter type is only settable on the column definition, which would re-render all columns.\n// so instead we store it in the filter value, but that means we also have to destructure that\n// before we filter - that's why this custom filter function exists\nexport function columnFilterFn(value: any, filter: TableFilterValue) {\n try {\n if (filter.comparator === TableFilterComparator.IsEmpty || filter.comparator === TableFilterComparator.IsNotEmpty) {\n const isEmpty = value === undefined || value === null || value === '';\n return filter.comparator === TableFilterComparator.IsEmpty ? isEmpty : !isEmpty;\n }\n\n if (filter.value === undefined || filter.value === null || filter.value === '') {\n return true;\n }\n\n switch (filter.comparator) {\n case TableFilterComparator.Contains:\n return isWeakContains(value, filter.value);\n\n case TableFilterComparator.DoesNotContain:\n return !isWeakContains(value, filter.value);\n\n case TableFilterComparator.IsEqualTo: {\n if (isDate(value)) {\n return isDate(filter.value) && isWeakEqualDate(value, filter.value);\n } else if (typeof filter.value === 'boolean') {\n return value === filter.value;\n }\n\n return isWeakEqual(value, filter.value);\n }\n\n case TableFilterComparator.IsNotEqualTo: {\n if (isDate(value)) {\n return isDate(filter.value) && isWeakEqualDate(value, filter.value) === false;\n } else if (typeof filter.value === 'boolean') {\n return value !== filter.value;\n }\n\n return !isWeakEqual(value, filter.value);\n }\n\n case TableFilterComparator.IsGreaterThan: {\n if (isDate(value)) {\n return isDate(filter.value) && isAfterDate(value, filter.value);\n } else {\n const valueAsNumber = parseInt(value);\n return !isNaN(valueAsNumber) && filter.value !== undefined && valueAsNumber > filter.value;\n }\n }\n\n case TableFilterComparator.IsLessThan: {\n if (isDate(value)) {\n return isDate(filter.value) && isBeforeDate(value, filter.value);\n } else {\n const valueAsNumber = parseInt(value);\n return !isNaN(valueAsNumber) && filter.value !== undefined && valueAsNumber < filter.value;\n }\n }\n\n case TableFilterComparator.IsLessThanOrEqualTo: {\n if (isDate(value)) {\n return isDate(filter.value) && (isBeforeDate(value, filter.value) || isEqualDate(value, filter.value));\n } else {\n const valueAsNumber = parseInt(value);\n return !isNaN(valueAsNumber) && filter.value !== undefined && valueAsNumber <= filter.value;\n }\n }\n\n case TableFilterComparator.IsGreaterThanOrEqualTo: {\n if (isDate(value)) {\n return isDate(filter.value) && (isAfterDate(value, filter.value) || isEqualDate(value, filter.value));\n } else {\n const valueAsNumber = parseInt(value);\n return !isNaN(valueAsNumber) && filter.value !== undefined && valueAsNumber >= filter.value;\n }\n }\n\n case TableFilterComparator.IsBetween: {\n const [fromValue, toValue] = filter.value;\n\n if (isDate(value)) {\n if (isDate(fromValue) && isBeforeDate(value, fromValue)) {\n return false;\n } else if (isDate(toValue) && isAfterDate(value, toValue)) {\n return false;\n }\n\n return true;\n } else {\n const valueAsNumber = parseInt(value);\n\n if (isNaN(valueAsNumber)) {\n return false;\n }\n\n if (fromValue !== undefined && valueAsNumber < fromValue) {\n return false;\n } else if (toValue !== undefined && valueAsNumber > toValue) {\n return false;\n }\n\n return true;\n }\n }\n\n case TableFilterComparator.HasAnyOf:\n return Array.isArray(filter.value) && Array.isArray(value)\n ? filter.value.some(item => value.includes(item))\n : false;\n\n case TableFilterComparator.HasNoneOf:\n return Array.isArray(filter.value) && Array.isArray(value)\n ? filter.value.every(item => value.includes(item) === false)\n : false;\n\n case TableFilterComparator.HasAllOf:\n return Array.isArray(filter.value) && Array.isArray(value)\n ? filter.value.filter(v => value.includes(v)).length === filter.value.length\n : false;\n }\n\n return false;\n } catch (e) {\n console.error(e);\n return true;\n }\n}\n\nexport function globalFilterFn<TType = unknown>(row: ReactTableRow<TType>, columnId: string, searchQuery: string) {\n try {\n if (row.original) {\n const dataType = row._getAllCellsByColumnId()[columnId]?.column.columnDef.meta?.dataType;\n const cellValue = getCellValueAsString(row.original[columnId], dataType);\n return isWeakContains(cellValue, searchQuery);\n }\n } catch {\n // we don't care, just fail silently and return no results\n }\n\n return false;\n}\n"],"names":["toLowerCase","value","String","toLocaleLowerCase","isWeakContains","left","right","includes","isWeakEqual","columnFilterFn","filter","comparator","TableFilterComparator","IsEmpty","IsNotEmpty","isEmpty","undefined","Contains","DoesNotContain","IsEqualTo","isDate","isWeakEqualDate","IsNotEqualTo","IsGreaterThan","isAfterDate","valueAsNumber","parseInt","isNaN","IsLessThan","isBeforeDate","IsLessThanOrEqualTo","isEqualDate","IsGreaterThanOrEqualTo","IsBetween","fromValue","toValue","HasAnyOf","Array","isArray","some","item","HasNoneOf","every","HasAllOf","v","length","e","console","error","globalFilterFn","row","columnId","searchQuery","original","_row$_getAllCellsByCo","_row$_getAllCellsByCo2","dataType","_getAllCellsByColumnId","column","columnDef","meta","cellValue","getCellValueAsString"],"mappings":";;;;;MAMaA,WAAW,GAAIC,KAAsB,IAAKC,MAAM,CAACD,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE,CAAC,CAACE,iBAAiB;MAC/EC,cAAc,GAAGA,CAACC,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AAM,GAC1E,KAAK;;IAGnB,OAAO,KAAK;GACf,CAAC,OAAOC,CAAC,EAAE;IACRC,OAAO,CAACC,KAAK,CAACF,CAAC,CAAC;IAChB,OAAO,IAAI;;AAEnB;SAEgBG,cAAcA,CAAkBC,GAAyB,EAAEC,QAAgB,EAAEC,WAAmB;EAC5G,IAAI;IACA,IAAIF,GAAG,CAACG,QAAQ,EAAE;MAAA,IAAAC,qBAAA,EAAAC,sBAAA;MACd,MAAMC,QAAQ,IAAAF,qBAAA,GAAGJ,GAAG,CAACO,sBAAsB,EAAE,CAACN,QAAQ,CAAC,cAAAG,qBAAA,wBAAAC,sBAAA,GAAtCD,qBAAA,CAAwCI,MAAM,CAACC,SAAS,CAACC,IAAI,cAAAL,sBAAA,uBAA7DA,sBAAA,CAA+DC,QAAQ;MACxF,MAAMK,SAAS,GAAGC,oBAAoB,CAACZ,GAAG,CAACG,QAAQ,CAACF,QAAQ,CAAC,EAAEK,QAAQ,CAAC;MACxE,OAAOpD,cAAc,CAACyD,SAAS,EAAET,WAAW,CAAC;;GAEpD,CAAC,MAAM;;;EAIR,OAAO,KAAK;AAChB;;;;"}
1
+ {"version":3,"file":"filtering.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/filtering.ts"],"sourcesContent":["import { isDate, isAfter as isAfterDate, isBefore as isBeforeDate, isEqual as isEqualDate } from 'date-fns';\nimport { isWeakEqual as isWeakEqualDate } from '../../../../utils/date';\nimport { TableFilterValue, TableFilterComparator } from '../../types';\n\nexport const toLowerCase = (value: string | number) => String(value ?? '').toLocaleLowerCase();\nexport const isWeakContains = (left: string | number, right: string | number) => toLowerCase(left).includes(toLowerCase(right));\nexport const isWeakEqual = (left: string | number, right: string | number) => toLowerCase(left) === toLowerCase(right);\n\n// the filter type is only settable on the column definition, which would re-render all columns.\n// so instead we store it in the filter value, but that means we also have to destructure that\n// before we filter - that's why this custom filter function exists\nexport function columnFilterFn(value: any, filter: TableFilterValue) {\n try {\n if (filter.comparator === TableFilterComparator.IsEmpty || filter.comparator === TableFilterComparator.IsNotEmpty) {\n const isEmpty = value === undefined || value === null || value === '';\n return filter.comparator === TableFilterComparator.IsEmpty ? isEmpty : !isEmpty;\n }\n\n if (filter.value === undefined || filter.value === null || filter.value === '') {\n return true;\n }\n\n switch (filter.comparator) {\n case TableFilterComparator.Contains:\n return isWeakContains(value, filter.value);\n\n case TableFilterComparator.DoesNotContain:\n return !isWeakContains(value, filter.value);\n\n case TableFilterComparator.IsEqualTo: {\n if (isDate(value)) {\n return isDate(filter.value) && isWeakEqualDate(value, filter.value);\n } else if (typeof filter.value === 'boolean') {\n return value === filter.value;\n }\n\n return isWeakEqual(value, filter.value);\n }\n\n case TableFilterComparator.IsNotEqualTo: {\n if (isDate(value)) {\n return isDate(filter.value) && isWeakEqualDate(value, filter.value) === false;\n } else if (typeof filter.value === 'boolean') {\n return value !== filter.value;\n }\n\n return !isWeakEqual(value, filter.value);\n }\n\n case TableFilterComparator.IsGreaterThan: {\n if (isDate(value)) {\n return isDate(filter.value) && isAfterDate(value, filter.value);\n } else {\n const valueAsNumber = parseInt(value);\n return !isNaN(valueAsNumber) && filter.value !== undefined && valueAsNumber > filter.value;\n }\n }\n\n case TableFilterComparator.IsLessThan: {\n if (isDate(value)) {\n return isDate(filter.value) && isBeforeDate(value, filter.value);\n } else {\n const valueAsNumber = parseInt(value);\n return !isNaN(valueAsNumber) && filter.value !== undefined && valueAsNumber < filter.value;\n }\n }\n\n case TableFilterComparator.IsLessThanOrEqualTo: {\n if (isDate(value)) {\n return isDate(filter.value) && (isBeforeDate(value, filter.value) || isEqualDate(value, filter.value));\n } else {\n const valueAsNumber = parseInt(value);\n return !isNaN(valueAsNumber) && filter.value !== undefined && valueAsNumber <= filter.value;\n }\n }\n\n case TableFilterComparator.IsGreaterThanOrEqualTo: {\n if (isDate(value)) {\n return isDate(filter.value) && (isAfterDate(value, filter.value) || isEqualDate(value, filter.value));\n } else {\n const valueAsNumber = parseInt(value);\n return !isNaN(valueAsNumber) && filter.value !== undefined && valueAsNumber >= filter.value;\n }\n }\n\n case TableFilterComparator.IsBetween: {\n const [fromValue, toValue] = filter.value;\n\n if (isDate(value)) {\n if (isDate(fromValue) && isBeforeDate(value, fromValue)) {\n return false;\n } else if (isDate(toValue) && isAfterDate(value, toValue)) {\n return false;\n }\n\n return true;\n } else {\n const valueAsNumber = parseInt(value);\n\n if (isNaN(valueAsNumber)) {\n return false;\n }\n\n if (fromValue !== undefined && valueAsNumber < fromValue) {\n return false;\n } else if (toValue !== undefined && valueAsNumber > toValue) {\n return false;\n }\n\n return true;\n }\n }\n\n case TableFilterComparator.HasAnyOf:\n return Array.isArray(filter.value) && Array.isArray(value)\n ? filter.value.some(item => value.includes(item))\n : false;\n\n case TableFilterComparator.HasNoneOf:\n return Array.isArray(filter.value) && Array.isArray(value)\n ? filter.value.every(item => value.includes(item) === false)\n : false;\n\n case TableFilterComparator.HasAllOf:\n return Array.isArray(filter.value) && Array.isArray(value)\n ? filter.value.filter(v => value.includes(v)).length === filter.value.length\n : false;\n }\n\n return false;\n } catch (e) {\n console.error(e);\n return true;\n }\n}\n"],"names":["toLowerCase","value","String","toLocaleLowerCase","isWeakContains","left","right","includes","isWeakEqual","columnFilterFn","filter","comparator","TableFilterComparator","IsEmpty","IsNotEmpty","isEmpty","undefined","Contains","DoesNotContain","IsEqualTo","isDate","isWeakEqualDate","IsNotEqualTo","IsGreaterThan","isAfterDate","valueAsNumber","parseInt","isNaN","IsLessThan","isBeforeDate","IsLessThanOrEqualTo","isEqualDate","IsGreaterThanOrEqualTo","IsBetween","fromValue","toValue","HasAnyOf","Array","isArray","some","item","HasNoneOf","every","HasAllOf","v","length","e","console","error"],"mappings":";;;;MAIaA,WAAW,GAAIC,KAAsB,IAAKC,MAAM,CAACD,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE,CAAC,CAACE,iBAAiB;MAC/EC,cAAc,GAAGA,CAACC,IAAqB,EAAEC,KAAsB,KAAKN,WAAW,CAACK,I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,CAAC,OAAOC,CAAC,EAAE;IACRC,OAAO,CAACC,KAAK,CAACF,CAAC,CAAC;IAChB,OAAO,IAAI;;AAEnB;;;;"}
@@ -1,11 +1,41 @@
1
1
  import get from 'lodash-es/get';
2
- import { getCellValueAsString } from './columns.js';
2
+ import { getDataTypeProperties } from './dataTypes.js';
3
3
  import { isWeakContains } from './filtering.js';
4
4
 
5
- function resetHighlightedColumnIndexes(value, table) {
5
+ function isMatched(searchQuery, cellValue, dataType, localization) {
6
+ const cellValueAsString = String(cellValue !== null && cellValue !== void 0 ? cellValue : '');
7
+ if (cellValueAsString !== undefined && isWeakContains(cellValueAsString, searchQuery)) {
8
+ return true;
9
+ } else {
10
+ const dataTypeProperties = getDataTypeProperties(dataType);
11
+ if (dataTypeProperties.getDisplayValue) {
12
+ const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, {
13
+ localization
14
+ });
15
+ if (cellDisplayValue !== undefined && isWeakContains(cellDisplayValue, searchQuery)) {
16
+ return true;
17
+ }
18
+ }
19
+ }
20
+ return false;
21
+ }
22
+ function globalFilterFn(row, columnId, searchQuery, localization) {
23
+ try {
24
+ if (row.original) {
25
+ var _row$_getAllCellsByCo, _row$_getAllCellsByCo2;
26
+ const cellValue = row.original[columnId];
27
+ const dataType = (_row$_getAllCellsByCo = row._getAllCellsByColumnId()[columnId]) === null || _row$_getAllCellsByCo === void 0 ? void 0 : (_row$_getAllCellsByCo2 = _row$_getAllCellsByCo.column.columnDef.meta) === null || _row$_getAllCellsByCo2 === void 0 ? void 0 : _row$_getAllCellsByCo2.dataType;
28
+ return isMatched(searchQuery, cellValue, dataType, localization);
29
+ }
30
+ } catch {
31
+ // we don't care, just fail silently and return no results
32
+ }
33
+ return false;
34
+ }
35
+ function resetHighlightedColumnIndexes(searchQuery, table, localization) {
6
36
  const tableMeta = table.options.meta;
7
37
  let firstRowIndex;
8
- if (value) {
38
+ if (searchQuery) {
9
39
  const indexes = [];
10
40
  const columns = table.getVisibleLeafColumns();
11
41
  const rowGrouping = table.getState().grouping;
@@ -25,9 +55,9 @@ function resetHighlightedColumnIndexes(value, table) {
25
55
  }
26
56
  if (column.getIsVisible() && column.columnDef.enableGlobalFilter && allowSearch) {
27
57
  var _column$columnDef$met;
28
- const cellValue = getCellValueAsString(get(row.original, column.id), (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.dataType);
29
- // indexes don't map to sorted data
30
- if (cellValue !== undefined && isWeakContains(cellValue, value)) {
58
+ const cellValue = get(row.original, column.id);
59
+ const dataType = (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.dataType;
60
+ if (isMatched(searchQuery, cellValue, dataType, localization)) {
31
61
  indexes.push([rowIndex, columnIndex]);
32
62
  }
33
63
  }
@@ -53,5 +83,5 @@ function resetHighlightedColumnIndexes(value, table) {
53
83
  return firstRowIndex;
54
84
  }
55
85
 
56
- export { resetHighlightedColumnIndexes };
86
+ export { globalFilterFn, isMatched, resetHighlightedColumnIndexes };
57
87
  //# sourceMappingURL=search.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/search.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport get from 'lodash/get';\nimport { getCellValueAsString } from './columns';\nimport { isWeakContains } from './filtering';\n\nexport function resetHighlightedColumnIndexes<TType = unknown>(value: string | undefined, table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let firstRowIndex: undefined | number;\n\n if (value) {\n const indexes: number[][] = [];\n const columns = table.getVisibleLeafColumns();\n const rowGrouping = table.getState().grouping;\n\n table.getRowModel().rows.forEach((row, rowIndex) => {\n columns.forEach((column, columnIndex) => {\n try {\n let allowSearch = true;\n\n if (rowGrouping?.length) {\n // if it's the grouped row, only allow search of the grouped column - because that's all that's visible\n if (row.getIsGrouped()) {\n allowSearch = column.getIsGrouped();\n }\n // otherwise for other rows, don't search the grouped column - because it isn't visible\n else if (rowGrouping.includes(column.id)) {\n allowSearch = false;\n }\n }\n\n if (column.getIsVisible() && column.columnDef.enableGlobalFilter && allowSearch) {\n const cellValue = getCellValueAsString(get(row.original, column.id), column.columnDef.meta?.dataType);\n\n // indexes don't map to sorted data\n if (cellValue !== undefined && isWeakContains(cellValue, value)) {\n indexes.push([rowIndex, columnIndex]);\n }\n }\n } catch (e) {\n //\n }\n });\n });\n\n tableMeta.search.setHighlightedColumnIndexes(indexes);\n\n if (indexes.length) {\n firstRowIndex = indexes[0][0];\n tableMeta.search.setCurrentHighlightColumnIndex(0);\n } else {\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n } else {\n tableMeta.search.setHighlightedColumnIndexes([]);\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n\n if (firstRowIndex !== undefined) {\n tableMeta.rowActive.setRowActiveIndex(firstRowIndex);\n }\n\n return firstRowIndex;\n}\n"],"names":["resetHighlightedColumnIndexes","value","table","tableMeta","options","meta","firstRowIndex","indexes","columns","getVisibleLeafColumns","rowGrouping","getState","grouping","getRowModel","rows","forEach","row","rowIndex","column","columnIndex","allowSearch","length","getIsGrouped","includes","id","getIsVisible","columnDef","enableGlobalFilter","_column$columnDef$met","cellValue","getCellValueAsString","get","original","dataType","undefined","isWeakContains","push","e","search","setHighlightedColumnIndexes","setCurrentHighlightColumnIndex","rowActive","setRowActiveIndex"],"mappings":";;;;SAKgBA,6BAA6BA,CAAkBC,KAAyB,EAAEC,KAAwB;EAC9G,MAAMC,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAC7D,IAAIC,aAAiC;EAErC,IAAIL,KAAK,EAAE;IACP,MAAMM,OAAO,GAAe,EAAE;IAC9B,MAAMC,OAAO,GAAGN,KAAK,CAACO,qBAAqB,EAAE;IAC7C,MAAMC,WAAW,GAAGR,KAAK,CAACS,QAAQ,EAAE,CAACC,QAAQ;I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MAAM;MACHrC,SAAS,CAACmC,MAAM,CAACE,8BAA8B,CAACN,SAAS,CAAC;;GAEjE,MAAM;IACH/B,SAAS,CAACmC,MAAM,CAACC,2BAA2B,CAAC,EAAE,CAAC;IAChDpC,SAAS,CAACmC,MAAM,CAACE,8BAA8B,CAACN,SAAS,CAAC;;EAG9D,IAAI5B,aAAa,KAAK4B,SAAS,EAAE;IAC7B/B,SAAS,CAACsC,SAAS,CAACC,iBAAiB,CAACpC,aAAa,CAAC;;EAGxD,OAAOA,aAAa;AACxB;;;;"}
1
+ {"version":3,"file":"search.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/search.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta, Row as ReactTableRow } from '@tanstack/react-table';\nimport get from 'lodash/get';\nimport { isWeakContains } from './filtering';\nimport { getDataTypeProperties } from './dataTypes';\nimport { TableColumnDataType } from '../../types';\nimport { Localization } from '../../../../components/Provider/Localization';\n\nexport function isMatched<TType = unknown>(\n searchQuery: string,\n cellValue: any,\n dataType: TableColumnDataType | undefined,\n localization: Localization\n) {\n const cellValueAsString = String(cellValue ?? '');\n\n if (cellValueAsString !== undefined && isWeakContains(cellValueAsString, searchQuery)) {\n return true;\n } else {\n const dataTypeProperties = getDataTypeProperties<TType>(dataType);\n\n if (dataTypeProperties.getDisplayValue) {\n const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, { localization });\n\n if (cellDisplayValue !== undefined && isWeakContains(cellDisplayValue, searchQuery)) {\n return true;\n }\n }\n }\n\n return false;\n}\n\nexport function globalFilterFn<TType = unknown>(\n row: ReactTableRow<TType>,\n columnId: string,\n searchQuery: string,\n localization: Localization\n) {\n try {\n if (row.original) {\n const cellValue = (row.original as any)[columnId];\n const dataType = row._getAllCellsByColumnId()[columnId]?.column.columnDef.meta?.dataType;\n return isMatched(searchQuery, cellValue, dataType, localization);\n }\n } catch {\n // we don't care, just fail silently and return no results\n }\n\n return false;\n}\n\nexport function resetHighlightedColumnIndexes<TType = unknown>(\n searchQuery: string | undefined,\n table: ReactTable<TType>,\n localization: Localization\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let firstRowIndex: undefined | number;\n\n if (searchQuery) {\n const indexes: number[][] = [];\n const columns = table.getVisibleLeafColumns();\n const rowGrouping = table.getState().grouping;\n\n table.getRowModel().rows.forEach((row, rowIndex) => {\n columns.forEach((column, columnIndex) => {\n try {\n let allowSearch = true;\n\n if (rowGrouping?.length) {\n // if it's the grouped row, only allow search of the grouped column - because that's all that's visible\n if (row.getIsGrouped()) {\n allowSearch = column.getIsGrouped();\n }\n // otherwise for other rows, don't search the grouped column - because it isn't visible\n else if (rowGrouping.includes(column.id)) {\n allowSearch = false;\n }\n }\n\n if (column.getIsVisible() && column.columnDef.enableGlobalFilter && allowSearch) {\n const cellValue = get(row.original, column.id);\n const dataType = column.columnDef.meta?.dataType;\n\n if (isMatched(searchQuery, cellValue, dataType, localization)) {\n indexes.push([rowIndex, columnIndex]);\n }\n }\n } catch (e) {\n //\n }\n });\n });\n\n tableMeta.search.setHighlightedColumnIndexes(indexes);\n\n if (indexes.length) {\n firstRowIndex = indexes[0][0];\n tableMeta.search.setCurrentHighlightColumnIndex(0);\n } else {\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n } else {\n tableMeta.search.setHighlightedColumnIndexes([]);\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n\n if (firstRowIndex !== undefined) {\n tableMeta.rowActive.setRowActiveIndex(firstRowIndex);\n }\n\n return firstRowIndex;\n}\n"],"names":["isMatched","searchQuery","cellValue","dataType","localization","cellValueAsString","String","undefined","isWeakContains","dataTypeProperties","getDataTypeProperties","getDisplayValue","cellDisplayValue","globalFilterFn","row","columnId","original","_row$_getAllCellsByCo","_row$_getAllCellsByCo2","_getAllCellsByColumnId","column","columnDef","meta","resetHighlightedColumnIndexes","table","tableMeta","options","firstRowIndex","indexes","columns","getVisibleLeafColumns","rowGrouping","getState","grouping","getRowModel","rows","forEach","rowIndex","columnIndex","allowSearch","length","getIsGrouped","includes","id","getIsVisible","enableGlobalFilter","_column$columnDef$met","get","push","e","search","setHighlightedColumnIndexes","setCurrentHighlightColumnIndex","rowActive","setRowActiveIndex"],"mappings":";;;;SAOgBA,SAASA,CACrBC,WAAmB,EACnBC,SAAc,EACdC,QAAyC,EACzCC,YAA0B;EAE1B,MAAMC,iBAAiB,GAAGC,MAAM,CAACJ,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI,EAAE,CAAC;EAEjD,IAAIG,iBAAiB,KAAKE,SAAS,IAAIC,cAAc,CAACH,iBAAiB,EAAEJ,WAAW,CAAC,EAAE;IACnF,OAAO,IAAI;GACd,MAAM;IACH,MAAMQ,kBAAkB,GAAGC,qBAAqB,CAAQP,QAAQ,CAAC;IAEjE,IAAIM,kBAAkB,CAACE,eAAe,EAAE;MACpC,MAAMC,gBAAgB,GAAGH,kBAAkB,CAACE,eAAe,CAACT,SAAS,EAAE;QAAEE;OAAc,CAAC;MAExF,IAAIQ,gBAAgB,KAAKL,SAAS,IAAIC,cAAc,CAACI,gBAAgB,EAAEX,WAAW,CAAC,EAAE;QACjF,OAAO,IAAI;;;;EAKvB,OAAO,KAAK;AAChB;SAEgBY,cAAcA,CAC1BC,GAAyB,EACzBC,QAAgB,EAChBd,WAAmB,EACnBG,YAA0B;EAE1B,IAAI;IACA,IAAIU,GAAG,CAACE,QAAQ,EAAE;MAAA,IAAAC,qBAAA,EAAAC,sBAAA;MACd,MAAMhB,SAAS,GAAIY,GAAG,CAACE,QAAgB,CAACD,QAAQ,CAAC;MACjD,MAAMZ,QAAQ,IAAAc,qBAAA,GAAGH,GAAG,CAACK,sBAAsB,EAAE,CAACJ,QAAQ,CAAC,cAAAE,qBAAA,wBAAAC,sBAAA,GAAtCD,qBAAA,CAAwCG,MAAM,CAACC,SAAS,CAACC,IAAI,cAAAJ,sBAAA,uBAA7DA,sBAAA,CAA+Df,QAAQ;MACxF,OAAOH,SAAS,CAAC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YAEhD,IAAIH,SAAS,CAACC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,YAAY,CAAC,EAAE;cAC3DwB,OAAO,CAACoB,IAAI,CAAC,CAACX,QAAQ,EAAEC,WAAW,CAAC,CAAC;;;SAGhD,CAAC,OAAOW,CAAC,EAAE;;;OAGf,CAAC;KACL,CAAC;IAEFxB,SAAS,CAACyB,MAAM,CAACC,2BAA2B,CAACvB,OAAO,CAAC;IAErD,IAAIA,OAAO,CAACY,MAAM,EAAE;MAChBb,aAAa,GAAGC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;MAC7BH,SAAS,CAACyB,MAAM,CAACE,8BAA8B,CAAC,CAAC,CAAC;KACrD,MAAM;MACH3B,SAAS,CAACyB,MAAM,CAACE,8BAA8B,CAAC7C,SAAS,CAAC;;GAEjE,MAAM;IACHkB,SAAS,CAACyB,MAAM,CAACC,2BAA2B,CAAC,EAAE,CAAC;IAChD1B,SAAS,CAACyB,MAAM,CAACE,8BAA8B,CAAC7C,SAAS,CAAC;;EAG9D,IAAIoB,aAAa,KAAKpB,SAAS,EAAE;IAC7BkB,SAAS,CAAC4B,SAAS,CAACC,iBAAiB,CAAC3B,aAAa,CAAC;;EAGxD,OAAOA,aAAa;AACxB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/settings.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { isInternalColumn } from './columns';\n\nexport function getSettings<TType = unknown>(table: ReactTable<TType>) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const state = table.getState();\n\n return {\n // commented out properties are here to highlight things we explicitly don't want them saved\n //columnFilters: table.options.enableColumnFilters ? state.columnFilters : undefined,\n columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,\n columnPinning: state.columnPinning,\n columnSizing: ignoreInternalColumns(state.columnSizing),\n columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,\n excludeUnmatchedRecordsInSearch: table.options.enableGlobalFilter,\n fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,\n //grouping: table.options.enableGrouping ? state.grouping : undefined,\n rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,\n //searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,\n sorting: state.sorting,\n };\n}\n\nexport function ignoreInternalColumns(data: object) {\n return Object.keys(data).reduce((accum, key) => {\n if (isInternalColumn(key)) {\n return accum;\n }\n\n return {\n ...accum,\n [key]: data[key],\n };\n }, {});\n}\n"],"names":["getSettings","table","meta","options","state","getState","columnOrder","columnOrdering","isEnabled","undefined","columnPinning","columnSizing","ignoreInternalColumns","columnVisibility","enableHiding","excludeUnmatchedRecordsInSearch","enableGlobalFilter","fontSize","size","rowHeight","height","sorting","data","Object","keys","reduce","accum","key","isInternalColumn"],"mappings":";;SAGgBA,WAAWA,CAAkBC,KAAwB;EACjE,MAAMC,IAAI,GAAGD,KAAK,CAACE,OAAO,CAACD,IAA6B;EACxD,MAAME,KAAK,GAAGH,KAAK,CAACI,QAAQ,EAAE;EAE9B,OAAO;;;IAGHC,WAAW,EAAEJ,IAAI,CAACK,cAAc,CAACC,SAAS,GAAGJ,KAAK,CAACE,WAAW,GAAGG,SAAS;IAC1EC,aAAa,EAAEN,KAAK,CAACM,aAAa;IAClCC,YAAY,EAAEC,qBAAqB,CAACR,KAAK,CAACO,YAAY,CAAC;IACvDE,gBAAgB,EAAEZ,KAAK,CAACE,OAAO,CAACW,YAAY,GAAGV,KAAK,CAACS,gBAAgB,GAAGJ,SAAS;IACjFM,+BAA+B,EAAEd,KAAK,CAACE,OAAO,CAACa,kBAAkB;IACjEC,QAAQ,EAAEf,IAAI,CAACe,QAAQ,CAACT,SAAS,GAAGN,IAAI,CAACe,QAAQ,CAACC,IAAI,GAAGT,SAAS;;IAElEU,SAAS,EAAEjB,IAAI,CAACiB,SAAS,CAACX,SAAS,GAAGN,IAAI,CAACiB,SAAS,CAACC,MAAM,GAAGX,SAAS;;IAEvEY,OAAO,EAAEjB,KAAK,CAACiB;GAClB;AACL;SAEgBT,qBAAqBA,CAACU,IAAY;EAC9C,OAAOC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,CAACG,MAAM,CAAC,CAACC,KAAK,EAAEC,GAAG;IACvC,IAAIC,gBAAgB,CAACD,GAAG,CAAC,EAAE;MACvB,OAAOD,KAAK;;IAGhB,OAAO;MACH,GAAGA,KAAK;MACR,CAACC,GAAG,GAAGL,IAAI,CAACK,GAAG;KAClB;GACJ,EAAE,EAAE,CAAC;AACV;;;;"}
1
+ {"version":3,"file":"settings.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/settings.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { isInternalColumn } from './columns';\n\nexport function getSettings<TType = unknown>(table: ReactTable<TType>) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const state = table.getState();\n\n return {\n // commented out properties are here to highlight things we explicitly don't want them saved\n //columnFilters: table.options.enableColumnFilters ? state.columnFilters : undefined,\n columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,\n columnPinning: state.columnPinning,\n columnSizing: ignoreInternalColumns(state.columnSizing),\n columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,\n excludeUnmatchedRecordsInSearch: table.options.enableGlobalFilter,\n fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,\n //grouping: table.options.enableGrouping ? state.grouping : undefined,\n rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,\n //searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,\n sorting: state.sorting,\n };\n}\n\nexport function ignoreInternalColumns(data: Record<string, any>) {\n return Object.keys(data).reduce((accum, key) => {\n if (isInternalColumn(key)) {\n return accum;\n }\n\n return {\n ...accum,\n [key]: data[key],\n };\n }, {});\n}\n"],"names":["getSettings","table","meta","options","state","getState","columnOrder","columnOrdering","isEnabled","undefined","columnPinning","columnSizing","ignoreInternalColumns","columnVisibility","enableHiding","excludeUnmatchedRecordsInSearch","enableGlobalFilter","fontSize","size","rowHeight","height","sorting","data","Object","keys","reduce","accum","key","isInternalColumn"],"mappings":";;SAGgBA,WAAWA,CAAkBC,KAAwB;EACjE,MAAMC,IAAI,GAAGD,KAAK,CAACE,OAAO,CAACD,IAA6B;EACxD,MAAME,KAAK,GAAGH,KAAK,CAACI,QAAQ,EAAE;EAE9B,OAAO;;;IAGHC,WAAW,EAAEJ,IAAI,CAACK,cAAc,CAACC,SAAS,GAAGJ,KAAK,CAACE,WAAW,GAAGG,SAAS;IAC1EC,aAAa,EAAEN,KAAK,CAACM,aAAa;IAClCC,YAAY,EAAEC,qBAAqB,CAACR,KAAK,CAACO,YAAY,CAAC;IACvDE,gBAAgB,EAAEZ,KAAK,CAACE,OAAO,CAACW,YAAY,GAAGV,KAAK,CAACS,gBAAgB,GAAGJ,SAAS;IACjFM,+BAA+B,EAAEd,KAAK,CAACE,OAAO,CAACa,kBAAkB;IACjEC,QAAQ,EAAEf,IAAI,CAACe,QAAQ,CAACT,SAAS,GAAGN,IAAI,CAACe,QAAQ,CAACC,IAAI,GAAGT,SAAS;;IAElEU,SAAS,EAAEjB,IAAI,CAACiB,SAAS,CAACX,SAAS,GAAGN,IAAI,CAACiB,SAAS,CAACC,MAAM,GAAGX,SAAS;;IAEvEY,OAAO,EAAEjB,KAAK,CAACiB;GAClB;AACL;SAEgBT,qBAAqBA,CAACU,IAAyB;EAC3D,OAAOC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,CAACG,MAAM,CAAC,CAACC,KAAK,EAAEC,GAAG;IACvC,IAAIC,gBAAgB,CAACD,GAAG,CAAC,EAAE;MACvB,OAAOD,KAAK;;IAGhB,OAAO;MACH,GAAGA,KAAK;MACR,CAACC,GAAG,GAAGL,IAAI,CAACK,GAAG;KAClB;GACJ,EAAE,EAAE,CAAC;AACV;;;;"}