@veeqo/transfigure 0.0.1

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 (357) hide show
  1. package/README.md +54 -0
  2. package/dist/BusinessLogic/BusinessLogicManager.d.ts +6 -0
  3. package/dist/BusinessLogic/index.d.ts +4 -0
  4. package/dist/BusinessLogic/mocks.d.ts +10 -0
  5. package/dist/BusinessLogic/types.d.ts +18 -0
  6. package/dist/BusinessLogic/useBusinessLogic.d.ts +1 -0
  7. package/dist/api/createCustomView/createCustomView.d.ts +6 -0
  8. package/dist/api/createCustomView/index.d.ts +1 -0
  9. package/dist/api/deleteCustomView/deleteCustomView.d.ts +1 -0
  10. package/dist/api/deleteCustomView/index.d.ts +1 -0
  11. package/dist/api/index.d.ts +5 -0
  12. package/dist/api/patchCurrentUser/index.d.ts +1 -0
  13. package/dist/api/patchCurrentUser/patchCurrentUser.d.ts +1 -0
  14. package/dist/api/patchCustomView/index.d.ts +1 -0
  15. package/dist/api/patchCustomView/patchCustomView.d.ts +6 -0
  16. package/dist/api/types.d.ts +16 -0
  17. package/dist/axiosWrappers/axiosWrappers.d.ts +15 -0
  18. package/dist/axiosWrappers/axiosWrappers.test.d.ts +1 -0
  19. package/dist/axiosWrappers/constants.d.ts +10 -0
  20. package/dist/axiosWrappers/index.d.ts +1 -0
  21. package/dist/axiosWrappers/types.d.ts +6 -0
  22. package/dist/axiosWrappers/utils/filterErrorStack/filterErrorStack.d.ts +14 -0
  23. package/dist/axiosWrappers/utils/filterErrorStack/filterErrorStack.test.d.ts +1 -0
  24. package/dist/axiosWrappers/utils/filterErrorStack/index.d.ts +1 -0
  25. package/dist/axiosWrappers/utils/filteringUtils/filteringUtils.d.ts +3 -0
  26. package/dist/axiosWrappers/utils/filteringUtils/filteringUtils.test.d.ts +1 -0
  27. package/dist/axiosWrappers/utils/filteringUtils/index.d.ts +1 -0
  28. package/dist/axiosWrappers/utils/injectIntoError/index.d.ts +1 -0
  29. package/dist/axiosWrappers/utils/injectIntoError/injectIntoError.d.ts +18 -0
  30. package/dist/axiosWrappers/utils/injectIntoError/injectIntoError.test.d.ts +1 -0
  31. package/dist/axiosWrappers/utils/isError/index.d.ts +1 -0
  32. package/dist/axiosWrappers/utils/isError/isError.d.ts +4 -0
  33. package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +17 -0
  34. package/dist/components/ErrorBoundary/index.d.ts +1 -0
  35. package/dist/components/Filters/ActiveFilters/ActiveFilterArrayTag/ActiveFilterArrayTag.d.ts +6 -0
  36. package/dist/components/Filters/ActiveFilters/ActiveFilterArrayTag/index.d.ts +1 -0
  37. package/dist/components/Filters/ActiveFilters/ActiveFilterDateRangeTag/ActiveFilterDateRangeTag.d.ts +6 -0
  38. package/dist/components/Filters/ActiveFilters/ActiveFilterDateRangeTag/index.d.ts +1 -0
  39. package/dist/components/Filters/ActiveFilters/ActiveFilterNumberRangeTag/ActiveFilterNumberRangeTag.d.ts +6 -0
  40. package/dist/components/Filters/ActiveFilters/ActiveFilterNumberRangeTag/index.d.ts +1 -0
  41. package/dist/components/Filters/ActiveFilters/ActiveFilterTag/ActiveFilterTag.d.ts +6 -0
  42. package/dist/components/Filters/ActiveFilters/ActiveFilterTag/index.d.ts +1 -0
  43. package/dist/components/Filters/ActiveFilters/ActiveFilters.d.ts +1 -0
  44. package/dist/components/Filters/ActiveFilters/index.d.ts +5 -0
  45. package/dist/components/Filters/AdaptiveHeightContainer/AdaptiveHeightContainer.d.ts +8 -0
  46. package/dist/components/Filters/AdaptiveHeightContainer/index.d.ts +1 -0
  47. package/dist/components/Filters/AdaptiveHeightContainer/styled.d.ts +3 -0
  48. package/dist/components/Filters/Fields/AsyncCheckboxFilter/AsyncCheckboxFilter.d.ts +6 -0
  49. package/dist/components/Filters/Fields/AsyncCheckboxFilter/index.d.ts +1 -0
  50. package/dist/components/Filters/Fields/AsyncInlineCheckboxFilter/AsyncInlineCheckboxFilter.d.ts +8 -0
  51. package/dist/components/Filters/Fields/AsyncInlineCheckboxFilter/index.d.ts +1 -0
  52. package/dist/components/Filters/Fields/AsyncInlineRadioFilter/AsyncInlineRadioFilter.d.ts +8 -0
  53. package/dist/components/Filters/Fields/AsyncInlineRadioFilter/index.d.ts +1 -0
  54. package/dist/components/Filters/Fields/AsyncRadioFilter/AsyncRadioFilter.d.ts +6 -0
  55. package/dist/components/Filters/Fields/AsyncRadioFilter/index.d.ts +1 -0
  56. package/dist/components/Filters/Fields/CheckboxFilter/CheckboxFilter.d.ts +6 -0
  57. package/dist/components/Filters/Fields/CheckboxFilter/index.d.ts +1 -0
  58. package/dist/components/Filters/Fields/DateRangeFilter/DateRangeFilter.d.ts +6 -0
  59. package/dist/components/Filters/Fields/DateRangeFilter/index.d.ts +1 -0
  60. package/dist/components/Filters/Fields/FilterArrayField/FilterArrayField.d.ts +8 -0
  61. package/dist/components/Filters/Fields/FilterArrayField/index.d.ts +1 -0
  62. package/dist/components/Filters/Fields/FilterField/FilterField.d.ts +8 -0
  63. package/dist/components/Filters/Fields/FilterField/index.d.ts +1 -0
  64. package/dist/components/Filters/Fields/FilterGroup/FilterGroup.d.ts +6 -0
  65. package/dist/components/Filters/Fields/FilterGroup/index.d.ts +1 -0
  66. package/dist/components/Filters/Fields/FilterNumberRangeFilter/FilterNumberRangeFilter.d.ts +9 -0
  67. package/dist/components/Filters/Fields/FilterNumberRangeFilter/index.d.ts +1 -0
  68. package/dist/components/Filters/Fields/MultipleFieldFilter/MultipleFieldFilter.d.ts +7 -0
  69. package/dist/components/Filters/Fields/MultipleFieldFilter/index.d.ts +1 -0
  70. package/dist/components/Filters/Fields/NumberRangeFilter/MuiSlider.d.ts +27 -0
  71. package/dist/components/Filters/Fields/NumberRangeFilter/NumberRangeFilter.d.ts +6 -0
  72. package/dist/components/Filters/Fields/NumberRangeFilter/index.d.ts +1 -0
  73. package/dist/components/Filters/Fields/RadioFilter/RadioFilter.d.ts +6 -0
  74. package/dist/components/Filters/Fields/RadioFilter/index.d.ts +1 -0
  75. package/dist/components/Filters/Fields/index.d.ts +13 -0
  76. package/dist/components/Filters/FiltersDropdown/FiltersDropdown.d.ts +2 -0
  77. package/dist/components/Filters/FiltersDropdown/index.d.ts +1 -0
  78. package/dist/components/Filters/FiltersList/FiltersList.d.ts +2 -0
  79. package/dist/components/Filters/FiltersList/index.d.ts +1 -0
  80. package/dist/components/Filters/index.d.ts +4 -0
  81. package/dist/components/SearchBar/SearchBar.d.ts +1 -0
  82. package/dist/components/SearchBar/index.d.ts +1 -0
  83. package/dist/components/Table/Table.d.ts +1 -0
  84. package/dist/components/ToastsManager/ToastsManager.d.ts +1 -0
  85. package/dist/components/ToastsManager/index.d.ts +1 -0
  86. package/dist/components/Views/CreateView/CreateView.d.ts +5 -0
  87. package/dist/components/Views/CreateView/index.d.ts +1 -0
  88. package/dist/components/Views/EditDropdown/EditDropdown.d.ts +7 -0
  89. package/dist/components/Views/EditDropdown/index.d.ts +1 -0
  90. package/dist/components/Views/OptionsDropdown/OptionsDropdown.d.ts +10 -0
  91. package/dist/components/Views/OptionsDropdown/index.d.ts +1 -0
  92. package/dist/components/Views/OptionsDropdown/styled.d.ts +17 -0
  93. package/dist/components/Views/PillNotifications/InfoPill.d.ts +1 -0
  94. package/dist/components/Views/PillNotifications/PillNotifications.d.ts +9 -0
  95. package/dist/components/Views/PillNotifications/index.d.ts +1 -0
  96. package/dist/components/Views/PillNotifications/styled.d.ts +33 -0
  97. package/dist/components/Views/SortableViews/LegacySortableViews.d.ts +3 -0
  98. package/dist/components/Views/SortableViews/SortableViews.d.ts +1 -0
  99. package/dist/components/Views/SortableViews/index.d.ts +1 -0
  100. package/dist/components/Views/SortableViews/styled.d.ts +8 -0
  101. package/dist/components/Views/UnsavedChanges/UnsavedChanges.d.ts +5 -0
  102. package/dist/components/Views/UnsavedChanges/index.d.ts +1 -0
  103. package/dist/components/Views/UnsavedChanges/styled.d.ts +33 -0
  104. package/dist/components/Views/ViewDropdowns/ViewDropdowns.d.ts +1 -0
  105. package/dist/components/Views/ViewDropdowns/index.d.ts +1 -0
  106. package/dist/components/Views/ViewList/ViewsList.d.ts +1 -0
  107. package/dist/components/Views/ViewList/index.d.ts +1 -0
  108. package/dist/components/Views/ViewList/styled.d.ts +2 -0
  109. package/dist/components/Views/ViewTab/Confirmation/Confirmation.d.ts +8 -0
  110. package/dist/components/Views/ViewTab/Confirmation/index.d.ts +1 -0
  111. package/dist/components/Views/ViewTab/ViewTab.d.ts +6 -0
  112. package/dist/components/Views/ViewTab/index.d.ts +1 -0
  113. package/dist/components/Views/constants.d.ts +10 -0
  114. package/dist/components/Views/index.d.ts +10 -0
  115. package/dist/constants/constants.d.ts +8 -0
  116. package/dist/constants/dateConstants.d.ts +17 -0
  117. package/dist/constants/index.d.ts +2 -0
  118. package/dist/context/ModalContext/ModalContext.d.ts +6 -0
  119. package/dist/context/ModalContext/hooks.d.ts +1 -0
  120. package/dist/context/ModalContext/index.d.ts +3 -0
  121. package/dist/context/ModalContext/mocks/mockUseModal.d.ts +6 -0
  122. package/dist/context/ModalContext/modalId.d.ts +3 -0
  123. package/dist/context/ModalContext/types.d.ts +7 -0
  124. package/dist/context/index.d.ts +1 -0
  125. package/dist/fetchers/constants.d.ts +12 -0
  126. package/dist/fetchers/fetchers.d.ts +12 -0
  127. package/dist/fetchers/index.d.ts +3 -0
  128. package/dist/fetchers/withCSRF.d.ts +2 -0
  129. package/dist/hooks/index.d.ts +9 -0
  130. package/dist/hooks/useCustomViews/index.d.ts +1 -0
  131. package/dist/hooks/useCustomViews/useCustomViews.d.ts +16 -0
  132. package/dist/hooks/useDropdownManager/index.d.ts +1 -0
  133. package/dist/hooks/useDropdownManager/useDropdownManager.d.ts +35 -0
  134. package/dist/hooks/useDuplicateActiveView/index.d.ts +1 -0
  135. package/dist/hooks/useDuplicateActiveView/useDuplicateActiveView.d.ts +3 -0
  136. package/dist/hooks/useFilterArrayLabel/index.d.ts +1 -0
  137. package/dist/hooks/useFilterArrayLabel/useFilterArrayLabel.d.ts +8 -0
  138. package/dist/hooks/useFilterLabel/index.d.ts +1 -0
  139. package/dist/hooks/useFilterLabel/useFilterLabel.d.ts +8 -0
  140. package/dist/hooks/usePersistUnsavedChanges/index.d.ts +1 -0
  141. package/dist/hooks/usePersistUnsavedChanges/usePersistUnsavedChanges.d.ts +18 -0
  142. package/dist/hooks/useStores/index.d.ts +1 -0
  143. package/dist/hooks/useStores/types.d.ts +8 -0
  144. package/dist/hooks/useStores/useStores.d.ts +2 -0
  145. package/dist/hooks/useViewUrlChange/index.d.ts +1 -0
  146. package/dist/hooks/useViewUrlChange/useViewUrlChange.d.ts +1 -0
  147. package/dist/hooks/useViews/index.d.ts +1 -0
  148. package/dist/hooks/useViews/useViews.d.ts +15 -0
  149. package/dist/index.cjs +1 -0
  150. package/dist/index.d.ts +15 -0
  151. package/dist/index.js +143 -0
  152. package/dist/index10.cjs +1 -0
  153. package/dist/index10.js +29 -0
  154. package/dist/index11.cjs +1 -0
  155. package/dist/index11.js +23 -0
  156. package/dist/index12.cjs +1 -0
  157. package/dist/index12.js +24 -0
  158. package/dist/index13.cjs +1 -0
  159. package/dist/index13.js +42 -0
  160. package/dist/index14.cjs +1 -0
  161. package/dist/index14.js +42 -0
  162. package/dist/index15.cjs +1 -0
  163. package/dist/index15.js +57 -0
  164. package/dist/index16.cjs +1 -0
  165. package/dist/index16.js +49 -0
  166. package/dist/index17.cjs +1 -0
  167. package/dist/index17.js +45 -0
  168. package/dist/index18.cjs +1 -0
  169. package/dist/index18.js +55 -0
  170. package/dist/index19.cjs +1 -0
  171. package/dist/index19.js +39 -0
  172. package/dist/index2.cjs +1 -0
  173. package/dist/index2.js +7 -0
  174. package/dist/index20.cjs +1 -0
  175. package/dist/index20.js +39 -0
  176. package/dist/index21.cjs +1 -0
  177. package/dist/index21.js +55 -0
  178. package/dist/index22.cjs +1 -0
  179. package/dist/index22.js +36 -0
  180. package/dist/index23.cjs +1 -0
  181. package/dist/index23.js +62 -0
  182. package/dist/index24.cjs +1 -0
  183. package/dist/index24.js +21 -0
  184. package/dist/index25.cjs +1 -0
  185. package/dist/index25.js +34 -0
  186. package/dist/index26.cjs +1 -0
  187. package/dist/index26.js +43 -0
  188. package/dist/index27.cjs +1 -0
  189. package/dist/index27.js +38 -0
  190. package/dist/index28.cjs +1 -0
  191. package/dist/index28.js +53 -0
  192. package/dist/index29.cjs +1 -0
  193. package/dist/index29.js +111 -0
  194. package/dist/index3.cjs +1 -0
  195. package/dist/index3.js +9 -0
  196. package/dist/index30.cjs +1 -0
  197. package/dist/index30.js +36 -0
  198. package/dist/index31.cjs +1 -0
  199. package/dist/index31.js +33 -0
  200. package/dist/index32.cjs +1 -0
  201. package/dist/index32.js +17 -0
  202. package/dist/index33.cjs +1 -0
  203. package/dist/index33.js +96 -0
  204. package/dist/index34.cjs +1 -0
  205. package/dist/index34.js +21 -0
  206. package/dist/index35.cjs +1 -0
  207. package/dist/index35.js +75 -0
  208. package/dist/index36.cjs +1 -0
  209. package/dist/index36.js +30 -0
  210. package/dist/index37.cjs +1 -0
  211. package/dist/index37.js +31 -0
  212. package/dist/index38.cjs +1 -0
  213. package/dist/index38.js +57 -0
  214. package/dist/index39.cjs +1 -0
  215. package/dist/index39.js +34 -0
  216. package/dist/index4.cjs +1 -0
  217. package/dist/index4.js +14 -0
  218. package/dist/index40.cjs +1 -0
  219. package/dist/index40.js +40 -0
  220. package/dist/index41.cjs +1 -0
  221. package/dist/index41.js +37 -0
  222. package/dist/index42.cjs +1 -0
  223. package/dist/index42.js +13 -0
  224. package/dist/index43.cjs +1 -0
  225. package/dist/index43.js +9 -0
  226. package/dist/index44.cjs +1 -0
  227. package/dist/index44.js +4 -0
  228. package/dist/index45.cjs +1 -0
  229. package/dist/index45.js +23 -0
  230. package/dist/index46.cjs +1 -0
  231. package/dist/index46.js +4 -0
  232. package/dist/index47.cjs +1 -0
  233. package/dist/index47.js +6 -0
  234. package/dist/index48.cjs +1 -0
  235. package/dist/index48.js +15 -0
  236. package/dist/index49.cjs +1 -0
  237. package/dist/index49.js +15 -0
  238. package/dist/index5.cjs +1 -0
  239. package/dist/index5.js +18 -0
  240. package/dist/index50.cjs +1 -0
  241. package/dist/index50.js +23 -0
  242. package/dist/index51.cjs +1 -0
  243. package/dist/index51.js +221 -0
  244. package/dist/index52.cjs +1 -0
  245. package/dist/index52.js +44 -0
  246. package/dist/index53.cjs +1 -0
  247. package/dist/index53.js +36 -0
  248. package/dist/index54.cjs +1 -0
  249. package/dist/index54.js +39 -0
  250. package/dist/index55.cjs +1 -0
  251. package/dist/index55.js +100 -0
  252. package/dist/index56.cjs +1 -0
  253. package/dist/index56.js +11 -0
  254. package/dist/index57.cjs +1 -0
  255. package/dist/index57.js +63 -0
  256. package/dist/index58.cjs +1 -0
  257. package/dist/index58.js +65 -0
  258. package/dist/index59.cjs +1 -0
  259. package/dist/index59.js +28 -0
  260. package/dist/index6.cjs +1 -0
  261. package/dist/index6.js +110 -0
  262. package/dist/index60.cjs +1 -0
  263. package/dist/index60.js +301 -0
  264. package/dist/index61.cjs +1 -0
  265. package/dist/index61.js +66 -0
  266. package/dist/index62.cjs +1 -0
  267. package/dist/index62.js +65 -0
  268. package/dist/index63.cjs +1 -0
  269. package/dist/index63.js +39 -0
  270. package/dist/index64.cjs +1 -0
  271. package/dist/index64.js +34 -0
  272. package/dist/index65.cjs +1 -0
  273. package/dist/index65.js +11 -0
  274. package/dist/index66.cjs +1 -0
  275. package/dist/index66.js +14 -0
  276. package/dist/index67.cjs +1 -0
  277. package/dist/index67.js +21 -0
  278. package/dist/index68.cjs +1 -0
  279. package/dist/index68.js +21 -0
  280. package/dist/index69.cjs +1 -0
  281. package/dist/index69.js +44 -0
  282. package/dist/index7.cjs +1 -0
  283. package/dist/index7.js +6 -0
  284. package/dist/index70.cjs +1 -0
  285. package/dist/index70.js +19 -0
  286. package/dist/index71.cjs +1 -0
  287. package/dist/index71.js +4 -0
  288. package/dist/index72.cjs +1 -0
  289. package/dist/index72.js +11 -0
  290. package/dist/index73.cjs +3 -0
  291. package/dist/index73.js +16 -0
  292. package/dist/index74.cjs +1 -0
  293. package/dist/index74.js +11 -0
  294. package/dist/index75.cjs +1 -0
  295. package/dist/index75.js +28 -0
  296. package/dist/index76.cjs +1 -0
  297. package/dist/index76.js +21 -0
  298. package/dist/index77.cjs +19 -0
  299. package/dist/index77.js +32 -0
  300. package/dist/index78.cjs +1 -0
  301. package/dist/index78.js +18 -0
  302. package/dist/index79.cjs +1 -0
  303. package/dist/index79.js +11 -0
  304. package/dist/index8.cjs +1 -0
  305. package/dist/index8.js +16 -0
  306. package/dist/index80.cjs +12 -0
  307. package/dist/index80.js +18 -0
  308. package/dist/index81.cjs +80 -0
  309. package/dist/index81.js +99 -0
  310. package/dist/index82.cjs +1 -0
  311. package/dist/index82.js +4 -0
  312. package/dist/index83.cjs +80 -0
  313. package/dist/index83.js +99 -0
  314. package/dist/index84.cjs +1 -0
  315. package/dist/index84.js +38 -0
  316. package/dist/index85.cjs +13 -0
  317. package/dist/index85.js +21 -0
  318. package/dist/index86.cjs +7 -0
  319. package/dist/index86.js +14 -0
  320. package/dist/index9.cjs +1 -0
  321. package/dist/index9.js +149 -0
  322. package/dist/mobx/Filters/Filters.d.ts +51 -0
  323. package/dist/mobx/Filters/index.d.ts +1 -0
  324. package/dist/mobx/MobXProvider/MobXProvider.d.ts +12 -0
  325. package/dist/mobx/MobXProvider/index.d.ts +1 -0
  326. package/dist/mobx/Notifications/Notifications.d.ts +13 -0
  327. package/dist/mobx/Notifications/index.d.ts +1 -0
  328. package/dist/mobx/NumberRangeFilter/NumberRangeFilter.d.ts +20 -0
  329. package/dist/mobx/NumberRangeFilter/index.d.ts +1 -0
  330. package/dist/mobx/RangeFilter/RangeFilter.d.ts +18 -0
  331. package/dist/mobx/RangeFilter/index.d.ts +1 -0
  332. package/dist/mobx/Views/Views.d.ts +10 -0
  333. package/dist/mobx/Views/index.d.ts +1 -0
  334. package/dist/mobx/index.d.ts +6 -0
  335. package/dist/setupTests.d.ts +0 -0
  336. package/dist/storybookHelpers/StoryWrapper.d.ts +13 -0
  337. package/dist/storybookHelpers/apiMocks/current_user.d.ts +272 -0
  338. package/dist/storybookHelpers/apiMocks/custom_views.d.ts +53 -0
  339. package/dist/storybookHelpers/constants.d.ts +5 -0
  340. package/dist/types.d.ts +93 -0
  341. package/dist/utils/createAllView/createAllView.d.ts +3 -0
  342. package/dist/utils/createAllView/createAllView.test.d.ts +1 -0
  343. package/dist/utils/createAllView/index.d.ts +1 -0
  344. package/dist/utils/getAsyncOptions/getAsyncOptions.d.ts +10 -0
  345. package/dist/utils/getAsyncOptions/getAsyncOptions.test.d.ts +1 -0
  346. package/dist/utils/getAsyncOptions/index.d.ts +1 -0
  347. package/dist/utils/getFetcherFunction/getFetcherFunction.d.ts +5 -0
  348. package/dist/utils/getFetcherFunction/getFetcherFunction.test.d.ts +1 -0
  349. package/dist/utils/getFetcherFunction/index.d.ts +1 -0
  350. package/dist/utils/index.d.ts +5 -0
  351. package/dist/utils/isValidDateRange/index.d.ts +1 -0
  352. package/dist/utils/isValidDateRange/isValidDateRange.d.ts +2 -0
  353. package/dist/utils/isValidDateRange/isValidDateRange.test.d.ts +1 -0
  354. package/dist/utils/viewsAdapter/index.d.ts +1 -0
  355. package/dist/utils/viewsAdapter/viewsAdapter.d.ts +7 -0
  356. package/dist/utils/viewsAdapter/viewsAdapter.test.d.ts +1 -0
  357. package/package.json +126 -0
@@ -0,0 +1,65 @@
1
+ import { useEffect as u } from "react";
2
+ import { ALL_VIEW_ID as I } from "./index70.js";
3
+ import { useCustomViews as E } from "./index59.js";
4
+ import { useViews as F } from "./index57.js";
5
+ import { useBusinessLogic as C } from "./index7.js";
6
+ import { useStores as D } from "./index56.js";
7
+ const T = () => {
8
+ const {
9
+ VIEW_TYPE: g,
10
+ SEARCH_FILTER_ID: c
11
+ } = C(), {
12
+ Filters: {
13
+ activeViewId: d,
14
+ initFiltersFromView: e,
15
+ initFromUrl: i,
16
+ discardChanges: w,
17
+ updateUrl: L,
18
+ setFilter: l
19
+ }
20
+ } = D(), {
21
+ isLoading: V,
22
+ isValidating: v
23
+ } = E({
24
+ type: g
25
+ }), {
26
+ viewsMap: t,
27
+ defaultCustomViewId: f,
28
+ isLoading: h
29
+ } = F(), p = v || h || V;
30
+ u(() => {
31
+ if (p) return;
32
+ const s = new URLSearchParams(window.location.search), m = s.get("view"), a = s.get(c), o = s.size > 0;
33
+ if (!d) {
34
+ if (m) {
35
+ const r = t.get(m);
36
+ if (r)
37
+ e(r), o && i();
38
+ else {
39
+ const n = t.get(f);
40
+ n && (e(n), o && i(!1));
41
+ }
42
+ } else {
43
+ const r = t.get(f);
44
+ if (r)
45
+ e(r), w(!0), o && i();
46
+ else {
47
+ const n = t.get(I);
48
+ n && e(n);
49
+ }
50
+ }
51
+ a && l(c, a);
52
+ }
53
+ }, [c, d, f, w, e, i, p, l, L, t]), u(() => {
54
+ const s = () => {
55
+ const a = new URLSearchParams(window.location.search).get("view");
56
+ if (!a) return;
57
+ const o = t.get(a);
58
+ o && (e(o), i());
59
+ };
60
+ return window.addEventListener("popstate", s), () => window.removeEventListener("popstate", s);
61
+ }, [w, e, i, t]);
62
+ };
63
+ export {
64
+ T as useViewUrlChange
65
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("swr"),v=require("./index50.cjs"),S=s=>s&&s.__esModule?s:{default:s},h=S(a),y=({type:s})=>{var o,t,i,n,u,r,c,m;const{data:e,isLoading:_,isValidating:l,error:w,mutate:f}=h.default("/current_user",v.fetcherV1),p=(t=(o=e==null?void 0:e.settings)==null?void 0:o.custom_view_positions)==null?void 0:t[s],V=(u=(n=(i=e==null?void 0:e.settings)==null?void 0:i.default_custom_views)==null?void 0:n[s])==null?void 0:u.toString(),d=!!((r=e==null?void 0:e.permissions)!=null&&r.delete_company_custom_views),g=!!((c=e==null?void 0:e.permissions)!=null&&c.update_company_custom_views),C=!!((m=e==null?void 0:e.permissions)!=null&&m.share_custom_views);return{canDeleteCustomViews:d,canUpdateCustomViews:g,canShareCustomViews:C,orderedListOfCustomViews:p,defaultCustomViewId:V,isLoading:_,isValidating:l,error:w,mutate:f}};exports.useCustomViews=y;
@@ -0,0 +1,28 @@
1
+ import h from "swr";
2
+ import { fetcherV1 as B } from "./index50.js";
3
+ const d = ({
4
+ type: e
5
+ }) => {
6
+ var o, t, i, n, r, m, u, c;
7
+ const {
8
+ data: s,
9
+ isLoading: _,
10
+ isValidating: w,
11
+ error: p,
12
+ mutate: l
13
+ } = h("/current_user", B), V = (t = (o = s == null ? void 0 : s.settings) == null ? void 0 : o.custom_view_positions) == null ? void 0 : t[e], f = (r = (n = (i = s == null ? void 0 : s.settings) == null ? void 0 : i.default_custom_views) == null ? void 0 : n[e]) == null ? void 0 : r.toString(), C = !!((m = s == null ? void 0 : s.permissions) != null && m.delete_company_custom_views), g = !!((u = s == null ? void 0 : s.permissions) != null && u.update_company_custom_views), v = !!((c = s == null ? void 0 : s.permissions) != null && c.share_custom_views);
14
+ return {
15
+ canDeleteCustomViews: C,
16
+ canUpdateCustomViews: g,
17
+ canShareCustomViews: v,
18
+ orderedListOfCustomViews: V,
19
+ defaultCustomViewId: f,
20
+ isLoading: _,
21
+ isValidating: w,
22
+ error: p,
23
+ mutate: l
24
+ };
25
+ };
26
+ export {
27
+ d as useCustomViews
28
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("axios"),i=require("./index71.cjs"),s=require("./index72.cjs"),l=require("./index73.cjs"),E=require("./index74.cjs"),p=t=>t&&t.__esModule?t:{default:t},c=p(u),y=async(t,a)=>{const o=new Error,r=s.filterOptionalArgsGetDelete(t,a);try{return await c.default.get(...r)}catch(e){throw l.filterErrorStack(o),E.injectIntoError({customError:o,originalError:e,type:i.AxiosErrorType.GET}),e}},f=async(t,a)=>{const o=new Error,r=s.filterOptionalArgsGetDelete(t,a);try{return await c.default.delete(...r)}catch(e){throw l.filterErrorStack(o),E.injectIntoError({customError:o,originalError:e,type:i.AxiosErrorType.DELETE}),e}},g=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.post(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.POST}),n}},w=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.patch(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.PATCH}),n}},A=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.put(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.PUT}),n}},d=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.postForm(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.POST_FORM}),n}},h=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.putForm(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.PUT_FORM}),n}},T=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.patchForm(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.PATCH_FORM}),n}},m={get:y,delete:f,post:g,patch:w,put:A,postForm:d,putForm:h,patchForm:T,CancelToken:c.default.CancelToken,isCancel:c.default.isCancel,getUri:c.default.getUri,isAxiosError:c.default.isAxiosError};exports.axios=m;
package/dist/index6.js ADDED
@@ -0,0 +1,110 @@
1
+ import a from "axios";
2
+ import { AxiosErrorType as e } from "./index71.js";
3
+ import { filterOptionalArgsGetDelete as y, filterOptionalArgs as p } from "./index72.js";
4
+ import { filterErrorStack as i } from "./index73.js";
5
+ import { injectIntoError as E } from "./index74.js";
6
+ const m = async (n, s) => {
7
+ const o = new Error(), r = y(n, s);
8
+ try {
9
+ return await a.get(...r);
10
+ } catch (t) {
11
+ throw i(o), E({
12
+ customError: o,
13
+ originalError: t,
14
+ type: e.GET
15
+ }), t;
16
+ }
17
+ }, w = async (n, s) => {
18
+ const o = new Error(), r = y(n, s);
19
+ try {
20
+ return await a.delete(...r);
21
+ } catch (t) {
22
+ throw i(o), E({
23
+ customError: o,
24
+ originalError: t,
25
+ type: e.DELETE
26
+ }), t;
27
+ }
28
+ }, g = async (n, s, o) => {
29
+ const r = new Error(), t = p(n, s, o);
30
+ try {
31
+ return await a.post(...t);
32
+ } catch (c) {
33
+ throw i(r), E({
34
+ customError: r,
35
+ originalError: c,
36
+ type: e.POST
37
+ }), c;
38
+ }
39
+ }, l = async (n, s, o) => {
40
+ const r = new Error(), t = p(n, s, o);
41
+ try {
42
+ return await a.patch(...t);
43
+ } catch (c) {
44
+ throw i(r), E({
45
+ customError: r,
46
+ originalError: c,
47
+ type: e.PATCH
48
+ }), c;
49
+ }
50
+ }, h = async (n, s, o) => {
51
+ const r = new Error(), t = p(n, s, o);
52
+ try {
53
+ return await a.put(...t);
54
+ } catch (c) {
55
+ throw i(r), E({
56
+ customError: r,
57
+ originalError: c,
58
+ type: e.PUT
59
+ }), c;
60
+ }
61
+ }, u = async (n, s, o) => {
62
+ const r = new Error(), t = p(n, s, o);
63
+ try {
64
+ return await a.postForm(...t);
65
+ } catch (c) {
66
+ throw i(r), E({
67
+ customError: r,
68
+ originalError: c,
69
+ type: e.POST_FORM
70
+ }), c;
71
+ }
72
+ }, T = async (n, s, o) => {
73
+ const r = new Error(), t = p(n, s, o);
74
+ try {
75
+ return await a.putForm(...t);
76
+ } catch (c) {
77
+ throw i(r), E({
78
+ customError: r,
79
+ originalError: c,
80
+ type: e.PUT_FORM
81
+ }), c;
82
+ }
83
+ }, F = async (n, s, o) => {
84
+ const r = new Error(), t = p(n, s, o);
85
+ try {
86
+ return await a.patchForm(...t);
87
+ } catch (c) {
88
+ throw i(r), E({
89
+ customError: r,
90
+ originalError: c,
91
+ type: e.PATCH_FORM
92
+ }), c;
93
+ }
94
+ }, P = {
95
+ get: m,
96
+ delete: w,
97
+ post: g,
98
+ patch: l,
99
+ put: h,
100
+ postForm: u,
101
+ putForm: T,
102
+ patchForm: F,
103
+ CancelToken: a.CancelToken,
104
+ isCancel: a.isCancel,
105
+ getUri: a.getUri,
106
+ isAxiosError: a.isAxiosError
107
+ };
108
+ export {
109
+ P as axios
110
+ };
@@ -0,0 +1 @@
1
+ "use strict";var U=Object.defineProperty;var L=(c,i,r)=>i in c?U(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r;var h=(c,i,r)=>L(c,typeof i!="symbol"?i+"":i,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("mobx"),N=require("@veeqo/ui"),_=require("@internationalized/date"),v=require("lodash/isEqual"),g=require("./index44.cjs"),b=require("./index62.cjs"),D=require("./index61.cjs"),S=require("./index70.cjs"),V=require("./index68.cjs"),d=require("./index8.cjs"),I=c=>c&&c.__esModule?c:{default:c},C=I(v);class B{constructor(){h(this,"defaultFilters");h(this,"defaultArrayFilters");h(this,"defaultDateRangeFilters");h(this,"defaultNumberRangeFilters");h(this,"filters");h(this,"arrayFilters");h(this,"dateRangeFilters");h(this,"numberRangeFilters");h(this,"activeViewId");h(this,"isFiltersDropdownVisible");h(this,"initDefaultFilterMaps",()=>{this.defaultFilters=new Map(this.filters),this.defaultArrayFilters=new Map(this.arrayFilters),this.defaultDateRangeFilters=new Map(this.dateRangeFilters),this.defaultNumberRangeFilters=new Map(this.numberRangeFilters)});h(this,"updateUrl",(i=!1)=>{try{const r=`${window.location.pathname}?${this.queryParams}`;i?window.history.pushState({},"",r):window.history.replaceState({},"",r)}catch(r){console.log(r)}});h(this,"setFilter",(i,r)=>{this.filters.set(i,r),this.updateUrl()});h(this,"clearFilter",i=>{this.filters.set(i,""),this.updateUrl()});h(this,"setArrayFilter",(i,r)=>{this.arrayFilters.set(i,r),this.updateUrl()});h(this,"clearArrayFilter",i=>{this.arrayFilters.set(i,[]),this.updateUrl()});h(this,"setRangeFilter",({key:i,range:r,dates:t})=>{r.setFilterType(i),r.setDates(t.start,t.end),this.updateUrl()});h(this,"clearRangeFilter",i=>{const r=this.dateRangeFilters.get(i);r&&(r.clear(),this.updateUrl())});h(this,"setNumberRangeFilter",({numberRange:i,gte:r,lte:t})=>{i.setGte(r),i.setLte(t),this.updateUrl()});h(this,"clearNumberRangeFilter",i=>{const r=this.numberRangeFilters.get(i);r&&(r.clear(),this.updateUrl())});h(this,"clearAllFilters",(i=!1)=>{const{SEARCH_FILTER_ID:r}=d.BusinessLogicManager.getBusinessLogic();this.filters.forEach((t,e)=>{e!==r&&this.filters.set(e,"")}),this.arrayFilters.forEach((t,e)=>this.arrayFilters.set(e,[])),this.dateRangeFilters.forEach(t=>t.clear()),this.numberRangeFilters.forEach(t=>t.clear()),i||this.updateUrl()});h(this,"clearFiltersForGroup",i=>{const{GROUP_MAP:r}=d.BusinessLogicManager.getBusinessLogic(),t=r.get(i);t&&t.fields.forEach(e=>{this.arrayFilters.has(e.id)?this.clearArrayFilter(e.id):this.dateRangeFilters.has(e.id)?this.clearRangeFilter(e.id):this.numberRangeFilters.has(e.id)?this.clearNumberRangeFilter(e.id):this.clearFilter(e.id)})});h(this,"setActiveViewId",i=>{this.activeViewId=i,this.updateUrl()});h(this,"toggleFiltersDropdownVisible",i=>{this.isFiltersDropdownVisible=i});h(this,"getFiltersForGroup",i=>{const{GROUP_MAP:r}=d.BusinessLogicManager.getBusinessLogic(),t=r.get(i);if(!t)return{};const e={};return t.fields.forEach(n=>{this.arrayFilters.has(n.id)?e[n.id]=this.arrayFilters.get(n.id):this.dateRangeFilters.has(n.id)?e[n.id]=this.dateRangeFilters.get(n.id):this.numberRangeFilters.has(n.id)?e[n.id]=this.numberRangeFilters.get(n.id):e[n.id]=this.filters.get(n.id)}),e});h(this,"initFiltersFromView",i=>{this.defaultFilters=new Map(i.filterMaps.filters),this.defaultArrayFilters=new Map(i.filterMaps.arrayFilters),this.defaultDateRangeFilters=new Map(Array.from(i.filterMaps.rangeFilters.entries()).map(([r,t])=>{const e=new b.RangeFilter(t.filterType);return t.gte&&t.lte&&e.setDates(t.gte,t.lte),[r,e]})),this.defaultNumberRangeFilters=new Map(Array.from(i.filterMaps.numberRangeFilters.entries()).map(([r,t])=>{const e=t.clone();return t.gte&&e.setGte(t.gte),t.lte&&e.setLte(t.lte),[r,e]})),this.filters=new Map(i.filterMaps.filters),this.arrayFilters=new Map(i.filterMaps.arrayFilters),this.dateRangeFilters=new Map(Array.from(i.filterMaps.rangeFilters.entries()).map(([r,t])=>{const e=new b.RangeFilter(t.filterType);return t.gte&&t.lte&&e.setDates(t.gte,t.lte),[r,e]})),this.numberRangeFilters=new Map(Array.from(i.filterMaps.numberRangeFilters.entries()).map(([r,t])=>{const e=t.clone();return t.gte&&e.setGte(t.gte),t.lte&&e.setLte(t.lte),[r,e]})),this.activeViewId=i.id});h(this,"initFromUrl",(i=!0)=>{const{GROUP_MAP:r,NUMBER_RANGE_FILTERS:t}=d.BusinessLogicManager.getBusinessLogic(),e=new URLSearchParams(window.location.search),n=Array.from(r.values()).flatMap(f=>f.fields),p=new Map,M=new Map,F=new Map,R=new Map,w=new Map;Array.from(e.entries()).forEach(([f,l])=>{(f.includes("_gte")||f.includes("_lte"))&&w.set(f,l)}),Array.from(e.entries()).forEach(([f,l])=>{if(f==="view"&&i){this.activeViewId=l;return}let a=n.find(s=>s.id===f);if(!a){const s=f.replace(/_[gl]te$/,"");t.includes(s)&&(a=n.find(u=>u.id===s))}if(a)switch(a.filterType){case g.FilterChoiceValue.CHECKBOX:l&&M.set(f,l.split(","));break;case g.FilterChoiceValue.DATE_RANGE:let s;if(l==="CUSTOM"){s=new b.RangeFilter("CUSTOM");const T=w.get(`${f}_gte`),E=w.get(`${f}_lte`);T&&E&&s.setDates(_.parseDate(T),_.parseDate(E))}else V.isValidDateRange(l)?s=new b.RangeFilter(l):s=new b.RangeFilter(N.DateRanges.TODAY);F.set(f,s);break;case g.FilterChoiceValue.NUMBER_RANGE:const u=new D.NumberRangeFilter({filterId:a.id}),m=f.replace(/_[gl]te$/,""),y=w.get(`${m}_gte`),A=w.get(`${m}_lte`);y&&u.setGte(Number(y)),A&&u.setLte(Number(A)),R.set(m,u);break;case g.FilterChoiceValue.TEXT:case g.FilterChoiceValue.NUMBER:case g.FilterChoiceValue.RADIO:p.set(f,l);break}}),this.filters=p,this.arrayFilters=M,this.dateRangeFilters=F,this.numberRangeFilters=R,this.updateUrl()});h(this,"discardChanges",(i=!1)=>{const{SEARCH_FILTER_ID:r}=d.BusinessLogicManager.getBusinessLogic(),t=new Map(this.defaultFilters);this.filters.has(r)&&t.set(r,this.filters.get(r)),this.filters=t,this.arrayFilters=new Map(this.defaultArrayFilters),this.dateRangeFilters.clear(),this.defaultDateRangeFilters.forEach((e,n)=>{const p=new b.RangeFilter(e.filterType);p.setDates(e.gte,e.lte),this.dateRangeFilters.set(n,p)}),this.numberRangeFilters.clear(),this.defaultNumberRangeFilters.forEach((e,n)=>{this.numberRangeFilters.set(n,e.clone())}),this.updateUrl(i)});const{GROUP_MAP:i}=d.BusinessLogicManager.getBusinessLogic(),r=Array.from(i.values()).flatMap(t=>t.fields);this.filters=new Map(r.filter(t=>t.filterType===g.FilterChoiceValue.TEXT||t.filterType===g.FilterChoiceValue.NUMBER||t.filterType===g.FilterChoiceValue.RADIO||t.filterType===g.FilterChoiceValue.DATE_RANGE).map(t=>[t.id,""])),this.arrayFilters=new Map(r.filter(t=>t.filterType===g.FilterChoiceValue.CHECKBOX).map(t=>[t.id,[]])),this.dateRangeFilters=new Map(r.filter(t=>t.filterType===g.FilterChoiceValue.DATE_RANGE).map(t=>[t.id,new b.RangeFilter])),this.numberRangeFilters=new Map(r.filter(t=>t.filterType===g.FilterChoiceValue.NUMBER_RANGE).map(t=>{const e=new D.NumberRangeFilter({filterId:t.id});return[t.id,e]})),this.defaultArrayFilters=new Map,this.defaultFilters=new Map,this.defaultDateRangeFilters=new Map,this.defaultNumberRangeFilters=new Map,this.initDefaultFilterMaps(),this.isFiltersDropdownVisible=!1,this.activeViewId=void 0,o.makeObservable(this,{defaultFilters:o.observable,defaultArrayFilters:o.observable,defaultDateRangeFilters:o.observable,defaultNumberRangeFilters:o.observable,filters:o.observable,arrayFilters:o.observable,numberRangeFilters:o.observable,dateRangeFilters:o.observable,isFiltersDropdownVisible:o.observable,activeViewId:o.observable,toggleFiltersDropdownVisible:o.action,setActiveViewId:o.action,setFilter:o.action,setArrayFilter:o.action,setRangeFilter:o.action,setNumberRangeFilter:o.action,clearFilter:o.action,clearArrayFilter:o.action,clearRangeFilter:o.action,clearNumberRangeFilter:o.action,clearAllFilters:o.action,getFiltersForGroup:o.action,clearFiltersForGroup:o.action,initFromUrl:o.action,initFiltersFromView:o.action,initDefaultFilterMaps:o.action,discardChanges:o.action,updateUrl:o.action,hasActiveFilters:o.computed,activeFilterKeysList:o.computed,queryParams:o.computed,hasUnsavedChanges:o.computed})}get hasActiveFilters(){const{GROUP_MAP:i}=d.BusinessLogicManager.getBusinessLogic(),r=Array.from(i.values()).flatMap(e=>e.fields),t=new Set(r.map(e=>e.id));return Array.from(this.filters.entries()).filter(([e])=>t.has(e)).some(([,e])=>e!=="")||Array.from(this.arrayFilters.entries()).filter(([e])=>t.has(e)).some(([,e])=>e.length>0)||Array.from(this.dateRangeFilters.entries()).filter(([e])=>t.has(e)).some(([,e])=>e.filterType!==void 0)||Array.from(this.numberRangeFilters.entries()).filter(([e])=>t.has(e)).some(([,e])=>e.isActive)}get activeFilterKeysList(){const{DATE_RANGE_FILTERS:i,NUMBER_RANGE_FILTERS:r}=d.BusinessLogicManager.getBusinessLogic(),t=Array.from(this.filters.entries()).filter(([F,R])=>R!==""&&!i.includes(F)&&!r.includes(F)).map(([F])=>F),e=Array.from(this.arrayFilters.entries()).filter(([,F])=>F.length>0).map(([F])=>F),n=Array.from(this.dateRangeFilters.entries()).filter(([,F])=>F.filterType!==void 0).map(([F])=>F),p=Array.from(this.numberRangeFilters.entries()).filter(([,F])=>F.isActive).map(([F])=>F);return[...new Set([...t,...e,...n,...p])]}get queryParams(){const{DATE_RANGE_FILTERS:i,NUMBER_RANGE_FILTERS:r}=d.BusinessLogicManager.getBusinessLogic(),t=new URLSearchParams;return Array.from(this.filters.entries()).filter(([e,n])=>n!==""&&!i.includes(e)&&!r.includes(e)).forEach(([e,n])=>{t.append(e,n)}),Array.from(this.arrayFilters.entries()).filter(([,e])=>e.length>0).forEach(([e,n])=>{t.append(e,n.join(","))}),Array.from(this.dateRangeFilters.entries()).filter(([,e])=>e.filterType!==void 0).forEach(([e,n])=>{t.set(e,n.filterType),n.filterType==="CUSTOM"&&(t.set(`${e}_gte`,n.gte.toString()),t.set(`${e}_lte`,n.lte.toString()))}),Array.from(this.numberRangeFilters.entries()).filter(([,e])=>e.isActive).forEach(([e,n])=>{n.gte!==void 0&&t.set(`${e}_gte`,n.gte.toString()),n.isValidLte&&t.set(`${e}_lte`,n.lte.toString())}),this.activeViewId&&t.set("view",this.activeViewId),t.toString()}get hasUnsavedChanges(){if(this.activeViewId===S.ALL_VIEW_ID)return!1;const{GROUP_MAP:i,SEARCH_FILTER_ID:r}=d.BusinessLogicManager.getBusinessLogic(),t=Array.from(i.values()).flatMap(l=>l.fields),e=new Set(t.map(l=>l.id));if(Array.from(this.filters.entries()).filter(([l])=>l!==r&&e.has(l)).some(([l,a])=>{const s=this.defaultFilters.get(l);return s===void 0&&a!==""||s!==void 0&&a!==s}))return!0;const p=Array.from(this.defaultArrayFilters.entries()).filter(([l])=>e.has(l)).some(([l,a])=>{const s=this.defaultArrayFilters.get(l)||[];return a.length>0||s.length>0?a.length!==s.length||!C.default(a,s):!1}),M=Array.from(this.arrayFilters.entries()).filter(([l])=>e.has(l)).some(([l,a])=>{const s=this.defaultArrayFilters.get(l)||[];return a.length>0||s.length>0?a.length!==s.length||!C.default(a,s):!1});if(p||M)return!0;const F=Array.from(this.numberRangeFilters.entries()).filter(([l])=>e.has(l)).some(([l,a])=>{const s=this.defaultNumberRangeFilters.get(l);return!a.isEqual(s)});if(Array.from(this.defaultNumberRangeFilters.entries()).filter(([l])=>e.has(l)).some(([l,a])=>{const s=this.numberRangeFilters.get(l);return!a.isEqual(s)})||F)return!0;const w=Array.from(this.defaultDateRangeFilters.entries()).filter(([l])=>e.has(l)).some(([l,a])=>{var u,m,y,A;const s=this.dateRangeFilters.get(l);return a!=null&&a.filterType&&!(s!=null&&s.filterType)||s!=null&&s.filterType&&!(a!=null&&a.filterType)||(s==null?void 0:s.filterType)!==(a==null?void 0:a.filterType)?!0:(s==null?void 0:s.filterType)==="CUSTOM"&&(a==null?void 0:a.filterType)==="CUSTOM"?((u=a.gte)==null?void 0:u.toString())!==((m=s.gte)==null?void 0:m.toString())||((y=a.lte)==null?void 0:y.toString())!==((A=s.lte)==null?void 0:A.toString()):!1});return Array.from(this.dateRangeFilters.entries()).filter(([l])=>e.has(l)).some(([l,a])=>{var u,m,y,A;const s=this.defaultDateRangeFilters.get(l);return a!=null&&a.filterType&&!(s!=null&&s.filterType)||s!=null&&s.filterType&&!(a!=null&&a.filterType)||(s==null?void 0:s.filterType)!==(a==null?void 0:a.filterType)?!0:(s==null?void 0:s.filterType)==="CUSTOM"&&(a==null?void 0:a.filterType)==="CUSTOM"?((u=a.gte)==null?void 0:u.toString())!==((m=s.gte)==null?void 0:m.toString())||((y=a.lte)==null?void 0:y.toString())!==((A=s.lte)==null?void 0:A.toString()):!1})||w}}exports.Filters=B;
@@ -0,0 +1,301 @@
1
+ var I = Object.defineProperty;
2
+ var L = (R, r, i) => r in R ? I(R, r, { enumerable: !0, configurable: !0, writable: !0, value: i }) : R[r] = i;
3
+ var o = (R, r, i) => L(R, typeof r != "symbol" ? r + "" : r, i);
4
+ import { makeObservable as C, computed as E, action as h, observable as d } from "mobx";
5
+ import { DateRanges as v } from "@veeqo/ui";
6
+ import { parseDate as D } from "@internationalized/date";
7
+ import N from "lodash/isEqual";
8
+ import { FilterChoiceValue as g } from "./index44.js";
9
+ import { RangeFilter as M } from "./index62.js";
10
+ import { NumberRangeFilter as S } from "./index61.js";
11
+ import { ALL_VIEW_ID as G } from "./index70.js";
12
+ import { isValidDateRange as V } from "./index68.js";
13
+ import { BusinessLogicManager as p } from "./index8.js";
14
+ class W {
15
+ constructor() {
16
+ // DEFAULT FILTERS
17
+ o(this, "defaultFilters");
18
+ o(this, "defaultArrayFilters");
19
+ o(this, "defaultDateRangeFilters");
20
+ o(this, "defaultNumberRangeFilters");
21
+ // CURRENT FILTERS
22
+ o(this, "filters");
23
+ o(this, "arrayFilters");
24
+ o(this, "dateRangeFilters");
25
+ o(this, "numberRangeFilters");
26
+ // VIEWS
27
+ o(this, "activeViewId");
28
+ // VISIBILITY STATE
29
+ o(this, "isFiltersDropdownVisible");
30
+ o(this, "initDefaultFilterMaps", () => {
31
+ this.defaultFilters = new Map(this.filters), this.defaultArrayFilters = new Map(this.arrayFilters), this.defaultDateRangeFilters = new Map(this.dateRangeFilters), this.defaultNumberRangeFilters = new Map(this.numberRangeFilters);
32
+ });
33
+ o(this, "updateUrl", (r = !1) => {
34
+ try {
35
+ const i = `${window.location.pathname}?${this.queryParams}`;
36
+ r ? window.history.pushState({}, "", i) : window.history.replaceState({}, "", i);
37
+ } catch (i) {
38
+ console.log(i);
39
+ }
40
+ });
41
+ // TEXT FILTERS
42
+ o(this, "setFilter", (r, i) => {
43
+ this.filters.set(r, i), this.updateUrl();
44
+ });
45
+ o(this, "clearFilter", (r) => {
46
+ this.filters.set(r, ""), this.updateUrl();
47
+ });
48
+ // ARRAY FILTERS
49
+ o(this, "setArrayFilter", (r, i) => {
50
+ this.arrayFilters.set(r, i), this.updateUrl();
51
+ });
52
+ o(this, "clearArrayFilter", (r) => {
53
+ this.arrayFilters.set(r, []), this.updateUrl();
54
+ });
55
+ // RANGE FILTERS
56
+ o(this, "setRangeFilter", ({
57
+ key: r,
58
+ range: i,
59
+ dates: t
60
+ }) => {
61
+ i.setFilterType(r), i.setDates(t.start, t.end), this.updateUrl();
62
+ });
63
+ o(this, "clearRangeFilter", (r) => {
64
+ const i = this.dateRangeFilters.get(r);
65
+ i && (i.clear(), this.updateUrl());
66
+ });
67
+ // NUMBER RANGE FILTERS
68
+ o(this, "setNumberRangeFilter", ({
69
+ numberRange: r,
70
+ gte: i,
71
+ lte: t
72
+ }) => {
73
+ r.setGte(i), r.setLte(t), this.updateUrl();
74
+ });
75
+ o(this, "clearNumberRangeFilter", (r) => {
76
+ const i = this.numberRangeFilters.get(r);
77
+ i && (i.clear(), this.updateUrl());
78
+ });
79
+ // CLEARING ALL FILTERS
80
+ o(this, "clearAllFilters", (r = !1) => {
81
+ const {
82
+ SEARCH_FILTER_ID: i
83
+ } = p.getBusinessLogic();
84
+ this.filters.forEach((t, e) => {
85
+ e !== i && this.filters.set(e, "");
86
+ }), this.arrayFilters.forEach((t, e) => this.arrayFilters.set(e, [])), this.dateRangeFilters.forEach((t) => t.clear()), this.numberRangeFilters.forEach((t) => t.clear()), r || this.updateUrl();
87
+ });
88
+ o(this, "clearFiltersForGroup", (r) => {
89
+ const {
90
+ GROUP_MAP: i
91
+ } = p.getBusinessLogic(), t = i.get(r);
92
+ t && t.fields.forEach((e) => {
93
+ this.arrayFilters.has(e.id) ? this.clearArrayFilter(e.id) : this.dateRangeFilters.has(e.id) ? this.clearRangeFilter(e.id) : this.numberRangeFilters.has(e.id) ? this.clearNumberRangeFilter(e.id) : this.clearFilter(e.id);
94
+ });
95
+ });
96
+ // VIEWS
97
+ o(this, "setActiveViewId", (r) => {
98
+ this.activeViewId = r, this.updateUrl();
99
+ });
100
+ // VISIBILITY
101
+ o(this, "toggleFiltersDropdownVisible", (r) => {
102
+ this.isFiltersDropdownVisible = r;
103
+ });
104
+ // FILTER GROUPS
105
+ o(this, "getFiltersForGroup", (r) => {
106
+ const {
107
+ GROUP_MAP: i
108
+ } = p.getBusinessLogic(), t = i.get(r);
109
+ if (!t) return {};
110
+ const e = {};
111
+ return t.fields.forEach((n) => {
112
+ this.arrayFilters.has(n.id) ? e[n.id] = this.arrayFilters.get(n.id) : this.dateRangeFilters.has(n.id) ? e[n.id] = this.dateRangeFilters.get(n.id) : this.numberRangeFilters.has(n.id) ? e[n.id] = this.numberRangeFilters.get(n.id) : e[n.id] = this.filters.get(n.id);
113
+ }), e;
114
+ });
115
+ o(this, "initFiltersFromView", (r) => {
116
+ this.defaultFilters = new Map(r.filterMaps.filters), this.defaultArrayFilters = new Map(r.filterMaps.arrayFilters), this.defaultDateRangeFilters = new Map(Array.from(r.filterMaps.rangeFilters.entries()).map(([i, t]) => {
117
+ const e = new M(t.filterType);
118
+ return t.gte && t.lte && e.setDates(t.gte, t.lte), [i, e];
119
+ })), this.defaultNumberRangeFilters = new Map(Array.from(r.filterMaps.numberRangeFilters.entries()).map(([i, t]) => {
120
+ const e = t.clone();
121
+ return t.gte && e.setGte(t.gte), t.lte && e.setLte(t.lte), [i, e];
122
+ })), this.filters = new Map(r.filterMaps.filters), this.arrayFilters = new Map(r.filterMaps.arrayFilters), this.dateRangeFilters = new Map(Array.from(r.filterMaps.rangeFilters.entries()).map(([i, t]) => {
123
+ const e = new M(t.filterType);
124
+ return t.gte && t.lte && e.setDates(t.gte, t.lte), [i, e];
125
+ })), this.numberRangeFilters = new Map(Array.from(r.filterMaps.numberRangeFilters.entries()).map(([i, t]) => {
126
+ const e = t.clone();
127
+ return t.gte && e.setGte(t.gte), t.lte && e.setLte(t.lte), [i, e];
128
+ })), this.activeViewId = r.id;
129
+ });
130
+ o(this, "initFromUrl", (r = !0) => {
131
+ const {
132
+ GROUP_MAP: i,
133
+ NUMBER_RANGE_FILTERS: t
134
+ } = p.getBusinessLogic(), e = new URLSearchParams(window.location.search), n = Array.from(i.values()).flatMap((F) => F.fields), c = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
135
+ Array.from(e.entries()).forEach(([F, l]) => {
136
+ (F.includes("_gte") || F.includes("_lte")) && w.set(F, l);
137
+ }), Array.from(e.entries()).forEach(([F, l]) => {
138
+ if (F === "view" && r) {
139
+ this.activeViewId = l;
140
+ return;
141
+ }
142
+ let a = n.find((s) => s.id === F);
143
+ if (!a) {
144
+ const s = F.replace(/_[gl]te$/, "");
145
+ t.includes(s) && (a = n.find((m) => m.id === s));
146
+ }
147
+ if (a)
148
+ switch (a.filterType) {
149
+ case g.CHECKBOX:
150
+ l && T.set(F, l.split(","));
151
+ break;
152
+ case g.DATE_RANGE:
153
+ let s;
154
+ if (l === "CUSTOM") {
155
+ s = new M("CUSTOM");
156
+ const _ = w.get(`${F}_gte`), U = w.get(`${F}_lte`);
157
+ _ && U && s.setDates(D(_), D(U));
158
+ } else V(l) ? s = new M(l) : s = new M(v.TODAY);
159
+ f.set(F, s);
160
+ break;
161
+ case g.NUMBER_RANGE:
162
+ const m = new S({
163
+ filterId: a.id
164
+ }), u = F.replace(/_[gl]te$/, ""), y = w.get(`${u}_gte`), A = w.get(`${u}_lte`);
165
+ y && m.setGte(Number(y)), A && m.setLte(Number(A)), b.set(u, m);
166
+ break;
167
+ case g.TEXT:
168
+ case g.NUMBER:
169
+ case g.RADIO:
170
+ c.set(F, l);
171
+ break;
172
+ }
173
+ }), this.filters = c, this.arrayFilters = T, this.dateRangeFilters = f, this.numberRangeFilters = b, this.updateUrl();
174
+ });
175
+ // In Filters class
176
+ o(this, "discardChanges", (r = !1) => {
177
+ const {
178
+ SEARCH_FILTER_ID: i
179
+ } = p.getBusinessLogic(), t = new Map(this.defaultFilters);
180
+ this.filters.has(i) && t.set(i, this.filters.get(i)), this.filters = t, this.arrayFilters = new Map(this.defaultArrayFilters), this.dateRangeFilters.clear(), this.defaultDateRangeFilters.forEach((e, n) => {
181
+ const c = new M(e.filterType);
182
+ c.setDates(e.gte, e.lte), this.dateRangeFilters.set(n, c);
183
+ }), this.numberRangeFilters.clear(), this.defaultNumberRangeFilters.forEach((e, n) => {
184
+ this.numberRangeFilters.set(n, e.clone());
185
+ }), this.updateUrl(r);
186
+ });
187
+ const {
188
+ GROUP_MAP: r
189
+ } = p.getBusinessLogic(), i = Array.from(r.values()).flatMap((t) => t.fields);
190
+ this.filters = new Map(i.filter((t) => t.filterType === g.TEXT || t.filterType === g.NUMBER || t.filterType === g.RADIO || t.filterType === g.DATE_RANGE).map((t) => [t.id, ""])), this.arrayFilters = new Map(i.filter((t) => t.filterType === g.CHECKBOX).map((t) => [t.id, []])), this.dateRangeFilters = new Map(i.filter((t) => t.filterType === g.DATE_RANGE).map((t) => [t.id, new M()])), this.numberRangeFilters = new Map(i.filter((t) => t.filterType === g.NUMBER_RANGE).map((t) => {
191
+ const e = new S({
192
+ filterId: t.id
193
+ });
194
+ return [t.id, e];
195
+ })), this.defaultArrayFilters = /* @__PURE__ */ new Map(), this.defaultFilters = /* @__PURE__ */ new Map(), this.defaultDateRangeFilters = /* @__PURE__ */ new Map(), this.defaultNumberRangeFilters = /* @__PURE__ */ new Map(), this.initDefaultFilterMaps(), this.isFiltersDropdownVisible = !1, this.activeViewId = void 0, C(this, {
196
+ defaultFilters: d,
197
+ defaultArrayFilters: d,
198
+ defaultDateRangeFilters: d,
199
+ defaultNumberRangeFilters: d,
200
+ filters: d,
201
+ arrayFilters: d,
202
+ numberRangeFilters: d,
203
+ dateRangeFilters: d,
204
+ isFiltersDropdownVisible: d,
205
+ activeViewId: d,
206
+ toggleFiltersDropdownVisible: h,
207
+ setActiveViewId: h,
208
+ setFilter: h,
209
+ setArrayFilter: h,
210
+ setRangeFilter: h,
211
+ setNumberRangeFilter: h,
212
+ clearFilter: h,
213
+ clearArrayFilter: h,
214
+ clearRangeFilter: h,
215
+ clearNumberRangeFilter: h,
216
+ clearAllFilters: h,
217
+ getFiltersForGroup: h,
218
+ clearFiltersForGroup: h,
219
+ initFromUrl: h,
220
+ initFiltersFromView: h,
221
+ initDefaultFilterMaps: h,
222
+ discardChanges: h,
223
+ updateUrl: h,
224
+ hasActiveFilters: E,
225
+ activeFilterKeysList: E,
226
+ queryParams: E,
227
+ hasUnsavedChanges: E
228
+ });
229
+ }
230
+ get hasActiveFilters() {
231
+ const {
232
+ GROUP_MAP: r
233
+ } = p.getBusinessLogic(), i = Array.from(r.values()).flatMap((e) => e.fields), t = new Set(i.map((e) => e.id));
234
+ return Array.from(this.filters.entries()).filter(([e]) => t.has(e)).some(([, e]) => e !== "") || Array.from(this.arrayFilters.entries()).filter(([e]) => t.has(e)).some(([, e]) => e.length > 0) || Array.from(this.dateRangeFilters.entries()).filter(([e]) => t.has(e)).some(([, e]) => e.filterType !== void 0) || Array.from(this.numberRangeFilters.entries()).filter(([e]) => t.has(e)).some(([, e]) => e.isActive);
235
+ }
236
+ get activeFilterKeysList() {
237
+ const {
238
+ DATE_RANGE_FILTERS: r,
239
+ NUMBER_RANGE_FILTERS: i
240
+ } = p.getBusinessLogic(), t = Array.from(this.filters.entries()).filter(([f, b]) => b !== "" && !r.includes(f) && !i.includes(f)).map(([f]) => f), e = Array.from(this.arrayFilters.entries()).filter(([, f]) => f.length > 0).map(([f]) => f), n = Array.from(this.dateRangeFilters.entries()).filter(([, f]) => f.filterType !== void 0).map(([f]) => f), c = Array.from(this.numberRangeFilters.entries()).filter(([, f]) => f.isActive).map(([f]) => f);
241
+ return [.../* @__PURE__ */ new Set([...t, ...e, ...n, ...c])];
242
+ }
243
+ get queryParams() {
244
+ const {
245
+ DATE_RANGE_FILTERS: r,
246
+ NUMBER_RANGE_FILTERS: i
247
+ } = p.getBusinessLogic(), t = new URLSearchParams();
248
+ return Array.from(this.filters.entries()).filter(([e, n]) => n !== "" && !r.includes(e) && !i.includes(e)).forEach(([e, n]) => {
249
+ t.append(e, n);
250
+ }), Array.from(this.arrayFilters.entries()).filter(([, e]) => e.length > 0).forEach(([e, n]) => {
251
+ t.append(e, n.join(","));
252
+ }), Array.from(this.dateRangeFilters.entries()).filter(([, e]) => e.filterType !== void 0).forEach(([e, n]) => {
253
+ t.set(e, n.filterType), n.filterType === "CUSTOM" && (t.set(`${e}_gte`, n.gte.toString()), t.set(`${e}_lte`, n.lte.toString()));
254
+ }), Array.from(this.numberRangeFilters.entries()).filter(([, e]) => e.isActive).forEach(([e, n]) => {
255
+ n.gte !== void 0 && t.set(`${e}_gte`, n.gte.toString()), n.isValidLte && t.set(`${e}_lte`, n.lte.toString());
256
+ }), this.activeViewId && t.set("view", this.activeViewId), t.toString();
257
+ }
258
+ get hasUnsavedChanges() {
259
+ if (this.activeViewId === G) return !1;
260
+ const {
261
+ GROUP_MAP: r,
262
+ SEARCH_FILTER_ID: i
263
+ } = p.getBusinessLogic(), t = Array.from(r.values()).flatMap((l) => l.fields), e = new Set(t.map((l) => l.id));
264
+ if (Array.from(this.filters.entries()).filter(([l]) => l !== i && e.has(l)).some(([l, a]) => {
265
+ const s = this.defaultFilters.get(l);
266
+ return s === void 0 && a !== "" || s !== void 0 && a !== s;
267
+ }))
268
+ return !0;
269
+ const c = Array.from(this.defaultArrayFilters.entries()).filter(([l]) => e.has(l)).some(([l, a]) => {
270
+ const s = this.defaultArrayFilters.get(l) || [];
271
+ return a.length > 0 || s.length > 0 ? a.length !== s.length || !N(a, s) : !1;
272
+ }), T = Array.from(this.arrayFilters.entries()).filter(([l]) => e.has(l)).some(([l, a]) => {
273
+ const s = this.defaultArrayFilters.get(l) || [];
274
+ return a.length > 0 || s.length > 0 ? a.length !== s.length || !N(a, s) : !1;
275
+ });
276
+ if (c || T)
277
+ return !0;
278
+ const f = Array.from(this.numberRangeFilters.entries()).filter(([l]) => e.has(l)).some(([l, a]) => {
279
+ const s = this.defaultNumberRangeFilters.get(l);
280
+ return !a.isEqual(s);
281
+ });
282
+ if (Array.from(this.defaultNumberRangeFilters.entries()).filter(([l]) => e.has(l)).some(([l, a]) => {
283
+ const s = this.numberRangeFilters.get(l);
284
+ return !a.isEqual(s);
285
+ }) || f)
286
+ return !0;
287
+ const w = Array.from(this.defaultDateRangeFilters.entries()).filter(([l]) => e.has(l)).some(([l, a]) => {
288
+ var m, u, y, A;
289
+ const s = this.dateRangeFilters.get(l);
290
+ return a != null && a.filterType && !(s != null && s.filterType) || s != null && s.filterType && !(a != null && a.filterType) || (s == null ? void 0 : s.filterType) !== (a == null ? void 0 : a.filterType) ? !0 : (s == null ? void 0 : s.filterType) === "CUSTOM" && (a == null ? void 0 : a.filterType) === "CUSTOM" ? ((m = a.gte) == null ? void 0 : m.toString()) !== ((u = s.gte) == null ? void 0 : u.toString()) || ((y = a.lte) == null ? void 0 : y.toString()) !== ((A = s.lte) == null ? void 0 : A.toString()) : !1;
291
+ });
292
+ return Array.from(this.dateRangeFilters.entries()).filter(([l]) => e.has(l)).some(([l, a]) => {
293
+ var m, u, y, A;
294
+ const s = this.defaultDateRangeFilters.get(l);
295
+ return a != null && a.filterType && !(s != null && s.filterType) || s != null && s.filterType && !(a != null && a.filterType) || (s == null ? void 0 : s.filterType) !== (a == null ? void 0 : a.filterType) ? !0 : (s == null ? void 0 : s.filterType) === "CUSTOM" && (a == null ? void 0 : a.filterType) === "CUSTOM" ? ((m = a.gte) == null ? void 0 : m.toString()) !== ((u = s.gte) == null ? void 0 : u.toString()) || ((y = a.lte) == null ? void 0 : y.toString()) !== ((A = s.lte) == null ? void 0 : A.toString()) : !1;
296
+ }) || w;
297
+ }
298
+ }
299
+ export {
300
+ W as Filters
301
+ };
@@ -0,0 +1 @@
1
+ "use strict";var c=Object.defineProperty;var M=(r,e,s)=>e in r?c(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s;var t=(r,e,s)=>M(r,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("mobx"),d=require("./index8.cjs");class n{constructor({filterId:e}){t(this,"filterId");t(this,"gteMinLabel");t(this,"gteMin");t(this,"lteMaxLabel");t(this,"lteMax");t(this,"gte");t(this,"lte");t(this,"setGte",e=>{this.gte=e});t(this,"setLte",e=>{this.lte=e});t(this,"clear",()=>{this.setGte(void 0),this.setLte(void 0)});t(this,"clone",()=>{const e=new n({filterId:this.filterId});return e.setGte(this.gte),e.setLte(this.lte),e});t(this,"isEqual",e=>!(!e||this.lte!==e.lte||this.gte!==e.gte));var h,o;i.makeObservable(this,{filterId:i.observable,filterLabel:i.computed,gte:i.observable,lte:i.observable,lteMax:i.observable,gteMin:i.observable,setGte:i.action,setLte:i.action,clear:i.action}),this.filterId=e;const{FIELDS_MAP:s}=d.BusinessLogicManager.getBusinessLogic(),l=s.get(this.filterId),u=(h=l==null?void 0:l.options)==null?void 0:h.every(a=>a.value&&Number.isInteger(Number(a.value)));if(l&&u&&((o=l.options)==null?void 0:o.length)===2){const[a,g]=l.options,b=Number(a.value),f=Number(g.value);this.gteMin=b,this.gteMinLabel=a.label,this.lteMax=f,this.lteMaxLabel=g.label}else this.gte=0,this.gteMin=0,this.gteMinLabel="Min.",this.lte=100,this.lteMax=100,this.lteMaxLabel="Max."}get isValidLte(){return!(this.lte===void 0||this.lte===this.lteMax)}get filterLabel(){return this.gte===void 0&&this.lte===void 0?"":this.isValidLte?`Between ${this.gte} and ${this.lte}`:this.gte!==void 0?`${this.gte} or more`:""}get isActive(){return this.gte===this.gteMin&&this.lte===this.lteMax||this.gte===this.lte||this.gte===void 0&&this.lte===void 0?!1:this.gte!==void 0?!0:this.lte!==void 0&&this.lte<this.lteMax}}exports.NumberRangeFilter=n;
@@ -0,0 +1,66 @@
1
+ var b = Object.defineProperty;
2
+ var v = (l, t, i) => t in l ? b(l, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : l[t] = i;
3
+ var e = (l, t, i) => v(l, typeof t != "symbol" ? t + "" : t, i);
4
+ import { makeObservable as L, action as n, observable as h, computed as c } from "mobx";
5
+ import { BusinessLogicManager as x } from "./index8.js";
6
+ class u {
7
+ constructor({
8
+ filterId: t
9
+ }) {
10
+ e(this, "filterId");
11
+ e(this, "gteMinLabel");
12
+ e(this, "gteMin");
13
+ e(this, "lteMaxLabel");
14
+ e(this, "lteMax");
15
+ e(this, "gte");
16
+ e(this, "lte");
17
+ e(this, "setGte", (t) => {
18
+ this.gte = t;
19
+ });
20
+ e(this, "setLte", (t) => {
21
+ this.lte = t;
22
+ });
23
+ e(this, "clear", () => {
24
+ this.setGte(void 0), this.setLte(void 0);
25
+ });
26
+ e(this, "clone", () => {
27
+ const t = new u({
28
+ filterId: this.filterId
29
+ });
30
+ return t.setGte(this.gte), t.setLte(this.lte), t;
31
+ });
32
+ e(this, "isEqual", (t) => !(!t || this.lte !== t.lte || this.gte !== t.gte));
33
+ var a, o;
34
+ L(this, {
35
+ filterId: h,
36
+ filterLabel: c,
37
+ gte: h,
38
+ lte: h,
39
+ lteMax: h,
40
+ gteMin: h,
41
+ setGte: n,
42
+ setLte: n,
43
+ clear: n
44
+ }), this.filterId = t;
45
+ const {
46
+ FIELDS_MAP: i
47
+ } = x.getBusinessLogic(), s = i.get(this.filterId), f = (a = s == null ? void 0 : s.options) == null ? void 0 : a.every((r) => r.value && Number.isInteger(Number(r.value)));
48
+ if (s && f && ((o = s.options) == null ? void 0 : o.length) === 2) {
49
+ const [r, g] = s.options, M = Number(r.value), d = Number(g.value);
50
+ this.gteMin = M, this.gteMinLabel = r.label, this.lteMax = d, this.lteMaxLabel = g.label;
51
+ } else
52
+ this.gte = 0, this.gteMin = 0, this.gteMinLabel = "Min.", this.lte = 100, this.lteMax = 100, this.lteMaxLabel = "Max.";
53
+ }
54
+ get isValidLte() {
55
+ return !(this.lte === void 0 || this.lte === this.lteMax);
56
+ }
57
+ get filterLabel() {
58
+ return this.gte === void 0 && this.lte === void 0 ? "" : this.isValidLte ? `Between ${this.gte} and ${this.lte}` : this.gte !== void 0 ? `${this.gte} or more` : "";
59
+ }
60
+ get isActive() {
61
+ return this.gte === this.gteMin && this.lte === this.lteMax || this.gte === this.lte || this.gte === void 0 && this.lte === void 0 ? !1 : this.gte !== void 0 ? !0 : this.lte !== void 0 && this.lte < this.lteMax;
62
+ }
63
+ }
64
+ export {
65
+ u as NumberRangeFilter
66
+ };
@@ -0,0 +1 @@
1
+ "use strict";var c=Object.defineProperty;var g=(r,e,t)=>e in r?c(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var i=(r,e,t)=>g(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("mobx"),a=require("@veeqo/ui"),l=require("./index43.cjs"),o=require("./index8.cjs");class u{constructor(e){i(this,"filterType");i(this,"gte");i(this,"lte");i(this,"setFilterType",e=>{if(e===this.filterType)return;const t=e||l.DateValue.TODAY;if(this.filterType=t,t!=="CUSTOM"){const n=a.getDateRange(t);n&&(this.gte=n.start,this.lte=n.end)}});i(this,"setDates",(e,t)=>{this.gte=e,this.lte=t});i(this,"clear",()=>{this.filterType=void 0;const{DEFAULT_DATE_RANGE:e}=o.BusinessLogicManager.getBusinessLogic();e&&this.setDates(e.start,e.end)});s.makeObservable(this,{filterType:s.observable,gte:s.observable,lte:s.observable,filterSelection:s.computed,filterLabel:s.computed,selectedRange:s.computed,setFilterType:s.action,setDates:s.action,clear:s.action});const t=e&&e!=="CUSTOM"?a.getDateRange(e):null,{DEFAULT_DATE_RANGE:n}=o.BusinessLogicManager.getBusinessLogic();this.filterType=e,this.gte=(t==null?void 0:t.start)??n.start,this.lte=(t==null?void 0:t.end)??n.end}get filterSelection(){const{DEFAULT_DATE_PRESET:e}=o.BusinessLogicManager.getBusinessLogic();return this.filterType?l.DateOptionMap.get(this.filterType)??e:e}get filterLabel(){return this.filterSelection.label}get selectedRange(){return{start:this.gte,end:this.lte}}}exports.RangeFilter=u;