@k-int/stripes-kint-components 5.33.1 → 5.34.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 (295) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +2 -3
  3. package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +4 -3
  4. package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +2 -3
  5. package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +2 -3
  6. package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.test.js +15 -5
  7. package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +2 -3
  8. package/es/lib/hooks/index.js +17 -1
  9. package/es/lib/hooks/useCustProps.js +88 -0
  10. package/es/lib/hooks/useParallelBatchFetch.js +140 -0
  11. package/package.json +1 -1
  12. package/src/artifacts/coverage-jest/ActionList/ActionList.js.html +1 -1
  13. package/src/artifacts/coverage-jest/ActionList/ActionListFieldArray.js.html +1 -1
  14. package/src/artifacts/coverage-jest/ActionList/index.html +1 -1
  15. package/src/artifacts/coverage-jest/ActionList/index.js.html +1 -1
  16. package/src/artifacts/coverage-jest/ButtonTypedown/ButtonTypedown.js.html +1 -1
  17. package/src/artifacts/coverage-jest/ButtonTypedown/index.html +1 -1
  18. package/src/artifacts/coverage-jest/ButtonTypedown/index.js.html +1 -1
  19. package/src/artifacts/coverage-jest/ComboButton/ComboButton.js.html +1 -1
  20. package/src/artifacts/coverage-jest/ComboButton/index.html +1 -1
  21. package/src/artifacts/coverage-jest/ComboButton/index.js.html +1 -1
  22. package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertiesLookup.js.html +26 -29
  23. package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertiesSettings.js.html +8 -5
  24. package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertyForm.js.html +1 -1
  25. package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertyView.js.html +1 -1
  26. package/src/artifacts/coverage-jest/CustomProperties/Config/index.html +20 -20
  27. package/src/artifacts/coverage-jest/CustomProperties/Config/index.js.html +1 -1
  28. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesEdit.js.html +1 -1
  29. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +23 -26
  30. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesListField.js.html +1 -1
  31. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertyField.js.html +1 -1
  32. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertyFormCard.js.html +1 -1
  33. package/src/artifacts/coverage-jest/CustomProperties/Edit/index.html +20 -20
  34. package/src/artifacts/coverage-jest/CustomProperties/Edit/index.js.html +1 -1
  35. package/src/artifacts/coverage-jest/CustomProperties/Edit/testResources.js.html +1 -1
  36. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilter.js.html +27 -30
  37. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterField.js.html +1 -1
  38. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +1 -1
  39. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +1 -1
  40. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesRule.js.html +1 -1
  41. package/src/artifacts/coverage-jest/CustomProperties/Filter/index.html +15 -15
  42. package/src/artifacts/coverage-jest/CustomProperties/Filter/index.js.html +1 -1
  43. package/src/artifacts/coverage-jest/CustomProperties/Filter/testResources.js.html +1 -1
  44. package/src/artifacts/coverage-jest/CustomProperties/Filter/useOperators.js.html +12 -12
  45. package/src/artifacts/coverage-jest/CustomProperties/Filter/useParseActiveFilterStrings.js.html +14 -14
  46. package/src/artifacts/coverage-jest/CustomProperties/Filter/useValueProps.js.html +1 -1
  47. package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertiesView.js.html +1 -1
  48. package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertiesViewCtx.js.html +36 -39
  49. package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertyCard.js.html +1 -1
  50. package/src/artifacts/coverage-jest/CustomProperties/View/index.html +21 -21
  51. package/src/artifacts/coverage-jest/CustomProperties/View/index.js.html +1 -1
  52. package/src/artifacts/coverage-jest/CustomProperties/View/testResources.js.html +1 -1
  53. package/src/artifacts/coverage-jest/CustomProperties/index.html +1 -1
  54. package/src/artifacts/coverage-jest/CustomProperties/index.js.html +1 -1
  55. package/src/artifacts/coverage-jest/CycleButton/CycleButton.js.html +1 -1
  56. package/src/artifacts/coverage-jest/CycleButton/index.html +1 -1
  57. package/src/artifacts/coverage-jest/CycleButton/index.js.html +1 -1
  58. package/src/artifacts/coverage-jest/FieldLabel/FieldLabel.js.html +1 -1
  59. package/src/artifacts/coverage-jest/FieldLabel/index.html +1 -1
  60. package/src/artifacts/coverage-jest/FieldLabel/index.js.html +1 -1
  61. package/src/artifacts/coverage-jest/FormModal/FormModal.js.html +1 -1
  62. package/src/artifacts/coverage-jest/FormModal/index.html +1 -1
  63. package/src/artifacts/coverage-jest/FormModal/index.js.html +1 -1
  64. package/src/artifacts/coverage-jest/FormattedKintMessage/FormattedKintMessage.js.html +1 -1
  65. package/src/artifacts/coverage-jest/FormattedKintMessage/index.html +1 -1
  66. package/src/artifacts/coverage-jest/FormattedKintMessage/index.js.html +1 -1
  67. package/src/artifacts/coverage-jest/IconSelect/IconSelect.js.html +1 -1
  68. package/src/artifacts/coverage-jest/IconSelect/index.html +1 -1
  69. package/src/artifacts/coverage-jest/IconSelect/index.js.html +1 -1
  70. package/src/artifacts/coverage-jest/NoResultsMessage/NoResultsMessage.js.html +1 -1
  71. package/src/artifacts/coverage-jest/NoResultsMessage/index.html +1 -1
  72. package/src/artifacts/coverage-jest/NoResultsMessage/index.js.html +1 -1
  73. package/src/artifacts/coverage-jest/NumberField/NumberField.js.html +15 -15
  74. package/src/artifacts/coverage-jest/NumberField/index.html +1 -1
  75. package/src/artifacts/coverage-jest/NumberField/index.js.html +1 -1
  76. package/src/artifacts/coverage-jest/QueryTypedown/QueryTypedown.js.html +1 -1
  77. package/src/artifacts/coverage-jest/QueryTypedown/index.html +1 -1
  78. package/src/artifacts/coverage-jest/QueryTypedown/index.js.html +1 -1
  79. package/src/artifacts/coverage-jest/RefdataButtons/RefdataButtons.js.html +1 -1
  80. package/src/artifacts/coverage-jest/RefdataButtons/index.html +1 -1
  81. package/src/artifacts/coverage-jest/RefdataButtons/index.js.html +1 -1
  82. package/src/artifacts/coverage-jest/ResponsiveButtonGroup/ResponsiveButtonGroup.js.html +1 -1
  83. package/src/artifacts/coverage-jest/ResponsiveButtonGroup/index.html +1 -1
  84. package/src/artifacts/coverage-jest/ResponsiveButtonGroup/index.js.html +1 -1
  85. package/src/artifacts/coverage-jest/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js.html +1 -1
  86. package/src/artifacts/coverage-jest/RichSelect/RichSelect.js.html +1 -1
  87. package/src/artifacts/coverage-jest/RichSelect/index.html +1 -1
  88. package/src/artifacts/coverage-jest/RichSelect/index.js.html +1 -1
  89. package/src/artifacts/coverage-jest/RichSelect/useSelectedOption.js.html +1 -1
  90. package/src/artifacts/coverage-jest/SASQLookupComponent/SASQLookupComponent.js.html +31 -31
  91. package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/TableBody.js.html +1 -1
  92. package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/index.html +1 -1
  93. package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/index.js.html +1 -1
  94. package/src/artifacts/coverage-jest/SASQLookupComponent/index.html +1 -1
  95. package/src/artifacts/coverage-jest/SASQLookupComponent/index.js.html +1 -1
  96. package/src/artifacts/coverage-jest/SASQRoute/SASQRoute.js.html +1 -1
  97. package/src/artifacts/coverage-jest/SASQRoute/index.html +1 -1
  98. package/src/artifacts/coverage-jest/SASQRoute/index.js.html +1 -1
  99. package/src/artifacts/coverage-jest/SASQViewComponent/SASQViewComponent.js.html +1 -1
  100. package/src/artifacts/coverage-jest/SASQViewComponent/index.html +1 -1
  101. package/src/artifacts/coverage-jest/SASQViewComponent/index.js.html +1 -1
  102. package/src/artifacts/coverage-jest/SearchField/SearchField.js.html +1 -1
  103. package/src/artifacts/coverage-jest/SearchField/index.html +1 -1
  104. package/src/artifacts/coverage-jest/SearchField/index.js.html +1 -1
  105. package/src/artifacts/coverage-jest/SearchKeyControl/SearchKeyControl.js.html +1 -1
  106. package/src/artifacts/coverage-jest/SearchKeyControl/index.html +1 -1
  107. package/src/artifacts/coverage-jest/SearchKeyControl/index.js.html +1 -1
  108. package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +1 -1
  109. package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/index.html +1 -1
  110. package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/index.js.html +1 -1
  111. package/src/artifacts/coverage-jest/Settings/EditableRefdataList/EditableRefdataList.js.html +1 -1
  112. package/src/artifacts/coverage-jest/Settings/EditableRefdataList/index.html +1 -1
  113. package/src/artifacts/coverage-jest/Settings/EditableRefdataList/index.js.html +1 -1
  114. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsList.js.html +1 -1
  115. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js.html +1 -1
  116. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/index.html +1 -1
  117. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/index.js.html +1 -1
  118. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js.html +1 -1
  119. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/index.html +1 -1
  120. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/index.js.html +1 -1
  121. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js.html +1 -1
  122. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/index.html +1 -1
  123. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/index.js.html +1 -1
  124. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/SettingField.js.html +1 -1
  125. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/index.html +1 -1
  126. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/index.js.html +1 -1
  127. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/index.html +1 -1
  128. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/index.js.html +1 -1
  129. package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/RefdataCategoriesSettings.js.html +1 -1
  130. package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/index.html +1 -1
  131. package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/index.js.html +1 -1
  132. package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPage.js.html +1 -1
  133. package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/SettingPagePane.js.html +1 -1
  134. package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/index.html +1 -1
  135. package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/index.js.html +1 -1
  136. package/src/artifacts/coverage-jest/Settings/SettingPage/index.html +1 -1
  137. package/src/artifacts/coverage-jest/Settings/SettingPage/index.js.html +1 -1
  138. package/src/artifacts/coverage-jest/Settings/Settings/Settings.js.html +1 -1
  139. package/src/artifacts/coverage-jest/Settings/Settings/index.html +1 -1
  140. package/src/artifacts/coverage-jest/Settings/Settings/index.js.html +1 -1
  141. package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/SettingsFormContainer.js.html +1 -1
  142. package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/index.html +1 -1
  143. package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/index.js.html +1 -1
  144. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsField.js.html +1 -1
  145. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js.html +1 -1
  146. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.html +1 -1
  147. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.js.html +1 -1
  148. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.html +1 -1
  149. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.js.html +1 -1
  150. package/src/artifacts/coverage-jest/Settings/constants/index.html +1 -1
  151. package/src/artifacts/coverage-jest/Settings/constants/index.js.html +1 -1
  152. package/src/artifacts/coverage-jest/Settings/constants/queryKeys.js.html +1 -1
  153. package/src/artifacts/coverage-jest/Settings/contexts/SettingsContext.js.html +1 -1
  154. package/src/artifacts/coverage-jest/Settings/contexts/index.html +1 -1
  155. package/src/artifacts/coverage-jest/Settings/contexts/index.js.html +1 -1
  156. package/src/artifacts/coverage-jest/Settings/hooks/index.html +1 -1
  157. package/src/artifacts/coverage-jest/Settings/hooks/index.js.html +1 -1
  158. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/index.html +1 -1
  159. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/index.js.html +1 -1
  160. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/index.html +1 -1
  161. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/index.js.html +1 -1
  162. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/useSettingCallout.js.html +1 -1
  163. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/index.html +1 -1
  164. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/index.js.html +1 -1
  165. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/useSettingsSectionInitalValues.js.html +1 -1
  166. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useStaticSettingsSection.js.html +1 -1
  167. package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/index.html +1 -1
  168. package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/index.js.html +1 -1
  169. package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/useAppSettings.js.html +1 -1
  170. package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/index.html +1 -1
  171. package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/index.js.html +1 -1
  172. package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/useSettingSection.js.html +1 -1
  173. package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.html +1 -1
  174. package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.js.html +1 -1
  175. package/src/artifacts/coverage-jest/Settings/hooks/useSettings/useSettings.js.html +1 -1
  176. package/src/artifacts/coverage-jest/Settings/index.html +1 -1
  177. package/src/artifacts/coverage-jest/Settings/index.js.html +1 -1
  178. package/src/artifacts/coverage-jest/Tags/Tags.js.html +1 -1
  179. package/src/artifacts/coverage-jest/Tags/hooks/index.html +1 -1
  180. package/src/artifacts/coverage-jest/Tags/hooks/index.js.html +1 -1
  181. package/src/artifacts/coverage-jest/Tags/hooks/useTags.js.html +1 -1
  182. package/src/artifacts/coverage-jest/Tags/hooks/useTagsEnabled.js.html +1 -1
  183. package/src/artifacts/coverage-jest/Tags/index.html +1 -1
  184. package/src/artifacts/coverage-jest/Tags/index.js.html +1 -1
  185. package/src/artifacts/coverage-jest/Tags/tagsConfig.js.html +1 -1
  186. package/src/artifacts/coverage-jest/Typedown/Typedown.js.html +1 -1
  187. package/src/artifacts/coverage-jest/Typedown/index.html +1 -1
  188. package/src/artifacts/coverage-jest/Typedown/index.js.html +1 -1
  189. package/src/artifacts/coverage-jest/cobertura-coverage.xml +564 -394
  190. package/src/artifacts/coverage-jest/constants/comparators.js.html +1 -1
  191. package/src/artifacts/coverage-jest/constants/customProperties.js.html +1 -1
  192. package/src/artifacts/coverage-jest/constants/endpoints.js.html +1 -1
  193. package/src/artifacts/coverage-jest/constants/eventCodes.js.html +1 -1
  194. package/src/artifacts/coverage-jest/constants/index.html +1 -1
  195. package/src/artifacts/coverage-jest/constants/pagination.js.html +1 -1
  196. package/src/artifacts/coverage-jest/hooks/index.html +39 -9
  197. package/src/artifacts/coverage-jest/hooks/index.js.html +11 -2
  198. package/src/artifacts/coverage-jest/hooks/intlHooks/index.html +1 -1
  199. package/src/artifacts/coverage-jest/hooks/intlHooks/index.js.html +1 -1
  200. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/index.html +1 -1
  201. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/index.js.html +1 -1
  202. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/useIntlKey.js.html +7 -7
  203. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/index.html +1 -1
  204. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/index.js.html +1 -1
  205. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js.html +6 -6
  206. package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/index.html +1 -1
  207. package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/index.js.html +1 -1
  208. package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/useKintIntl.js.html +11 -11
  209. package/src/artifacts/coverage-jest/hooks/typedownHooks/index.html +1 -1
  210. package/src/artifacts/coverage-jest/hooks/typedownHooks/index.js.html +1 -1
  211. package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedown.js.html +1 -1
  212. package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedownData.js.html +1 -1
  213. package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedownToggle.js.html +1 -1
  214. package/src/artifacts/coverage-jest/hooks/useActionListRef.js.html +1 -1
  215. package/src/artifacts/coverage-jest/hooks/useActiveElement.js.html +1 -1
  216. package/src/artifacts/coverage-jest/hooks/useCustProps.js.html +376 -0
  217. package/src/artifacts/coverage-jest/hooks/useCustomProperties.js.html +1 -1
  218. package/src/artifacts/coverage-jest/hooks/useHelperApp.js.html +1 -1
  219. package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/index.html +1 -1
  220. package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/index.js.html +1 -1
  221. package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/useInvalidateRefdata.js.html +1 -1
  222. package/src/artifacts/coverage-jest/hooks/useKiwtFieldArray.js.html +1 -1
  223. package/src/artifacts/coverage-jest/hooks/useKiwtSASQuery.js.html +9 -9
  224. package/src/artifacts/coverage-jest/hooks/useLocalPageStore.js.html +1 -1
  225. package/src/artifacts/coverage-jest/hooks/useLocalStorageState.js.html +5 -5
  226. package/src/artifacts/coverage-jest/hooks/useModConfigEntries.js.html +1 -1
  227. package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/index.html +1 -1
  228. package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/index.js.html +1 -1
  229. package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/useMutateCustomProperties.js.html +1 -1
  230. package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.html +1 -1
  231. package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.js.html +1 -1
  232. package/src/artifacts/coverage-jest/hooks/useMutateGeneric/useMutateGeneric.js.html +1 -1
  233. package/src/artifacts/coverage-jest/hooks/useMutateModConfigEntry.js.html +1 -1
  234. package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/index.html +1 -1
  235. package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/index.js.html +1 -1
  236. package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js.html +1 -1
  237. package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/index.html +1 -1
  238. package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/index.js.html +1 -1
  239. package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/useMutateRefdataValue.js.html +1 -1
  240. package/src/artifacts/coverage-jest/hooks/useParallelBatchFetch.js.html +589 -0
  241. package/src/artifacts/coverage-jest/hooks/usePrevNextPagination.js.html +20 -20
  242. package/src/artifacts/coverage-jest/hooks/useQIndex.js.html +8 -8
  243. package/src/artifacts/coverage-jest/hooks/useRefdata.js.html +1 -1
  244. package/src/artifacts/coverage-jest/hooks/useSASQQueryMeta.js.html +1 -1
  245. package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/index.html +1 -1
  246. package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/index.js.html +1 -1
  247. package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/useStandaloneSASQQueryParameter.js.html +1 -1
  248. package/src/artifacts/coverage-jest/hooks/useTemplates.js.html +1 -1
  249. package/src/artifacts/coverage-jest/index.html +70 -70
  250. package/src/artifacts/coverage-jest/utils/buildUrl.js.html +1 -1
  251. package/src/artifacts/coverage-jest/utils/filterParsers/deparseKiwtQueryFilters.js.html +1 -1
  252. package/src/artifacts/coverage-jest/utils/filterParsers/index.html +1 -1
  253. package/src/artifacts/coverage-jest/utils/filterParsers/index.js.html +1 -1
  254. package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryFilters.js.html +1 -1
  255. package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryGroups.js.html +1 -1
  256. package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryString.js.html +1 -1
  257. package/src/artifacts/coverage-jest/utils/generateKiwtQuery.js.html +1 -1
  258. package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/generateKiwtQueryParams.js.html +71 -71
  259. package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/index.html +19 -19
  260. package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/index.js.html +1 -1
  261. package/src/artifacts/coverage-jest/utils/groupCustomPropertiesByCtx.js.html +1 -1
  262. package/src/artifacts/coverage-jest/utils/index.html +1 -1
  263. package/src/artifacts/coverage-jest/utils/index.js.html +1 -1
  264. package/src/artifacts/coverage-jest/utils/matchString/index.html +1 -1
  265. package/src/artifacts/coverage-jest/utils/matchString/index.js.html +1 -1
  266. package/src/artifacts/coverage-jest/utils/matchString/matchString.js.html +1 -1
  267. package/src/artifacts/coverage-jest/utils/modConfigEntriesQueryKey.js.html +1 -1
  268. package/src/artifacts/coverage-jest/utils/parseErrorResponse.js.html +1 -1
  269. package/src/artifacts/coverage-jest/utils/parseModConfigEntry.js.html +1 -1
  270. package/src/artifacts/coverage-jest/utils/refdataOptions.js.html +1 -1
  271. package/src/artifacts/coverage-jest/utils/refdataQueryKey/index.html +1 -1
  272. package/src/artifacts/coverage-jest/utils/refdataQueryKey/index.js.html +1 -1
  273. package/src/artifacts/coverage-jest/utils/refdataQueryKey/refdataQueryKey.js.html +1 -1
  274. package/src/artifacts/coverage-jest/utils/selectorSafe.js.html +1 -1
  275. package/src/artifacts/coverage-jest/utils/sortByLabel.js.html +1 -1
  276. package/src/artifacts/coverage-jest/utils/stringStyling/boldString.js.html +1 -1
  277. package/src/artifacts/coverage-jest/utils/stringStyling/highlightString.js.html +1 -1
  278. package/src/artifacts/coverage-jest/utils/stringStyling/index.html +1 -1
  279. package/src/artifacts/coverage-jest/utils/stringStyling/index.js.html +1 -1
  280. package/src/artifacts/coverage-jest/utils/toCamelCase.js.html +1 -1
  281. package/src/artifacts/coverage-jest/utils/typedownQueryKey.js.html +1 -1
  282. package/src/artifacts/coverage-jest/validators/index.html +1 -1
  283. package/src/artifacts/coverage-jest/validators/index.js.html +1 -1
  284. package/src/artifacts/coverage-jest/validators/validators.js.html +1 -1
  285. package/src/lib/CustomProperties/Config/CustomPropertiesLookup.js +2 -3
  286. package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +4 -3
  287. package/src/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +2 -3
  288. package/src/lib/CustomProperties/Filter/CustomPropertiesFilter.js +3 -4
  289. package/src/lib/CustomProperties/Filter/CustomPropertiesFilter.test.js +13 -3
  290. package/src/lib/CustomProperties/View/CustomPropertiesViewCtx.js +2 -3
  291. package/src/lib/hooks/README.md +101 -1
  292. package/src/lib/hooks/index.js +3 -0
  293. package/src/lib/hooks/useCustProps.js +97 -0
  294. package/src/lib/hooks/useParallelBatchFetch.js +168 -0
  295. package/styles/TypeDown.css +2 -2
@@ -355,7 +355,7 @@ export {
355
355
  <div class='footer quiet pad2 space-top1 center small'>
356
356
  Code coverage generated by
357
357
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
358
- at 2026-03-09T14:50:53.363Z
358
+ at 2026-03-18T13:14:53.894Z
359
359
  </div>
360
360
  <script src="../prettify.js"></script>
361
361
  <script>
@@ -5,7 +5,7 @@ import { Col, MultiColumnList, Row, Spinner, Select, Button } from '@folio/strip
5
5
 
6
6
  import { Form } from 'react-final-form';
7
7
  import SearchField from '../../SearchField';
8
- import { useCustomProperties, useKintIntl } from '../../hooks';
8
+ import { useCustProps, useKintIntl } from '../../hooks';
9
9
 
10
10
  import css from '../../../../styles/CustomProperties.css';
11
11
 
@@ -24,11 +24,10 @@ const CustomPropertiesLookup = ({
24
24
  });
25
25
  const [selectedContext, setSelectedContext] = useState();
26
26
 
27
- const { data: custprops, isLoading } = useCustomProperties({
27
+ const { custprops, isLoading } = useCustProps({
28
28
  endpoint,
29
29
  nsValues,
30
30
  queryParams,
31
- returnQueryObject: true,
32
31
  ctx: selectedContext,
33
32
  options: {
34
33
  sort: [
@@ -13,6 +13,7 @@ import CustomPropertiesLookup from './CustomPropertiesLookup';
13
13
  import CustomPropertyView from './CustomPropertyView';
14
14
  import CustomPropertiesForm from './CustomPropertyForm';
15
15
  import { useKintIntl, useMutateCustomProperties, useRefdata } from '../../hooks';
16
+ import { CUSTPROPS_QUERY_KEY_BASE } from '../../hooks/useCustProps';
16
17
  import { parseErrorResponse } from '../../utils';
17
18
 
18
19
  const EDITING = 'edit';
@@ -87,7 +88,7 @@ const CustomPropertiesSettings = ({
87
88
  afterQueryCalls: {
88
89
  put: res => {
89
90
  setMode(VIEWING);
90
- queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
91
+ queryClient.invalidateQueries(CUSTPROPS_QUERY_KEY_BASE);
91
92
  setCustomProperty(res);
92
93
  if (afterQueryCalls?.put) {
93
94
  afterQueryCalls.put(res);
@@ -95,7 +96,7 @@ const CustomPropertiesSettings = ({
95
96
  },
96
97
  post: res => {
97
98
  setMode(VIEWING);
98
- queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
99
+ queryClient.invalidateQueries(CUSTPROPS_QUERY_KEY_BASE);
99
100
  setCustomProperty(res);
100
101
  if (afterQueryCalls?.post) {
101
102
  afterQueryCalls.post(res);
@@ -103,7 +104,7 @@ const CustomPropertiesSettings = ({
103
104
  },
104
105
  delete: res => {
105
106
  setMode(VIEWING);
106
- queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
107
+ queryClient.invalidateQueries(CUSTPROPS_QUERY_KEY_BASE);
107
108
  setCustomProperty();
108
109
  if (afterQueryCalls?.delete) {
109
110
  afterQueryCalls.delete(res);
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
2
2
  import { Accordion } from '@folio/stripes/components';
3
3
 
4
4
  import CustomPropertiesListField from './CustomPropertiesListField';
5
- import { useCustomProperties, useKintIntl } from '../../hooks';
5
+ import { useCustProps, useKintIntl } from '../../hooks';
6
6
 
7
7
  const CustomPropertiesEditCtx = ({
8
8
  ctx,
@@ -41,10 +41,9 @@ const CustomPropertiesEditCtx = ({
41
41
  );
42
42
  };
43
43
 
44
- const { data: custprops, isLoading } = useCustomProperties({
44
+ const { custprops, isLoading } = useCustProps({
45
45
  ctx,
46
46
  endpoint: customPropertiesEndpoint,
47
- returnQueryObject: true,
48
47
  options: {
49
48
  filters: [{
50
49
  path: 'retired',
@@ -7,7 +7,7 @@ import {
7
7
  Layout,
8
8
  Spinner
9
9
  } from '@folio/stripes/components';
10
- import { useCustomProperties, useKintIntl } from '../../hooks';
10
+ import { useCustProps, useKintIntl } from '../../hooks';
11
11
  import useParseActiveFilterStrings from './useParseActiveFilterStrings';
12
12
  import CustomPropertiesFilterForm from './CustomPropertiesFilterForm';
13
13
  import { MULTI_REFDATA_CLASS_NAME, REFDATA_CLASS_NAME } from '../../constants/customProperties';
@@ -22,16 +22,15 @@ const CustomPropertiesFilter = ({
22
22
  intlKey: passedIntlKey,
23
23
  intlNS: passedIntlNS,
24
24
  labelOverrides = {}
25
- }) => {
25
+ }) => {
26
26
  const [editingFilters, setEditingFilters] = useState(false);
27
27
  const openEditModal = () => setEditingFilters(true);
28
28
  const closeEditModal = () => setEditingFilters(false);
29
29
 
30
30
  const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
31
31
 
32
- const { data: custprops, isLoading } = useCustomProperties({
32
+ const { custprops, isLoading } = useCustProps({
33
33
  endpoint: customPropertiesEndpoint,
34
- returnQueryObject: true,
35
34
  options: {
36
35
  sort: [
37
36
  { path: 'ctx' }, // Group by ctx
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
 
3
3
  import { MemoryRouter } from 'react-router-dom';
4
+
5
+ import { waitFor } from '@folio/jest-config-stripes/testing-library/react';
4
6
  import { Accordion, Button } from '@folio/stripes-erm-testing';
5
7
 
6
8
  import { activeFilters, filterHandlers } from './testResources';
@@ -40,8 +42,16 @@ describe('CustomPropertiesFilter', () => {
40
42
  await Button({ id: 'accordion-toggle-button-clickable-custprop-filter' }).exists();
41
43
  });
42
44
 
43
- it('renders CustomPropertiesFilterForm component ', () => {
44
- const { getByText } = renderComponent;
45
- expect(getByText('CustomPropertiesFilterForm')).toBeInTheDocument();
45
+ describe.each('Opening the Custom properties accordion', () => {
46
+ beforeEach(async () => {
47
+ await waitFor(async () => {
48
+ await Accordion({ id: 'clickable-custprop-filter' }).click();
49
+ });
50
+ });
51
+
52
+ it('renders CustomPropertiesFilterForm component ', () => {
53
+ const { getByText } = renderComponent;
54
+ expect(getByText('CustomPropertiesFilterForm')).toBeInTheDocument();
55
+ });
46
56
  });
47
57
  });
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import { Accordion, Badge, Spinner } from '@folio/stripes/components';
3
3
 
4
- import { useCustomProperties, useKintIntl } from '../../hooks';
4
+ import { useCustProps, useKintIntl } from '../../hooks';
5
5
 
6
6
  import CustomPropertyCard from './CustomPropertyCard';
7
7
 
@@ -42,10 +42,9 @@ const CustomPropertiesViewCtx = ({
42
42
  );
43
43
  };
44
44
 
45
- const { data: custprops, isLoading } = useCustomProperties({
45
+ const { custprops, isLoading } = useCustProps({
46
46
  ctx,
47
47
  endpoint: customPropertiesEndpoint,
48
- returnQueryObject: true,
49
48
  options: {
50
49
  sort: [
51
50
  { path: 'retired' }, // Place retired custprops at the end
@@ -7,7 +7,7 @@ A hook for fetching refdata values
7
7
  ```javascript
8
8
  import { useRefdata } from '@k-int/stripes-kint-components'
9
9
  ...
10
- const data = useRefdata({
10
+ const data = useRefdata({
11
11
  desc: 'PublicationRequest.PublicationType',
12
12
  endpoint: 'oa/refdata'
13
13
  });
@@ -253,3 +253,103 @@ updateObject({ id: 456, name: 'Updated Object' }) // Updates the object with id
253
253
  | queryKeyMutators | object | An object of the form `{ delete: func1, post: func2, put: func3 }` where `func1()`, `func2()`, and `func3()` are functions that return the query key for each mutation. | `{ delete: () => [...queryKey, 'delete'], post: () => [...queryKey, 'create'], put: () => [...queryKey, 'edit'] }` | ✕ |
254
254
  | queryParams | object | An object of the form `{ delete: obj1, post: obj2, put: obj3 }` where `obj1`, `obj2`, and `obj3` are the query parameters for each operation. | `{}` | ✕ |
255
255
  | returnQueryObject | object | An object of the form `{ delete: bool1, post: bool2, put: bool3 }` containing switches to return the entire query object from `useMutation` for each operation. If `false` (the default), the `mutateAsync` function will be returned; if `true`, the full object (including `mutate`, `isLoading`, `error`, etc.) will be returned. | `{ delete: false, post: false, put: false }` | ✕ |
256
+ ## useCustProps
257
+ A hook for fetching custom property definitions using batched parallel requests.
258
+
259
+ This hook replaces `useCustomProperties` as the preferred way of retrieving custom property definitions. It uses `useParallelBatchFetch` internally to ensure that all available custom properties are fetched even when the backend paginates responses.
260
+
261
+ ### Why this hook exists
262
+ The previous `useCustomProperties` hook relied on a single request with `max: 100`, which meant that only the first 100 custom properties could be retrieved. In environments with more definitions this led to incomplete data.
263
+
264
+ `useCustProps` resolves this by:
265
+ - using batched requests with controlled concurrency
266
+ - retrieving all available custom property definitions
267
+ - maintaining compatibility with existing query key patterns used across `stripes-kint-components`
268
+
269
+ ### Basic usage
270
+ ```javascript
271
+ const { custprops, isLoading } = useCustProps({
272
+ ctx,
273
+ endpoint: customPropertiesEndpoint,
274
+ });
275
+ ```
276
+ ### Props
277
+ | Name | Type | Description | Default | Required |
278
+ |--------------------|------------------|-----------------------------------------------------------------------------|-------------------|----------|
279
+ | endpoint | string | Backend endpoint used to retrieve custom property definitions | | ✓ |
280
+ | ctx | string \| string[]| Context or contexts used to filter custom properties | | ✕ |
281
+ | nsValues | object | Additional namespace query parameters passed to generateKiwtQueryParams | { sort: 'id' } | ✕ |
282
+ | options | object | Additional query configuration merged into the custom property query | {} | ✕ |
283
+ | queryParams | object | Options forwarded to the underlying react-query calls | {} | ✕ |
284
+ | batchLimit | number | Maximum number of records to fetch | Infinity | ✕ |
285
+ | batchSize | number | Number of records fetched per batch | 100 | ✕ |
286
+ | concurrentRequests | number | Number of concurrent requests made when fetching batches | 5 | ✕ |
287
+
288
+ ## useCustomProperties
289
+ Legacy hook for fetching custom property definitions.
290
+
291
+ This hook performs a single request using a `max` parameter (typically `100`) and therefore only retrieves the first page of results. In environments where more than 100 custom properties exist, this can lead to incomplete data.
292
+
293
+ ### Recommendation
294
+ Where possible it is recommended to migrate to:
295
+
296
+ - `useCustProps` for retrieving custom property definitions
297
+ - or one of the shared components such as:
298
+ - `CustomPropertiesLookup`
299
+ - `CustomPropertiesView`
300
+ - `CustomPropertiesSettings`
301
+
302
+ These components already use `useCustProps` internally and ensure consistent behaviour.
303
+
304
+ `useCustomProperties` remains available for backwards compatibility but may be deprecated in the future.
305
+
306
+ ### Basic usage
307
+ ```javascript
308
+ import { useCustomProperties } from '@k-int/stripes-kint-components';
309
+
310
+ const { data, isLoading } = useCustomProperties({
311
+ endpoint: '/erm/custom-properties',
312
+ returnQueryObject: true
313
+ });
314
+ ```
315
+ ### Props
316
+ | Name | Type | Description | Default | Required |
317
+ |-------------------|------------------|---------------------------------------------------------------------------|---------------|----------|
318
+ | endpoint | string | Backend endpoint used to retrieve custom property definitions | | ✓ |
319
+ | ctx | string \| string[]| Context or contexts used to filter custom properties | | ✕ |
320
+ | nsValues | object | Additional namespace query parameters passed to generateKiwtQuery | { sort: 'id'} | ✕ |
321
+ | options | object | Additional query configuration merged into the custom property query | {} | ✕ |
322
+ | queryParams | object | Options forwarded to the underlying react-query call | {} | ✕ |
323
+ | returnQueryObject | boolean | If true, the full react-query result object is returned instead of data | false | ✕ |
324
+ ## useParallelBatchFetch
325
+ A generic hook for performing batched parallel API requests.
326
+
327
+ This hook is designed to fetch paginated resources in multiple requests while limiting the number of concurrent requests. It was originally introduced in `stripes-erm-components` and has been incorporated into `stripes-kint-components` to maintain consistency across libraries.
328
+
329
+ The hook performs the following steps:
330
+
331
+ 1. Fetches the first page of results to determine the total record count.
332
+ 2. Generates additional requests using offsets.
333
+ 3. Executes batches of requests in parallel with a configurable concurrency limit.
334
+ 4. Returns a flattened array of results.
335
+
336
+ ### Basic usage
337
+ ```javascript
338
+ import useParallelBatchFetch from '@k-int/stripes-kint-components/hooks/useParallelBatchFetch';
339
+
340
+ const { items, isLoading, total } = useParallelBatchFetch({
341
+ endpoint: '/erm/custom-properties'
342
+ });
343
+ ```
344
+ ### Props
345
+ | Name | Type | Description | Default | Required |
346
+ |---------------------|----------|---------------------------------------------------------------------|-----------------------------|----------|
347
+ | endpoint | string | Endpoint used for fetching resources | | ✓ |
348
+ | batchParams | object | Query configuration passed to generateKiwtQueryParams | {} | ✕ |
349
+ | nsValues | object | Additional namespace query parameters | {} | ✕ |
350
+ | BATCH_SIZE | number | Number of records fetched per request | 100 | ✕ |
351
+ | CONCURRENT_REQUESTS | number | Maximum number of parallel requests | 5 | ✕ |
352
+ | BATCH_LIMIT | number | Maximum number of records to fetch | Infinity | ✕ |
353
+ | generateQueryKey | function | Optional function used to generate custom react-query keys | | ✕ |
354
+ | queryOptions | object | Options passed to the underlying react-query calls | {} | ✕ |
355
+ | queryNamespace | string | Namespace used for the default query key | 'stripes-kint-components' | ✕ |
@@ -7,6 +7,7 @@ export { default as useLocalStorageState } from './useLocalStorageState';
7
7
  export { default as useQIndex } from './useQIndex';
8
8
  export { default as useKiwtFieldArray } from './useKiwtFieldArray';
9
9
  export { default as useCustomProperties } from './useCustomProperties';
10
+ export { default as useCustProps } from './useCustProps';
10
11
  export { default as useInvalidateRefdata } from './useInvalidateRefdata';
11
12
  export { default as useSASQQueryMeta } from './useSASQQueryMeta';
12
13
  export { default as useModConfigEntries } from './useModConfigEntries';
@@ -21,4 +22,6 @@ export { default as useMutateModConfigEntry } from './useMutateModConfigEntry';
21
22
  export { default as usePrevNextPagination } from './usePrevNextPagination';
22
23
  export { default as useStandaloneSASQQueryParameter } from './useStandaloneSASQQueryParameter';
23
24
 
25
+ export { default as useParallelBatchFetch } from './useParallelBatchFetch';
26
+
24
27
  export * from './intlHooks';
@@ -0,0 +1,97 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ import useParallelBatchFetch from './useParallelBatchFetch';
4
+
5
+ export const CUSTPROPS_QUERY_KEY_BASE = [
6
+ 'stripes-kint-components',
7
+ 'useCustProps',
8
+ 'custprops'
9
+ ];
10
+
11
+ const useCustProps = ({
12
+ endpoint,
13
+ ctx,
14
+ nsValues = {
15
+ sort: 'id'
16
+ },
17
+ options = {},
18
+ queryParams = {},
19
+ batchLimit = Infinity,
20
+ batchSize = 100,
21
+ concurrentRequests = 5,
22
+ }) => {
23
+ const custPropOptions = {
24
+ searchKey: 'label,name,description',
25
+ filterKeys: {
26
+ ContextKey: 'ctx'
27
+ },
28
+ sort: [
29
+ { path: 'weight' },
30
+ { path: 'label' }
31
+ ],
32
+ filters: [],
33
+ ...options
34
+ };
35
+
36
+ if (Array.isArray(ctx)) {
37
+ custPropOptions.filters.push({
38
+ values: ctx.map(c => (c === 'isNull' ? 'ctx isNull' : `ctx==${c}`))
39
+ });
40
+ } else if (ctx === 'isNull') {
41
+ custPropOptions.filters.push({
42
+ value: 'ctx isNull'
43
+ });
44
+ } else if (ctx) {
45
+ custPropOptions.filters.push({
46
+ path: 'ctx',
47
+ value: ctx
48
+ });
49
+ }
50
+
51
+ const {
52
+ items: custprops = [],
53
+ isLoading = true,
54
+ total = 0
55
+ } = useParallelBatchFetch({
56
+ endpoint,
57
+ BATCH_LIMIT: batchLimit,
58
+ BATCH_SIZE: batchSize,
59
+ CONCURRENT_REQUESTS: concurrentRequests,
60
+ batchParams: custPropOptions,
61
+ nsValues,
62
+ generateQueryKey: ({
63
+ endpoint: queryEndpoint,
64
+ offset,
65
+ paramsArray
66
+ }) => [
67
+ ...CUSTPROPS_QUERY_KEY_BASE,
68
+ ctx,
69
+ queryEndpoint,
70
+ offset,
71
+ paramsArray
72
+ ],
73
+ queryOptions: queryParams
74
+ });
75
+
76
+ return {
77
+ custprops,
78
+ isLoading,
79
+ total
80
+ };
81
+ };
82
+
83
+ useCustProps.propTypes = {
84
+ endpoint: PropTypes.string,
85
+ ctx: PropTypes.oneOfType([
86
+ PropTypes.string,
87
+ PropTypes.arrayOf(PropTypes.string)
88
+ ]),
89
+ nsValues: PropTypes.object,
90
+ options: PropTypes.object,
91
+ queryParams: PropTypes.object,
92
+ batchLimit: PropTypes.number,
93
+ batchSize: PropTypes.number,
94
+ concurrentRequests: PropTypes.number,
95
+ };
96
+
97
+ export default useCustProps;
@@ -0,0 +1,168 @@
1
+
2
+ import { useCallback, useEffect, useMemo, useState } from 'react';
3
+ import { useQueries, useQuery } from 'react-query';
4
+
5
+ import { chunk } from 'lodash';
6
+ import { useOkapiKy } from '@folio/stripes/core';
7
+ import { generateKiwtQueryParams } from '../utils';
8
+
9
+ // A hook to do the same thing as batch fetching > 100 resources, but parallelising it.
10
+
11
+ // Only defining defaults to ward of "magic number" sonarlint rule -.-
12
+ const CONCURRENT_REQUESTS_DEFAULT = 5;
13
+ const MAX_BATCH_SIZE = 100;
14
+ const DEFAULT_BATCH_LIMIT = Infinity;
15
+
16
+ // CONCURRENT_REQUESTS and BATCH_SIZE can be tweaked here, but implementor beware
17
+ // They are formatted as if constants to discourage this
18
+ const useParallelBatchFetch = ({
19
+ BATCH_LIMIT = DEFAULT_BATCH_LIMIT, // Number of resources to stop at, Infinity by default but can be set to a limit
20
+ batchParams = {}, // Params object of the shape accepted by generateKiwtQueryParams
21
+ nsValues = {},
22
+ BATCH_SIZE = MAX_BATCH_SIZE, // Number of resources to fetch per batch
23
+ CONCURRENT_REQUESTS = CONCURRENT_REQUESTS_DEFAULT, // Number of requests to make concurrently
24
+ endpoint, // endpoint to hit to fetch items
25
+ generateQueryKey, // Passed function to allow customised query keys
26
+ queryNamespace = 'stripes-kint-components',
27
+ queryOptions: passedQueryOptions = {}, // Options to pass to each query
28
+ }) => {
29
+ const ky = useOkapiKy();
30
+ const SAFE_BATCH_SIZE = Math.min(BATCH_SIZE, MAX_BATCH_SIZE);
31
+ const [isLoading, setIsLoading] = useState(true);
32
+
33
+ // Destructure passed query options to grab enabled
34
+ const { enabled: queryEnabled = true, ...queryOptions } = passedQueryOptions;
35
+
36
+ const paramsArray = useMemo(() => (
37
+ generateKiwtQueryParams(
38
+ {
39
+ ...batchParams,
40
+ perPage: SAFE_BATCH_SIZE,
41
+ stats: true
42
+ },
43
+ nsValues
44
+ )
45
+ ), [batchParams, nsValues, SAFE_BATCH_SIZE]);
46
+
47
+ const getDefaultNSArray = useCallback(
48
+ (offset) => [queryNamespace, endpoint, offset, paramsArray, 'useChunkedBatchedFetch'],
49
+ [queryNamespace, endpoint, paramsArray]
50
+ );
51
+ const namespaceArray = generateQueryKey ? generateQueryKey({
52
+ CONCURRENT_REQUESTS,
53
+ BATCH_LIMIT,
54
+ SAFE_BATCH_SIZE,
55
+ batchParams,
56
+ endpoint,
57
+ offset: 0,
58
+ paramsArray,
59
+ passedQueryOptions,
60
+ }) : getDefaultNSArray(0);
61
+
62
+
63
+ // Firstly fetch page 1 to get information about totals
64
+ const firstFetchResult = useQuery(
65
+ namespaceArray,
66
+ () => ky.get(`${endpoint}?${[...paramsArray, 'offset=0']?.join('&')}`).json(),
67
+ passedQueryOptions
68
+ );
69
+
70
+ const totalRecords = useMemo(() => firstFetchResult?.data?.total ?? 0, [firstFetchResult]);
71
+
72
+ // WAIT for initial fetch to conclude before setting up queryArray
73
+ // Set up query array, and only enable the first CONCURRENT_REQUESTS requests
74
+ const getQueryArray = useCallback(() => {
75
+ if (!firstFetchResult?.isFetched) {
76
+ return [];
77
+ }
78
+
79
+ const recordsToFetch = Math.min(totalRecords, BATCH_LIMIT);
80
+ // Have already fetched page 1
81
+
82
+ const queryArray = [];
83
+ // Offset will be i * SAFE_BATCH_SIZE
84
+ for (let offset = SAFE_BATCH_SIZE; offset < recordsToFetch; offset += SAFE_BATCH_SIZE) {
85
+ const queryKey = generateQueryKey ? generateQueryKey({
86
+ CONCURRENT_REQUESTS,
87
+ BATCH_LIMIT,
88
+ SAFE_BATCH_SIZE,
89
+ batchParams,
90
+ endpoint,
91
+ offset,
92
+ paramsArray,
93
+ passedQueryOptions,
94
+ }) : getDefaultNSArray(offset);
95
+
96
+ const paramString = [...paramsArray, `offset=${offset}`]?.join('&');
97
+ queryArray.push({
98
+ queryKey,
99
+ queryFn: () => ky.get(`${endpoint}?${paramString}`).json(),
100
+ // Only enable once the previous slice has all been fetched
101
+ enabled: queryEnabled && offset / SAFE_BATCH_SIZE < CONCURRENT_REQUESTS,
102
+ ...queryOptions
103
+ });
104
+ }
105
+ return queryArray;
106
+ }, [
107
+ BATCH_LIMIT,
108
+ batchParams,
109
+ CONCURRENT_REQUESTS,
110
+ endpoint,
111
+ firstFetchResult,
112
+ generateQueryKey,
113
+ getDefaultNSArray,
114
+ ky,
115
+ paramsArray,
116
+ passedQueryOptions,
117
+ queryEnabled,
118
+ queryOptions,
119
+ SAFE_BATCH_SIZE,
120
+ totalRecords
121
+ ]);
122
+
123
+ // Differentiate between chunked logic and the first return (Which includes the initial fetch)
124
+ const itemQueries = useQueries(getQueryArray());
125
+ const returnItemQueries = useMemo(() => [firstFetchResult, ...itemQueries], [firstFetchResult, itemQueries]);
126
+
127
+ // Once chunk has finished fetching, fetch next chunk
128
+ useEffect(() => {
129
+ const chunkedQuery = chunk(returnItemQueries, CONCURRENT_REQUESTS);
130
+ chunkedQuery.forEach((q, i) => {
131
+ // Check that all previous chunk are fetched,
132
+ // and that all of our current chunk are not fetched and not loading
133
+ if (
134
+ i !== 0 &&
135
+ chunkedQuery[i - 1]?.every(pq => pq.isFetched === true) &&
136
+ q.every(req => req.isFetched === false) &&
137
+ q.every(req => req.isLoading === false)
138
+ ) {
139
+ // Trigger fetch for each request in the chunk
140
+ q.forEach(req => {
141
+ req.refetch();
142
+ });
143
+ }
144
+ });
145
+ }, [CONCURRENT_REQUESTS, returnItemQueries]);
146
+
147
+ // Keep easy track of whether this hook is all loaded or not
148
+ // (This slightly flattens the "isLoading/isFetched" distinction, but it's an ease of use prop)
149
+ useEffect(() => {
150
+ const newLoading = ((returnItemQueries?.length ?? 0) < 1 || returnItemQueries?.some(uq => !uq.isFetched));
151
+
152
+ if (isLoading !== newLoading) {
153
+ setIsLoading(newLoading);
154
+ }
155
+ }, [isLoading, returnItemQueries]);
156
+
157
+ return {
158
+ itemQueries: returnItemQueries,
159
+ isLoading,
160
+ // Offer all fetched orderLines in flattened array once ready
161
+ items: isLoading ? [] : returnItemQueries?.reduce((acc, curr) => {
162
+ return [...acc, ...(curr?.data?.results ?? [])];
163
+ }, []),
164
+ total: totalRecords
165
+ };
166
+ };
167
+
168
+ export default useParallelBatchFetch;
@@ -20,8 +20,8 @@
20
20
  box-shadow: var(--shadow);
21
21
  border: 1px solid #ccc;
22
22
  margin-top: 0;
23
- max-width: max(var(--searchWidth), 300px);
24
- min-width: min(var(--searchWidth), 300px);
23
+ width: var(--searchWidth);
24
+ min-width: max(var(--searchWidth), 300px);
25
25
  pointer-events: all;
26
26
  z-index: 1000;
27
27
  }