@economic/taco 2.53.2 → 2.55.0-settings.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (460) hide show
  1. package/dist/charts/components/Area/AreaChart.d.ts +1 -1
  2. package/dist/charts/components/Bar/BarChart.d.ts +1 -1
  3. package/dist/charts/components/Donut/ActiveShape.d.ts +2 -2
  4. package/dist/charts/components/Donut/CenteredLabel.d.ts +2 -2
  5. package/dist/charts/components/Donut/DonutChart.d.ts +1 -1
  6. package/dist/charts/components/Donut/Legend.d.ts +1 -1
  7. package/dist/charts/components/Legend.d.ts +2 -2
  8. package/dist/charts/components/Line/LineChart.d.ts +1 -1
  9. package/dist/charts/components/ResponsiveContainer.d.ts +1 -1
  10. package/dist/charts/components/Tooltip.d.ts +2 -2
  11. package/dist/charts/utils/common.d.ts +3 -3
  12. package/dist/components/Accordion/Accordion.d.ts +2 -2
  13. package/dist/components/Alert/Alert.d.ts +1 -1
  14. package/dist/components/AlertDialog/components/Content.d.ts +1 -1
  15. package/dist/components/Calendar/Calendar.d.ts +1 -1
  16. package/dist/components/Checkbox/Checkbox.d.ts +7 -2
  17. package/dist/components/Datepicker/Datepicker.d.ts +1 -1
  18. package/dist/components/Dialog/components/Content.d.ts +1 -1
  19. package/dist/components/Dialog/components/DialogDrawer.d.ts +1 -1
  20. package/dist/components/Drawer/components/Content.d.ts +2 -2
  21. package/dist/components/Header/components/Agreement/Badge.d.ts +1 -1
  22. package/dist/components/Header/components/Agreement/Display.d.ts +2 -2
  23. package/dist/components/Header/components/Agreement/Item.d.ts +2 -2
  24. package/dist/components/Header/components/AgreementSelector.d.ts +2 -2
  25. package/dist/components/Header/components/Button.d.ts +1 -1
  26. package/dist/components/HoverCard/HoverCard.d.ts +1 -1
  27. package/dist/components/Icon/components/AccountPreview.d.ts +1 -1
  28. package/dist/components/Icon/components/Accounting.d.ts +1 -1
  29. package/dist/components/Icon/components/AccountingYear.d.ts +1 -1
  30. package/dist/components/Icon/components/AccountingYearCancel.d.ts +1 -1
  31. package/dist/components/Icon/components/AiChatSolid.d.ts +1 -1
  32. package/dist/components/Icon/components/AiStars.d.ts +1 -1
  33. package/dist/components/Icon/components/ArrowBottom.d.ts +1 -1
  34. package/dist/components/Icon/components/ArrowDown.d.ts +1 -1
  35. package/dist/components/Icon/components/ArrowEnd.d.ts +1 -1
  36. package/dist/components/Icon/components/ArrowLeft.d.ts +1 -1
  37. package/dist/components/Icon/components/ArrowRight.d.ts +1 -1
  38. package/dist/components/Icon/components/ArrowStart.d.ts +1 -1
  39. package/dist/components/Icon/components/ArrowTop.d.ts +1 -1
  40. package/dist/components/Icon/components/ArrowUp.d.ts +1 -1
  41. package/dist/components/Icon/components/Attach.d.ts +1 -1
  42. package/dist/components/Icon/components/AttachAuto.d.ts +1 -1
  43. package/dist/components/Icon/components/AttachCancel.d.ts +1 -1
  44. package/dist/components/Icon/components/AttachWarning.d.ts +1 -1
  45. package/dist/components/Icon/components/Autopay.d.ts +1 -1
  46. package/dist/components/Icon/components/AutopayPaused.d.ts +1 -1
  47. package/dist/components/Icon/components/Autotext.d.ts +1 -1
  48. package/dist/components/Icon/components/AutotextInsert.d.ts +1 -1
  49. package/dist/components/Icon/components/Basic.d.ts +1 -1
  50. package/dist/components/Icon/components/BasicTabs.d.ts +1 -1
  51. package/dist/components/Icon/components/BellSolid.d.ts +1 -1
  52. package/dist/components/Icon/components/Book.d.ts +1 -1
  53. package/dist/components/Icon/components/Booking.d.ts +1 -1
  54. package/dist/components/Icon/components/Budget.d.ts +1 -1
  55. package/dist/components/Icon/components/Calendar.d.ts +1 -1
  56. package/dist/components/Icon/components/CashAccount.d.ts +1 -1
  57. package/dist/components/Icon/components/CashReports.d.ts +1 -1
  58. package/dist/components/Icon/components/ChartArea.d.ts +1 -1
  59. package/dist/components/Icon/components/ChartBar.d.ts +1 -1
  60. package/dist/components/Icon/components/ChartLine.d.ts +1 -1
  61. package/dist/components/Icon/components/ChartPie.d.ts +1 -1
  62. package/dist/components/Icon/components/ChartTable.d.ts +1 -1
  63. package/dist/components/Icon/components/Chat.d.ts +1 -1
  64. package/dist/components/Icon/components/ChatSolid.d.ts +1 -1
  65. package/dist/components/Icon/components/ChevronDown.d.ts +1 -1
  66. package/dist/components/Icon/components/ChevronDownDouble.d.ts +1 -1
  67. package/dist/components/Icon/components/ChevronDownSolid.d.ts +1 -1
  68. package/dist/components/Icon/components/ChevronLeft.d.ts +1 -1
  69. package/dist/components/Icon/components/ChevronLeftDouble.d.ts +1 -1
  70. package/dist/components/Icon/components/ChevronLeftSolid.d.ts +1 -1
  71. package/dist/components/Icon/components/ChevronRight.d.ts +1 -1
  72. package/dist/components/Icon/components/ChevronRightDouble.d.ts +1 -1
  73. package/dist/components/Icon/components/ChevronRightSolid.d.ts +1 -1
  74. package/dist/components/Icon/components/ChevronUp.d.ts +1 -1
  75. package/dist/components/Icon/components/ChevronUpDouble.d.ts +1 -1
  76. package/dist/components/Icon/components/ChevronUpSolid.d.ts +1 -1
  77. package/dist/components/Icon/components/CircleClose.d.ts +1 -1
  78. package/dist/components/Icon/components/CircleInformation.d.ts +1 -1
  79. package/dist/components/Icon/components/CircleMinus.d.ts +1 -1
  80. package/dist/components/Icon/components/CirclePlus.d.ts +1 -1
  81. package/dist/components/Icon/components/CircleQuestionmark.d.ts +1 -1
  82. package/dist/components/Icon/components/CircleTick.d.ts +1 -1
  83. package/dist/components/Icon/components/CircleWarning.d.ts +1 -1
  84. package/dist/components/Icon/components/Clamp.d.ts +1 -1
  85. package/dist/components/Icon/components/ClampOpen.d.ts +1 -1
  86. package/dist/components/Icon/components/Close.d.ts +1 -1
  87. package/dist/components/Icon/components/ColumnFreeze.d.ts +1 -1
  88. package/dist/components/Icon/components/ColumnUnfreeze.d.ts +1 -1
  89. package/dist/components/Icon/components/Columns.d.ts +1 -1
  90. package/dist/components/Icon/components/ConnectionEnable.d.ts +1 -1
  91. package/dist/components/Icon/components/ConnectionRevoke.d.ts +1 -1
  92. package/dist/components/Icon/components/Contacts.d.ts +1 -1
  93. package/dist/components/Icon/components/Copy.d.ts +1 -1
  94. package/dist/components/Icon/components/Courses.d.ts +1 -1
  95. package/dist/components/Icon/components/Credit.d.ts +1 -1
  96. package/dist/components/Icon/components/Delete.d.ts +1 -1
  97. package/dist/components/Icon/components/DeletePermanently.d.ts +1 -1
  98. package/dist/components/Icon/components/Depecriate.d.ts +1 -1
  99. package/dist/components/Icon/components/Developer.d.ts +1 -1
  100. package/dist/components/Icon/components/DistributionTemplate.d.ts +1 -1
  101. package/dist/components/Icon/components/Document.d.ts +1 -1
  102. package/dist/components/Icon/components/DocumentApprove.d.ts +1 -1
  103. package/dist/components/Icon/components/DocumentCreateEntry.d.ts +1 -1
  104. package/dist/components/Icon/components/DocumentCut.d.ts +1 -1
  105. package/dist/components/Icon/components/DocumentError.d.ts +1 -1
  106. package/dist/components/Icon/components/DocumentIsolatePage.d.ts +1 -1
  107. package/dist/components/Icon/components/DocumentMerge.d.ts +1 -1
  108. package/dist/components/Icon/components/DocumentMove.d.ts +1 -1
  109. package/dist/components/Icon/components/DocumentPreview.d.ts +1 -1
  110. package/dist/components/Icon/components/DocumentReceived.d.ts +1 -1
  111. package/dist/components/Icon/components/DocumentRejectedRequest.d.ts +1 -1
  112. package/dist/components/Icon/components/DocumentSigned.d.ts +1 -1
  113. package/dist/components/Icon/components/DocumentSignedSolid.d.ts +1 -1
  114. package/dist/components/Icon/components/DocumentSplit.d.ts +1 -1
  115. package/dist/components/Icon/components/DocumentTime.d.ts +1 -1
  116. package/dist/components/Icon/components/Download.d.ts +1 -1
  117. package/dist/components/Icon/components/Drag.d.ts +1 -1
  118. package/dist/components/Icon/components/ECopedia.d.ts +1 -1
  119. package/dist/components/Icon/components/Edit.d.ts +1 -1
  120. package/dist/components/Icon/components/EditSimple.d.ts +1 -1
  121. package/dist/components/Icon/components/EllipsisHorizontal.d.ts +1 -1
  122. package/dist/components/Icon/components/EllipsisVertical.d.ts +1 -1
  123. package/dist/components/Icon/components/EntriesOnAccount.d.ts +1 -1
  124. package/dist/components/Icon/components/EntriesOpen.d.ts +1 -1
  125. package/dist/components/Icon/components/EntriesWarning.d.ts +1 -1
  126. package/dist/components/Icon/components/EntryTypeCustomerInvoice.d.ts +1 -1
  127. package/dist/components/Icon/components/EntryTypeCustomerPayment.d.ts +1 -1
  128. package/dist/components/Icon/components/EntryTypeJournalEntry.d.ts +1 -1
  129. package/dist/components/Icon/components/EntryTypeManualCustomerInvoice.d.ts +1 -1
  130. package/dist/components/Icon/components/EntryTypeSupplierInvoice.d.ts +1 -1
  131. package/dist/components/Icon/components/EntryTypeSupplierPayment.d.ts +1 -1
  132. package/dist/components/Icon/components/Envelope.d.ts +1 -1
  133. package/dist/components/Icon/components/EnvelopeApproved.d.ts +1 -1
  134. package/dist/components/Icon/components/EnvelopeSolid.d.ts +1 -1
  135. package/dist/components/Icon/components/ExpandView.d.ts +1 -1
  136. package/dist/components/Icon/components/Expenses.d.ts +1 -1
  137. package/dist/components/Icon/components/Experiment.d.ts +1 -1
  138. package/dist/components/Icon/components/Export.d.ts +1 -1
  139. package/dist/components/Icon/components/ExportToExcel.d.ts +1 -1
  140. package/dist/components/Icon/components/ExportToPdf.d.ts +1 -1
  141. package/dist/components/Icon/components/EyeOff.d.ts +1 -1
  142. package/dist/components/Icon/components/EyeOn.d.ts +1 -1
  143. package/dist/components/Icon/components/Filter.d.ts +1 -1
  144. package/dist/components/Icon/components/FilterSolid.d.ts +1 -1
  145. package/dist/components/Icon/components/FontSize.d.ts +1 -1
  146. package/dist/components/Icon/components/GraphSolid.d.ts +1 -1
  147. package/dist/components/Icon/components/Hash.d.ts +1 -1
  148. package/dist/components/Icon/components/HeightExtraTall.d.ts +1 -1
  149. package/dist/components/Icon/components/HeightMedium.d.ts +1 -1
  150. package/dist/components/Icon/components/HeightShort.d.ts +1 -1
  151. package/dist/components/Icon/components/HeightTall.d.ts +1 -1
  152. package/dist/components/Icon/components/House.d.ts +1 -1
  153. package/dist/components/Icon/components/HouseSolid.d.ts +1 -1
  154. package/dist/components/Icon/components/Id.d.ts +1 -1
  155. package/dist/components/Icon/components/Images.d.ts +1 -1
  156. package/dist/components/Icon/components/Import.d.ts +1 -1
  157. package/dist/components/Icon/components/Inbox.d.ts +1 -1
  158. package/dist/components/Icon/components/InboxEinvoicing.d.ts +1 -1
  159. package/dist/components/Icon/components/InboxScanning.d.ts +1 -1
  160. package/dist/components/Icon/components/InboxSmart.d.ts +1 -1
  161. package/dist/components/Icon/components/Info.d.ts +1 -1
  162. package/dist/components/Icon/components/Inventory.d.ts +1 -1
  163. package/dist/components/Icon/components/InventoryMatrix.d.ts +1 -1
  164. package/dist/components/Icon/components/JournalPro.d.ts +1 -1
  165. package/dist/components/Icon/components/Layout.d.ts +1 -1
  166. package/dist/components/Icon/components/LayoutBoth.d.ts +1 -1
  167. package/dist/components/Icon/components/LayoutFirst.d.ts +1 -1
  168. package/dist/components/Icon/components/LayoutLast.d.ts +1 -1
  169. package/dist/components/Icon/components/LayoutNone.d.ts +1 -1
  170. package/dist/components/Icon/components/LedgerCard.d.ts +1 -1
  171. package/dist/components/Icon/components/LedgerCardCustomerReminder.d.ts +1 -1
  172. package/dist/components/Icon/components/LedgerCardManualCustomerInvoice.d.ts +1 -1
  173. package/dist/components/Icon/components/LedgerCardObsoleteStock.d.ts +1 -1
  174. package/dist/components/Icon/components/LedgerCardOpeningEntry.d.ts +1 -1
  175. package/dist/components/Icon/components/LedgerCardReservedEntry.d.ts +1 -1
  176. package/dist/components/Icon/components/LedgerCardShrinkagePilferage.d.ts +1 -1
  177. package/dist/components/Icon/components/LedgerCardStockAdjustment.d.ts +1 -1
  178. package/dist/components/Icon/components/LedgerCardTransferredOpeningEntry.d.ts +1 -1
  179. package/dist/components/Icon/components/Lightbulb.d.ts +1 -1
  180. package/dist/components/Icon/components/Line.d.ts +1 -1
  181. package/dist/components/Icon/components/LinkExternal.d.ts +1 -1
  182. package/dist/components/Icon/components/List.d.ts +1 -1
  183. package/dist/components/Icon/components/ListBulleted.d.ts +1 -1
  184. package/dist/components/Icon/components/ListSearch.d.ts +1 -1
  185. package/dist/components/Icon/components/Location.d.ts +1 -1
  186. package/dist/components/Icon/components/Lock.d.ts +1 -1
  187. package/dist/components/Icon/components/LockOpen.d.ts +1 -1
  188. package/dist/components/Icon/components/Log.d.ts +1 -1
  189. package/dist/components/Icon/components/LogOut.d.ts +1 -1
  190. package/dist/components/Icon/components/Market.d.ts +1 -1
  191. package/dist/components/Icon/components/MastercardOs.d.ts +1 -1
  192. package/dist/components/Icon/components/MatchAmount.d.ts +1 -1
  193. package/dist/components/Icon/components/MatchEntries.d.ts +1 -1
  194. package/dist/components/Icon/components/Menu.d.ts +1 -1
  195. package/dist/components/Icon/components/Mileage.d.ts +1 -1
  196. package/dist/components/Icon/components/ModalResize.d.ts +1 -1
  197. package/dist/components/Icon/components/ModalShrink.d.ts +1 -1
  198. package/dist/components/Icon/components/More.d.ts +1 -1
  199. package/dist/components/Icon/components/MoreSolid.d.ts +1 -1
  200. package/dist/components/Icon/components/Move.d.ts +1 -1
  201. package/dist/components/Icon/components/NavigationList.d.ts +1 -1
  202. package/dist/components/Icon/components/Note.d.ts +1 -1
  203. package/dist/components/Icon/components/NoteFollowUp.d.ts +1 -1
  204. package/dist/components/Icon/components/NoteRead.d.ts +1 -1
  205. package/dist/components/Icon/components/NovemberFirst.d.ts +1 -1
  206. package/dist/components/Icon/components/Numbers.d.ts +1 -1
  207. package/dist/components/Icon/components/PartnerApi.d.ts +1 -1
  208. package/dist/components/Icon/components/PaymentPaid.d.ts +1 -1
  209. package/dist/components/Icon/components/PaymentUnpaid.d.ts +1 -1
  210. package/dist/components/Icon/components/Period.d.ts +1 -1
  211. package/dist/components/Icon/components/Person.d.ts +1 -1
  212. package/dist/components/Icon/components/PersonChange.d.ts +1 -1
  213. package/dist/components/Icon/components/PersonMinus.d.ts +1 -1
  214. package/dist/components/Icon/components/PersonPlus.d.ts +1 -1
  215. package/dist/components/Icon/components/PersonSolid.d.ts +1 -1
  216. package/dist/components/Icon/components/PersonTick.d.ts +1 -1
  217. package/dist/components/Icon/components/Phone.d.ts +1 -1
  218. package/dist/components/Icon/components/PhoneSolid.d.ts +1 -1
  219. package/dist/components/Icon/components/Play.d.ts +1 -1
  220. package/dist/components/Icon/components/PlusMinus.d.ts +1 -1
  221. package/dist/components/Icon/components/Print.d.ts +1 -1
  222. package/dist/components/Icon/components/ProcessPayment.d.ts +1 -1
  223. package/dist/components/Icon/components/ProductLedgerCard.d.ts +1 -1
  224. package/dist/components/Icon/components/Profile.d.ts +1 -1
  225. package/dist/components/Icon/components/ProjectCards.d.ts +1 -1
  226. package/dist/components/Icon/components/Projects.d.ts +1 -1
  227. package/dist/components/Icon/components/QuestionMark.d.ts +1 -1
  228. package/dist/components/Icon/components/QuestionMarkBold.d.ts +1 -1
  229. package/dist/components/Icon/components/Quicklinks.d.ts +1 -1
  230. package/dist/components/Icon/components/RatingBankruptcy.d.ts +1 -1
  231. package/dist/components/Icon/components/RatingPaymentProblems.d.ts +1 -1
  232. package/dist/components/Icon/components/Reconciled.d.ts +1 -1
  233. package/dist/components/Icon/components/Refresh.d.ts +1 -1
  234. package/dist/components/Icon/components/Report.d.ts +1 -1
  235. package/dist/components/Icon/components/ReportSolid.d.ts +1 -1
  236. package/dist/components/Icon/components/Restore.d.ts +1 -1
  237. package/dist/components/Icon/components/RotateLeft.d.ts +1 -1
  238. package/dist/components/Icon/components/RotateRight.d.ts +1 -1
  239. package/dist/components/Icon/components/Sales.d.ts +1 -1
  240. package/dist/components/Icon/components/Search.d.ts +1 -1
  241. package/dist/components/Icon/components/SearchBold.d.ts +1 -1
  242. package/dist/components/Icon/components/Secure.d.ts +1 -1
  243. package/dist/components/Icon/components/SecureTick.d.ts +1 -1
  244. package/dist/components/Icon/components/Settings.d.ts +1 -1
  245. package/dist/components/Icon/components/SettingsSolid.d.ts +1 -1
  246. package/dist/components/Icon/components/Shortcuts.d.ts +1 -1
  247. package/dist/components/Icon/components/ShowAll.d.ts +1 -1
  248. package/dist/components/Icon/components/ShowLess.d.ts +1 -1
  249. package/dist/components/Icon/components/ShowMore.d.ts +1 -1
  250. package/dist/components/Icon/components/ShowTemplate.d.ts +1 -1
  251. package/dist/components/Icon/components/Sliders.d.ts +1 -1
  252. package/dist/components/Icon/components/Smartpay.d.ts +1 -1
  253. package/dist/components/Icon/components/SortBy.d.ts +1 -1
  254. package/dist/components/Icon/components/Star.d.ts +1 -1
  255. package/dist/components/Icon/components/StarSolid.d.ts +1 -1
  256. package/dist/components/Icon/components/Subscriptions.d.ts +1 -1
  257. package/dist/components/Icon/components/SystemEntries.d.ts +1 -1
  258. package/dist/components/Icon/components/Tag.d.ts +1 -1
  259. package/dist/components/Icon/components/TemplateOverride.d.ts +1 -1
  260. package/dist/components/Icon/components/Templates.d.ts +1 -1
  261. package/dist/components/Icon/components/ThumbBoth.d.ts +1 -1
  262. package/dist/components/Icon/components/ThumbDown.d.ts +1 -1
  263. package/dist/components/Icon/components/ThumbDownSolid.d.ts +1 -1
  264. package/dist/components/Icon/components/ThumbUp.d.ts +1 -1
  265. package/dist/components/Icon/components/ThumbUpSolid.d.ts +1 -1
  266. package/dist/components/Icon/components/Tick.d.ts +1 -1
  267. package/dist/components/Icon/components/TickBold.d.ts +1 -1
  268. package/dist/components/Icon/components/Time.d.ts +1 -1
  269. package/dist/components/Icon/components/Transfer.d.ts +1 -1
  270. package/dist/components/Icon/components/TransferCancel.d.ts +1 -1
  271. package/dist/components/Icon/components/TransferLocked.d.ts +1 -1
  272. package/dist/components/Icon/components/Undo.d.ts +1 -1
  273. package/dist/components/Icon/components/Undock.d.ts +1 -1
  274. package/dist/components/Icon/components/Unreconciled.d.ts +1 -1
  275. package/dist/components/Icon/components/Wallet.d.ts +1 -1
  276. package/dist/components/Icon/components/Warning.d.ts +1 -1
  277. package/dist/components/Icon/components/Webshop.d.ts +1 -1
  278. package/dist/components/Icon/components/Website.d.ts +1 -1
  279. package/dist/components/Icon/components/Workflow.d.ts +1 -1
  280. package/dist/components/Icon/components/WorkflowTemplateBasic.d.ts +1 -1
  281. package/dist/components/Icon/components/Zoom.d.ts +1 -1
  282. package/dist/components/IconButton/IconButton.d.ts +2 -2
  283. package/dist/components/Input/Input.d.ts +2 -2
  284. package/dist/components/Layout/components/Sidebar.d.ts +14 -2
  285. package/dist/components/Layout/components/Top.d.ts +4 -4
  286. package/dist/components/List/List.d.ts +7 -7
  287. package/dist/components/List/components/Button.d.ts +1 -1
  288. package/dist/components/List/components/Collapsible.d.ts +1 -1
  289. package/dist/components/List/components/Group.d.ts +1 -1
  290. package/dist/components/List/components/Item.d.ts +1 -1
  291. package/dist/components/List/components/Link.d.ts +1 -1
  292. package/dist/components/List/components/Toggle.d.ts +2 -2
  293. package/dist/components/Listbox/Listbox.d.ts +2 -2
  294. package/dist/components/Listbox/ScrollableList.d.ts +1 -1
  295. package/dist/components/Listbox/util.d.ts +2 -2
  296. package/dist/components/Menu/components/Checkbox.d.ts +1 -1
  297. package/dist/components/Menu/components/Content.d.ts +2 -2
  298. package/dist/components/Menu/components/Item.d.ts +2 -2
  299. package/dist/components/Menu/components/Link.d.ts +1 -1
  300. package/dist/components/Menu/components/RadioGroup.d.ts +1 -1
  301. package/dist/components/Menu/components/SubMenu.d.ts +1 -1
  302. package/dist/components/Menu/components/Trigger.d.ts +1 -1
  303. package/dist/components/ModeSwitch/ModeSwitch.d.ts +6 -3
  304. package/dist/components/Navigation2/components/Group.d.ts +1 -1
  305. package/dist/components/Provider/Provider.d.ts +7 -6
  306. package/dist/components/Provider/TacoContext.d.ts +7 -0
  307. package/dist/components/Provider/useTacoSettings.d.ts +8 -0
  308. package/dist/components/Report/Report.d.ts +4 -2
  309. package/dist/components/ScrollArea/ScrollArea.d.ts +2 -2
  310. package/dist/components/SearchInput/SearchInput.d.ts +1 -1
  311. package/dist/components/Select/Select.d.ts +1 -1
  312. package/dist/components/Select2/components/All.d.ts +2 -2
  313. package/dist/components/Select2/components/Collection.d.ts +1 -1
  314. package/dist/components/Select2/components/Create.d.ts +1 -1
  315. package/dist/components/Select2/components/Edit.d.ts +2 -2
  316. package/dist/components/Select2/components/Group.d.ts +1 -1
  317. package/dist/components/Select2/components/Option.d.ts +1 -1
  318. package/dist/components/Select2/components/Search.d.ts +3 -3
  319. package/dist/components/Select2/components/Trigger.d.ts +1 -1
  320. package/dist/components/Select2/hooks/useChildren.d.ts +2 -2
  321. package/dist/components/Shortcut/Shortcut.d.ts +1 -1
  322. package/dist/components/Switch/Switch.d.ts +6 -4
  323. package/dist/components/Table3/Table3.d.ts +3 -4
  324. package/dist/components/Table3/components/Columns/Cell/Cell.d.ts +2 -2
  325. package/dist/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.d.ts +1 -1
  326. package/dist/components/Table3/components/Columns/Cell/EditingControlCell.d.ts +2 -2
  327. package/dist/components/Table3/components/Columns/Internal/EditingActionsMenu.d.ts +2 -2
  328. package/dist/components/Table3/components/Editing/Alert.d.ts +1 -1
  329. package/dist/components/Table3/components/Editing/DiscardChangesConfirmationDialog.d.ts +2 -2
  330. package/dist/components/Table3/components/Row/Editing/CreateNewRow.d.ts +1 -1
  331. package/dist/components/Table3/components/Row/Editing/SaveStatus.d.ts +2 -2
  332. package/dist/components/Table3/components/Row/Editing/TemporaryRow.d.ts +1 -1
  333. package/dist/components/Table3/components/Row/Row.d.ts +2 -2
  334. package/dist/components/Table3/components/Toolbar/Editing/Editing.d.ts +1 -1
  335. package/dist/components/Tag/Tag.d.ts +2 -2
  336. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  337. package/dist/components/Tour/Tour.d.ts +1 -1
  338. package/dist/components/Truncate/Truncate.d.ts +1 -1
  339. package/dist/esm/index.css +76 -5
  340. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +41 -63
  341. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  342. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +9 -6
  343. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  344. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  345. package/dist/esm/packages/taco/src/components/Layout/components/Top.js +2 -2
  346. package/dist/esm/packages/taco/src/components/Layout/components/Top.js.map +1 -1
  347. package/dist/esm/packages/taco/src/components/List/components/Toggle.js +14 -4
  348. package/dist/esm/packages/taco/src/components/List/components/Toggle.js.map +1 -1
  349. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +6 -3
  350. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
  351. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +34 -12
  352. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
  353. package/dist/esm/packages/taco/src/components/Provider/Provider.js +14 -7
  354. package/dist/esm/packages/taco/src/components/Provider/Provider.js.map +1 -1
  355. package/dist/esm/packages/taco/src/components/Provider/TacoContext.js +6 -0
  356. package/dist/esm/packages/taco/src/components/Provider/TacoContext.js.map +1 -0
  357. package/dist/esm/packages/taco/src/components/Provider/useTacoSettings.js +39 -0
  358. package/dist/esm/packages/taco/src/components/Provider/useTacoSettings.js.map +1 -0
  359. package/dist/esm/packages/taco/src/components/Report/Report.js +10 -3
  360. package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
  361. package/dist/esm/packages/taco/src/components/Switch/Switch.js +37 -35
  362. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  363. package/dist/esm/packages/taco/src/components/Table3/Table3.js +9 -3
  364. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  365. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +4 -2
  366. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  367. package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
  368. package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
  369. package/dist/esm/packages/taco/src/components/Tour/Tour.js +1 -1
  370. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  371. package/dist/esm/packages/taco/src/hooks/useTaco.js +9 -0
  372. package/dist/esm/packages/taco/src/hooks/useTaco.js.map +1 -0
  373. package/dist/esm/packages/taco/src/index.js +1 -1
  374. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/Body.js +2 -0
  375. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/Body.js.map +1 -1
  376. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js +1 -0
  377. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
  378. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/Toolbar.js +6 -4
  379. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/Toolbar.js.map +1 -1
  380. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -1
  381. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +9 -5
  382. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  383. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js.map +1 -1
  384. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  385. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js +18 -21
  386. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js.map +1 -1
  387. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +2 -2
  388. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
  389. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js +3 -3
  390. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -1
  391. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js +57 -9
  392. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -1
  393. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +7 -5
  394. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  395. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableSettingsPreloader.js +44 -0
  396. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableSettingsPreloader.js.map +1 -0
  397. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js +3 -1
  398. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
  399. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +5 -2
  400. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  401. package/dist/esm/packages/taco/src/utils/dom.js +3 -2
  402. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  403. package/dist/hooks/useTaco.d.ts +1 -0
  404. package/dist/index.css +76 -5
  405. package/dist/primitives/BubbleSelect.d.ts +1 -1
  406. package/dist/primitives/Sortable/components/Container.d.ts +2 -2
  407. package/dist/primitives/Sortable/components/Item.d.ts +1 -1
  408. package/dist/primitives/Sortable/components/List.d.ts +1 -1
  409. package/dist/primitives/Table/Core/Table.d.ts +2 -2
  410. package/dist/primitives/Table/Core/components/Body/Body.d.ts +1 -1
  411. package/dist/primitives/Table/Core/components/Body/EmptyStateBody.d.ts +1 -1
  412. package/dist/primitives/Table/Core/components/Body/util.d.ts +4 -4
  413. package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.d.ts +2 -2
  414. package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.d.ts +2 -2
  415. package/dist/primitives/Table/Core/components/Columns/Cell/Cell.d.ts +1 -1
  416. package/dist/primitives/Table/Core/components/Columns/Internal/Actions.d.ts +2 -2
  417. package/dist/primitives/Table/Core/components/Footer/Footer.d.ts +2 -2
  418. package/dist/primitives/Table/Core/components/Footer/Summary.d.ts +2 -2
  419. package/dist/primitives/Table/Core/components/Header/Header.d.ts +1 -1
  420. package/dist/primitives/Table/Core/components/Header/components/Goto.d.ts +2 -2
  421. package/dist/primitives/Table/Core/components/Header/components/Menu.d.ts +1 -1
  422. package/dist/primitives/Table/Core/components/Header/components/Resizer.d.ts +2 -2
  423. package/dist/primitives/Table/Core/components/Header/components/SortIndicator.d.ts +1 -1
  424. package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +2 -2
  425. package/dist/primitives/Table/Core/components/Row/Row.d.ts +1 -1
  426. package/dist/primitives/Table/Core/components/Toolbar/Toolbar.d.ts +1 -1
  427. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/Filters.d.ts +2 -2
  428. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.d.ts +2 -2
  429. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.d.ts +2 -2
  430. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +1 -1
  431. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.d.ts +2 -2
  432. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.d.ts +2 -2
  433. package/dist/primitives/Table/Core/components/Toolbar/components/Print/Print.d.ts +1 -1
  434. package/dist/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.d.ts +2 -2
  435. package/dist/primitives/Table/Core/components/Toolbar/components/Search/Search.d.ts +1 -1
  436. package/dist/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.d.ts +2 -2
  437. package/dist/primitives/Table/Core/components/Toolbar/components/Settings/Settings.d.ts +2 -2
  438. package/dist/primitives/Table/Core/features/useTableRenderer.d.ts +2 -2
  439. package/dist/primitives/Table/Core/useTable.d.ts +4 -4
  440. package/dist/primitives/Table/types.d.ts +16 -6
  441. package/dist/primitives/Table/useTableManager/features/useTablePrinting.d.ts +2 -8
  442. package/dist/primitives/Table/useTableManager/features/useTableRowActive.d.ts +2 -2
  443. package/dist/primitives/Table/useTableManager/listeners/useTableSettingsListener.d.ts +2 -2
  444. package/dist/primitives/Table/useTableManager/useTableSettingsPreloader.d.ts +3 -0
  445. package/dist/primitives/Table/useTableManager/util/settings.d.ts +2 -0
  446. package/dist/taco.cjs.development.js +354 -293
  447. package/dist/taco.cjs.development.js.map +1 -1
  448. package/dist/taco.cjs.production.min.js +1 -1
  449. package/dist/taco.cjs.production.min.js.map +1 -1
  450. package/dist/utils/dom.d.ts +2 -2
  451. package/package.json +27 -28
  452. package/dist/esm/packages/taco/src/hooks/useLocalStorage.js +0 -44
  453. package/dist/esm/packages/taco/src/hooks/useLocalStorage.js.map +0 -1
  454. package/dist/esm/packages/taco/src/hooks/useTacoSettings.js +0 -9
  455. package/dist/esm/packages/taco/src/hooks/useTacoSettings.js.map +0 -1
  456. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js +0 -69
  457. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +0 -1
  458. package/dist/hooks/useLocalStorage.d.ts +0 -2
  459. package/dist/hooks/useTacoSettings.d.ts +0 -1
  460. package/dist/primitives/Table/useTableManager/features/useTableSettings.d.ts +0 -3
@@ -1,35 +1,32 @@
1
1
  import React__default from 'react';
2
- import { useTacoSettings } from '../../../../hooks/useTacoSettings.js';
3
- import { useLocalStorage } from '../../../../hooks/useLocalStorage.js';
2
+ import { getSettingsId } from '../util/settings.js';
3
+ import { useTaco } from '../../../../hooks/useTaco.js';
4
4
 
5
- function useTablePrinting(isEnabled = false, tableId) {
6
- const [isPrinting, setIsPrinting] = React__default.useState(false);
7
- const [settings, setSetting] = useTablePrintingSettings(tableId);
8
- return {
9
- isEnabled,
10
- isPrinting,
11
- setIsPrinting,
12
- settings,
13
- setSetting
14
- };
15
- }
16
5
  const DEFAULT_PRINT_SETTINGS = {
17
6
  size: 'A4',
18
7
  orientation: 'portrait',
19
8
  allRows: true,
20
9
  splitGroups: true
21
10
  };
22
- function useTablePrintingSettings(tableId) {
23
- const tacoSettings = useTacoSettings();
24
- const uniqueId = `taco.${tacoSettings.uniqueUserIdentifier}.table.${tableId}.print.settings`;
25
- const [persistedSettings, setPersistedSettings] = useLocalStorage(uniqueId, DEFAULT_PRINT_SETTINGS);
26
- function setSetting(key, value) {
27
- setPersistedSettings(currentSettings => ({
11
+ function useTablePrinting(isEnabled = false, tableId) {
12
+ var _taco$settings$getSet, _taco$settings$getSet2;
13
+ const [isPrinting, setIsPrinting] = React__default.useState(false);
14
+ const taco = useTaco();
15
+ const key = getSettingsId(tableId);
16
+ const [settings, _setSettings] = React__default.useState((_taco$settings$getSet = (_taco$settings$getSet2 = taco.settings.getSetting(key)) === null || _taco$settings$getSet2 === void 0 ? void 0 : _taco$settings$getSet2.print) !== null && _taco$settings$getSet !== void 0 ? _taco$settings$getSet : DEFAULT_PRINT_SETTINGS);
17
+ function setSetting(path, value) {
18
+ _setSettings(currentSettings => ({
28
19
  ...currentSettings,
29
- [key]: value
20
+ [path]: value
30
21
  }));
31
22
  }
32
- return [persistedSettings, setSetting];
23
+ return {
24
+ isEnabled,
25
+ isPrinting,
26
+ setIsPrinting,
27
+ settings,
28
+ setSetting
29
+ };
33
30
  }
34
31
 
35
32
  export { useTablePrinting };
@@ -1 +1 @@
1
- {"version":3,"file":"useTablePrinting.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/features/useTablePrinting.ts"],"sourcesContent":["import React from 'react';\nimport { useTacoSettings } from '../../../../hooks/useTacoSettings';\nimport { useLocalStorage } from '../../../../hooks/useLocalStorage';\n\ntype TablePrintSettings = {\n allRows: boolean;\n orientation: 'portrait' | 'landscape';\n size: 'A3' | 'A4' | 'A5' | 'letter' | 'legal';\n splitGroups: boolean;\n};\n\nexport function useTablePrinting(isEnabled = false, tableId: string) {\n const [isPrinting, setIsPrinting] = React.useState(false);\n const [settings, setSetting] = useTablePrintingSettings(tableId);\n\n return {\n isEnabled,\n isPrinting,\n setIsPrinting,\n settings,\n setSetting,\n };\n}\n\nconst DEFAULT_PRINT_SETTINGS: TablePrintSettings = {\n size: 'A4',\n orientation: 'portrait',\n allRows: true,\n splitGroups: true,\n};\n\nfunction useTablePrintingSettings(tableId: string): [TablePrintSettings, (key: keyof TablePrintSettings, value: any) => void] {\n const tacoSettings = useTacoSettings();\n const uniqueId = `taco.${tacoSettings.uniqueUserIdentifier}.table.${tableId}.print.settings`;\n\n const [persistedSettings, setPersistedSettings] = useLocalStorage<TablePrintSettings>(uniqueId, DEFAULT_PRINT_SETTINGS);\n\n function setSetting(key: keyof TablePrintSettings, value: any) {\n setPersistedSettings(currentSettings => ({\n ...currentSettings,\n [key]: value,\n }));\n }\n\n return [persistedSettings, setSetting];\n}\n"],"names":["useTablePrinting","isEnabled","tableId","isPrinting","setIsPrinting","React","useState","settings","setSetting","useTablePrintingSettings","DEFAULT_PRINT_SETTINGS","size","orientation","allRows","splitGroups","tacoSettings","useTacoSettings","uniqueId","uniqueUserIdentifier","persistedSettings","setPersistedSettings","useLocalStorage","key","value","currentSettings"],"mappings":";;;;SAWgBA,gBAAgBA,CAACC,SAAS,GAAG,KAAK,EAAEC,OAAe;EAC/D,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EACzD,MAAM,CAACC,QAAQ,EAAEC,UAAU,CAAC,GAAGC,wBAAwB,CAACP,OAAO,CAAC;EAEhE,OAAO;IACHD,SAAS;IACTE,UAAU;IACVC,aAAa;IACbG,QAAQ;IACRC;GACH;AACL;AAEA,MAAME,sBAAsB,GAAuB;EAC/CC,IAAI,EAAE,IAAI;EACVC,WAAW,EAAE,UAAU;EACvBC,OAAO,EAAE,IAAI;EACbC,WAAW,EAAE;CAChB;AAED,SAASL,wBAAwBA,CAACP,OAAe;EAC7C,MAAMa,YAAY,GAAGC,eAAe,EAAE;EACtC,MAAMC,QAAQ,GAAG,QAAQF,YAAY,CAACG,oBAAoB,UAAUhB,OAAO,iBAAiB;EAE5F,MAAM,CAACiB,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGC,eAAe,CAAqBJ,QAAQ,EAAEP,sBAAsB,CAAC;EAEvH,SAASF,UAAUA,CAACc,GAA6B,EAAEC,KAAU;IACzDH,oBAAoB,CAACI,eAAe,KAAK;MACrC,GAAGA,eAAe;MAClB,CAACF,GAAG,GAAGC;KACV,CAAC,CAAC;;EAGP,OAAO,CAACJ,iBAAiB,EAAEX,UAAU,CAAC;AAC1C;;;;"}
1
+ {"version":3,"file":"useTablePrinting.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/features/useTablePrinting.ts"],"sourcesContent":["import React from 'react';\nimport { useTaco } from '../../../../hooks/useTaco';\nimport { TablePrintSettings, TableSettings } from '../../types';\nimport { getSettingsId } from '../util/settings';\n\nconst DEFAULT_PRINT_SETTINGS: TablePrintSettings = {\n size: 'A4',\n orientation: 'portrait',\n allRows: true,\n splitGroups: true,\n};\n\nexport function useTablePrinting(isEnabled = false, tableId: string) {\n const [isPrinting, setIsPrinting] = React.useState(false);\n const taco = useTaco();\n const key = getSettingsId(tableId);\n const [settings, _setSettings] = React.useState<TablePrintSettings>(\n taco.settings.getSetting<TableSettings>(key)?.print ?? DEFAULT_PRINT_SETTINGS\n );\n\n function setSetting(path: keyof TablePrintSettings, value: any) {\n _setSettings(currentSettings => ({ ...currentSettings, [path]: value }));\n }\n\n return {\n isEnabled,\n isPrinting,\n setIsPrinting,\n settings,\n setSetting,\n };\n}\n"],"names":["DEFAULT_PRINT_SETTINGS","size","orientation","allRows","splitGroups","useTablePrinting","isEnabled","tableId","isPrinting","setIsPrinting","React","useState","taco","useTaco","key","getSettingsId","settings","_setSettings","_taco$settings$getSet","_taco$settings$getSet2","getSetting","print","setSetting","path","value","currentSettings"],"mappings":";;;;AAKA,MAAMA,sBAAsB,GAAuB;EAC/CC,IAAI,EAAE,IAAI;EACVC,WAAW,EAAE,UAAU;EACvBC,OAAO,EAAE,IAAI;EACbC,WAAW,EAAE;CAChB;SAEeC,gBAAgBA,CAACC,SAAS,GAAG,KAAK,EAAEC,OAAe;;EAC/D,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EACzD,MAAMC,IAAI,GAAGC,OAAO,EAAE;EACtB,MAAMC,GAAG,GAAGC,aAAa,CAACR,OAAO,CAAC;EAClC,MAAM,CAACS,QAAQ,EAAEC,YAAY,CAAC,GAAGP,cAAK,CAACC,QAAQ,EAAAO,qBAAA,IAAAC,sBAAA,GAC3CP,IAAI,CAACI,QAAQ,CAACI,UAAU,CAAgBN,GAAG,CAAC,cAAAK,sBAAA,uBAA5CA,sBAAA,CAA8CE,KAAK,cAAAH,qBAAA,cAAAA,qBAAA,GAAIlB,sBAAsB,CAChF;EAED,SAASsB,UAAUA,CAACC,IAA8B,EAAEC,KAAU;IAC1DP,YAAY,CAACQ,eAAe,KAAK;MAAE,GAAGA,eAAe;MAAE,CAACF,IAAI,GAAGC;KAAO,CAAC,CAAC;;EAG5E,OAAO;IACHlB,SAAS;IACTE,UAAU;IACVC,aAAa;IACbO,QAAQ;IACRM;GACH;AACL;;;;"}
@@ -2,8 +2,8 @@ import React__default from 'react';
2
2
  import { isElementInsideOrTriggeredFromContainer } from '../../../../utils/dom.js';
3
3
  import { useIsHoverStatePaused } from '../../../../hooks/useIsHoverStatePaused.js';
4
4
 
5
- function useTableRowActive(isEnabled = false, initialRowActiveIndex) {
6
- const [rowActiveIndex, setRowActiveIndex] = React__default.useState(initialRowActiveIndex);
5
+ function useTableRowActive(isEnabled = false, tableSettings, initialRowActiveIndex) {
6
+ const [rowActiveIndex, setRowActiveIndex] = React__default.useState(typeof initialRowActiveIndex === 'function' ? initialRowActiveIndex(tableSettings) : initialRowActiveIndex);
7
7
  const [rowHoverIndex, setRowHoverIndex] = React__default.useState(undefined);
8
8
  const [isHoverStatePaused, setHoverStatePaused] = useIsHoverStatePaused();
9
9
  const move = (direction, length, scrollToIndex) => {
@@ -1 +1 @@
1
- {"version":3,"file":"useTableRowActive.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/features/useTableRowActive.ts"],"sourcesContent":["import React from 'react';\nimport { TableScrollToIndexHandler } from '../../types';\nimport { useIsHoverStatePaused } from '../../../../hooks/useIsHoverStatePaused';\nimport { isElementInsideOrTriggeredFromContainer } from '../../../../utils/dom';\n\nexport function useTableRowActive(isEnabled = false, initialRowActiveIndex?: number) {\n const [rowActiveIndex, setRowActiveIndex] = React.useState<number | undefined>(initialRowActiveIndex);\n const [rowHoverIndex, setRowHoverIndex] = React.useState<number | undefined>(undefined);\n const [isHoverStatePaused, setHoverStatePaused] = useIsHoverStatePaused();\n\n const move = (direction: -1 | 1, length: number, scrollToIndex: TableScrollToIndexHandler) => {\n const nextIndex = rowActiveIndex !== undefined ? getNextIndex(direction, rowActiveIndex, length) : 0;\n scrollToIndex(nextIndex);\n setTimeout(() => setRowActiveIndex(nextIndex), 50);\n };\n\n const onKeyDown = React.useCallback(\n (event: KeyboardEvent, length: number, scrollToIndex: TableScrollToIndexHandler) => {\n if (!isEnabled || event.defaultPrevented) {\n return;\n }\n\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n setHoverStatePaused(true);\n }\n\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n\n if (event.ctrlKey || event.metaKey) {\n const newIndex = 0;\n scrollToIndex(newIndex);\n setRowActiveIndex(newIndex);\n } else {\n move(-1, length, scrollToIndex);\n }\n\n return;\n } else if (event.key === 'ArrowDown') {\n event.preventDefault();\n\n if (event.ctrlKey || event.metaKey) {\n const newIndex = length - 1;\n scrollToIndex(newIndex);\n setRowActiveIndex(newIndex);\n } else {\n move(+1, length, scrollToIndex);\n }\n return;\n }\n },\n [isEnabled, rowActiveIndex]\n );\n\n const onFocus = React.useCallback(\n (event: React.FocusEvent, length: number, scrollToIndex: TableScrollToIndexHandler) => {\n if (!isEnabled || event.isDefaultPrevented()) {\n return;\n }\n\n if (event.target.closest('tbody') || isElementInsideOrTriggeredFromContainer(event.target, event.currentTarget)) {\n return;\n }\n\n if (rowActiveIndex === undefined && length > 0) {\n setRowActiveIndex(index => {\n if (index === undefined) {\n scrollToIndex(0);\n return 0;\n }\n return index;\n });\n }\n },\n [rowActiveIndex, isEnabled]\n );\n\n return {\n isEnabled,\n rowActiveIndex,\n setRowActiveIndex: isEnabled ? setRowActiveIndex : () => undefined,\n rowHoverIndex,\n setRowHoverIndex,\n isHoverStatePaused,\n setHoverStatePaused: isEnabled ? setHoverStatePaused : () => undefined,\n handleFocus: isEnabled ? onFocus : () => undefined,\n handleKeyDown: isEnabled ? onKeyDown : () => undefined,\n };\n}\n\nfunction getNextIndex(direction: -1 | 1, currentIndex: number, length: number) {\n if (direction === -1) {\n return currentIndex - 1 > 0 ? currentIndex - 1 : 0;\n }\n\n return currentIndex + 1 < length ? currentIndex + 1 : currentIndex;\n}\n"],"names":["useTableRowActive","isEnabled","initialRowActiveIndex","rowActiveIndex","setRowActiveIndex","React","useState","rowHoverIndex","setRowHoverIndex","undefined","isHoverStatePaused","setHoverStatePaused","useIsHoverStatePaused","move","direction","length","scrollToIndex","nextIndex","getNextIndex","setTimeout","onKeyDown","useCallback","event","defaultPrevented","key","preventDefault","ctrlKey","metaKey","newIndex","onFocus","isDefaultPrevented","target","closest","isElementInsideOrTriggeredFromContainer","currentTarget","index","handleFocus","handleKeyDown","currentIndex"],"mappings":";;;;SAKgBA,iBAAiBA,CAACC,SAAS,GAAG,KAAK,EAAEC,qBAA8B;EAC/E,MAAM,CAACC,cAAc,EAAEC,iBAAiB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAqBJ,qBAAqB,CAAC;EACrG,MAAM,CAACK,aAAa,EAAEC,gBAAgB,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAqBG,SAAS,CAAC;EACvF,MA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G,CAAC,GAAG,CAAC;;EAGtD,OAAOA,YAAY,GAAG,CAAC,GAAGvB,MAAM,GAAGuB,YAAY,GAAG,CAAC,GAAGA,YAAY;AACtE;;;;"}
1
+ {"version":3,"file":"useTableRowActive.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/features/useTableRowActive.ts"],"sourcesContent":["import React from 'react';\nimport { TableDefaultRowActiveIndex, TableScrollToIndexHandler, TableSettings } from '../../types';\nimport { useIsHoverStatePaused } from '../../../../hooks/useIsHoverStatePaused';\nimport { isElementInsideOrTriggeredFromContainer } from '../../../../utils/dom';\n\nexport function useTableRowActive(\n isEnabled = false,\n tableSettings: TableSettings,\n initialRowActiveIndex?: TableDefaultRowActiveIndex\n) {\n const [rowActiveIndex, setRowActiveIndex] = React.useState<number | undefined>(\n typeof initialRowActiveIndex === 'function' ? initialRowActiveIndex(tableSettings) : initialRowActiveIndex\n );\n const [rowHoverIndex, setRowHoverIndex] = React.useState<number | undefined>(undefined);\n const [isHoverStatePaused, setHoverStatePaused] = useIsHoverStatePaused();\n\n const move = (direction: -1 | 1, length: number, scrollToIndex: TableScrollToIndexHandler) => {\n const nextIndex = rowActiveIndex !== undefined ? getNextIndex(direction, rowActiveIndex, length) : 0;\n scrollToIndex(nextIndex);\n setTimeout(() => setRowActiveIndex(nextIndex), 50);\n };\n\n const onKeyDown = React.useCallback(\n (event: KeyboardEvent, length: number, scrollToIndex: TableScrollToIndexHandler) => {\n if (!isEnabled || event.defaultPrevented) {\n return;\n }\n\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n setHoverStatePaused(true);\n }\n\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n\n if (event.ctrlKey || event.metaKey) {\n const newIndex = 0;\n scrollToIndex(newIndex);\n setRowActiveIndex(newIndex);\n } else {\n move(-1, length, scrollToIndex);\n }\n\n return;\n } else if (event.key === 'ArrowDown') {\n event.preventDefault();\n\n if (event.ctrlKey || event.metaKey) {\n const newIndex = length - 1;\n scrollToIndex(newIndex);\n setRowActiveIndex(newIndex);\n } else {\n move(+1, length, scrollToIndex);\n }\n return;\n }\n },\n [isEnabled, rowActiveIndex]\n );\n\n const onFocus = React.useCallback(\n (event: React.FocusEvent, length: number, scrollToIndex: TableScrollToIndexHandler) => {\n if (!isEnabled || event.isDefaultPrevented()) {\n return;\n }\n\n if (event.target.closest('tbody') || isElementInsideOrTriggeredFromContainer(event.target, event.currentTarget)) {\n return;\n }\n\n if (rowActiveIndex === undefined && length > 0) {\n setRowActiveIndex(index => {\n if (index === undefined) {\n scrollToIndex(0);\n return 0;\n }\n return index;\n });\n }\n },\n [rowActiveIndex, isEnabled]\n );\n\n return {\n isEnabled,\n rowActiveIndex,\n setRowActiveIndex: isEnabled ? setRowActiveIndex : () => undefined,\n rowHoverIndex,\n setRowHoverIndex,\n isHoverStatePaused,\n setHoverStatePaused: isEnabled ? setHoverStatePaused : () => undefined,\n handleFocus: isEnabled ? onFocus : () => undefined,\n handleKeyDown: isEnabled ? onKeyDown : () => undefined,\n };\n}\n\nfunction getNextIndex(direction: -1 | 1, currentIndex: number, length: number) {\n if (direction === -1) {\n return currentIndex - 1 > 0 ? currentIndex - 1 : 0;\n }\n\n return currentIndex + 1 < length ? currentIndex + 1 : currentIndex;\n}\n"],"names":["useTableRowActive","isEnabled","tableSettings","initialRowActiveIndex","rowActiveIndex","setRowActiveIndex","React","useState","rowHoverIndex","setRowHoverIndex","undefined","isHoverStatePaused","setHoverStatePaused","useIsHoverStatePaused","move","direction","length","scrollToIndex","nextIndex","getNextIndex","setTimeout","onKeyDown","useCallback","event","defaultPrevented","key","preventDefault","ctrlKey","metaKey","newIndex","onFocus","isDefaultPrevented","target","closest","isElementInsideOrTriggeredFromContainer","currentTarget","index","handleFocus","handleKeyDown","currentIndex"],"mappings":";;;;SAKgBA,iBAAiBA,CAC7BC,SAAS,GAAG,KAAK,EACjBC,aAA4B,EAC5BC,qBAAkD;EAElD,MAAM,CAACC,cAAc,EAAEC,iBAAiB,CAAC,GA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EAAErC,SAAS,GAAGoB,SAAS,GAAG,MAAMX;GAChD;AACL;AAEA,SAASS,YAAYA,CAACJ,SAAiB,EAAEwB,YAAoB,EAAEvB,MAAc;EACzE,IAAID,SAAS,KAAK,CAAC,CAAC,EAAE;IAClB,OAAOwB,YAAY,GAAG,CAAC,GAAG,CAAC,GAAGA,YAAY,GAAG,CAAC,GAAG,CAAC;;EAGtD,OAAOA,YAAY,GAAG,CAAC,GAAGvB,MAAM,GAAGuB,YAAY,GAAG,CAAC,GAAGA,YAAY;AACtE;;;;"}
@@ -12,10 +12,10 @@ function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFi
12
12
  // react-table doesn't re-render when options.enableGlobalFilter changes, so for now we force it
13
13
  const currentFilter = instance.getState().globalFilter;
14
14
  if (currentFilter) {
15
- setTimeout(() => {
16
- instance.setGlobalFilter('');
15
+ instance.resetGlobalFilter(true);
16
+ window.requestAnimationFrame(() => {
17
17
  instance.setGlobalFilter(currentFilter);
18
- }, 1);
18
+ });
19
19
  }
20
20
  }
21
21
  // highlighting
@@ -1 +1 @@
1
- {"version":3,"file":"useTableSearch.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/features/useTableSearch.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { TableSearchHandler } from '../../types';\n\n/*\n Search has two behaviours:\n - Highlighting search results, this is custom and only uses the state part of globalFilter (to store the search query)\n - Filtering of results, this is essentially the built in filtering, and relies on enableGlobalFilter being on or off\n*/\nexport function useTableSearch<TType = unknown>(\n isEnabled = false,\n onChangeSearch: TableSearchHandler | undefined,\n defaultEnableGlobalFilter = false\n) {\n const [enableGlobalFilter, _setEnableGlobalFilter] = React.useState<boolean>(defaultEnableGlobalFilter);\n\n function setEnableGlobalFilter<T extends TType>(enabled: boolean, instance: ReactTable<T>) {\n _setEnableGlobalFilter(enabled);\n\n // react-table doesn't re-render when options.enableGlobalFilter changes, so for now we force it\n const currentFilter = instance.getState().globalFilter;\n\n if (currentFilter) {\n setTimeout(() => {\n instance.setGlobalFilter('');\n instance.setGlobalFilter(currentFilter);\n }, 1);\n }\n }\n\n // highlighting\n const [highlightedColumnIndexes, setHighlightedColumnIndexes] = React.useState<number[][]>([]);\n const [currentHighlightColumnIndex, setCurrentHighlightColumnIndex] = React.useState<number | undefined>(undefined);\n\n return {\n isEnabled,\n // filtering - built-in\n enableGlobalFilter,\n setEnableGlobalFilter,\n // highlighting - custom\n highlightedColumnIndexes,\n setHighlightedColumnIndexes,\n currentHighlightColumnIndex,\n setCurrentHighlightColumnIndex,\n handleSearch: isEnabled && typeof onChangeSearch === 'function' ? onChangeSearch : undefined,\n };\n}\n"],"names":["useTableSearch","isEnabled","onChangeSearch","defaultEnableGlobalFilter","enableGlobalFilter","_setEnableGlobalFilter","React","useState","setEnableGlobalFilter","enabled","instance","currentFilter","getState","globalFilter","setTimeout","setGlobalFilter","highlightedColumnIndexes","setHighlightedColumnIndexes","currentHighlightColumnIndex","setCurrentHighlightColumnIndex","undefined","handleSearch"],"mappings":";;AAIA;;;;;SAKgBA,cAAcA,CAC1BC,SAAS,GAAG,KAAK,EACjBC,cAA8C,EAC9CC,yBAAyB,GAAG,KAAK;EAEjC,MAAM,CAACC,kBAAkB,EAAEC,sBAAsB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAUJ,yBAAyB,CAAC;EAEvG,SAASK,qBAAqBA,CAAkBC,OAAgB,EAAEC,QAAuB;IACrFL,sBAAsB,CAACI,OAAO,CAAC;;IAG/B,MAAME,aAAa,GAAGD,QAAQ,CAACE,QAAQ,EAAE,CAACC,YAAY;IAEtD,IAAIF,aAAa,EAAE;MACfG,UAAU,CAAC;QACPJ,QAAQ,CAACK,eAAe,CAAC,EAAE,CAAC;QAC5BL,QAAQ,CAACK,eAAe,CAACJ,aAAa,CAAC;OAC1C,EAAE,CAAC,CAAC;;;;EAKb,MAAM,CAACK,wBAAwB,EAAEC,2BAA2B,CAAC,GAAGX,cAAK,CAACC,QAAQ,CAAa,EAAE,CAAC;EAC9F,MAAM,CAACW,2BAA2B,EAAEC,8BAA8B,CAAC,GAAGb,cAAK,CAACC,QAAQ,CAAqBa,SAAS,CAAC;EAEnH,OAAO;IACHnB,SAAS;;IAETG,kBAAkB;IAClBI,qBAAqB;;IAErBQ,wBAAwB;IACxBC,2BAA2B;IAC3BC,2BAA2B;IAC3BC,8BAA8B;IAC9BE,YAAY,EAAEpB,SAAS,IAAI,OAAOC,cAAc,KAAK,UAAU,GAAGA,cAAc,GAAGkB;GACtF;AACL;;;;"}
1
+ {"version":3,"file":"useTableSearch.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/features/useTableSearch.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { TableSearchHandler } from '../../types';\n\n/*\n Search has two behaviours:\n - Highlighting search results, this is custom and only uses the state part of globalFilter (to store the search query)\n - Filtering of results, this is essentially the built in filtering, and relies on enableGlobalFilter being on or off\n*/\nexport function useTableSearch<TType = unknown>(\n isEnabled = false,\n onChangeSearch: TableSearchHandler | undefined,\n defaultEnableGlobalFilter = false\n) {\n const [enableGlobalFilter, _setEnableGlobalFilter] = React.useState<boolean>(defaultEnableGlobalFilter);\n\n function setEnableGlobalFilter<T extends TType>(enabled: boolean, instance: ReactTable<T>) {\n _setEnableGlobalFilter(enabled);\n\n // react-table doesn't re-render when options.enableGlobalFilter changes, so for now we force it\n const currentFilter = instance.getState().globalFilter;\n\n if (currentFilter) {\n instance.resetGlobalFilter(true);\n\n window.requestAnimationFrame(() => {\n instance.setGlobalFilter(currentFilter);\n });\n }\n }\n\n // highlighting\n const [highlightedColumnIndexes, setHighlightedColumnIndexes] = React.useState<number[][]>([]);\n const [currentHighlightColumnIndex, setCurrentHighlightColumnIndex] = React.useState<number | undefined>(undefined);\n\n return {\n isEnabled,\n // filtering - built-in\n enableGlobalFilter,\n setEnableGlobalFilter,\n // highlighting - custom\n highlightedColumnIndexes,\n setHighlightedColumnIndexes,\n currentHighlightColumnIndex,\n setCurrentHighlightColumnIndex,\n handleSearch: isEnabled && typeof onChangeSearch === 'function' ? onChangeSearch : undefined,\n };\n}\n"],"names":["useTableSearch","isEnabled","onChangeSearch","defaultEnableGlobalFilter","enableGlobalFilter","_setEnableGlobalFilter","React","useState","setEnableGlobalFilter","enabled","instance","currentFilter","getState","globalFilter","resetGlobalFilter","window","requestAnimationFrame","setGlobalFilter","highlightedColumnIndexes","setHighlightedColumnIndexes","currentHighlightColumnIndex","setCurrentHighlightColumnIndex","undefined","handleSearch"],"mappings":";;AAIA;;;;;SAKgBA,cAAcA,CAC1BC,SAAS,GAAG,KAAK,EACjBC,cAA8C,EAC9CC,yBAAyB,GAAG,KAAK;EAEjC,MAAM,CAACC,kBAAkB,EAAEC,sBAAsB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAUJ,yBAAyB,CAAC;EAEvG,SAASK,qBAAqBA,CAAkBC,OAAgB,EAAEC,QAAuB;IACrFL,sBAAsB,CAACI,OAAO,CAAC;;IAG/B,MAAME,aAAa,GAAGD,QAAQ,CAACE,QAAQ,EAAE,CAACC,YAAY;IAEtD,IAAIF,aAAa,EAAE;MACfD,QAAQ,CAACI,iBAAiB,CAAC,IAAI,CAAC;MAEhCC,MAAM,CAACC,qBAAqB,CAAC;QACzBN,QAAQ,CAACO,eAAe,CAACN,aAAa,CAAC;OAC1C,CAAC;;;;EAKV,MAAM,CAACO,wBAAwB,EAAEC,2BAA2B,CAAC,GAAGb,cAAK,CAACC,QAAQ,CAAa,EAAE,CAAC;EAC9F,MAAM,CAACa,2BAA2B,EAAEC,8BAA8B,CAAC,GAAGf,cAAK,CAACC,QAAQ,CAAqBe,SAAS,CAAC;EAEnH,OAAO;IACHrB,SAAS;;IAETG,kBAAkB;IAClBI,qBAAqB;;IAErBU,wBAAwB;IACxBC,2BAA2B;IAC3BC,2BAA2B;IAC3BC,8BAA8B;IAC9BE,YAAY,EAAEtB,SAAS,IAAI,OAAOC,cAAc,KAAK,UAAU,GAAGA,cAAc,GAAGoB;GACtF;AACL;;;;"}
@@ -1,26 +1,74 @@
1
1
  import React__default from 'react';
2
- import { getSettings } from '../util/settings.js';
2
+ import { getSettings, getSettingsId } from '../util/settings.js';
3
+ import { useTaco } from '../../../../hooks/useTaco.js';
3
4
 
4
- function useTableSettingsListener(table, onChangeSettings) {
5
+ function useTableSettingsListener(table, tableId, onChangeSettings, isEnabled = false) {
6
+ const [enabledSettings, hasSomeEnabledSettings] = useEnabledSettings(isEnabled);
7
+ const taco = useTaco();
5
8
  const meta = table.options.meta;
6
9
  const state = table.getState();
7
10
  React__default.useEffect(() => {
8
- let handler;
9
- if (typeof onChangeSettings === 'function') {
10
- handler = setTimeout(() => {
11
+ const handler = setTimeout(() => {
12
+ if (!hasSomeEnabledSettings) {
13
+ return;
14
+ }
15
+ const settings = removeDisabledSettings(getSettings(table), enabledSettings);
16
+ if (Object.keys(settings).length) {
11
17
  // some settings shouldn't be persisted, but we comment them out here to highlight the intention
12
- onChangeSettings(getSettings(table));
13
- }, 250);
14
- }
18
+ taco.settings.saveSetting(getSettingsId(tableId), settings);
19
+ if (onChangeSettings) {
20
+ onChangeSettings(getSettings(table));
21
+ }
22
+ }
23
+ }, 250);
15
24
  return () => clearTimeout(handler);
16
25
  }, [
17
26
  //state.columnFilters,
18
27
  state.columnOrder, state.columnPinning, state.columnSizing, state.columnVisibility, table.options.enableGlobalFilter, meta.fontSize.size,
19
28
  //state.grouping,
20
- meta.rowHeight.height,
29
+ meta.printing.settings, meta.rowHeight.height,
21
30
  //state.globalFilter,
22
31
  state.sorting]);
23
32
  }
33
+ const DEFAULT_ENABLED_OPTIONS = {
34
+ columnOrder: true,
35
+ columnPinning: true,
36
+ columnSizing: true,
37
+ columnVisibility: true,
38
+ excludeUnmatchedRecordsInSearch: true,
39
+ fontSize: true,
40
+ grouping: true,
41
+ rowHeight: true,
42
+ sorting: true
43
+ };
44
+ function useEnabledSettings(isEnabled) {
45
+ return React__default.useMemo(() => {
46
+ if (isEnabled === false) {
47
+ return [Object.keys(DEFAULT_ENABLED_OPTIONS).reduce((o, key) => ({
48
+ ...o,
49
+ [key]: false
50
+ }), {}), false];
51
+ } else if (isEnabled === true) {
52
+ return [DEFAULT_ENABLED_OPTIONS, true];
53
+ }
54
+ const options = {
55
+ ...DEFAULT_ENABLED_OPTIONS,
56
+ ...isEnabled
57
+ };
58
+ return [options, Object.values(options).some(o => o === true)];
59
+ }, [isEnabled]);
60
+ }
61
+ function removeDisabledSettings(settings, enabledSettings) {
62
+ const sanitizedSettings = {
63
+ ...settings
64
+ };
65
+ Object.keys(enabledSettings).forEach(setting => {
66
+ if (!enabledSettings[setting]) {
67
+ delete sanitizedSettings[setting];
68
+ }
69
+ });
70
+ return sanitizedSettings;
71
+ }
24
72
 
25
73
  export { useTableSettingsListener };
26
74
  //# sourceMappingURL=useTableSettingsListener.js.map
@@ -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 { getSettings, getSettingsId } from '../util/settings';\nimport { useTaco } from '../../../../hooks/useTaco';\nimport { TableEnableSettingsOptions, TableSettings, TableSettingsHandler } from '../../types';\n\nexport function useTableSettingsListener<TType = unknown>(\n table: ReactTable<TType>,\n tableId: string,\n onChangeSettings: TableSettingsHandler | undefined,\n isEnabled: boolean | Partial<TableEnableSettingsOptions> = false\n) {\n const [enabledSettings, hasSomeEnabledSettings] = useEnabledSettings(isEnabled);\n const taco = useTaco();\n const meta = table.options.meta as ReactTableMeta<TType>;\n const state = table.getState();\n\n React.useEffect(() => {\n const handler = setTimeout(() => {\n if (!hasSomeEnabledSettings) {\n return;\n }\n\n const settings = removeDisabledSettings(getSettings(table), enabledSettings);\n\n if (Object.keys(settings).length) {\n // some settings shouldn't be persisted, but we comment them out here to highlight the intention\n taco.settings.saveSetting(getSettingsId(tableId), settings);\n\n if (onChangeSettings) {\n onChangeSettings(getSettings(table));\n }\n }\n }, 250);\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.printing.settings,\n meta.rowHeight.height,\n //state.globalFilter,\n state.sorting,\n ]);\n}\n\nconst DEFAULT_ENABLED_OPTIONS = {\n columnOrder: true,\n columnPinning: true,\n columnSizing: true,\n columnVisibility: true,\n excludeUnmatchedRecordsInSearch: true,\n fontSize: true,\n grouping: true,\n rowHeight: true,\n sorting: true,\n};\n\nfunction useEnabledSettings(isEnabled: boolean | Partial<TableEnableSettingsOptions>): [TableEnableSettingsOptions, boolean] {\n return React.useMemo(() => {\n if (isEnabled === false) {\n return [\n Object.keys(DEFAULT_ENABLED_OPTIONS).reduce(\n (o, key) => ({ ...o, [key]: false }),\n {}\n ) as TableEnableSettingsOptions,\n false,\n ];\n } else if (isEnabled === true) {\n return [DEFAULT_ENABLED_OPTIONS, true];\n }\n\n const options = { ...DEFAULT_ENABLED_OPTIONS, ...isEnabled };\n return [options, Object.values(options).some(o => o === true)];\n }, [isEnabled]);\n}\n\nfunction removeDisabledSettings(settings: TableSettings, enabledSettings: TableEnableSettingsOptions) {\n const sanitizedSettings: TableSettings = { ...settings };\n\n Object.keys(enabledSettings).forEach(setting => {\n if (!enabledSettings[setting]) {\n delete sanitizedSettings[setting];\n }\n });\n\n return sanitizedSettings;\n}\n"],"names":["useTableSettingsListener","table","tableId","onChangeSettings","isEnabled","enabledSettings","hasSomeEnabledSettings","useEnabledSettings","taco","useTaco","meta","options","state","getState","React","useEffect","handler","setTimeout","settings","removeDisabledSettings","getSettings","Object","keys","length","saveSetting","getSettingsId","clearTimeout","columnOrder","columnPinning","columnSizing","columnVisibility","enableGlobalFilter","fontSize","size","printing","rowHeight","height","sorting","DEFAULT_ENABLED_OPTIONS","excludeUnmatchedRecordsInSearch","grouping","useMemo","reduce","o","key","values","some","sanitizedSettings","forEach","setting"],"mappings":";;;;SAMgBA,wBAAwBA,CACpCC,KAAwB,EACxBC,OAAe,EACfC,gBAAkD,EAClDC,YAA2D,KAAK;EAEhE,MAAM,CAACC,eAAe,EAAEC,sBAAsB,CAAC,GAAGC,kBAAkB,CAACH,SAAS,CAAC;EAC/E,MAAMI,IAAI,GAAGC,OAAO,EAAE;EACtB,MAAMC,IAAI,GAAGT,KAAK,CAACU,OAAO,CAACD,IAA6B;EACxD,MAAME,KAAK,GAAGX,KAAK,CAACY,QAAQ,EAAE;EAE9BC,cAAK,CAACC,SAAS,CAAC;IACZ,MAAMC,OAAO,GAAGC,UAAU,CAAC;MACvB,IAAI,CAACX,sBAAsB,EAAE;QACzB;;MAGJ,MAAMY,QAAQ,GAAGC,sBAAsB,CAACC,WAAW,CAACnB,KAAK,CAAC,EAAEI,eAAe,CAAC;MAE5E,IAAIgB,MAAM,CAACC,IAAI,CAACJ,QAAQ,CAAC,CAACK,MAAM,EAAE;;QAE9Bf,IAAI,CAACU,QAAQ,CAACM,WAAW,CAACC,aAAa,CAACvB,OAAO,CAAC,EAAEgB,QAAQ,CAAC;QAE3D,IAAIf,gBAAgB,EAAE;UAClBA,gBAAgB,CAACiB,WAAW,CAACnB,KAAK,CAAC,CAAC;;;KAG/C,EAAE,GAAG,CAAC;IAEP,OAAO,MAAMyB,YAAY,CAACV,OAAO,CAAC;GACrC,EAAE;;EAECJ,KAAK,CAACe,WAAW,EACjBf,KAAK,CA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AAEb,eAA2C;EAChG,MAAM0C,iBAAiB,GAAkB;IAAE,GAAG7B;GAAU;EAExDG,MAAM,CAACC,IAAI,CAACjB,eAAe,CAAC,CAAC2C,OAAO,CAACC,OAAO;IACxC,IAAI,CAAC5C,eAAe,CAAC4C,OAAO,CAAC,EAAE;MAC3B,OAAOF,iBAAiB,CAACE,OAAO,CAAC;;GAExC,CAAC;EAEF,OAAOF,iBAAiB;AAC5B;;;;"}
@@ -1,11 +1,13 @@
1
1
  import { useLocalization } from '../../../components/Provider/Localization.js';
2
2
  import { useReactTable, getCoreRowModel } from '@tanstack/react-table';
3
+ import { getSettingsId } from './util/settings.js';
3
4
  import { mapTableChildrenToColumns, useReactTableInitialState, configureReactTableOptions } from './util/setup.js';
4
5
  import { getTableFeaturePreset } from './util/presets.js';
5
6
  import { useTableColumnFreezing } from './features/useTableColumnFreezing.js';
6
7
  import { useTableColumnOrdering } from './features/useTableColumnOrdering.js';
7
8
  import { useTableFooter } from './features/useTableFooter.js';
8
9
  import { useTableFontSize } from './features/useTableFontSize.js';
10
+ import { useTaco } from '../../../hooks/useTaco.js';
9
11
  import { useTablePrinting } from './features/useTablePrinting.js';
10
12
  import { useTableRowActions } from './features/useTableRowActions.js';
11
13
  import { useTableRowActive } from './features/useTableRowActive.js';
@@ -17,7 +19,6 @@ import { useTableRowHeight } from './features/useTableRowHeight.js';
17
19
  import { useTableRowSelection } from './features/useTableRowSelection.js';
18
20
  import { useTableSearch } from './features/useTableSearch.js';
19
21
  import { useTableServerLoading } from './features/useTableServerLoading.js';
20
- import { useTableSettings } from './features/useTableSettings.js';
21
22
  import { useTableDataListener } from './listeners/useTableDataListener.js';
22
23
  import { useTableFilterListener } from './listeners/useTableFilterListener.js';
23
24
  import { useTableFontSizeListener } from './listeners/useTableFontSizeListener.js';
@@ -34,14 +35,15 @@ import { useTableRowDrop } from './features/useTableRowDrop.js';
34
35
  // Placed this array outside the hook to avoid creating a new array reference on each hook re-render
35
36
  const DEFAULT_EMPTY_ARRAY = [];
36
37
  function useTableManager(props, meta, internalColumns) {
37
- var _props$data, _props$length, _meta$editing, _instance$options$met;
38
+ var _ref, _taco$settings$getSet, _props$data, _props$length, _meta$editing, _instance$options$met;
39
+ const taco = useTaco();
38
40
  const localization = useLocalization();
39
41
  // CSS.escape would be best here, but it doesn't seem to work very well
40
42
  const safeId = props.id.replace('.', '_');
41
43
  // configure table options, merging props with presets
42
44
  const options = getTableFeaturePreset(props);
43
45
  // load any persisted table settings and merge them with any defaults
44
- const [settings, setSettings] = useTableSettings(options.enableSaveSettings, safeId, props.defaultSettings, props.onChangeSettings);
46
+ const settings = (_ref = (_taco$settings$getSet = taco.settings.getSetting(getSettingsId(safeId))) !== null && _taco$settings$getSet !== void 0 ? _taco$settings$getSet : props.defaultSettings) !== null && _ref !== void 0 ? _ref : {};
45
47
  // ensure data is always valid
46
48
  const data = (_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : DEFAULT_EMPTY_ARRAY;
47
49
  const length = (_props$length = props.length) !== null && _props$length !== void 0 ? _props$length : data.length;
@@ -51,7 +53,7 @@ function useTableManager(props, meta, internalColumns) {
51
53
  const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);
52
54
  const footer = useTableFooter(options.enableFooter);
53
55
  const printing = useTablePrinting(options.enablePrinting, safeId);
54
- const rowActive = useTableRowActive(options.enableRowActive, props.defaultRowActiveIndex);
56
+ const rowActive = useTableRowActive(options.enableRowActive, settings, props.defaultRowActiveIndex);
55
57
  const rowActions = useTableRowActions(options.enableRowActions, props.rowActions, props.rowActionsLength);
56
58
  const rowClick = useTableRowClick(options.enableRowClick, props.onRowClick);
57
59
  const rowDrag = useTableRowDrag(options.enableRowDrag && !(meta !== null && meta !== void 0 && (_meta$editing = meta.editing) !== null && _meta$editing !== void 0 && _meta$editing.isEditing), props.onRowDrag);
@@ -116,7 +118,7 @@ function useTableManager(props, meta, internalColumns) {
116
118
  useTableRowSelectionListener(instance, props.onRowSelect);
117
119
  useTableSearchListener(instance);
118
120
  useTableServerLoadingListener(instance, server.loadPage);
119
- useTableSettingsListener(instance, setSettings);
121
+ useTableSettingsListener(instance, safeId, props._DEPRECATED_DO_NOT_USE_onChangeSettings, options.enableSaveSettings);
120
122
  useTableShortcutsListener(instance, props.shortcuts);
121
123
  useTableSortingListener(instance, props.onChangeSort);
122
124
  return {
@@ -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 TableEventHandler,\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 onEvent: TableEventHandler;\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 rowIdentityAccessor: keyof TData;\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 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>(\n options.enableRowExpansion,\n options.enableRowExpansionAll,\n props.rowExpansionRenderer\n );\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, props.onChangeSearch, settings.excludeUnmatchedRecordsInSearch);\n const server = useTableServerLoading(\n length,\n data,\n props.loadPage,\n props.loadAll,\n props.pages,\n props.pageSize,\n props._experimentalDataLoader2\n );\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 onEvent: props.onEvent,\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 rowIdentityAccessor: props.rowIdentityAccessor,\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, length);\n useTableFilterListener(instance, props.onChangeFilter);\n useTableFontSizeListener(instance);\n useTableRowHeightListener(instance);\n useTableRowSelectionListener(instance, props.onRowSelect);\n useTableSearchListener(instance);\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","enableRowExpansionAll","rowExpansionRenderer","rowGoto","useTableRowGoto","enableRowGoto","onRowGoto","rowGroups","useTableRowGroups","rowActionsForGroup","rowHeight","useTableRowHeight","enableRowHeight","rowSelection","useTableRowSelection","enableRowSelection","search","useTableSearch","enableSearch","onChangeSearch","excludeUnmatchedRecordsInSearch","server","useTableServerLoading","loadPage","loadAll","pages","pageSize","_experimentalDataLoader2","columns","defaultState","mapTableChildrenToColumns","initialState","useReactTableInitialState","instance","useReactTable","getCoreRowModel","configureReactTableOptions","enableGlobalFilter","onEvent","rowIdentityAccessor","useTableDataListener","useTableFilterListener","onChangeFilter","useTableFontSizeListener","useTableRowHeightListener","useTableRowSelectionListener","onRowSelect","useTableSearchListener","useTableServerLoadingListener","useTableSettingsListener","useTableShortcutsListener","shortcuts","useTableSortingListener","onChangeSort","_instance$options$met","state","getState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkGA;AACA,MAAMA,mBAAmB,GAAG,EAAE;SAEdC,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,iBAAiB,CAAC5B,OAAO,CAAC6B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ACX,QAAQ,CAAC;EACnCY,4BAA4B,CAACZ,QAAQ,EAAE7F,KAAK,CAAC0G,WAAW,CAAC;EACzDC,sBAAsB,CAACd,QAAQ,CAAC;EAChCe,6BAA6B,CAACf,QAAQ,EAAEZ,MAAM,CAACE,QAAQ,CAAC;EACxD0B,wBAAwB,CAAChB,QAAQ,EAAElF,WAAW,CAAC;EAC/CmG,yBAAyB,CAACjB,QAAQ,EAAE7F,KAAK,CAAC+G,SAAS,CAAC;EACpDC,uBAAuB,CAACnB,QAAQ,EAAE7F,KAAK,CAACiH,YAAY,CAAC;EAErD,OAAO;IACH3G,EAAE,EAAED,MAAM;IACVwF,QAAQ;IACR5F,IAAI,GAAAiH,qBAAA,GAAGrB,QAAQ,CAACrF,OAAO,CAACP,IAAI,cAAAiH,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 TableEventHandler,\n TableFilterComparator,\n TableProps,\n TableSettings,\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 { 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';\nimport { useTaco } from '../../../hooks/useTaco';\nimport { getSettingsId } from './util/settings';\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 onEvent: TableEventHandler;\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 rowIdentityAccessor: keyof TData;\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 const taco = useTaco();\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 = taco.settings.getSetting<TableSettings>(getSettingsId(safeId)) ?? props.defaultSettings ?? {};\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, settings, 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>(\n options.enableRowExpansion,\n options.enableRowExpansionAll,\n props.rowExpansionRenderer\n );\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, props.onChangeSearch, settings.excludeUnmatchedRecordsInSearch);\n const server = useTableServerLoading(\n length,\n data,\n props.loadPage,\n props.loadAll,\n props.pages,\n props.pageSize,\n props._experimentalDataLoader2\n );\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 onEvent: props.onEvent,\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 rowIdentityAccessor: props.rowIdentityAccessor,\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, length);\n useTableFilterListener(instance, props.onChangeFilter);\n useTableFontSizeListener(instance);\n useTableRowHeightListener(instance);\n useTableRowSelectionListener(instance, props.onRowSelect);\n useTableSearchListener(instance);\n useTableServerLoadingListener(instance, server.loadPage);\n useTableSettingsListener(instance, safeId, props._DEPRECATED_DO_NOT_USE_onChangeSettings, options.enableSaveSettings);\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","taco","useTaco","localization","useLocalization","safeId","id","replace","options","getTableFeaturePreset","settings","_ref","_taco$settings$getSet","getSetting","getSettingsId","defaultSettings","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","enableRowExpansionAll","rowExpansionRenderer","rowGoto","useTableRowGoto","enableRowGoto","onRowGoto","rowGroups","useTableRowGroups","rowActionsForGroup","rowHeight","useTableRowHeight","enableRowHeight","rowSelection","useTableRowSelection","enableRowSelection","search","useTableSearch","enableSearch","onChangeSearch","excludeUnmatchedRecordsInSearch","server","useTableServerLoading","loadPage","loadAll","pages","pageSize","_experimentalDataLoader2","columns","defaultState","mapTableChildrenToColumns","initialState","useReactTableInitialState","instance","useReactTable","getCoreRowModel","configureReactTableOptions","enableGlobalFilter","onEvent","rowIdentityAccessor","useTableDataListener","useTableFilterListener","onChangeFilter","useTableFontSizeListener","useTableRowHeightListener","useTableRowSelectionListener","onRowSelect","useTableSearchListener","useTableServerLoadingListener","useTableSettingsListener","_DEPRECATED_DO_NOT_USE_onChangeSettings","enableSaveSettings","useTableShortcutsListener","shortcuts","useTableSortingListener","onChangeSort","_instance$options$met","state","getState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoGA;AACA,MAAMA,mBAAmB,GAAG,EAAE;SAEdC,eAAeA,CAC3BC,KAAwB,EACxBC,IAA6C,EAC7CC,eAAuD;;EAEvD,MAAMC,IAAI,GAAGC,OAAO,EAAE;EACtB,MAAMC,YAAY,GAAGC,eAAe,EAAE;;EAEtC,MAAMC,MAAM,GAAGP,KAAK,CAACQ,EAAE,CAACC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;;EAEzC,MAAMC,OAAO,GAAGC,qBAAqB,CAACX,KAAK,CAAC;;EAG5C,MAAMY,QAAQ,IAAAC,IAAA,IAAAC,qBAAA,GAAGX,IAAI,CAACS,QAAQ,CAACG,UAAU,CAAgBC,aAAa,CAACT,MAAM,CAAC,CAAC,cAAAO,qBAAA,cAAAA,qBAAA,GAAId,KAAK,CAACiB,eAAe,cAAAJ,IAAA,cAAAA,IAAA,GAAI,EAAE;;EAG9G,MAAMK,IAAI,IAAAC,WAAA,GAAGnB,KAAK,CAACkB,IAAI,cAAAC,W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Q;GAC3B;AACL;;;;"}
@@ -0,0 +1,44 @@
1
+ import React__default from 'react';
2
+ import { getSettingsId } from './util/settings.js';
3
+ import { useTaco } from '../../../hooks/useTaco.js';
4
+
5
+ function getLegacySetting(currentKey) {
6
+ try {
7
+ const localStorageValue = localStorage.getItem(currentKey);
8
+ if (localStorageValue) {
9
+ const value = JSON.parse(localStorageValue || 'null');
10
+ if (value !== null) {
11
+ localStorage.removeItem(currentKey);
12
+ return value;
13
+ }
14
+ }
15
+ } catch {
16
+ // If user is in private mode or has storage restriction
17
+ // localStorage can throw. JSON.parse can throw, too.
18
+ }
19
+ return undefined;
20
+ }
21
+ function useTableSettingsPreloader(tableId) {
22
+ const taco = useTaco();
23
+ const [loading, setLoading] = React__default.useState(true);
24
+ React__default.useLayoutEffect(() => {
25
+ const key = getSettingsId(tableId);
26
+ // migrate legacy settings if they exist, can be removed in the future
27
+ const legacySettings = getLegacySetting(`taco.${taco.userId}.table.${tableId}.settings`);
28
+ if (legacySettings) {
29
+ const legacyPrintSettings = getLegacySetting(`taco.${taco.userId}.table.${tableId}.print.settings`);
30
+ taco.settings.saveSetting(key, {
31
+ ...legacySettings,
32
+ print: legacyPrintSettings !== null && legacyPrintSettings !== void 0 ? legacyPrintSettings : {}
33
+ }).finally(() => setLoading(false));
34
+ } else {
35
+ taco.settings.loadSetting(key).finally(() => setLoading(false));
36
+ }
37
+ }, []);
38
+ return {
39
+ loading
40
+ };
41
+ }
42
+
43
+ export { useTableSettingsPreloader };
44
+ //# sourceMappingURL=useTableSettingsPreloader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTableSettingsPreloader.js","sources":["../../../../../../../../src/primitives/Table/useTableManager/useTableSettingsPreloader.ts"],"sourcesContent":["import React from 'react';\nimport { useTaco } from '../../../hooks/useTaco';\nimport { TablePrintSettings, TableSettings } from '../types';\nimport { getSettingsId } from './util/settings';\n\nfunction getLegacySetting<TType = unknown>(currentKey: string): TType | undefined {\n try {\n const localStorageValue = localStorage.getItem(currentKey);\n\n if (localStorageValue) {\n const value = JSON.parse(localStorageValue || 'null');\n\n if (value !== null) {\n localStorage.removeItem(currentKey);\n return value;\n }\n }\n } catch {\n // If user is in private mode or has storage restriction\n // localStorage can throw. JSON.parse can throw, too.\n }\n\n return undefined;\n}\n\nexport function useTableSettingsPreloader(tableId: string) {\n const taco = useTaco();\n const [loading, setLoading] = React.useState(true);\n\n React.useLayoutEffect(() => {\n const key = getSettingsId(tableId);\n\n // migrate legacy settings if they exist, can be removed in the future\n const legacySettings = getLegacySetting<TableSettings>(`taco.${taco.userId}.table.${tableId}.settings`);\n\n if (legacySettings) {\n const legacyPrintSettings = getLegacySetting<TablePrintSettings>(\n `taco.${taco.userId}.table.${tableId}.print.settings`\n );\n\n taco.settings\n .saveSetting(key, {\n ...legacySettings,\n print: legacyPrintSettings ?? {},\n })\n .finally(() => setLoading(false));\n } else {\n taco.settings.loadSetting<TableSettings>(key).finally(() => setLoading(false));\n }\n }, []);\n\n return { loading };\n}\n"],"names":["getLegacySetting","currentKey","localStorageValue","localStorage","getItem","value","JSON","parse","removeItem","undefined","useTableSettingsPreloader","tableId","taco","useTaco","loading","setLoading","React","useState","useLayoutEffect","key","getSettingsId","legacySettings","userId","legacyPrintSettings","settings","saveSetting","print","finally","loadSetting"],"mappings":";;;;AAKA,SAASA,gBAAgBA,CAAkBC,UAAkB;EACzD,IAAI;IACA,MAAMC,iBAAiB,GAAGC,YAAY,CAACC,OAAO,CAACH,UAAU,CAAC;IAE1D,IAAIC,iBAAiB,EAAE;MACnB,MAAMG,KAAK,GAAGC,IAAI,CAACC,KAAK,CAACL,iBAAiB,IAAI,MAAM,CAAC;MAErD,IAAIG,KAAK,KAAK,IAAI,EAAE;QAChBF,YAAY,CAACK,UAAU,CAACP,UAAU,CAAC;QACnC,OAAOI,KAAK;;;GAGvB,CAAC,MAAM;;;;EAKR,OAAOI,SAAS;AACpB;SAEgBC,yBAAyBA,CAACC,OAAe;EACrD,MAAMC,IAAI,GAAGC,OAAO,EAAE;EACtB,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,IAAI,CAAC;EAElDD,cAAK,CAACE,eAAe,CAAC;IAClB,MAAMC,GAAG,GAAGC,aAAa,CAACT,OAAO,CAAC;;IAGlC,MAAMU,cAAc,GAAGrB,gBAAgB,CAAgB,QAAQY,IAAI,CAACU,MAAM,UAAUX,OAAO,WAAW,CAAC;IAEvG,IAAIU,cAAc,EAAE;MAChB,MAAME,mBAAmB,GAAGvB,gBAAgB,CACxC,QAAQY,IAAI,CAACU,MAAM,UAAUX,OAAO,iBAAiB,CACxD;MAEDC,IAAI,CAACY,QAAQ,CACRC,WAAW,CAACN,GAAG,EAAE;QACd,GAAGE,cAAc;QACjBK,KAAK,EAAEH,mBAAmB,aAAnBA,mBAAmB,cAAnBA,mBAAmB,GAAI;OACjC,CAAC,CACDI,OAAO,CAAC,MAAMZ,UAAU,CAAC,KAAK,CAAC,CAAC;KACxC,MAAM;MACHH,IAAI,CAACY,QAAQ,CAACI,WAAW,CAAgBT,GAAG,CAAC,CAACQ,OAAO,CAAC,MAAMZ,UAAU,CAAC,KAAK,CAAC,CAAC;;GAErF,EAAE,EAAE,CAAC;EAEN,OAAO;IAAED;GAAS;AACtB;;;;"}
@@ -1,5 +1,6 @@
1
1
  import { isInternalColumn } from './columns.js';
2
2
 
3
+ const getSettingsId = tableId => `table.${tableId.replace('.', '_')}`;
3
4
  function getSettings(table) {
4
5
  const meta = table.options.meta;
5
6
  const state = table.getState();
@@ -13,6 +14,7 @@ function getSettings(table) {
13
14
  excludeUnmatchedRecordsInSearch: table.options.enableGlobalFilter,
14
15
  fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,
15
16
  //grouping: table.options.enableGrouping ? state.grouping : undefined,
17
+ print: meta.printing.settings,
16
18
  rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,
17
19
  //searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,
18
20
  sorting: state.sorting
@@ -30,5 +32,5 @@ function ignoreInternalColumns(data) {
30
32
  }, {});
31
33
  }
32
34
 
33
- export { getSettings, ignoreInternalColumns };
35
+ export { getSettings, getSettingsId, ignoreInternalColumns };
34
36
  //# sourceMappingURL=settings.js.map
@@ -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 const getSettingsId = (tableId: string) => `table.${tableId.replace('.', '_')}`;\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 print: meta.printing.settings,\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":["getSettingsId","tableId","replace","getSettings","table","meta","options","state","getState","columnOrder","columnOrdering","isEnabled","undefined","columnPinning","columnSizing","ignoreInternalColumns","columnVisibility","enableHiding","excludeUnmatchedRecordsInSearch","enableGlobalFilter","fontSize","size","print","printing","settings","rowHeight","height","sorting","data","Object","keys","reduce","accum","key","isInternalColumn"],"mappings":";;MAGaA,aAAa,GAAIC,OAAe,IAAK,SAASA,OAAO,CAACC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;SAEpEC,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,KAAK,EAAEjB,IAAI,CAACkB,QAAQ,CAACC,QAAQ;IAC7BC,SAAS,EAAEpB,IAAI,CAACoB,SAAS,CAACd,SAAS,GAAGN,IAAI,CAACoB,SAAS,CAACC,MAAM,GAAGd,SAAS;;IAEvEe,OAAO,EAAEpB,KAAK,CAACoB;GAClB;AACL;SAEgBZ,qBAAqBA,CAACa,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;;;;"}
@@ -297,8 +297,11 @@ function useReactTableInitialState(props, columns, persistedSettings, defaults)
297
297
  if (columnPinning !== null && columnPinning !== void 0 && (_columnPinning$left = columnPinning.left) !== null && _columnPinning$left !== void 0 && _columnPinning$left.length) {
298
298
  columnPinning.left = freezeUptoExternalColumn(columnOrder.indexOf(columnPinning.left[columnPinning.left.length - 1]), columnOrder);
299
299
  } else {
300
- if (props.defaultColumnFreezingIndex) {
301
- columnPinning.left = freezeUptoExternalColumn(props.defaultColumnFreezingIndex, columnOrder);
300
+ if (props.defaultColumnFreezingIndex !== undefined) {
301
+ const index = typeof props.defaultColumnFreezingIndex === 'function' ? props.defaultColumnFreezingIndex(persistedSettings) : props.defaultColumnFreezingIndex;
302
+ if (index !== undefined) {
303
+ columnPinning.left = freezeUptoExternalColumn(index, columnOrder);
304
+ }
302
305
  } else {
303
306
  columnPinning.left = unfreezeAllExternalColumns(columnOrder);
304
307
  }