@k-int/stripes-kint-components 5.34.1 → 5.36.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 (327) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/es/index.js +12 -0
  3. package/es/lib/Files/FileUploader/FileUploader.js +119 -0
  4. package/es/lib/Files/FileUploader/index.js +13 -0
  5. package/es/lib/Files/FileView/FileView.js +116 -0
  6. package/es/lib/Files/FileView/index.js +13 -0
  7. package/es/lib/Files/index.js +27 -0
  8. package/es/lib/Files/useFileHandlers.js +133 -0
  9. package/es/lib/NoResultsMessage/NoResultsMessage.js +28 -10
  10. package/es/lib/SASQLookupComponent/SASQLookupComponent.js +109 -60
  11. package/es/lib/SASQLookupComponent/SASQLookupComponent.test.js +11 -0
  12. package/es/lib/SASQLookupComponent/TableBody/TableBody.js +6 -0
  13. package/es/lib/hooks/index.js +8 -0
  14. package/es/lib/hooks/useMutateTemplates/index.js +13 -0
  15. package/es/lib/hooks/useMutateTemplates/useMutateTemplates.js +45 -0
  16. package/es/lib/utils/downloadBlob.js +42 -0
  17. package/es/lib/utils/index.js +9 -1
  18. package/package.json +2 -1
  19. package/src/artifacts/coverage-jest/ActionList/ActionList.js.html +1 -1
  20. package/src/artifacts/coverage-jest/ActionList/ActionListFieldArray.js.html +1 -1
  21. package/src/artifacts/coverage-jest/ActionList/index.html +1 -1
  22. package/src/artifacts/coverage-jest/ActionList/index.js.html +1 -1
  23. package/src/artifacts/coverage-jest/ButtonTypedown/ButtonTypedown.js.html +1 -1
  24. package/src/artifacts/coverage-jest/ButtonTypedown/index.html +1 -1
  25. package/src/artifacts/coverage-jest/ButtonTypedown/index.js.html +1 -1
  26. package/src/artifacts/coverage-jest/ComboButton/ComboButton.js.html +1 -1
  27. package/src/artifacts/coverage-jest/ComboButton/index.html +1 -1
  28. package/src/artifacts/coverage-jest/ComboButton/index.js.html +1 -1
  29. package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertiesLookup.js.html +1 -1
  30. package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertiesSettings.js.html +1 -1
  31. package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertyForm.js.html +1 -1
  32. package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertyView.js.html +1 -1
  33. package/src/artifacts/coverage-jest/CustomProperties/Config/index.html +1 -1
  34. package/src/artifacts/coverage-jest/CustomProperties/Config/index.js.html +1 -1
  35. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesEdit.js.html +1 -1
  36. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +1 -1
  37. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesListField.js.html +1 -1
  38. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertyField.js.html +1 -1
  39. package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertyFormCard.js.html +1 -1
  40. package/src/artifacts/coverage-jest/CustomProperties/Edit/index.html +1 -1
  41. package/src/artifacts/coverage-jest/CustomProperties/Edit/index.js.html +1 -1
  42. package/src/artifacts/coverage-jest/CustomProperties/Edit/testResources.js.html +1 -1
  43. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilter.js.html +1 -1
  44. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterField.js.html +1 -1
  45. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +1 -1
  46. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +1 -1
  47. package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesRule.js.html +1 -1
  48. package/src/artifacts/coverage-jest/CustomProperties/Filter/index.html +1 -1
  49. package/src/artifacts/coverage-jest/CustomProperties/Filter/index.js.html +1 -1
  50. package/src/artifacts/coverage-jest/CustomProperties/Filter/testResources.js.html +1 -1
  51. package/src/artifacts/coverage-jest/CustomProperties/Filter/useOperators.js.html +1 -1
  52. package/src/artifacts/coverage-jest/CustomProperties/Filter/useParseActiveFilterStrings.js.html +1 -1
  53. package/src/artifacts/coverage-jest/CustomProperties/Filter/useValueProps.js.html +1 -1
  54. package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertiesView.js.html +1 -1
  55. package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertiesViewCtx.js.html +1 -1
  56. package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertyCard.js.html +1 -1
  57. package/src/artifacts/coverage-jest/CustomProperties/View/index.html +1 -1
  58. package/src/artifacts/coverage-jest/CustomProperties/View/index.js.html +1 -1
  59. package/src/artifacts/coverage-jest/CustomProperties/View/testResources.js.html +1 -1
  60. package/src/artifacts/coverage-jest/CustomProperties/index.html +1 -1
  61. package/src/artifacts/coverage-jest/CustomProperties/index.js.html +1 -1
  62. package/src/artifacts/coverage-jest/CycleButton/CycleButton.js.html +1 -1
  63. package/src/artifacts/coverage-jest/CycleButton/index.html +1 -1
  64. package/src/artifacts/coverage-jest/CycleButton/index.js.html +1 -1
  65. package/src/artifacts/coverage-jest/FieldLabel/FieldLabel.js.html +1 -1
  66. package/src/artifacts/coverage-jest/FieldLabel/index.html +1 -1
  67. package/src/artifacts/coverage-jest/FieldLabel/index.js.html +1 -1
  68. package/src/artifacts/coverage-jest/Files/FileUploader/FileUploader.js.html +487 -0
  69. package/src/artifacts/coverage-jest/Files/FileUploader/index.html +131 -0
  70. package/src/artifacts/coverage-jest/Files/FileUploader/index.js.html +88 -0
  71. package/src/artifacts/coverage-jest/Files/FileView/FileView.js.html +430 -0
  72. package/src/artifacts/coverage-jest/Files/FileView/index.html +131 -0
  73. package/src/artifacts/coverage-jest/Files/FileView/index.js.html +88 -0
  74. package/src/artifacts/coverage-jest/Files/index.html +131 -0
  75. package/src/artifacts/coverage-jest/Files/index.js.html +94 -0
  76. package/src/artifacts/coverage-jest/Files/useFileHandlers.js.html +469 -0
  77. package/src/artifacts/coverage-jest/FormModal/FormModal.js.html +1 -1
  78. package/src/artifacts/coverage-jest/FormModal/index.html +1 -1
  79. package/src/artifacts/coverage-jest/FormModal/index.js.html +1 -1
  80. package/src/artifacts/coverage-jest/FormattedKintMessage/FormattedKintMessage.js.html +1 -1
  81. package/src/artifacts/coverage-jest/FormattedKintMessage/index.html +1 -1
  82. package/src/artifacts/coverage-jest/FormattedKintMessage/index.js.html +1 -1
  83. package/src/artifacts/coverage-jest/IconSelect/IconSelect.js.html +1 -1
  84. package/src/artifacts/coverage-jest/IconSelect/index.html +1 -1
  85. package/src/artifacts/coverage-jest/IconSelect/index.js.html +1 -1
  86. package/src/artifacts/coverage-jest/NoResultsMessage/NoResultsMessage.js.html +70 -13
  87. package/src/artifacts/coverage-jest/NoResultsMessage/index.html +3 -3
  88. package/src/artifacts/coverage-jest/NoResultsMessage/index.js.html +1 -1
  89. package/src/artifacts/coverage-jest/NumberField/NumberField.js.html +1 -1
  90. package/src/artifacts/coverage-jest/NumberField/index.html +1 -1
  91. package/src/artifacts/coverage-jest/NumberField/index.js.html +1 -1
  92. package/src/artifacts/coverage-jest/QueryTypedown/QueryTypedown.js.html +1 -1
  93. package/src/artifacts/coverage-jest/QueryTypedown/index.html +1 -1
  94. package/src/artifacts/coverage-jest/QueryTypedown/index.js.html +1 -1
  95. package/src/artifacts/coverage-jest/RefdataButtons/RefdataButtons.js.html +1 -1
  96. package/src/artifacts/coverage-jest/RefdataButtons/index.html +1 -1
  97. package/src/artifacts/coverage-jest/RefdataButtons/index.js.html +1 -1
  98. package/src/artifacts/coverage-jest/ResponsiveButtonGroup/ResponsiveButtonGroup.js.html +1 -1
  99. package/src/artifacts/coverage-jest/ResponsiveButtonGroup/index.html +1 -1
  100. package/src/artifacts/coverage-jest/ResponsiveButtonGroup/index.js.html +1 -1
  101. package/src/artifacts/coverage-jest/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js.html +1 -1
  102. package/src/artifacts/coverage-jest/RichSelect/RichSelect.js.html +1 -1
  103. package/src/artifacts/coverage-jest/RichSelect/index.html +1 -1
  104. package/src/artifacts/coverage-jest/RichSelect/index.js.html +1 -1
  105. package/src/artifacts/coverage-jest/RichSelect/useSelectedOption.js.html +1 -1
  106. package/src/artifacts/coverage-jest/SASQLookupComponent/SASQLookupComponent.js.html +298 -136
  107. package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/TableBody.js.html +12 -3
  108. package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/index.html +1 -1
  109. package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/index.js.html +1 -1
  110. package/src/artifacts/coverage-jest/SASQLookupComponent/index.html +16 -16
  111. package/src/artifacts/coverage-jest/SASQLookupComponent/index.js.html +1 -1
  112. package/src/artifacts/coverage-jest/SASQRoute/SASQRoute.js.html +1 -1
  113. package/src/artifacts/coverage-jest/SASQRoute/index.html +1 -1
  114. package/src/artifacts/coverage-jest/SASQRoute/index.js.html +1 -1
  115. package/src/artifacts/coverage-jest/SASQViewComponent/SASQViewComponent.js.html +12 -12
  116. package/src/artifacts/coverage-jest/SASQViewComponent/index.html +15 -15
  117. package/src/artifacts/coverage-jest/SASQViewComponent/index.js.html +1 -1
  118. package/src/artifacts/coverage-jest/SearchField/SearchField.js.html +1 -1
  119. package/src/artifacts/coverage-jest/SearchField/index.html +1 -1
  120. package/src/artifacts/coverage-jest/SearchField/index.js.html +1 -1
  121. package/src/artifacts/coverage-jest/SearchKeyControl/SearchKeyControl.js.html +1 -1
  122. package/src/artifacts/coverage-jest/SearchKeyControl/index.html +1 -1
  123. package/src/artifacts/coverage-jest/SearchKeyControl/index.js.html +1 -1
  124. package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +1 -1
  125. package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/index.html +1 -1
  126. package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/index.js.html +1 -1
  127. package/src/artifacts/coverage-jest/Settings/EditableRefdataList/EditableRefdataList.js.html +1 -1
  128. package/src/artifacts/coverage-jest/Settings/EditableRefdataList/index.html +1 -1
  129. package/src/artifacts/coverage-jest/Settings/EditableRefdataList/index.js.html +1 -1
  130. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsList.js.html +1 -1
  131. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js.html +1 -1
  132. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/index.html +1 -1
  133. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/index.js.html +1 -1
  134. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js.html +1 -1
  135. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/index.html +1 -1
  136. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/index.js.html +1 -1
  137. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js.html +1 -1
  138. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/index.html +1 -1
  139. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/index.js.html +1 -1
  140. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/SettingField.js.html +1 -1
  141. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/index.html +1 -1
  142. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/index.js.html +1 -1
  143. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/index.html +1 -1
  144. package/src/artifacts/coverage-jest/Settings/EditableSettingsList/index.js.html +1 -1
  145. package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/RefdataCategoriesSettings.js.html +1 -1
  146. package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/index.html +1 -1
  147. package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/index.js.html +1 -1
  148. package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPage.js.html +1 -1
  149. package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/SettingPagePane.js.html +1 -1
  150. package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/index.html +1 -1
  151. package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/index.js.html +1 -1
  152. package/src/artifacts/coverage-jest/Settings/SettingPage/index.html +1 -1
  153. package/src/artifacts/coverage-jest/Settings/SettingPage/index.js.html +1 -1
  154. package/src/artifacts/coverage-jest/Settings/Settings/Settings.js.html +1 -1
  155. package/src/artifacts/coverage-jest/Settings/Settings/index.html +1 -1
  156. package/src/artifacts/coverage-jest/Settings/Settings/index.js.html +1 -1
  157. package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/SettingsFormContainer.js.html +1 -1
  158. package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/index.html +1 -1
  159. package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/index.js.html +1 -1
  160. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsField.js.html +1 -1
  161. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js.html +1 -1
  162. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.html +1 -1
  163. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.js.html +1 -1
  164. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.html +1 -1
  165. package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.js.html +1 -1
  166. package/src/artifacts/coverage-jest/Settings/constants/index.html +1 -1
  167. package/src/artifacts/coverage-jest/Settings/constants/index.js.html +1 -1
  168. package/src/artifacts/coverage-jest/Settings/constants/queryKeys.js.html +1 -1
  169. package/src/artifacts/coverage-jest/Settings/contexts/SettingsContext.js.html +1 -1
  170. package/src/artifacts/coverage-jest/Settings/contexts/index.html +1 -1
  171. package/src/artifacts/coverage-jest/Settings/contexts/index.js.html +1 -1
  172. package/src/artifacts/coverage-jest/Settings/hooks/index.html +1 -1
  173. package/src/artifacts/coverage-jest/Settings/hooks/index.js.html +1 -1
  174. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/index.html +1 -1
  175. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/index.js.html +1 -1
  176. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/index.html +1 -1
  177. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/index.js.html +1 -1
  178. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/useSettingCallout.js.html +1 -1
  179. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/index.html +1 -1
  180. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/index.js.html +1 -1
  181. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/useSettingsSectionInitalValues.js.html +1 -1
  182. package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useStaticSettingsSection.js.html +1 -1
  183. package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/index.html +1 -1
  184. package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/index.js.html +1 -1
  185. package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/useAppSettings.js.html +1 -1
  186. package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/index.html +1 -1
  187. package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/index.js.html +1 -1
  188. package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/useSettingSection.js.html +1 -1
  189. package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.html +1 -1
  190. package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.js.html +1 -1
  191. package/src/artifacts/coverage-jest/Settings/hooks/useSettings/useSettings.js.html +1 -1
  192. package/src/artifacts/coverage-jest/Settings/index.html +1 -1
  193. package/src/artifacts/coverage-jest/Settings/index.js.html +1 -1
  194. package/src/artifacts/coverage-jest/Tags/Tags.js.html +9 -9
  195. package/src/artifacts/coverage-jest/Tags/hooks/index.html +16 -16
  196. package/src/artifacts/coverage-jest/Tags/hooks/index.js.html +1 -1
  197. package/src/artifacts/coverage-jest/Tags/hooks/useTags.js.html +9 -9
  198. package/src/artifacts/coverage-jest/Tags/hooks/useTagsEnabled.js.html +1 -1
  199. package/src/artifacts/coverage-jest/Tags/index.html +15 -15
  200. package/src/artifacts/coverage-jest/Tags/index.js.html +1 -1
  201. package/src/artifacts/coverage-jest/Tags/tagsConfig.js.html +1 -1
  202. package/src/artifacts/coverage-jest/Typedown/Typedown.js.html +1 -1
  203. package/src/artifacts/coverage-jest/Typedown/index.html +1 -1
  204. package/src/artifacts/coverage-jest/Typedown/index.js.html +1 -1
  205. package/src/artifacts/coverage-jest/cobertura-coverage.xml +580 -314
  206. package/src/artifacts/coverage-jest/constants/comparators.js.html +1 -1
  207. package/src/artifacts/coverage-jest/constants/customProperties.js.html +1 -1
  208. package/src/artifacts/coverage-jest/constants/endpoints.js.html +1 -1
  209. package/src/artifacts/coverage-jest/constants/eventCodes.js.html +1 -1
  210. package/src/artifacts/coverage-jest/constants/index.html +1 -1
  211. package/src/artifacts/coverage-jest/constants/pagination.js.html +1 -1
  212. package/src/artifacts/coverage-jest/hooks/index.html +15 -15
  213. package/src/artifacts/coverage-jest/hooks/index.js.html +8 -2
  214. package/src/artifacts/coverage-jest/hooks/intlHooks/index.html +1 -1
  215. package/src/artifacts/coverage-jest/hooks/intlHooks/index.js.html +1 -1
  216. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/index.html +1 -1
  217. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/index.js.html +1 -1
  218. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/useIntlKey.js.html +7 -7
  219. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/index.html +1 -1
  220. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/index.js.html +1 -1
  221. package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js.html +11 -11
  222. package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/index.html +1 -1
  223. package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/index.js.html +1 -1
  224. package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/useKintIntl.js.html +9 -9
  225. package/src/artifacts/coverage-jest/hooks/typedownHooks/index.html +1 -1
  226. package/src/artifacts/coverage-jest/hooks/typedownHooks/index.js.html +1 -1
  227. package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedown.js.html +1 -1
  228. package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedownData.js.html +1 -1
  229. package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedownToggle.js.html +1 -1
  230. package/src/artifacts/coverage-jest/hooks/useActionListRef.js.html +1 -1
  231. package/src/artifacts/coverage-jest/hooks/useActiveElement.js.html +1 -1
  232. package/src/artifacts/coverage-jest/hooks/useCustProps.js.html +1 -1
  233. package/src/artifacts/coverage-jest/hooks/useCustomProperties.js.html +1 -1
  234. package/src/artifacts/coverage-jest/hooks/useHelperApp.js.html +1 -1
  235. package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/index.html +1 -1
  236. package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/index.js.html +1 -1
  237. package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/useInvalidateRefdata.js.html +1 -1
  238. package/src/artifacts/coverage-jest/hooks/useKiwtFieldArray.js.html +1 -1
  239. package/src/artifacts/coverage-jest/hooks/useKiwtSASQuery.js.html +16 -16
  240. package/src/artifacts/coverage-jest/hooks/useLocalPageStore.js.html +1 -1
  241. package/src/artifacts/coverage-jest/hooks/useLocalStorageState.js.html +5 -5
  242. package/src/artifacts/coverage-jest/hooks/useModConfigEntries.js.html +1 -1
  243. package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/index.html +1 -1
  244. package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/index.js.html +1 -1
  245. package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/useMutateCustomProperties.js.html +1 -1
  246. package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.html +1 -1
  247. package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.js.html +1 -1
  248. package/src/artifacts/coverage-jest/hooks/useMutateGeneric/useMutateGeneric.js.html +1 -1
  249. package/src/artifacts/coverage-jest/hooks/useMutateModConfigEntry.js.html +1 -1
  250. package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/index.html +1 -1
  251. package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/index.js.html +1 -1
  252. package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js.html +1 -1
  253. package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/index.html +1 -1
  254. package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/index.js.html +1 -1
  255. package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/useMutateRefdataValue.js.html +1 -1
  256. package/src/artifacts/coverage-jest/hooks/useMutateTemplates/index.html +131 -0
  257. package/src/artifacts/coverage-jest/hooks/useMutateTemplates/index.js.html +88 -0
  258. package/src/artifacts/coverage-jest/hooks/useMutateTemplates/useMutateTemplates.js.html +217 -0
  259. package/src/artifacts/coverage-jest/hooks/useParallelBatchFetch.js.html +9 -9
  260. package/src/artifacts/coverage-jest/hooks/usePrevNextPagination.js.html +37 -37
  261. package/src/artifacts/coverage-jest/hooks/useQIndex.js.html +9 -9
  262. package/src/artifacts/coverage-jest/hooks/useRefdata.js.html +1 -1
  263. package/src/artifacts/coverage-jest/hooks/useSASQQueryMeta.js.html +1 -1
  264. package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/index.html +1 -1
  265. package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/index.js.html +1 -1
  266. package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/useStandaloneSASQQueryParameter.js.html +1 -1
  267. package/src/artifacts/coverage-jest/hooks/useTemplates.js.html +1 -1
  268. package/src/artifacts/coverage-jest/index.html +120 -60
  269. package/src/artifacts/coverage-jest/utils/buildUrl.js.html +12 -12
  270. package/src/artifacts/coverage-jest/utils/downloadBlob.js.html +211 -0
  271. package/src/artifacts/coverage-jest/utils/filterParsers/deparseKiwtQueryFilters.js.html +1 -1
  272. package/src/artifacts/coverage-jest/utils/filterParsers/index.html +1 -1
  273. package/src/artifacts/coverage-jest/utils/filterParsers/index.js.html +1 -1
  274. package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryFilters.js.html +1 -1
  275. package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryGroups.js.html +1 -1
  276. package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryString.js.html +1 -1
  277. package/src/artifacts/coverage-jest/utils/generateKiwtQuery.js.html +3 -3
  278. package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/generateKiwtQueryParams.js.html +19 -19
  279. package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/index.html +1 -1
  280. package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/index.js.html +1 -1
  281. package/src/artifacts/coverage-jest/utils/groupCustomPropertiesByCtx.js.html +1 -1
  282. package/src/artifacts/coverage-jest/utils/index.html +24 -9
  283. package/src/artifacts/coverage-jest/utils/index.js.html +5 -2
  284. package/src/artifacts/coverage-jest/utils/matchString/index.html +1 -1
  285. package/src/artifacts/coverage-jest/utils/matchString/index.js.html +1 -1
  286. package/src/artifacts/coverage-jest/utils/matchString/matchString.js.html +1 -1
  287. package/src/artifacts/coverage-jest/utils/modConfigEntriesQueryKey.js.html +1 -1
  288. package/src/artifacts/coverage-jest/utils/parseErrorResponse.js.html +1 -1
  289. package/src/artifacts/coverage-jest/utils/parseModConfigEntry.js.html +1 -1
  290. package/src/artifacts/coverage-jest/utils/refdataOptions.js.html +1 -1
  291. package/src/artifacts/coverage-jest/utils/refdataQueryKey/index.html +1 -1
  292. package/src/artifacts/coverage-jest/utils/refdataQueryKey/index.js.html +1 -1
  293. package/src/artifacts/coverage-jest/utils/refdataQueryKey/refdataQueryKey.js.html +1 -1
  294. package/src/artifacts/coverage-jest/utils/selectorSafe.js.html +1 -1
  295. package/src/artifacts/coverage-jest/utils/sortByLabel.js.html +1 -1
  296. package/src/artifacts/coverage-jest/utils/stringStyling/boldString.js.html +1 -1
  297. package/src/artifacts/coverage-jest/utils/stringStyling/highlightString.js.html +1 -1
  298. package/src/artifacts/coverage-jest/utils/stringStyling/index.html +1 -1
  299. package/src/artifacts/coverage-jest/utils/stringStyling/index.js.html +1 -1
  300. package/src/artifacts/coverage-jest/utils/toCamelCase.js.html +1 -1
  301. package/src/artifacts/coverage-jest/utils/typedownQueryKey.js.html +1 -1
  302. package/src/artifacts/coverage-jest/validators/index.html +1 -1
  303. package/src/artifacts/coverage-jest/validators/index.js.html +1 -1
  304. package/src/artifacts/coverage-jest/validators/validators.js.html +1 -1
  305. package/src/index.js +2 -0
  306. package/src/lib/Files/FileUploader/FileUploader.js +134 -0
  307. package/src/lib/Files/FileUploader/index.js +1 -0
  308. package/src/lib/Files/FileView/FileView.js +115 -0
  309. package/src/lib/Files/FileView/index.js +1 -0
  310. package/src/lib/Files/index.js +3 -0
  311. package/src/lib/Files/useFileHandlers.js +128 -0
  312. package/src/lib/NoResultsMessage/NoResultsMessage.js +29 -10
  313. package/src/lib/NoResultsMessage/README.md +16 -13
  314. package/src/lib/SASQLookupComponent/README.md +12 -0
  315. package/src/lib/SASQLookupComponent/SASQLookupComponent.js +127 -73
  316. package/src/lib/SASQLookupComponent/SASQLookupComponent.test.js +13 -1
  317. package/src/lib/SASQLookupComponent/TableBody/TableBody.js +4 -1
  318. package/src/lib/SASQRoute/README.md +6 -1
  319. package/src/lib/hooks/index.js +2 -0
  320. package/src/lib/hooks/useMutateTemplates/index.js +1 -0
  321. package/src/lib/hooks/useMutateTemplates/useMutateTemplates.js +44 -0
  322. package/src/lib/utils/downloadBlob.js +42 -0
  323. package/src/lib/utils/index.js +1 -0
  324. package/styles/FileUploader.css +34 -0
  325. package/styles/FileView.css +8 -0
  326. package/styles/NoResultsMessage.css +1 -0
  327. package/styles/SASQLookupComponent.css +15 -0
@@ -0,0 +1,115 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ import { Col, Icon, IconButton, KeyValue, Row, Tooltip } from '@folio/stripes/components';
4
+
5
+ import { useKintIntl } from '../../hooks';
6
+
7
+ import css from '../../../../styles/FileView.css';
8
+
9
+ const FileView = ({
10
+ canDownload,
11
+ file,
12
+ onDownload,
13
+ intlKey: passedIntlKey,
14
+ intlNS: passedIntlNS,
15
+ labelOverrides = {},
16
+ onDelete,
17
+ }) => {
18
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
19
+
20
+ if (!file) return null;
21
+
22
+ return (
23
+ <div className={css.fileViewContainer}>
24
+ <Row>
25
+ <Col xs={6}>
26
+ <KeyValue
27
+ label={
28
+ kintIntl.formatKintMessage({
29
+ id: 'files.filename',
30
+ overrideValue: labelOverrides.filename,
31
+ })
32
+ }
33
+ >
34
+ {canDownload ?
35
+ /* eslint-disable-next-line jsx-a11y/anchor-is-valid */
36
+ <a
37
+ data-test-fileview-name
38
+ href="#"
39
+ onClick={(e) => {
40
+ onDownload(file);
41
+ e.preventDefault();
42
+ e.stopPropagation();
43
+ }}
44
+ rel="noopener noreferrer"
45
+ style={{ wordBreak: 'break-all' }}
46
+ target="_blank"
47
+ >
48
+ {file.name}
49
+ <Icon icon="external-link" />
50
+ </a> :
51
+ <div data-test-fileview-name>
52
+ {file.name}
53
+ </div>
54
+ }
55
+ </KeyValue>
56
+ </Col>
57
+ <Col xs={4}>
58
+ <KeyValue
59
+ label={
60
+ kintIntl.formatKintMessage({
61
+ id: 'files.uploaded',
62
+ overrideValue: labelOverrides.uploaded,
63
+ })
64
+ }
65
+ value={(
66
+ <span data-test-fileview-uploaded>
67
+ <div>{kintIntl.formatDate(file.modified)}</div>
68
+ <div>{kintIntl.formatTime(file.modified)}</div>
69
+ </span>
70
+ )}
71
+ />
72
+ </Col>
73
+ <Col xs={2}>
74
+ <Tooltip
75
+ id={`file-${file?.id}-delete-button`}
76
+ text={
77
+ kintIntl.formatKintMessage({
78
+ id: 'files.remove',
79
+ overrideValue: labelOverrides.remove,
80
+ })
81
+ }
82
+ >
83
+ {({ ariaIds, ref }) => (
84
+ <IconButton
85
+ ref={ref}
86
+ aria-labelledby={ariaIds.text}
87
+ data-test-fileview-delete
88
+ icon="trash"
89
+ onClick={e => {
90
+ e.stopPropagation();
91
+ onDelete(file);
92
+ }}
93
+ />
94
+ )}
95
+ </Tooltip>
96
+ </Col>
97
+ </Row>
98
+ </div>
99
+ );
100
+ };
101
+
102
+ FileView.propTypes = {
103
+ file: PropTypes.shape({
104
+ name: PropTypes.string,
105
+ }),
106
+ intlKey: PropTypes.string,
107
+ intlNS: PropTypes.string,
108
+ labelOverrides: PropTypes.shape({
109
+ filename: PropTypes.string,
110
+ remove: PropTypes.string,
111
+ uploaded: PropTypes.string,
112
+ })
113
+ };
114
+
115
+ export default FileView;
@@ -0,0 +1 @@
1
+ export { default } from './FileView';
@@ -0,0 +1,3 @@
1
+ export { default as FileView } from './FileView';
2
+ export { default as FileUploader } from './FileUploader';
3
+ export { default as useFileHandlers } from './useFileHandlers';
@@ -0,0 +1,128 @@
1
+ import { useCallback } from 'react';
2
+ import { useMutation, useQuery } from 'react-query';
3
+
4
+ import { useOkapiKy } from '@folio/stripes/core';
5
+ import { downloadBlob } from '../utils';
6
+
7
+ // This is copied and adapted from stripes-erm-components
8
+
9
+ const useFileHandlers = ({
10
+ // When fetchFile is true, will AUTOMATICALLY fetch not only
11
+ // fileMetadata but ALSO file itself
12
+ fetchFile = false,
13
+ /* fileEndpoint can be a string or
14
+ * {
15
+ * download: string | function,
16
+ * metadata: string | function
17
+ * upload: string | function,
18
+ * }
19
+ */
20
+ fileEndpoint,
21
+ fileField = 'upload',
22
+ fileMappings = {}, // A mapping from file -> formData field,
23
+ fileId // An OPTIONAL id for a file which results in fetching and returning file metadata
24
+ }) => {
25
+ const ky = useOkapiKy();
26
+
27
+ // A method which resolves the endpoint to hit based on fileEndpoint
28
+ const resolveEndpoint = useCallback((type, file) => {
29
+ if (typeof fileEndpoint === 'string') {
30
+ // We have a base endpoint, configure default behaviour
31
+ switch (type) {
32
+ case 'upload':
33
+ return fileEndpoint;
34
+ case 'download':
35
+ return `${fileEndpoint}/${file?.id}/raw`;
36
+ case 'metadata':
37
+ return `${fileEndpoint}/${file.id}`;
38
+ default:
39
+ throw new TypeError(`Unsupported endpoint type ${type}`);
40
+ }
41
+ }
42
+
43
+ if (typeof fileEndpoint !== 'object') {
44
+ throw new TypeError(`Unsupported fileEndpoint type ${typeof fileEndpoint}`);
45
+ }
46
+ const config = fileEndpoint[type];
47
+
48
+ if (config === null) {
49
+ throw new TypeError(`Unsupported fileEndpoint[${type}] is not configured`);
50
+ }
51
+
52
+ // Finally we have configured behaviour
53
+ switch (typeof config) {
54
+ case 'function':
55
+ return config(file);
56
+ case 'string':
57
+ return config;
58
+ default:
59
+ // If we have hit the end then we've done something wrong
60
+ throw new TypeError(`Unsupported configuration for fileEndpoint[${type}]: ${typeof config}`);
61
+ }
62
+ }, [fileEndpoint]);
63
+
64
+ const { mutateAsync: handleUploadFile } = useMutation(
65
+ [fileEndpoint, 'handleUpload'],
66
+ (file) => {
67
+ const formData = new FormData();
68
+ formData.append(fileField, file);
69
+
70
+ Object.entries(fileMappings).forEach(([key, value]) => {
71
+ if (typeof value === 'string') {
72
+ formData.append(key, value);
73
+ } else if (typeof value === 'function') {
74
+ formData.append(key, value(file));
75
+ } else {
76
+ throw new TypeError('Invalid fileMapping: ' + key);
77
+ }
78
+ });
79
+
80
+ return ky.post(resolveEndpoint('upload', file), { body: formData }).json();
81
+ }
82
+ );
83
+
84
+ const {
85
+ data: fileBlob,
86
+ isLoading: isFileLoading,
87
+ refetch: refetchFile
88
+ } = useQuery({
89
+ queryKey: [fileEndpoint, 'content', fileId],
90
+ queryFn: () => ky.get(resolveEndpoint('download', { id: fileId })).blob(),
91
+ enabled: !!fileId && typeof fileId === 'string' && fetchFile,
92
+ staleTime: Infinity, // Assume the file won't change underneath us.
93
+ });
94
+
95
+
96
+ // We are declaratively fetching a file via a function, useMutation is more convenient here
97
+ // NOTE even if fileBlob already exists this will refetch it for download
98
+ const { mutate: getFile, mutateAsync: getFileAsync } = useMutation(
99
+ [fileEndpoint, 'getFile'],
100
+ (file) => ky.get(resolveEndpoint('download', file)).blob()
101
+ );
102
+
103
+ const handleDownloadFile = useCallback((fileMetadata) => {
104
+ return getFileAsync(fileMetadata)
105
+ /* In this instance we want the file name back as it was handed in, whitespace and all */
106
+ .then(downloadBlob(fileMetadata.name, { processWhitespace: false }));
107
+ }, [getFileAsync]);
108
+
109
+ const { data: fileMetadata, isLoading: isFileMetadataLoading } = useQuery({
110
+ queryKey: [fileEndpoint, 'metadata', fileId],
111
+ queryFn: () => ky.get(resolveEndpoint('metadata', { id: fileId })).json(),
112
+ enabled: !!fileId && typeof fileId === 'string',
113
+ });
114
+
115
+ return {
116
+ file: fileBlob,
117
+ fileMetadata,
118
+ getFile,
119
+ getFileAsync,
120
+ handleDownloadFile,
121
+ handleUploadFile,
122
+ isFileLoading,
123
+ isFileMetadataLoading,
124
+ refetchFile
125
+ };
126
+ };
127
+
128
+ export default useFileHandlers;
@@ -2,17 +2,27 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { FormattedMessage } from 'react-intl';
4
4
  import { Button, Icon } from '@folio/stripes/components';
5
- import css from '../../../styles/NoResultsMessage.css';
6
5
  import { useKintIntl } from '../hooks';
7
6
 
7
+ import css from '../../../styles/NoResultsMessage.css';
8
+
8
9
  const NoResultsMessage = ({
10
+ className,
11
+ error,
12
+ filters,
13
+ filterPaneIsVisible,
9
14
  icon: userIcon,
15
+ iconPresets: {
16
+ noTerms: noTermsIcon,
17
+ noTermsWhenFilterPane: noTermsWhenFilterPaneIcon,
18
+ noResults: noResultsIcon,
19
+ isLoading: isLoadingIcon,
20
+ error: errorIcon,
21
+ } = {},
10
22
  intlKey: passedIntlKey,
11
23
  intlNS: passedIntlNS,
12
24
  isLoading,
13
25
  isError,
14
- error,
15
- filterPaneIsVisible,
16
26
  label: userLabel,
17
27
  labelOverrides = {},
18
28
  searchTerm,
@@ -23,28 +33,28 @@ const NoResultsMessage = ({
23
33
  let icon = 'search';
24
34
  let label = <FormattedMessage id="stripes-smart-components.sas.noResults.default" values={{ searchTerm }} />;
25
35
 
26
- if (!isLoading && !searchTerm) {
36
+ if (!isLoading && !searchTerm && !filters) {
27
37
  // No search term and not loading
28
- icon = filterPaneIsVisible ? 'arrow-left' : null;
38
+ icon = noTermsIcon ?? (filterPaneIsVisible ? (noTermsWhenFilterPaneIcon ?? 'arrow-left') : null);
29
39
  label = <FormattedMessage id="stripes-smart-components.sas.noResults.noTerms" />;
30
40
  } else if (!isLoading) {
31
41
  // Search term but not loading
32
- icon = 'search';
42
+ icon = noResultsIcon ?? 'search';
33
43
  label = <FormattedMessage id="stripes-smart-components.sas.noResults.noResults" />;
34
44
  } else if (isLoading) {
35
45
  // Loading
36
- icon = 'spinner-ellipsis';
46
+ icon = isLoadingIcon ?? 'spinner-ellipsis';
37
47
  label = <FormattedMessage id="stripes-smart-components.sas.noResults.loading" />;
38
48
  } else if (isError) {
39
49
  // Request failure
40
- icon = 'exclamation-circle';
50
+ icon = errorIcon ?? 'exclamation-circle';
41
51
  label = error?.message;
42
52
  }
43
53
 
44
54
  return (
45
- <div className={css.noResultsMessage}>
55
+ <div className={`${className} ${css.noResultsMessage}`}>
46
56
  <div className={css.noResultsMessageLabelWrap}>
47
- {(icon || userIcon) &&
57
+ {(userIcon || icon) &&
48
58
  <Icon
49
59
  icon={userIcon ?? icon}
50
60
  iconRootClass={css.noResultsMessageIcon}
@@ -72,9 +82,18 @@ const NoResultsMessage = ({
72
82
  };
73
83
 
74
84
  NoResultsMessage.propTypes = {
85
+ className: PropTypes.string,
75
86
  error: PropTypes.object,
87
+ filters: PropTypes.string,
76
88
  filterPaneIsVisible: PropTypes.bool.isRequired,
77
89
  icon: PropTypes.string,
90
+ iconPresets: PropTypes.shape({
91
+ noTerms: PropTypes.string,
92
+ noTermsWhenFilterPane: PropTypes.string,
93
+ noResults: PropTypes.string,
94
+ isLoading: PropTypes.string,
95
+ error: PropTypes.string,
96
+ }),
78
97
  intlKey: PropTypes.string,
79
98
  intlNS: PropTypes.string,
80
99
  isLoading: PropTypes.bool,
@@ -66,16 +66,19 @@ export default MyDataView;
66
66
 
67
67
  ## Props
68
68
 
69
- | **Prop** | **Type** | **Required** | **Description** |
70
- |-----------------------|--------------------------|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
71
- | `filterPaneIsVisible` | `boolean` | | Indicates if the associated filter pane is currently visible. Controls the display of the "Show Filters" button. |
72
- | `toggleFilterPane` | `() => void` | | Callback function invoked when the "Show Filters" button is clicked. Typically used to toggle the filter pane's visibility. |
73
- | `error` | `object` | | An error object (e.g., from `react-query`) containing details of a failed request. Its `message` property will be displayed if `isError` is `true`. |
74
- | `icon` | `string` | | An optional custom icon string (from `@folio/stripes/components/Icon`) to override the default icon based on the message state. |
75
- | `intlKey` | `string` | ✕ | A base internationalization key used by the internal `useKintIntl` hook to resolve localized messages. |
76
- | `intlNS` | `string` | ✕ | An internationalization namespace used by the internal `useKintIntl` hook. |
77
- | `isLoading` | `boolean` | ✕ | When `true`, indicates that data is currently being loaded, displaying a loading message. |
78
- | `isError` | `boolean` | ✕ | When `true`, indicates an error occurred during data fetching, displaying an error message. |
79
- | `label` | `string`, `node`, `func` | ✕ | An optional custom label to override all default message content. |
80
- | `labelOverrides` | `object` | ✕ | An object for overriding specific parts of the default labels, such as `{ noResultsLabel: 'No records found' }` or `{ showFilters: 'View Filters' }`. |
81
- | `searchTerm` | `string` | ✕ | The current search query string. Used to differentiate between "no results for search" and "no search term entered" messages. |
69
+ | **Prop** | **Type** | **Required** | **Description** |
70
+ |-----------------------|--------------------------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
71
+ | `className` | `string` | | Allows the passing of additional CSS characteristics to the noResultsMessage |
72
+ | `filters ` | `string` | | The current filters. Used alongside searchTerm to differentiate between "no results for search" and "no search term entered" messages. |
73
+ | `filterPaneIsVisible` | `boolean` | | Indicates if the associated filter pane is currently visible. Controls the display of the "Show Filters" button. |
74
+ | `toggleFilterPane` | `() => void` | | Callback function invoked when the "Show Filters" button is clicked. Typically used to toggle the filter pane's visibility. |
75
+ | `error` | `object` | ✕ | An error object (e.g., from `react-query`) containing details of a failed request. Its `message` property will be displayed if `isError` is `true`. |
76
+ | `icon` | `string` | ✕ | An optional custom icon string (from `@folio/stripes/components/Icon`) to override the default icon based on the message state. |
77
+ | `iconPresets` | `object` | ✕ | An optional object containing keys: `noTerms`, `noTermsWhenFilterPane`, `noResults`, `isLoading` and `error`. Each key is optional and allows direcet overriding of one of the states NoResultsMessage is configured to output |
78
+ | `intlKey` | `string` | ✕ | A base internationalization key used by the internal `useKintIntl` hook to resolve localized messages. |
79
+ | `intlNS` | `string` | ✕ | An internationalization namespace used by the internal `useKintIntl` hook. |
80
+ | `isLoading` | `boolean` | ✕ | When `true`, indicates that data is currently being loaded, displaying a loading message. |
81
+ | `isError` | `boolean` | ✕ | When `true`, indicates an error occurred during data fetching, displaying an error message. |
82
+ | `label` | `string`, `node`, `func` | ✕ | An optional custom label to override all default message content. |
83
+ | `labelOverrides` | `object` | ✕ | An object for overriding specific parts of the default labels, such as `{ noResultsLabel: 'No records found' }` or `{ showFilters: 'View Filters' }`. |
84
+ | `searchTerm` | `string` | ✕ | The current search query string. Used alongside filters to differentiate between "no results for search" and "no search term entered" messages. |
@@ -178,3 +178,15 @@ export default LookupWithRefExample;
178
178
  Using `forwardRef` and `useImperativeHandle`, the component exposes certain query properties and generated query parameters to parent components.
179
179
 
180
180
  This design enables **SASQLookupComponent** to serve as a robust and flexible foundation for building data lookup views with advanced filtering, search, and pagination functionalities.
181
+
182
+ ## Use in Settings
183
+
184
+ In Settings, often a "search and filter" experience is wanted, but with 2 panes instead of 3. In order to facilitate this,
185
+ SASQRoute (via SASQLookupComponent) exposes a set of props.
186
+
187
+ - `hasFilterPane`. This defaults to true, if set to false it will _instead_ default to rendering a search bar at the
188
+ top of the main pane. It will additionally render any passed FilterHeaderComponent and FilterComponent.
189
+ - `noSearchField`. In order to prevent rendering of the search bar, set this to false.
190
+
191
+ In this way a SASQRoute can be set up to be purely routing with no search/filter, or with search and filter in the main
192
+ body for settings.
@@ -1,5 +1,5 @@
1
1
  import {
2
- forwardRef,
2
+ forwardRef, useCallback,
3
3
  useEffect,
4
4
  useImperativeHandle,
5
5
  useMemo,
@@ -38,6 +38,8 @@ import {
38
38
  import TableBody from './TableBody';
39
39
  import SearchKeyControl from '../SearchKeyControl';
40
40
 
41
+ import css from '../../../styles/SASQLookupComponent.css';
42
+
41
43
  const SASQLookupComponent = forwardRef((props, ref) => {
42
44
  const {
43
45
  children,
@@ -60,9 +62,7 @@ const SASQLookupComponent = forwardRef((props, ref) => {
60
62
  if (passedId) {
61
63
  queryNamespace.push(passedId);
62
64
  }
63
- queryNamespace.push('viewAll');
64
- queryNamespace.push(query);
65
- queryNamespace.push(currentPage);
65
+ queryNamespace.push('viewAll', query, currentPage);
66
66
 
67
67
  return queryNamespace;
68
68
  },
@@ -78,6 +78,7 @@ const SASQLookupComponent = forwardRef((props, ref) => {
78
78
  rowNavigation = true, // Default navigation onRowClick
79
79
  sasqProps,
80
80
  searchableIndexes = [],
81
+ SearchComponent: PassedSearchComponent,
81
82
  searchFieldAriaLabel,
82
83
  searchFieldProps = {},
83
84
  } = props;
@@ -194,6 +195,53 @@ const SASQLookupComponent = forwardRef((props, ref) => {
194
195
  queryParams,
195
196
  }));
196
197
 
198
+ const InternalSearchComponent = useCallback(({
199
+ disableReset,
200
+ resetAll,
201
+ searchHandlers,
202
+ searchValue
203
+ }) => (
204
+ <>
205
+ <SearchField
206
+ ariaLabel={searchFieldAriaLabel}
207
+ autoFocus
208
+ id={`sasq-search-field-${id}`}
209
+ name="query"
210
+ onChange={(e) => {
211
+ if (e.target?.value) {
212
+ searchHandlers.query(e); // SASQ needs the whole event here
213
+ } else {
214
+ searchHandlers.reset();
215
+ }
216
+ }}
217
+ onClear={searchHandlers.reset}
218
+ value={searchValue.query}
219
+ {...searchFieldProps}
220
+ />
221
+ {searchableIndexes?.length > 0 && (
222
+ <SearchKeyControl options={searchableIndexes} />
223
+ )}
224
+ <Button
225
+ buttonStyle="primary"
226
+ disabled={!searchValue.query}
227
+ fullWidth
228
+ type="submit"
229
+ >
230
+ <FormattedMessage id="stripes-smart-components.search" />
231
+ </Button>
232
+ <Button
233
+ buttonStyle="none"
234
+ disabled={disableReset}
235
+ id="clickable-reset-all"
236
+ onClick={resetAll}
237
+ >
238
+ <Icon icon="times-circle-solid">
239
+ <FormattedMessage id="stripes-smart-components.resetAll" />
240
+ </Icon>
241
+ </Button>
242
+ </>
243
+ ), [id, searchFieldAriaLabel, searchFieldProps, searchableIndexes]);
244
+
197
245
  return (
198
246
  <SearchAndSortQuery
199
247
  initialSearchState={{ query: '' }}
@@ -260,6 +308,8 @@ const SASQLookupComponent = forwardRef((props, ref) => {
260
308
  return null;
261
309
  };
262
310
 
311
+ const SearchComponent = PassedSearchComponent ?? InternalSearchComponent;
312
+
263
313
  return (
264
314
  <PersistedPaneset
265
315
  appId={namespace}
@@ -291,49 +341,17 @@ const SASQLookupComponent = forwardRef((props, ref) => {
291
341
  >
292
342
  <form onSubmit={onSubmitSearch}>
293
343
  <FilterPaneHeaderComponent />
294
- {!noSearchField && (
295
- <>
296
- <SearchField
297
- ariaLabel={searchFieldAriaLabel}
298
- autoFocus
299
- id={`sasq-search-field-${id}`}
300
- name="query"
301
- onChange={(e) => {
302
- if (e.target?.value) {
303
- searchHandlers.query(e); // SASQ needs the whole event here
304
- } else {
305
- searchHandlers.reset();
306
- }
307
- }}
308
- onClear={searchHandlers.reset}
309
- value={searchValue.query}
310
- {...searchFieldProps}
311
- />
312
- {searchableIndexes?.length > 0 && (
313
- <SearchKeyControl options={searchableIndexes} />
314
- )}
315
- <Button
316
- buttonStyle="primary"
317
- disabled={!searchValue.query}
318
- fullWidth
319
- type="submit"
320
- >
321
- <FormattedMessage id="stripes-smart-components.search" />
322
- </Button>
323
- <Button
324
- buttonStyle="none"
325
- disabled={disableReset}
326
- id="clickable-reset-all"
327
- onClick={resetAll}
328
- >
329
- <Icon icon="times-circle-solid">
330
- <FormattedMessage id="stripes-smart-components.resetAll" />
331
- </Icon>
332
- </Button>
333
- </>
334
- )}
344
+ {!noSearchField &&
345
+ <SearchComponent
346
+ disableReset={disableReset}
347
+ resetAll={resetAll}
348
+ searchHandlers={searchHandlers}
349
+ searchValue={searchValue}
350
+ />
351
+ }
335
352
  <FilterComponent
336
- activeFilters={activeFilters.state}
353
+ activeFilters={activeFilters}
354
+ data={data}
337
355
  filterChanged={filterChanged}
338
356
  filterHandlers={getFilterHandlers()}
339
357
  resetAll={resetAll}
@@ -363,33 +381,68 @@ const SASQLookupComponent = forwardRef((props, ref) => {
363
381
  )}
364
382
  {...restOfMainPaneProps}
365
383
  >
366
- <Body
367
- data={data}
368
- filterPaneVisible={filterPaneVisible}
369
- intlKey={passedIntlKey}
370
- intlNS={passedIntlNS}
371
- labelOverrides={labelOverrides}
372
- noResultsProps={noResultsProps}
373
- query={query}
374
- rowNavigation={rowNavigation}
375
- toggleFilterPane={toggleFilterPane}
376
- {...restOfQueryProps}
377
- {...sasqRenderProps}
378
- /*
379
- * This is insane, it looks like SASQProps `initialSortState`
380
- * needs to be passed through to MCL, as it relies on MCL calling the initial
381
- * sort handler. Passing through SASQProps.
382
- */
383
- {...sasqProps}
384
- // pass down all props handed to us except mclProps (pass those down below with our extra prev/next goodies)
385
- {...{
386
- ...props,
387
- mclProps: {
388
- ...paginationMCLProps,
389
- ...mclProps,
390
- },
391
- }}
392
- />
384
+ <div className={css.mainPaneContainer}>
385
+ {!hasFilterPane &&
386
+ <div className={css.controlsContainer}>
387
+ <form onSubmit={onSubmitSearch}>
388
+ <FilterPaneHeaderComponent />
389
+ {!noSearchField &&
390
+ <SearchComponent
391
+ disableReset={disableReset}
392
+ resetAll={resetAll}
393
+ searchHandlers={searchHandlers}
394
+ searchValue={searchValue}
395
+ />
396
+ }
397
+ <FilterComponent
398
+ activeFilters={activeFilters}
399
+ data={data}
400
+ filterChanged={filterChanged}
401
+ filterHandlers={getFilterHandlers()}
402
+ resetAll={resetAll}
403
+ searchChanged={searchChanged}
404
+ searchHandlers={getSearchHandlers()}
405
+ searchValue={searchValue}
406
+ />
407
+ </form>
408
+ </div>
409
+ }
410
+ <div className={css.bodyContainer}>
411
+ <Body
412
+ data={data}
413
+ filterPaneVisible={filterPaneVisible}
414
+ intlKey={passedIntlKey}
415
+ intlNS={passedIntlNS}
416
+ labelOverrides={labelOverrides}
417
+ noResultsProps={{
418
+ ...noResultsProps,
419
+ iconPresets: {
420
+ noTermsWhenFilterPane: hasFilterPane ? null : 'arrow-up',
421
+ ...noResultsProps.iconPresets,
422
+ },
423
+ }}
424
+ query={query}
425
+ rowNavigation={rowNavigation}
426
+ toggleFilterPane={toggleFilterPane}
427
+ {...restOfQueryProps}
428
+ {...sasqRenderProps}
429
+ /*
430
+ * This is insane, it looks like SASQProps `initialSortState`
431
+ * needs to be passed through to MCL, as it relies on MCL calling the initial
432
+ * sort handler. Passing through SASQProps.
433
+ */
434
+ {...sasqProps}
435
+ // pass down all props handed to us except mclProps (pass those down below with our extra prev/next goodies)
436
+ {...{
437
+ ...props,
438
+ mclProps: {
439
+ ...paginationMCLProps,
440
+ ...mclProps,
441
+ },
442
+ }}
443
+ />
444
+ </div>
445
+ </div>
393
446
  </Pane>
394
447
  {children}
395
448
  </PersistedPaneset>
@@ -431,6 +484,7 @@ SASQLookupComponent.propTypes = {
431
484
  label: PropTypes.string,
432
485
  })
433
486
  ),
487
+ SearchComponent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
434
488
  searchFieldAriaLabel: PropTypes.string,
435
489
  searchFieldProps: PropTypes.object,
436
490
  };