@k-int/stripes-kint-components 5.31.3 → 5.32.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 (417) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/es/__mocks__/@folio/stripes/components.js +7 -3
  3. package/es/__mocks__/@folio/stripes/core.js +6 -4
  4. package/es/__mocks__/@folio/stripes/smart-components.js +6 -4
  5. package/es/__mocks__/react-query.js +6 -4
  6. package/es/__mocks__/react-router-dom.js +6 -6
  7. package/es/lib/ActionList/ActionList.js +33 -26
  8. package/es/lib/ActionList/ActionListFieldArray.js +119 -103
  9. package/es/lib/ButtonTypedown/ButtonTypedown.js +72 -17
  10. package/es/lib/ComboButton/ComboButton.js +47 -42
  11. package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +17 -11
  12. package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +46 -42
  13. package/es/lib/CustomProperties/Config/CustomPropertyForm.js +58 -58
  14. package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +8 -4
  15. package/es/lib/CustomProperties/Config/CustomPropertyView.js +33 -32
  16. package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +1 -1
  17. package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +1 -1
  18. package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +3 -3
  19. package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +35 -29
  20. package/es/lib/CustomProperties/Edit/CustomPropertyField.js +59 -61
  21. package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +20 -20
  22. package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +2 -2
  23. package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +1 -1
  24. package/es/lib/CustomProperties/Edit/testResources.js +12 -11
  25. package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +33 -22
  26. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +37 -24
  27. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +1 -1
  28. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +6 -6
  29. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +6 -3
  30. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +8 -4
  31. package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +19 -15
  32. package/es/lib/CustomProperties/Filter/testResources.js +2 -1
  33. package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +2 -1
  34. package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
  35. package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +26 -18
  36. package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +6 -3
  37. package/es/lib/CustomProperties/View/CustomPropertyCard.js +11 -7
  38. package/es/lib/CycleButton/CycleButton.js +17 -9
  39. package/es/lib/FormModal/FormModal.js +32 -24
  40. package/es/lib/FormattedKintMessage/FormattedKintMessage.js +30 -23
  41. package/es/lib/IconSelect/IconSelect.js +32 -22
  42. package/es/lib/NoResultsMessage/NoResultsMessage.js +5 -4
  43. package/es/lib/NumberField/NumberField.js +25 -17
  44. package/es/lib/NumberField/NumberField.test.js +7 -6
  45. package/es/lib/QueryTypedown/QueryTypedown.js +15 -8
  46. package/es/lib/RefdataButtons/RefdataButtons.js +9 -6
  47. package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +60 -48
  48. package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +6 -5
  49. package/es/lib/RichSelect/RichSelect.js +36 -31
  50. package/es/lib/RichSelect/useSelectedOption.js +2 -1
  51. package/es/lib/SASQLookupComponent/SASQLookupComponent.js +94 -91
  52. package/es/lib/SASQLookupComponent/SASQLookupComponent.test.js +532 -0
  53. package/es/lib/SASQLookupComponent/TableBody/TableBody.js +58 -43
  54. package/es/lib/SASQLookupComponent/TableBody/TableBody.test.js +257 -0
  55. package/es/lib/SASQLookupComponent/__mocks__/SASQLookupComponent.js +33 -0
  56. package/es/lib/SASQLookupComponent/__mocks__/SASQLookupComponentRender.js +24 -0
  57. package/es/lib/SASQLookupComponent/__mocks__/index.js +20 -0
  58. package/es/lib/SASQRoute/SASQRoute.js +29 -25
  59. package/es/lib/SASQRoute/SASQRoute.test.js +269 -0
  60. package/es/lib/SASQViewComponent/SASQViewComponent.js +76 -68
  61. package/es/lib/SASQViewComponent/SASQViewComponent.test.js +108 -0
  62. package/es/lib/SASQViewComponent/__mocks__/SASQViewComponent.js +19 -0
  63. package/es/lib/SASQViewComponent/__mocks__/SASQViewComponentRender.js +19 -0
  64. package/es/lib/SASQViewComponent/__mocks__/index.js +20 -0
  65. package/es/lib/SearchField/SearchField.js +13 -7
  66. package/es/lib/SearchKeyControl/SearchKeyControl.js +13 -8
  67. package/es/lib/SearchKeyControl/SearchKeyControl.test.js +6 -2
  68. package/es/lib/Settings/EditableRefdataCategoryList/EditableRefdataCategoryList.js +46 -30
  69. package/es/lib/Settings/EditableRefdataList/EditableRefdataList.js +43 -33
  70. package/es/lib/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +12 -8
  71. package/es/lib/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js +20 -13
  72. package/es/lib/Settings/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js +12 -10
  73. package/es/lib/Settings/EditableSettingsList/SettingField/SettingField.js +15 -10
  74. package/es/lib/Settings/EditableSettingsList/SettingField/SettingField.test.js +3 -3
  75. package/es/lib/Settings/RefdataCategoriesSettings/RefdataCategoriesSettings.js +26 -19
  76. package/es/lib/Settings/SettingPage/SettingPagePane/SettingPagePane.js +2 -2
  77. package/es/lib/Settings/Settings/Settings.js +158 -0
  78. package/es/lib/Settings/Settings/index.js +13 -0
  79. package/es/lib/Settings/SettingsFormContainer/SettingsFormContainer.js +35 -30
  80. package/es/lib/Settings/StaticSettingsField/StaticSettingsField.js +8 -5
  81. package/es/lib/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js +22 -18
  82. package/es/lib/Settings/hooks/staticSettingsPages/useSettingCallout/useSettingCallout.js +2 -2
  83. package/es/lib/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/useSettingsSectionInitalValues.js +1 -1
  84. package/es/lib/Settings/hooks/staticSettingsPages/useStaticSettingsSection.js +7 -3
  85. package/es/lib/Settings/hooks/useAppSettings/useAppSettings.js +11 -7
  86. package/es/lib/Settings/hooks/useSettingSection/useSettingSection.js +22 -16
  87. package/es/lib/Settings/hooks/useSettings/useSettings.js +69 -63
  88. package/es/lib/Tags/Tags.js +8 -5
  89. package/es/lib/Tags/hooks/useTags.js +1 -1
  90. package/es/lib/Tags/hooks/useTagsEnabled.js +3 -2
  91. package/es/lib/Tags/tagsConfig.js +1 -1
  92. package/es/lib/Typedown/Typedown.js +31 -21
  93. package/es/lib/hooks/__mocks__/index.js +7 -3
  94. package/es/lib/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js +26 -20
  95. package/es/lib/hooks/intlHooks/useKintIntl/useKintIntl.js +34 -24
  96. package/es/lib/hooks/typedownHooks/useTypedown.js +12 -11
  97. package/es/lib/hooks/typedownHooks/useTypedownToggle.js +2 -2
  98. package/es/lib/hooks/useActionListRef.js +1 -1
  99. package/es/lib/hooks/useActiveElement.js +1 -1
  100. package/es/lib/hooks/useCustomProperties.js +10 -6
  101. package/es/lib/hooks/useHelperApp.js +16 -13
  102. package/es/lib/hooks/useKiwtFieldArray.js +8 -7
  103. package/es/lib/hooks/useKiwtSASQuery.js +19 -15
  104. package/es/lib/hooks/useLocalPageStore.js +10 -7
  105. package/es/lib/hooks/useModConfigEntries.js +2 -2
  106. package/es/lib/hooks/useMutateCustomProperties/useMutateCustomProperties.js +17 -10
  107. package/es/lib/hooks/useMutateGeneric/useMutateGeneric.js +2 -2
  108. package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
  109. package/es/lib/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js +21 -15
  110. package/es/lib/hooks/useMutateRefdataValue/useMutateRefdataValue.js +23 -16
  111. package/es/lib/hooks/usePrevNextPagination.js +19 -17
  112. package/es/lib/hooks/useQIndex.js +14 -11
  113. package/es/lib/hooks/useRefdata.js +3 -3
  114. package/es/lib/hooks/useStandaloneSASQQueryParameter/useStandaloneSASQQueryParameter.js +13 -9
  115. package/es/lib/hooks/useTemplates.js +4 -4
  116. package/es/lib/utils/buildUrl.js +3 -2
  117. package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +5 -5
  118. package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +2 -2
  119. package/es/lib/utils/filterParsers/parseKiwtQueryGroups.js +5 -4
  120. package/es/lib/utils/filterParsers/parseKiwtQueryString.js +1 -1
  121. package/es/lib/utils/generateKiwtQueryParams/generateKiwtQueryParams.js +107 -94
  122. package/es/lib/utils/groupCustomPropertiesByCtx.js +9 -5
  123. package/es/lib/utils/matchString.js +7 -5
  124. package/es/lib/utils/parseErrorResponse.js +7 -3
  125. package/es/lib/utils/selectorSafe.js +3 -2
  126. package/es/lib/utils/sortByLabel.js +3 -2
  127. package/es/lib/validators/validators.js +9 -6
  128. package/package.json +5 -1
  129. package/src/artifacts/coverage-jest/ActionList/ActionList.js.html +4 -4
  130. package/src/artifacts/coverage-jest/ActionList/ActionListFieldArray.js.html +10 -10
  131. package/src/artifacts/coverage-jest/ActionList/index.html +1 -1
  132. package/src/artifacts/coverage-jest/ActionList/index.js.html +1 -1
  133. package/src/artifacts/coverage-jest/ButtonTypedown/ButtonTypedown.js.html +217 -25
  134. package/src/artifacts/coverage-jest/ButtonTypedown/index.html +17 -17
  135. package/src/artifacts/coverage-jest/ButtonTypedown/index.js.html +1 -1
  136. package/src/artifacts/coverage-jest/ComboButton/ComboButton.js.html +3 -3
  137. package/src/artifacts/coverage-jest/ComboButton/index.html +1 -1
  138. package/src/artifacts/coverage-jest/ComboButton/index.js.html +1 -1
  139. package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertiesLookup.js.html +3 -3
  140. package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertiesSettings.js.html +6 -6
  141. package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertyForm.js.html +3 -3
  142. package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertyView.js.html +3 -3
  143. package/src/artifacts/coverage-jest/CustomProperties/Config/index.html +1 -1
  144. package/src/artifacts/coverage-jest/CustomProperties/Config/index.js.html +1 -1
  145. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesEdit.js.html +3 -3
  146. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +3 -3
  147. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesListField.js.html +5 -5
  148. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertyField.js.html +3 -3
  149. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertyFormCard.js.html +3 -3
  150. package/src/artifacts/coverage-jest/CustomProperties/Edit/index.html +1 -1
  151. package/src/artifacts/coverage-jest/CustomProperties/Edit/index.js.html +1 -1
  152. package/src/artifacts/coverage-jest/CustomProperties/Edit/testResources.js.html +1 -1
  153. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilter.js.html +3 -3
  154. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterField.js.html +3 -3
  155. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +3 -3
  156. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +3 -3
  157. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesRule.js.html +4 -4
  158. package/src/artifacts/coverage-jest/CustomProperties/Filter/index.html +1 -1
  159. package/src/artifacts/coverage-jest/CustomProperties/Filter/index.js.html +1 -1
  160. package/src/artifacts/coverage-jest/CustomProperties/Filter/testResources.js.html +1 -1
  161. package/src/artifacts/coverage-jest/CustomProperties/Filter/useOperators.js.html +3 -3
  162. package/src/artifacts/coverage-jest/CustomProperties/Filter/useParseActiveFilterStrings.js.html +2 -2
  163. package/src/artifacts/coverage-jest/CustomProperties/Filter/useValueProps.js.html +3 -3
  164. package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertiesView.js.html +3 -3
  165. package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertiesViewCtx.js.html +3 -3
  166. package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertyCard.js.html +3 -3
  167. package/src/artifacts/coverage-jest/CustomProperties/View/index.html +1 -1
  168. package/src/artifacts/coverage-jest/CustomProperties/View/index.js.html +1 -1
  169. package/src/artifacts/coverage-jest/CustomProperties/View/testResources.js.html +1 -1
  170. package/src/artifacts/coverage-jest/CustomProperties/index.html +1 -1
  171. package/src/artifacts/coverage-jest/CustomProperties/index.js.html +1 -1
  172. package/src/artifacts/coverage-jest/CycleButton/CycleButton.js.html +3 -3
  173. package/src/artifacts/coverage-jest/CycleButton/index.html +1 -1
  174. package/src/artifacts/coverage-jest/CycleButton/index.js.html +1 -1
  175. package/src/artifacts/coverage-jest/FieldLabel/FieldLabel.js.html +2 -2
  176. package/src/artifacts/coverage-jest/FieldLabel/index.html +1 -1
  177. package/src/artifacts/coverage-jest/FieldLabel/index.js.html +1 -1
  178. package/src/artifacts/coverage-jest/FormModal/FormModal.js.html +3 -3
  179. package/src/artifacts/coverage-jest/FormModal/index.html +1 -1
  180. package/src/artifacts/coverage-jest/FormModal/index.js.html +1 -1
  181. package/src/artifacts/coverage-jest/FormattedKintMessage/FormattedKintMessage.js.html +3 -3
  182. package/src/artifacts/coverage-jest/FormattedKintMessage/index.html +1 -1
  183. package/src/artifacts/coverage-jest/FormattedKintMessage/index.js.html +1 -1
  184. package/src/artifacts/coverage-jest/IconSelect/IconSelect.js.html +3 -3
  185. package/src/artifacts/coverage-jest/IconSelect/index.html +1 -1
  186. package/src/artifacts/coverage-jest/IconSelect/index.js.html +1 -1
  187. package/src/artifacts/coverage-jest/NoResultsMessage/NoResultsMessage.js.html +3 -3
  188. package/src/artifacts/coverage-jest/NoResultsMessage/index.html +1 -1
  189. package/src/artifacts/coverage-jest/NoResultsMessage/index.js.html +1 -1
  190. package/src/artifacts/coverage-jest/NumberField/NumberField.js.html +3 -3
  191. package/src/artifacts/coverage-jest/NumberField/index.html +1 -1
  192. package/src/artifacts/coverage-jest/NumberField/index.js.html +1 -1
  193. package/src/artifacts/coverage-jest/QueryTypedown/QueryTypedown.js.html +3 -3
  194. package/src/artifacts/coverage-jest/QueryTypedown/index.html +1 -1
  195. package/src/artifacts/coverage-jest/QueryTypedown/index.js.html +1 -1
  196. package/src/artifacts/coverage-jest/RefdataButtons/RefdataButtons.js.html +3 -3
  197. package/src/artifacts/coverage-jest/RefdataButtons/index.html +1 -1
  198. package/src/artifacts/coverage-jest/RefdataButtons/index.js.html +1 -1
  199. package/src/artifacts/coverage-jest/ResponsiveButtonGroup/ResponsiveButtonGroup.js.html +6 -6
  200. package/src/artifacts/coverage-jest/ResponsiveButtonGroup/index.html +1 -1
  201. package/src/artifacts/coverage-jest/ResponsiveButtonGroup/index.js.html +1 -1
  202. package/src/artifacts/coverage-jest/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js.html +2 -2
  203. package/src/artifacts/coverage-jest/RichSelect/RichSelect.js.html +3 -3
  204. package/src/artifacts/coverage-jest/RichSelect/index.html +1 -1
  205. package/src/artifacts/coverage-jest/RichSelect/index.js.html +1 -1
  206. package/src/artifacts/coverage-jest/RichSelect/useSelectedOption.js.html +2 -2
  207. package/src/artifacts/coverage-jest/SASQLookupComponent/SASQLookupComponent.js.html +146 -149
  208. package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/TableBody.js.html +74 -65
  209. package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/index.html +21 -21
  210. package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/index.js.html +1 -1
  211. package/src/artifacts/coverage-jest/SASQLookupComponent/index.html +21 -21
  212. package/src/artifacts/coverage-jest/SASQLookupComponent/index.js.html +1 -1
  213. package/src/artifacts/coverage-jest/SASQRoute/SASQRoute.js.html +43 -43
  214. package/src/artifacts/coverage-jest/SASQRoute/index.html +21 -21
  215. package/src/artifacts/coverage-jest/SASQRoute/index.js.html +1 -1
  216. package/src/artifacts/coverage-jest/SASQViewComponent/SASQViewComponent.js.html +42 -42
  217. package/src/artifacts/coverage-jest/SASQViewComponent/index.html +21 -21
  218. package/src/artifacts/coverage-jest/SASQViewComponent/index.js.html +1 -1
  219. package/src/artifacts/coverage-jest/SearchField/SearchField.js.html +4 -4
  220. package/src/artifacts/coverage-jest/SearchField/index.html +1 -1
  221. package/src/artifacts/coverage-jest/SearchField/index.js.html +1 -1
  222. package/src/artifacts/coverage-jest/SearchKeyControl/SearchKeyControl.js.html +3 -3
  223. package/src/artifacts/coverage-jest/SearchKeyControl/index.html +1 -1
  224. package/src/artifacts/coverage-jest/SearchKeyControl/index.js.html +1 -1
  225. package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +4 -4
  226. package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/index.html +1 -1
  227. package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/index.js.html +1 -1
  228. package/src/artifacts/coverage-jest/Settings/EditableRefdataList/EditableRefdataList.js.html +4 -4
  229. package/src/artifacts/coverage-jest/Settings/EditableRefdataList/index.html +1 -1
  230. package/src/artifacts/coverage-jest/Settings/EditableRefdataList/index.js.html +1 -1
  231. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsList.js.html +3 -3
  232. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js.html +5 -5
  233. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/index.html +1 -1
  234. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/index.js.html +1 -1
  235. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js.html +3 -3
  236. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/index.html +1 -1
  237. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/index.js.html +1 -1
  238. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js.html +3 -3
  239. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/index.html +1 -1
  240. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/index.js.html +1 -1
  241. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/SettingField.js.html +3 -3
  242. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/index.html +1 -1
  243. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/index.js.html +1 -1
  244. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/index.html +1 -1
  245. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/index.js.html +1 -1
  246. package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/RefdataCategoriesSettings.js.html +4 -4
  247. package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/index.html +1 -1
  248. package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/index.js.html +1 -1
  249. package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPage.js.html +3 -3
  250. package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/SettingPagePane.js.html +3 -3
  251. package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/index.html +1 -1
  252. package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/index.js.html +1 -1
  253. package/src/artifacts/coverage-jest/Settings/SettingPage/index.html +1 -1
  254. package/src/artifacts/coverage-jest/Settings/SettingPage/index.js.html +1 -1
  255. package/src/artifacts/coverage-jest/Settings/Settings/Settings.js.html +643 -0
  256. package/src/artifacts/coverage-jest/Settings/Settings/index.html +131 -0
  257. package/src/artifacts/coverage-jest/Settings/Settings/index.js.html +88 -0
  258. package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/SettingsFormContainer.js.html +3 -3
  259. package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/index.html +1 -1
  260. package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/index.js.html +1 -1
  261. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsField.js.html +3 -3
  262. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js.html +2 -2
  263. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.html +1 -1
  264. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.js.html +1 -1
  265. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.html +1 -1
  266. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.js.html +1 -1
  267. package/src/artifacts/coverage-jest/Settings/constants/index.html +1 -1
  268. package/src/artifacts/coverage-jest/Settings/constants/index.js.html +1 -1
  269. package/src/artifacts/coverage-jest/Settings/constants/queryKeys.js.html +5 -5
  270. package/src/artifacts/coverage-jest/Settings/contexts/SettingsContext.js.html +2 -2
  271. package/src/artifacts/coverage-jest/Settings/contexts/index.html +1 -1
  272. package/src/artifacts/coverage-jest/Settings/contexts/index.js.html +1 -1
  273. package/src/artifacts/coverage-jest/Settings/hooks/index.html +1 -1
  274. package/src/artifacts/coverage-jest/Settings/hooks/index.js.html +1 -1
  275. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/index.html +1 -1
  276. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/index.js.html +1 -1
  277. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/index.html +1 -1
  278. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/index.js.html +1 -1
  279. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/useSettingCallout.js.html +2 -2
  280. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/index.html +1 -1
  281. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/index.js.html +1 -1
  282. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/useSettingsSectionInitalValues.js.html +2 -2
  283. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useStaticSettingsSection.js.html +2 -2
  284. package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/index.html +1 -1
  285. package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/index.js.html +1 -1
  286. package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/useAppSettings.js.html +2 -2
  287. package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/index.html +1 -1
  288. package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/index.js.html +1 -1
  289. package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/useSettingSection.js.html +2 -2
  290. package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.html +12 -12
  291. package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.js.html +1 -1
  292. package/src/artifacts/coverage-jest/Settings/hooks/useSettings/useSettings.js.html +33 -15
  293. package/src/artifacts/coverage-jest/Settings/index.html +1 -1
  294. package/src/artifacts/coverage-jest/Settings/index.js.html +1 -1
  295. package/src/artifacts/coverage-jest/Tags/Tags.js.html +3 -3
  296. package/src/artifacts/coverage-jest/Tags/hooks/index.html +1 -1
  297. package/src/artifacts/coverage-jest/Tags/hooks/index.js.html +1 -1
  298. package/src/artifacts/coverage-jest/Tags/hooks/useTags.js.html +2 -2
  299. package/src/artifacts/coverage-jest/Tags/hooks/useTagsEnabled.js.html +8 -8
  300. package/src/artifacts/coverage-jest/Tags/index.html +1 -1
  301. package/src/artifacts/coverage-jest/Tags/index.js.html +1 -1
  302. package/src/artifacts/coverage-jest/Tags/tagsConfig.js.html +5 -5
  303. package/src/artifacts/coverage-jest/Typedown/Typedown.js.html +15 -6
  304. package/src/artifacts/coverage-jest/Typedown/index.html +3 -3
  305. package/src/artifacts/coverage-jest/Typedown/index.js.html +1 -1
  306. package/src/artifacts/coverage-jest/cobertura-coverage.xml +1006 -839
  307. package/src/artifacts/coverage-jest/constants/comparators.js.html +1 -1
  308. package/src/artifacts/coverage-jest/constants/customProperties.js.html +12 -12
  309. package/src/artifacts/coverage-jest/constants/endpoints.js.html +4 -4
  310. package/src/artifacts/coverage-jest/constants/eventCodes.js.html +4 -4
  311. package/src/artifacts/coverage-jest/constants/index.html +1 -1
  312. package/src/artifacts/coverage-jest/constants/pagination.js.html +6 -6
  313. package/src/artifacts/coverage-jest/hooks/index.html +51 -51
  314. package/src/artifacts/coverage-jest/hooks/index.js.html +1 -1
  315. package/src/artifacts/coverage-jest/hooks/intlHooks/index.html +1 -1
  316. package/src/artifacts/coverage-jest/hooks/intlHooks/index.js.html +1 -1
  317. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/index.html +1 -1
  318. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/index.js.html +1 -1
  319. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/useIntlKey.js.html +8 -8
  320. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/index.html +1 -1
  321. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/index.js.html +1 -1
  322. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js.html +12 -12
  323. package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/index.html +1 -1
  324. package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/index.js.html +1 -1
  325. package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/useKintIntl.js.html +10 -10
  326. package/src/artifacts/coverage-jest/hooks/typedownHooks/index.html +1 -1
  327. package/src/artifacts/coverage-jest/hooks/typedownHooks/index.js.html +1 -1
  328. package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedown.js.html +2 -2
  329. package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedownData.js.html +2 -2
  330. package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedownToggle.js.html +2 -2
  331. package/src/artifacts/coverage-jest/hooks/useActionListRef.js.html +2 -2
  332. package/src/artifacts/coverage-jest/hooks/useActiveElement.js.html +2 -2
  333. package/src/artifacts/coverage-jest/hooks/useCustomProperties.js.html +3 -3
  334. package/src/artifacts/coverage-jest/hooks/useHelperApp.js.html +2 -2
  335. package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/index.html +1 -1
  336. package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/index.js.html +1 -1
  337. package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/useInvalidateRefdata.js.html +2 -2
  338. package/src/artifacts/coverage-jest/hooks/useKiwtFieldArray.js.html +2 -2
  339. package/src/artifacts/coverage-jest/hooks/useKiwtSASQuery.js.html +48 -48
  340. package/src/artifacts/coverage-jest/hooks/useLocalPageStore.js.html +3 -3
  341. package/src/artifacts/coverage-jest/hooks/useLocalStorageState.js.html +22 -22
  342. package/src/artifacts/coverage-jest/hooks/useModConfigEntries.js.html +3 -3
  343. package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/index.html +1 -1
  344. package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/index.js.html +1 -1
  345. package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/useMutateCustomProperties.js.html +2 -2
  346. package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.html +1 -1
  347. package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.js.html +5 -2
  348. package/src/artifacts/coverage-jest/hooks/useMutateGeneric/useMutateGeneric.js.html +2 -2
  349. package/src/artifacts/coverage-jest/hooks/useMutateModConfigEntry.js.html +2 -2
  350. package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/index.html +1 -1
  351. package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/index.js.html +1 -1
  352. package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js.html +2 -2
  353. package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/index.html +1 -1
  354. package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/index.js.html +1 -1
  355. package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/useMutateRefdataValue.js.html +2 -2
  356. package/src/artifacts/coverage-jest/hooks/usePrevNextPagination.js.html +68 -68
  357. package/src/artifacts/coverage-jest/hooks/useQIndex.js.html +28 -28
  358. package/src/artifacts/coverage-jest/hooks/useRefdata.js.html +3 -3
  359. package/src/artifacts/coverage-jest/hooks/useSASQQueryMeta.js.html +2 -2
  360. package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/index.html +1 -1
  361. package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/index.js.html +1 -1
  362. package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/useStandaloneSASQQueryParameter.js.html +2 -2
  363. package/src/artifacts/coverage-jest/hooks/useTemplates.js.html +2 -2
  364. package/src/artifacts/coverage-jest/index.html +115 -100
  365. package/src/artifacts/coverage-jest/utils/buildUrl.js.html +34 -34
  366. package/src/artifacts/coverage-jest/utils/filterParsers/deparseKiwtQueryFilters.js.html +3 -3
  367. package/src/artifacts/coverage-jest/utils/filterParsers/index.html +1 -1
  368. package/src/artifacts/coverage-jest/utils/filterParsers/index.js.html +1 -1
  369. package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryFilters.js.html +3 -3
  370. package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryGroups.js.html +2 -2
  371. package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryString.js.html +5 -5
  372. package/src/artifacts/coverage-jest/utils/generateKiwtQuery.js.html +7 -7
  373. package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/generateKiwtQueryParams.js.html +67 -67
  374. package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/index.html +21 -21
  375. package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/index.js.html +1 -1
  376. package/src/artifacts/coverage-jest/utils/groupCustomPropertiesByCtx.js.html +2 -2
  377. package/src/artifacts/coverage-jest/utils/highlightString.js.html +3 -3
  378. package/src/artifacts/coverage-jest/utils/index.html +22 -22
  379. package/src/artifacts/coverage-jest/utils/index.js.html +1 -1
  380. package/src/artifacts/coverage-jest/utils/matchString.js.html +2 -2
  381. package/src/artifacts/coverage-jest/utils/modConfigEntriesQueryKey.js.html +2 -2
  382. package/src/artifacts/coverage-jest/utils/parseErrorResponse.js.html +2 -2
  383. package/src/artifacts/coverage-jest/utils/parseModConfigEntry.js.html +2 -2
  384. package/src/artifacts/coverage-jest/utils/refdataOptions.js.html +1 -1
  385. package/src/artifacts/coverage-jest/utils/refdataQueryKey/index.html +1 -1
  386. package/src/artifacts/coverage-jest/utils/refdataQueryKey/index.js.html +1 -1
  387. package/src/artifacts/coverage-jest/utils/refdataQueryKey/refdataQueryKey.js.html +2 -2
  388. package/src/artifacts/coverage-jest/utils/selectorSafe.js.html +2 -2
  389. package/src/artifacts/coverage-jest/utils/sortByLabel.js.html +2 -2
  390. package/src/artifacts/coverage-jest/utils/toCamelCase.js.html +2 -2
  391. package/src/artifacts/coverage-jest/utils/typedownQueryKey.js.html +2 -2
  392. package/src/artifacts/coverage-jest/validators/index.html +1 -1
  393. package/src/artifacts/coverage-jest/validators/index.js.html +1 -1
  394. package/src/artifacts/coverage-jest/validators/validators.js.html +8 -8
  395. package/src/lib/ButtonTypedown/ButtonTypedown.js +77 -13
  396. package/src/lib/SASQLookupComponent/SASQLookupComponent.js +3 -4
  397. package/src/lib/SASQLookupComponent/SASQLookupComponent.test.js +495 -0
  398. package/src/lib/SASQLookupComponent/TableBody/TableBody.js +6 -3
  399. package/src/lib/SASQLookupComponent/TableBody/TableBody.test.js +247 -0
  400. package/src/lib/SASQLookupComponent/__mocks__/SASQLookupComponent.js +31 -0
  401. package/src/lib/SASQLookupComponent/__mocks__/SASQLookupComponentRender.js +20 -0
  402. package/src/lib/SASQLookupComponent/__mocks__/index.js +2 -0
  403. package/src/lib/SASQRoute/SASQRoute.test.js +281 -0
  404. package/src/lib/SASQViewComponent/SASQViewComponent.test.js +114 -0
  405. package/src/lib/SASQViewComponent/__mocks__/SASQViewComponent.js +13 -0
  406. package/src/lib/SASQViewComponent/__mocks__/SASQViewComponentRender.js +17 -0
  407. package/src/lib/SASQViewComponent/__mocks__/index.js +2 -0
  408. package/src/lib/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +1 -1
  409. package/src/lib/Settings/Settings/Settings.js +186 -0
  410. package/src/lib/Settings/Settings/index.js +1 -0
  411. package/src/lib/Settings/hooks/useSettings/useSettings.js +13 -7
  412. package/src/lib/Typedown/Typedown.js +4 -1
  413. package/src/lib/hooks/useMutateGeneric/index.js +1 -1
  414. package/styles/TypeDown.css +2 -2
  415. package/test/helpers/test-implementor-translations.json +2 -1
  416. package/test/helpers/translationsProperties.js +1 -1
  417. package/test/jest/setupTests.js +1 -1
@@ -0,0 +1,495 @@
1
+ import { createRef } from 'react';
2
+
3
+ import { MemoryRouter } from 'react-router-dom';
4
+
5
+ import { waitFor } from '@folio/jest-config-stripes/testing-library/react';
6
+
7
+ import { mockKy } from '@folio/stripes/core';
8
+ import { Button as MockStripesButton } from '@folio/stripes/components';
9
+ import {
10
+ Button,
11
+ SearchField,
12
+ Pane,
13
+ IconButton
14
+ } from '@folio/stripes-erm-testing';
15
+
16
+ import { useQuery } from 'react-query';
17
+ import { renderWithKintHarness } from '../../../test/jest';
18
+ import SASQLookupComponent from './SASQLookupComponent';
19
+ import translationsProperties from '../../../test/helpers';
20
+
21
+ jest.mock('react-query', () => {
22
+ const { mockReactQuery } = jest.requireActual('@folio/stripes-erm-testing');
23
+ return {
24
+ ...jest.requireActual('react-query'),
25
+ ...mockReactQuery,
26
+ useQuery: jest.fn((_key, func, opts) => {
27
+ const defaultData = {
28
+ results: [
29
+ { id: 1, someData: false, test: 'wibble' },
30
+ { id: 2, someData: true, test: 'wobble' }
31
+ ],
32
+ totalRecords: 2
33
+ };
34
+
35
+ // Mock ensures the function is called so we can test outcomes
36
+ if (opts.enabled) {
37
+ func();
38
+ }
39
+
40
+ if (opts.select) {
41
+ return ({
42
+ data: opts.select(defaultData),
43
+ extraProp: 'extraProp'
44
+ });
45
+ }
46
+
47
+ return ({
48
+ data: defaultData,
49
+ extraProp: 'extraProp'
50
+ });
51
+ }),
52
+ };
53
+ });
54
+
55
+ // TODO why does unmocking react-router-dom cause module hierarchy issues?
56
+ // EXAMPLE mocking react-router-dom
57
+ const mockHistoryPush = jest.fn();
58
+ const mockHistoryReplace = jest.fn();
59
+ jest.mock('react-router-dom', () => {
60
+ const { mockReactRouterDom } = jest.requireActual('@folio/stripes-erm-testing');
61
+ const actualReactRouterDom = jest.requireActual('react-router-dom');
62
+
63
+ return ({
64
+ ...actualReactRouterDom,
65
+ ...mockReactRouterDom,
66
+ useHistory: jest.fn(() => ({ push: mockHistoryPush, replace: mockHistoryReplace })),
67
+ useLocation: actualReactRouterDom.useLocation, // Bit ugly... idk why I need to put this back specifically like this instead of just unmocking react-router-dom
68
+ });
69
+ });
70
+
71
+ jest.mock('./TableBody', () => jest.fn(({ mclProps }) => (
72
+ <div>
73
+ <div>TableBody</div>
74
+ {/* This allows our interactors to find and click a pagination trigger */}
75
+ <MockStripesButton
76
+ onClick={() => mclProps.onNeedMoreData(null, 1)}
77
+ >
78
+ Next Page
79
+ </MockStripesButton>
80
+ </div>
81
+ )));
82
+
83
+ jest.mock('../SearchKeyControl', () => jest.fn(() => <div>SearchKeyControl</div>));
84
+
85
+ const fetchParameters = {
86
+ endpoint: '/wibble',
87
+ SASQ_MAP: {
88
+ searchKey: 'test.test1.test2,test3',
89
+ filterKeys: {
90
+ status: 'status.value',
91
+ wobble: 'wobble.value',
92
+ },
93
+ },
94
+ };
95
+
96
+ const baseSASQLookupProps = {
97
+ id: 'testing-sasq-lookup-component',
98
+ path: 'the-path', // Required as it's needed for children
99
+ fetchParameters
100
+ };
101
+
102
+ const baseSASQObj = { filters: '', qindex: undefined, query: '' };
103
+ const getBaseExpectedQueryNamespace = (obj = baseSASQLookupProps) => ([
104
+ '@folio/test-implementor',
105
+ 'SASQ',
106
+ 'testing-sasq-lookup-component',
107
+ 'viewAll',
108
+ obj,
109
+ 1
110
+ ]);
111
+
112
+ let renderComponent;
113
+ let theRef;
114
+ describe('SASQLookupComponent', () => {
115
+ describe.each([
116
+ {
117
+ testLabel: 'default behaviour',
118
+ props: baseSASQLookupProps,
119
+ expectQueryFire: false,
120
+ expectedMockKyCall: '/wibble?filters=status.value%3D%3DtestFilter&stats=true&page=1',
121
+ },
122
+ {
123
+ testLabel: 'with searchable indexes',
124
+ props: {
125
+ ...baseSASQLookupProps,
126
+ searchableIndexes: [{ key: 'name', label: 'Name' }]
127
+ },
128
+ expectQueryFire: false, // No actual query yet
129
+ expectedSearchKeyControl: true,
130
+ },
131
+ {
132
+ testLabel: 'starting with filters',
133
+ props: baseSASQLookupProps,
134
+ startingLocation: '/wibble?filters=status.testFilter',
135
+ expectedQueryNamespace: getBaseExpectedQueryNamespace({
136
+ filters: 'status.testFilter',
137
+ qindex: undefined,
138
+ query: ''
139
+ }),
140
+ expectedMockKyCall: '/wibble?filters=status.value%3D%3DtestFilter&stats=true&page=1',
141
+ expectedMockKyCallAfterSearch: '/wibble?match=test.test1.test2&match=test3&term=some%20test%20query&filters=status.value%3D%3DtestFilter&stats=true&page=1',
142
+ expectedRef: {
143
+ lookupQueryProps: {
144
+ data: {
145
+ results: [{ 'id': 1, 'someData': false, 'test': 'wibble' }, { 'id': 2, 'someData': true, 'test': 'wobble' }],
146
+ totalRecords: 2
147
+ },
148
+ 'extraProp': 'extraProp'
149
+ },
150
+ queryParams: '?filters=status.value%3D%3DtestFilter&stats=true&page=1'
151
+ }
152
+ },
153
+ {
154
+ testLabel: 'starting with qindex and no query',
155
+ props: baseSASQLookupProps,
156
+ startingLocation: '/wibble?qindex=test.test1.test2',
157
+ expectQueryFire: false,
158
+ expectedQueryNamespace: getBaseExpectedQueryNamespace({
159
+ filters: '',
160
+ qindex: 'test.test1.test2',
161
+ query: ''
162
+ }),
163
+ expectedMockKyCallAfterSearch: '/wibble?match=test.test1.test2&term=some%20test%20query&stats=true&page=1',
164
+ },
165
+ {
166
+ testLabel: 'starting with qindex and query',
167
+ props: {
168
+ ...baseSASQLookupProps,
169
+ sasqProps: {
170
+ initialSearchState: { query: 'hello', qindex: 'test.test1.test2' },
171
+ },
172
+ },
173
+ startingLocation: '/wibble?qindex=some.new.qindex.path&query=hello',
174
+ expectedQueryNamespace: getBaseExpectedQueryNamespace({
175
+ filters: '',
176
+ qindex: 'some.new.qindex.path',
177
+ query: 'hello'
178
+ }),
179
+ expectedMockKyCall: '/wibble?match=some.new.qindex.path&term=hello&stats=true&page=1',
180
+ expectedMockKyCallAfterSearch: '/wibble?match=some.new.qindex.path&term=some%20test%20query&stats=true&page=1',
181
+ expectedRef: {
182
+ lookupQueryProps: {
183
+ data: {
184
+ results: [{ 'id': 1, 'someData': false, 'test': 'wibble' }, { 'id': 2, 'someData': true, 'test': 'wobble' }],
185
+ totalRecords: 2
186
+ },
187
+ 'extraProp': 'extraProp'
188
+ },
189
+ queryParams: '?match=some.new.qindex.path&term=hello&stats=true&page=1'
190
+ }
191
+ },
192
+ {
193
+ testLabel: 'with FilterComponent',
194
+ props: {
195
+ ...baseSASQLookupProps,
196
+ FilterComponent: () => <div>FilterComponent</div>
197
+ },
198
+ expectQueryFire: false,
199
+ expectedMockKyCall: '/wibble?filters=status.value%3D%3DtestFilter&stats=true&page=1',
200
+ expectedFilterComponent: 'FilterComponent',
201
+ },
202
+ {
203
+ testLabel: 'with filter pane disabled',
204
+ props: {
205
+ ...baseSASQLookupProps,
206
+ hasFilterPane: false
207
+ },
208
+ expectQueryFire: false,
209
+ expectedSearchField :false,
210
+ expectedFilterPane: false,
211
+ },
212
+ {
213
+ testLabel: 'with FilterHeaderComponent',
214
+ props: {
215
+ ...baseSASQLookupProps,
216
+ FilterPaneHeaderComponent: () => <div>FilterPaneHeaderComponent</div>
217
+ },
218
+ expectQueryFire: false,
219
+ expectedMockKyCall: '/wibble?filters=status.value%3D%3DtestFilter&stats=true&page=1',
220
+ expectedFilterHeaderComponent: 'FilterPaneHeaderComponent',
221
+ },
222
+ {
223
+ testLabel: 'no search field mode',
224
+ props: {
225
+ ...baseSASQLookupProps,
226
+ noSearchField: true
227
+ },
228
+ expectQueryFire: false,
229
+ expectedSearchField: false,
230
+ },
231
+ {
232
+ testLabel: 'with RenderBody',
233
+ props: {
234
+ ...baseSASQLookupProps,
235
+ RenderBody: () => <div>TheBodyComponent</div>
236
+ },
237
+ expectQueryFire: false,
238
+ expectedMockKyCall: '/wibble?filters=status.value%3D%3DtestFilter&stats=true&page=1',
239
+ expectedBodyComponent: 'TheBodyComponent',
240
+ },
241
+ {
242
+ testLabel: 'with custom lookupQueryNamespaceGenerator',
243
+ props: {
244
+ ...baseSASQLookupProps,
245
+ lookupQueryNamespaceGenerator: ({
246
+ currentPage,
247
+ namespace,
248
+ id: passedId,
249
+ }) => [`testing-${currentPage}`, `testing-${namespace}`, `testing-${passedId}`],
250
+ },
251
+ expectedQueryNamespace: ['testing-1', 'testing-@folio/test-implementor', 'testing-testing-sasq-lookup-component'],
252
+ startingLocation: '/wibble?filters=status.testFilter',
253
+ expectedMockKyCall: '/wibble?filters=status.value%3D%3DtestFilter&stats=true&page=1',
254
+ expectedMockKyCallAfterSearch: '/wibble?match=test.test1.test2&match=test3&term=some%20test%20query&filters=status.value%3D%3DtestFilter&stats=true&page=1',
255
+ expectedRef: {
256
+ lookupQueryProps: {
257
+ data: {
258
+ results: [{ 'id': 1, 'someData': false, 'test': 'wibble' }, { 'id': 2, 'someData': true, 'test': 'wobble' }],
259
+ totalRecords: 2
260
+ },
261
+ 'extraProp': 'extraProp'
262
+ },
263
+ queryParams: '?filters=status.value%3D%3DtestFilter&stats=true&page=1'
264
+ }
265
+ },
266
+ {
267
+ testLabel: 'with lookupResponseTransform',
268
+ props: {
269
+ ...baseSASQLookupProps,
270
+ sasqProps: {
271
+ initialSearchState: { query: 'test', qindex: 'test.test1.test2' },
272
+ },
273
+ // Wrap results in an extra object to prove transform works
274
+ lookupResponseTransform: (resp) => ({ originalData: resp, transformed: true }),
275
+ },
276
+ startingLocation: '/wibble?query=test',
277
+ expectedQueryNamespace: getBaseExpectedQueryNamespace({
278
+ filters: '',
279
+ qindex: undefined,
280
+ query: 'test'
281
+ }),
282
+ expectedMockKyCall: '/wibble?match=test.test1.test2&match=test3&term=test&stats=true&page=1',
283
+ expectedRef: {
284
+ lookupQueryProps: {
285
+ data: {
286
+ originalData: {
287
+ results: [{ 'id': 1, 'someData': false, 'test': 'wibble' }, { 'id': 2, 'someData': true, 'test': 'wobble' }],
288
+ totalRecords: 2
289
+ },
290
+ transformed: true,
291
+ },
292
+ 'extraProp': 'extraProp'
293
+ },
294
+ queryParams: '?match=test.test1.test2&match=test3&term=test&stats=true&page=1'
295
+ },
296
+ expectedNumberOfResults: 0
297
+ },
298
+ ])('$testLabel', ({
299
+ props,
300
+ startingLocation = '/wibble',
301
+ expectQueryFire = true,
302
+ expectedQueryNamespace = getBaseExpectedQueryNamespace(baseSASQObj),
303
+ expectedMockKyCall = '/wibble?match=test.test1.test2&match=test3&term=some%20test%20query&stats=true&page=1',
304
+ expectedMockKyCallAfterSearch = '/wibble?match=test.test1.test2&match=test3&term=some%20test%20query&stats=true&page=1',
305
+ expectedFilterComponent,
306
+ expectedFilterHeaderComponent,
307
+ expectedFilterPane = true,
308
+ expectedBodyComponent,
309
+ expectedNumberOfResults = 2,
310
+ expectedSearchField = true,
311
+ expectedSearchKeyControl = false,
312
+ expectedRef,
313
+ }) => {
314
+ beforeEach(() => {
315
+ // CLEAR MOCKS
316
+ mockKy.mockClear();
317
+ useQuery.mockClear();
318
+
319
+ // CLEAR LOCAL STORAGE to ensure filter pane starts open
320
+ window.localStorage.clear();
321
+
322
+ // SET UP REF
323
+ theRef = createRef();
324
+ renderComponent = renderWithKintHarness(
325
+ <MemoryRouter initialEntries={[startingLocation]}>
326
+ <SASQLookupComponent ref={theRef} {...props}>
327
+ <div>CHILD COMPONENT</div>
328
+ </SASQLookupComponent>
329
+ </MemoryRouter>,
330
+ undefined,
331
+ translationsProperties
332
+ );
333
+ });
334
+
335
+ test('renders children', () => {
336
+ const { getByText } = renderComponent;
337
+ expect(getByText('CHILD COMPONENT')).toBeInTheDocument();
338
+ });
339
+
340
+ test('renders the main pane', async () => {
341
+ await Pane({ id: `${props.id}-main-pane` }).exists();
342
+ });
343
+
344
+ // This MUST happen before the Searching block as that will clear the mocks
345
+ describe('Initial lookup', () => {
346
+ // Called once without SASQ props, then once without page, then finally as expected, so call 2
347
+ test('useQuery namespace was as expected', () => {
348
+ expect(useQuery.mock.calls[3][0]).toEqual(expectedQueryNamespace);
349
+ });
350
+
351
+ if (expectQueryFire) {
352
+ test('mockKy was called with expected values', () => {
353
+ expect(mockKy).toHaveBeenCalledWith(expectedMockKyCall);
354
+ });
355
+
356
+ test('ref has gained lookup data', async () => {
357
+ await waitFor(() => {
358
+ expect(theRef.current).toEqual(expectedRef);
359
+ });
360
+ });
361
+ } else {
362
+ test('mockKy was not called', () => {
363
+ expect(mockKy).toHaveBeenCalledTimes(0);
364
+ });
365
+ }
366
+ });
367
+
368
+ describe('Searching', () => {
369
+ if (expectedSearchKeyControl) {
370
+ test('renders SearchKeyControl', () => {
371
+ const { getByText } = renderComponent;
372
+ expect(getByText('SearchKeyControl')).toBeInTheDocument();
373
+ });
374
+ }
375
+
376
+ if (!expectedSearchField) {
377
+ test('does not render SearchField', async () => {
378
+ await SearchField().absent();
379
+ });
380
+ } else {
381
+ test('renders SearchField', async () => {
382
+ await SearchField().exists();
383
+ });
384
+
385
+ test('mockKy has not yet been called with expected search', async () => {
386
+ await waitFor(() => {
387
+ expect(mockKy).not.toHaveBeenCalledWith(expectedMockKyCallAfterSearch);
388
+ });
389
+ });
390
+
391
+ describe('running a search', () => {
392
+ beforeEach(async () => {
393
+ mockKy.mockClear();
394
+ await waitFor(async () => {
395
+ await SearchField().fillIn('some test query');
396
+ await Button('Search').click();
397
+ });
398
+ });
399
+
400
+ test('mockKy behaves as expected after search', async () => {
401
+ await waitFor(() => {
402
+ expect(mockKy).toHaveBeenCalledWith(expectedMockKyCallAfterSearch);
403
+ });
404
+ });
405
+
406
+ describe('resetting search', () => {
407
+ beforeEach(async () => {
408
+ mockKy.mockClear();
409
+ await waitFor(async () => {
410
+ await Button('Reset all').click();
411
+ });
412
+ });
413
+
414
+ if (expectQueryFire) {
415
+ test('mockKy was called with expected values after reset', async () => {
416
+ await waitFor(() => {
417
+ expect(mockKy).toHaveBeenCalledWith(expectedMockKyCall);
418
+ });
419
+ });
420
+ } else {
421
+ test('mockKy was not called after reset', () => {
422
+ expect(mockKy).toHaveBeenCalledTimes(0);
423
+ });
424
+ }
425
+ });
426
+ });
427
+ }
428
+ });
429
+
430
+ // TESTING TOTAL RECORDS DISPLAY
431
+ test('displays the correct number of found values', async () => {
432
+ // SASQ uses paneSub for "found X values"
433
+ await Pane({ subtitle: `Found ${expectedNumberOfResults} values` }).exists();
434
+ });
435
+
436
+ if (expectedBodyComponent) {
437
+ test('renders the RenderBody', () => {
438
+ const { getByText } = renderComponent;
439
+ expect(getByText(expectedBodyComponent)).toBeInTheDocument();
440
+ });
441
+ } else {
442
+ test('renders the TableBody', () => {
443
+ const { getByText } = renderComponent;
444
+ expect(getByText('TableBody')).toBeInTheDocument();
445
+ });
446
+ }
447
+
448
+ if (expectedFilterPane) {
449
+ describe('Filter pane', () => {
450
+ test('renders the filter pane', async () => {
451
+ await Pane({ id: `${props.id}-filter-pane` }).exists();
452
+ });
453
+
454
+ test('collapse filter pane button exists', async () => {
455
+ await IconButton('caret-left').exists();
456
+ });
457
+
458
+ test('expand filter pane button does not exist', async () => {
459
+ await IconButton('caret-right').absent();
460
+ });
461
+
462
+ describe('toggling the filter pane', () => {
463
+ beforeEach(async () => {
464
+ // Find the collapse button in the filter pane
465
+ await waitFor(async () => {
466
+ await IconButton('caret-left').click();
467
+ });
468
+ });
469
+
470
+ test('expand button appears in main pane', async () => {
471
+ await IconButton('caret-right').exists();
472
+ });
473
+
474
+ test('filter pane is removed from DOM', async () => {
475
+ await Pane({ id: `${props.id}-filter-pane` }).absent();
476
+ });
477
+ });
478
+
479
+ if (expectedFilterComponent) {
480
+ test('FilterComponent renders', () => {
481
+ const { getByText } = renderComponent;
482
+ expect(getByText(expectedFilterComponent)).toBeInTheDocument();
483
+ });
484
+ }
485
+
486
+ if (expectedFilterHeaderComponent) {
487
+ test('FilterHeaderComponent renders', () => {
488
+ const { getByText } = renderComponent;
489
+ expect(getByText(expectedFilterHeaderComponent)).toBeInTheDocument();
490
+ });
491
+ }
492
+ });
493
+ }
494
+ });
495
+ });
@@ -51,7 +51,7 @@ const TableBody = ({
51
51
  const getRowUrl = useCallback((rowData) => {
52
52
  const baseUrl = `${path}/${getNavigationIdentifier(rowData)}`;
53
53
  return {
54
- url: `${baseUrl}${location?.search}`,
54
+ url: `${baseUrl}${location?.search ?? ''}`,
55
55
  path,
56
56
  baseUrl,
57
57
  location
@@ -61,9 +61,12 @@ const TableBody = ({
61
61
  const getEnhancedFormatter = useCallback(() => {
62
62
  const enhancedFormatter = {};
63
63
  for (const [key, value] of Object.entries(formatter)) {
64
- enhancedFormatter[key] = (item) => value({ ...item, defaultRowUrl: getRowUrl(item) });
64
+ if (typeof value === 'function') {
65
+ enhancedFormatter[key] = (item) => value({ ...item, defaultRowUrl: getRowUrl(item) });
66
+ } else {
67
+ enhancedFormatter[key] = value;
68
+ }
65
69
  }
66
-
67
70
  return enhancedFormatter;
68
71
  }, [formatter, getRowUrl]);
69
72