@headless-adminapp/app 0.0.8-0.0.9-alpha.1.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 (494) hide show
  1. package/LICENSE +21 -0
  2. package/dist/app/context.d.ts +8 -0
  3. package/dist/app/context.js +5 -0
  4. package/dist/app/hooks/index.d.ts +1 -0
  5. package/dist/app/hooks/index.js +17 -0
  6. package/dist/app/hooks/useAppContext.d.ts +2 -0
  7. package/dist/app/hooks/useAppContext.js +12 -0
  8. package/dist/app/index.d.ts +2 -0
  9. package/dist/app/index.js +7 -0
  10. package/dist/appearance/context.d.ts +7 -0
  11. package/dist/appearance/context.js +5 -0
  12. package/dist/appearance/hooks/index.d.ts +1 -0
  13. package/dist/appearance/hooks/index.js +17 -0
  14. package/dist/appearance/hooks/useAppearanceContext.d.ts +1 -0
  15. package/dist/appearance/hooks/useAppearanceContext.js +12 -0
  16. package/dist/appearance/index.d.ts +2 -0
  17. package/dist/appearance/index.js +20 -0
  18. package/dist/auth/AuthProvider.d.ts +7 -0
  19. package/dist/auth/AuthProvider.js +104 -0
  20. package/dist/auth/context.d.ts +30 -0
  21. package/dist/auth/context.js +5 -0
  22. package/dist/auth/hooks/index.d.ts +2 -0
  23. package/dist/auth/hooks/index.js +18 -0
  24. package/dist/auth/hooks/useAuthSession.d.ts +2 -0
  25. package/dist/auth/hooks/useAuthSession.js +16 -0
  26. package/dist/auth/hooks/useLogout.d.ts +1 -0
  27. package/dist/auth/hooks/useLogout.js +19 -0
  28. package/dist/auth/index.d.ts +4 -0
  29. package/dist/auth/index.js +23 -0
  30. package/dist/auth/types.d.ts +10 -0
  31. package/dist/auth/types.js +2 -0
  32. package/dist/builders/CommandBuilder.d.ts +176 -0
  33. package/dist/builders/CommandBuilder.js +474 -0
  34. package/dist/builders/SchemaExperienceBuilder.d.ts +69 -0
  35. package/dist/builders/SchemaExperienceBuilder.js +267 -0
  36. package/dist/builders/index.d.ts +2 -0
  37. package/dist/builders/index.js +7 -0
  38. package/dist/command/hooks/index.d.ts +2 -0
  39. package/dist/command/hooks/index.js +18 -0
  40. package/dist/command/hooks/useBaseCommandHandlerContext.d.ts +4 -0
  41. package/dist/command/hooks/useBaseCommandHandlerContext.js +42 -0
  42. package/dist/command/hooks/useCommands.d.ts +7 -0
  43. package/dist/command/hooks/useCommands.js +16 -0
  44. package/dist/command/index.d.ts +2 -0
  45. package/dist/command/index.js +18 -0
  46. package/dist/command/types.d.ts +76 -0
  47. package/dist/command/types.js +2 -0
  48. package/dist/command/utils/index.d.ts +3 -0
  49. package/dist/command/utils/index.js +63 -0
  50. package/dist/components/ScrollView/index.d.ts +10 -0
  51. package/dist/components/ScrollView/index.js +11 -0
  52. package/dist/dataform/DataFormProvider/DataResolver.d.ts +5 -0
  53. package/dist/dataform/DataFormProvider/DataResolver.js +143 -0
  54. package/dist/dataform/DataFormProvider/InitialValueResolver.d.ts +1 -0
  55. package/dist/dataform/DataFormProvider/InitialValueResolver.js +44 -0
  56. package/dist/dataform/DataFormProvider/ReadonlyInfoResolver.d.ts +3 -0
  57. package/dist/dataform/DataFormProvider/ReadonlyInfoResolver.js +27 -0
  58. package/dist/dataform/DataFormProvider/index.d.ts +10 -0
  59. package/dist/dataform/DataFormProvider/index.js +72 -0
  60. package/dist/dataform/context.d.ts +22 -0
  61. package/dist/dataform/context.js +5 -0
  62. package/dist/dataform/hooks/index.d.ts +11 -0
  63. package/dist/dataform/hooks/index.js +27 -0
  64. package/dist/dataform/hooks/useFormInstance.d.ts +1 -0
  65. package/dist/dataform/hooks/useFormInstance.js +8 -0
  66. package/dist/dataform/hooks/useFormIsDirty.d.ts +1 -0
  67. package/dist/dataform/hooks/useFormIsDirty.js +8 -0
  68. package/dist/dataform/hooks/useFormIsReadonly.d.ts +1 -0
  69. package/dist/dataform/hooks/useFormIsReadonly.js +9 -0
  70. package/dist/dataform/hooks/useFormNotifications.d.ts +4 -0
  71. package/dist/dataform/hooks/useFormNotifications.js +34 -0
  72. package/dist/dataform/hooks/useFormRecord.d.ts +1 -0
  73. package/dist/dataform/hooks/useFormRecord.js +9 -0
  74. package/dist/dataform/hooks/useFormSave.d.ts +2 -0
  75. package/dist/dataform/hooks/useFormSave.js +135 -0
  76. package/dist/dataform/hooks/useFormSchema.d.ts +2 -0
  77. package/dist/dataform/hooks/useFormSchema.js +8 -0
  78. package/dist/dataform/hooks/useLoadFormGridPage.d.ts +18 -0
  79. package/dist/dataform/hooks/useLoadFormGridPage.js +73 -0
  80. package/dist/dataform/hooks/useMainFormCommands.d.ts +16 -0
  81. package/dist/dataform/hooks/useMainFormCommands.js +47 -0
  82. package/dist/dataform/hooks/useRecordId.d.ts +1 -0
  83. package/dist/dataform/hooks/useRecordId.js +8 -0
  84. package/dist/dataform/hooks/useRecordTitle.d.ts +1 -0
  85. package/dist/dataform/hooks/useRecordTitle.js +20 -0
  86. package/dist/dataform/hooks/useSelectedForm.d.ts +3 -0
  87. package/dist/dataform/hooks/useSelectedForm.js +8 -0
  88. package/dist/dataform/utils/index.d.ts +62 -0
  89. package/dist/dataform/utils/index.js +356 -0
  90. package/dist/datagrid/DataGridProvider/DataResolver.d.ts +2 -0
  91. package/dist/datagrid/DataGridProvider/DataResolver.js +208 -0
  92. package/dist/datagrid/DataGridProvider/index.d.ts +18 -0
  93. package/dist/datagrid/DataGridProvider/index.js +77 -0
  94. package/dist/datagrid/DataGridProvider/transformViewColumns.d.ts +5 -0
  95. package/dist/datagrid/DataGridProvider/transformViewColumns.js +29 -0
  96. package/dist/datagrid/DataGridProvider/utils.d.ts +3 -0
  97. package/dist/datagrid/DataGridProvider/utils.js +74 -0
  98. package/dist/datagrid/column-filter/constants.d.ts +4 -0
  99. package/dist/datagrid/column-filter/constants.js +482 -0
  100. package/dist/datagrid/column-filter/index.d.ts +3 -0
  101. package/dist/datagrid/column-filter/index.js +7 -0
  102. package/dist/datagrid/column-filter/types.d.ts +65 -0
  103. package/dist/datagrid/column-filter/types.js +2 -0
  104. package/dist/datagrid/column-filter/utils.d.ts +3 -0
  105. package/dist/datagrid/column-filter/utils.js +8 -0
  106. package/dist/datagrid/context.d.ts +33 -0
  107. package/dist/datagrid/context.js +5 -0
  108. package/dist/datagrid/hooks/index.d.ts +19 -0
  109. package/dist/datagrid/hooks/index.js +35 -0
  110. package/dist/datagrid/hooks/useChangeView.d.ts +1 -0
  111. package/dist/datagrid/hooks/useChangeView.js +12 -0
  112. package/dist/datagrid/hooks/useGridColumnFilter.d.ts +2 -0
  113. package/dist/datagrid/hooks/useGridColumnFilter.js +16 -0
  114. package/dist/datagrid/hooks/useGridColumns.d.ts +3 -0
  115. package/dist/datagrid/hooks/useGridColumns.js +8 -0
  116. package/dist/datagrid/hooks/useGridCommands.d.ts +3 -0
  117. package/dist/datagrid/hooks/useGridCommands.js +9 -0
  118. package/dist/datagrid/hooks/useGridData.d.ts +1 -0
  119. package/dist/datagrid/hooks/useGridData.js +9 -0
  120. package/dist/datagrid/hooks/useGridDataState.d.ts +5 -0
  121. package/dist/datagrid/hooks/useGridDataState.js +9 -0
  122. package/dist/datagrid/hooks/useGridExtraFilter.d.ts +1 -0
  123. package/dist/datagrid/hooks/useGridExtraFilter.js +8 -0
  124. package/dist/datagrid/hooks/useGridOptions.d.ts +1 -0
  125. package/dist/datagrid/hooks/useGridOptions.js +6 -0
  126. package/dist/datagrid/hooks/useGridPagination.d.ts +1 -0
  127. package/dist/datagrid/hooks/useGridPagination.js +6 -0
  128. package/dist/datagrid/hooks/useGridRefresh.d.ts +1 -0
  129. package/dist/datagrid/hooks/useGridRefresh.js +18 -0
  130. package/dist/datagrid/hooks/useGridSchema.d.ts +2 -0
  131. package/dist/datagrid/hooks/useGridSchema.js +8 -0
  132. package/dist/datagrid/hooks/useGridSelection.d.ts +1 -0
  133. package/dist/datagrid/hooks/useGridSelection.js +21 -0
  134. package/dist/datagrid/hooks/useGridSorting.d.ts +3 -0
  135. package/dist/datagrid/hooks/useGridSorting.js +14 -0
  136. package/dist/datagrid/hooks/useGridViewLookupData.d.ts +1 -0
  137. package/dist/datagrid/hooks/useGridViewLookupData.js +9 -0
  138. package/dist/datagrid/hooks/useLoadMainGridPage.d.ts +20 -0
  139. package/dist/datagrid/hooks/useLoadMainGridPage.js +55 -0
  140. package/dist/datagrid/hooks/useMainGridCommands.d.ts +19 -0
  141. package/dist/datagrid/hooks/useMainGridCommands.js +228 -0
  142. package/dist/datagrid/hooks/useMaxRecords.d.ts +1 -0
  143. package/dist/datagrid/hooks/useMaxRecords.js +8 -0
  144. package/dist/datagrid/hooks/useSearchText.d.ts +1 -0
  145. package/dist/datagrid/hooks/useSearchText.js +14 -0
  146. package/dist/datagrid/hooks/useSelectedView.d.ts +3 -0
  147. package/dist/datagrid/hooks/useSelectedView.js +8 -0
  148. package/dist/datagrid/hooks/useSubGridCommands.d.ts +5 -0
  149. package/dist/datagrid/hooks/useSubGridCommands.js +87 -0
  150. package/dist/dialog/DialogProvider.d.ts +5 -0
  151. package/dist/dialog/DialogProvider.js +13 -0
  152. package/dist/dialog/context.d.ts +6 -0
  153. package/dist/dialog/context.js +5 -0
  154. package/dist/dialog/hooks/index.d.ts +8 -0
  155. package/dist/dialog/hooks/index.js +24 -0
  156. package/dist/dialog/hooks/useCloseDialog.d.ts +1 -0
  157. package/dist/dialog/hooks/useCloseDialog.js +30 -0
  158. package/dist/dialog/hooks/useDialogItem.d.ts +1 -0
  159. package/dist/dialog/hooks/useDialogItem.js +8 -0
  160. package/dist/dialog/hooks/useDialogItems.d.ts +1 -0
  161. package/dist/dialog/hooks/useDialogItems.js +8 -0
  162. package/dist/dialog/hooks/useOpenAlertDialog.d.ts +2 -0
  163. package/dist/dialog/hooks/useOpenAlertDialog.js +20 -0
  164. package/dist/dialog/hooks/useOpenConfirmDialog.d.ts +2 -0
  165. package/dist/dialog/hooks/useOpenConfirmDialog.js +26 -0
  166. package/dist/dialog/hooks/useOpenDialog.d.ts +5 -0
  167. package/dist/dialog/hooks/useOpenDialog.js +27 -0
  168. package/dist/dialog/hooks/useOpenErrorDialog.d.ts +2 -0
  169. package/dist/dialog/hooks/useOpenErrorDialog.js +16 -0
  170. package/dist/dialog/hooks/useOpenPromptDialog.d.ts +3 -0
  171. package/dist/dialog/hooks/useOpenPromptDialog.js +26 -0
  172. package/dist/dialog/index.d.ts +3 -0
  173. package/dist/dialog/index.js +22 -0
  174. package/dist/form/FormValidationStringContext.d.ts +12 -0
  175. package/dist/form/FormValidationStringContext.js +19 -0
  176. package/dist/hooks/index.d.ts +5 -0
  177. package/dist/hooks/index.js +21 -0
  178. package/dist/hooks/useDebouncedValue.d.ts +3 -0
  179. package/dist/hooks/useDebouncedValue.js +32 -0
  180. package/dist/hooks/useElementLayout.d.ts +7 -0
  181. package/dist/hooks/useElementLayout.js +34 -0
  182. package/dist/hooks/useIsMobile.d.ts +1 -0
  183. package/dist/hooks/useIsMobile.js +21 -0
  184. package/dist/hooks/useStorageState.d.ts +2 -0
  185. package/dist/hooks/useStorageState.js +26 -0
  186. package/dist/hooks/useSystemColorScheme.d.ts +1 -0
  187. package/dist/hooks/useSystemColorScheme.js +27 -0
  188. package/dist/insights/context.d.ts +2 -0
  189. package/dist/insights/context.js +5 -0
  190. package/dist/locale/context.d.ts +2 -0
  191. package/dist/locale/context.js +5 -0
  192. package/dist/locale/index.d.ts +3 -0
  193. package/dist/locale/index.js +21 -0
  194. package/dist/locale/types.d.ts +2 -0
  195. package/dist/locale/types.js +2 -0
  196. package/dist/locale/useLocale.d.ts +1 -0
  197. package/dist/locale/useLocale.js +12 -0
  198. package/dist/metadata/MetadataProvider.d.ts +9 -0
  199. package/dist/metadata/MetadataProvider.js +29 -0
  200. package/dist/metadata/context.d.ts +7 -0
  201. package/dist/metadata/context.js +5 -0
  202. package/dist/metadata/hooks/index.d.ts +8 -0
  203. package/dist/metadata/hooks/index.js +24 -0
  204. package/dist/metadata/hooks/useAppStore.d.ts +1 -0
  205. package/dist/metadata/hooks/useAppStore.js +8 -0
  206. package/dist/metadata/hooks/useExperienceStore.d.ts +1 -0
  207. package/dist/metadata/hooks/useExperienceStore.js +8 -0
  208. package/dist/metadata/hooks/useExperienceView.d.ts +4 -0
  209. package/dist/metadata/hooks/useExperienceView.js +37 -0
  210. package/dist/metadata/hooks/useExperienceViewCommands.d.ts +4 -0
  211. package/dist/metadata/hooks/useExperienceViewCommands.js +28 -0
  212. package/dist/metadata/hooks/useExperienceViewLookup.d.ts +4 -0
  213. package/dist/metadata/hooks/useExperienceViewLookup.js +36 -0
  214. package/dist/metadata/hooks/useExperienceViewSubgridCommands.d.ts +4 -0
  215. package/dist/metadata/hooks/useExperienceViewSubgridCommands.js +28 -0
  216. package/dist/metadata/hooks/useMetadata.d.ts +9 -0
  217. package/dist/metadata/hooks/useMetadata.js +28 -0
  218. package/dist/metadata/hooks/useSchema.d.ts +2 -0
  219. package/dist/metadata/hooks/useSchema.js +8 -0
  220. package/dist/metadata/index.d.ts +3 -0
  221. package/dist/metadata/index.js +22 -0
  222. package/dist/mutable/context.d.ts +11 -0
  223. package/dist/mutable/context.js +46 -0
  224. package/dist/mutable/index.d.ts +3 -0
  225. package/dist/mutable/index.js +26 -0
  226. package/dist/mutable/state.d.ts +6 -0
  227. package/dist/mutable/state.js +12 -0
  228. package/dist/mutable/type.d.ts +11 -0
  229. package/dist/mutable/type.js +2 -0
  230. package/dist/mutable/utils.d.ts +3 -0
  231. package/dist/mutable/utils.js +62 -0
  232. package/dist/navigation/hooks/useOpenForm.d.ts +4 -0
  233. package/dist/navigation/hooks/useOpenForm.js +20 -0
  234. package/dist/progress-indicator/ProgressIndicatorProvider.d.ts +2 -0
  235. package/dist/progress-indicator/ProgressIndicatorProvider.js +54 -0
  236. package/dist/progress-indicator/context.d.ts +8 -0
  237. package/dist/progress-indicator/context.js +5 -0
  238. package/dist/progress-indicator/hooks/index.d.ts +1 -0
  239. package/dist/progress-indicator/hooks/index.js +17 -0
  240. package/dist/progress-indicator/hooks/useProgressIndicator.d.ts +1 -0
  241. package/dist/progress-indicator/hooks/useProgressIndicator.js +12 -0
  242. package/dist/progress-indicator/index.d.ts +3 -0
  243. package/dist/progress-indicator/index.js +22 -0
  244. package/dist/providers/PageEntityFormProvider/index.d.ts +11 -0
  245. package/dist/providers/PageEntityFormProvider/index.js +8 -0
  246. package/dist/providers/PageEntityViewProvider/index.d.ts +13 -0
  247. package/dist/providers/PageEntityViewProvider/index.js +8 -0
  248. package/dist/recordset/RecordSetProvider.d.ts +2 -0
  249. package/dist/recordset/RecordSetProvider.js +40 -0
  250. package/dist/recordset/context.d.ts +8 -0
  251. package/dist/recordset/context.js +5 -0
  252. package/dist/recordset/hooks/index.d.ts +3 -0
  253. package/dist/recordset/hooks/index.js +19 -0
  254. package/dist/recordset/hooks/useRecordSetResult.d.ts +7 -0
  255. package/dist/recordset/hooks/useRecordSetResult.js +81 -0
  256. package/dist/recordset/hooks/useRecordSetSetter.d.ts +1 -0
  257. package/dist/recordset/hooks/useRecordSetSetter.js +17 -0
  258. package/dist/recordset/hooks/useRecordSetVisibility.d.ts +1 -0
  259. package/dist/recordset/hooks/useRecordSetVisibility.js +16 -0
  260. package/dist/recordset/index.d.ts +3 -0
  261. package/dist/recordset/index.js +22 -0
  262. package/dist/route/RouteProvider.d.ts +13 -0
  263. package/dist/route/RouteProvider.js +24 -0
  264. package/dist/route/context.d.ts +23 -0
  265. package/dist/route/context.js +9 -0
  266. package/dist/route/hooks/index.d.ts +4 -0
  267. package/dist/route/hooks/index.js +20 -0
  268. package/dist/route/hooks/useBasePath.d.ts +1 -0
  269. package/dist/route/hooks/useBasePath.js +8 -0
  270. package/dist/route/hooks/usePathname.d.ts +1 -0
  271. package/dist/route/hooks/usePathname.js +8 -0
  272. package/dist/route/hooks/useRouteResolver.d.ts +1 -0
  273. package/dist/route/hooks/useRouteResolver.js +8 -0
  274. package/dist/route/hooks/useRouter.d.ts +1 -0
  275. package/dist/route/hooks/useRouter.js +8 -0
  276. package/dist/route/hooks/useSearchParams.d.ts +1 -0
  277. package/dist/route/hooks/useSearchParams.js +8 -0
  278. package/dist/route/index.d.ts +2 -0
  279. package/dist/route/index.js +20 -0
  280. package/dist/route/types.d.ts +2 -0
  281. package/dist/route/types.js +2 -0
  282. package/dist/store/ClientAppStore.d.ts +7 -0
  283. package/dist/store/ClientAppStore.js +30 -0
  284. package/dist/store/ComponentStore.d.ts +6 -0
  285. package/dist/store/ComponentStore.js +23 -0
  286. package/dist/store/EventManager.d.ts +7 -0
  287. package/dist/store/EventManager.js +42 -0
  288. package/dist/store/SchemaExperienceStore.d.ts +32 -0
  289. package/dist/store/SchemaExperienceStore.js +264 -0
  290. package/dist/store/index.d.ts +4 -0
  291. package/dist/store/index.js +20 -0
  292. package/dist/toast-notification/ToastNotificationProvider.d.ts +5 -0
  293. package/dist/toast-notification/ToastNotificationProvider.js +13 -0
  294. package/dist/toast-notification/context.d.ts +15 -0
  295. package/dist/toast-notification/context.js +5 -0
  296. package/dist/toast-notification/hooks/index.d.ts +3 -0
  297. package/dist/toast-notification/hooks/index.js +19 -0
  298. package/dist/toast-notification/hooks/useCloseToastNotification.d.ts +1 -0
  299. package/dist/toast-notification/hooks/useCloseToastNotification.js +30 -0
  300. package/dist/toast-notification/hooks/useOpenToastNotification.d.ts +5 -0
  301. package/dist/toast-notification/hooks/useOpenToastNotification.js +27 -0
  302. package/dist/toast-notification/hooks/useToastNotificationItems.d.ts +1 -0
  303. package/dist/toast-notification/hooks/useToastNotificationItems.js +8 -0
  304. package/dist/toast-notification/index.d.ts +3 -0
  305. package/dist/toast-notification/index.js +22 -0
  306. package/dist/transport/InMemoryDataService/index.d.ts +25 -0
  307. package/dist/transport/InMemoryDataService/index.js +112 -0
  308. package/dist/transport/RestDataService/index.d.ts +25 -0
  309. package/dist/transport/RestDataService/index.js +124 -0
  310. package/dist/transport/context.d.ts +2 -0
  311. package/dist/transport/context.js +5 -0
  312. package/dist/transport/hooks/index.d.ts +1 -0
  313. package/dist/transport/hooks/index.js +17 -0
  314. package/dist/transport/hooks/useDataService.d.ts +1 -0
  315. package/dist/transport/hooks/useDataService.js +12 -0
  316. package/dist/transport/index.d.ts +2 -0
  317. package/dist/transport/index.js +20 -0
  318. package/dist/utils/calculateColumnWidths.d.ts +14 -0
  319. package/dist/utils/calculateColumnWidths.js +46 -0
  320. package/dist/utils/index.d.ts +1 -0
  321. package/dist/utils/index.js +17 -0
  322. package/dist/widget/context.d.ts +2 -0
  323. package/dist/widget/context.js +5 -0
  324. package/dist/widget/hooks/index.d.ts +3 -0
  325. package/dist/widget/hooks/index.js +8 -0
  326. package/dist/widget/index.d.ts +1 -0
  327. package/dist/widget/index.js +5 -0
  328. package/package.json +45 -0
  329. package/src/app/context.ts +11 -0
  330. package/src/app/hooks/index.ts +1 -0
  331. package/src/app/hooks/useAppContext.ts +13 -0
  332. package/src/app/index.ts +2 -0
  333. package/src/appearance/context.ts +13 -0
  334. package/src/appearance/hooks/index.ts +1 -0
  335. package/src/appearance/hooks/useAppearanceContext.ts +13 -0
  336. package/src/appearance/index.ts +6 -0
  337. package/src/auth/AuthProvider.tsx +118 -0
  338. package/src/auth/context.ts +41 -0
  339. package/src/auth/hooks/index.ts +2 -0
  340. package/src/auth/hooks/useAuthSession.ts +17 -0
  341. package/src/auth/hooks/useLogout.ts +23 -0
  342. package/src/auth/index.ts +4 -0
  343. package/src/auth/types.ts +17 -0
  344. package/src/builders/CommandBuilder.ts +777 -0
  345. package/src/builders/SchemaExperienceBuilder.ts +488 -0
  346. package/src/builders/index.ts +2 -0
  347. package/src/command/hooks/index.ts +2 -0
  348. package/src/command/hooks/useBaseCommandHandlerContext.ts +51 -0
  349. package/src/command/hooks/useCommands.ts +26 -0
  350. package/src/command/index.ts +2 -0
  351. package/src/command/types.ts +116 -0
  352. package/src/command/utils/index.ts +142 -0
  353. package/src/components/ScrollView/index.tsx +26 -0
  354. package/src/dataform/DataFormProvider/DataResolver.tsx +186 -0
  355. package/src/dataform/DataFormProvider/InitialValueResolver.tsx +55 -0
  356. package/src/dataform/DataFormProvider/ReadonlyInfoResolver.tsx +35 -0
  357. package/src/dataform/DataFormProvider/index.tsx +102 -0
  358. package/src/dataform/context.ts +53 -0
  359. package/src/dataform/hooks/index.ts +11 -0
  360. package/src/dataform/hooks/useFormInstance.ts +6 -0
  361. package/src/dataform/hooks/useFormIsDirty.ts +7 -0
  362. package/src/dataform/hooks/useFormIsReadonly.ts +11 -0
  363. package/src/dataform/hooks/useFormNotifications.ts +46 -0
  364. package/src/dataform/hooks/useFormRecord.ts +7 -0
  365. package/src/dataform/hooks/useFormSave.ts +147 -0
  366. package/src/dataform/hooks/useFormSchema.ts +13 -0
  367. package/src/dataform/hooks/useLoadFormGridPage.ts +97 -0
  368. package/src/dataform/hooks/useMainFormCommands.ts +65 -0
  369. package/src/dataform/hooks/useRecordId.ts +6 -0
  370. package/src/dataform/hooks/useRecordTitle.ts +22 -0
  371. package/src/dataform/hooks/useSelectedForm.ts +14 -0
  372. package/src/dataform/utils/index.ts +582 -0
  373. package/src/datagrid/DataGridProvider/DataResolver.tsx +281 -0
  374. package/src/datagrid/DataGridProvider/index.tsx +134 -0
  375. package/src/datagrid/DataGridProvider/transformViewColumns.ts +54 -0
  376. package/src/datagrid/DataGridProvider/utils.ts +89 -0
  377. package/src/datagrid/column-filter/constants.ts +493 -0
  378. package/src/datagrid/column-filter/index.ts +3 -0
  379. package/src/datagrid/column-filter/types.ts +68 -0
  380. package/src/datagrid/column-filter/utils.ts +19 -0
  381. package/src/datagrid/context.ts +66 -0
  382. package/src/datagrid/hooks/index.ts +19 -0
  383. package/src/datagrid/hooks/useChangeView.ts +18 -0
  384. package/src/datagrid/hooks/useGridColumnFilter.ts +28 -0
  385. package/src/datagrid/hooks/useGridColumns.ts +13 -0
  386. package/src/datagrid/hooks/useGridCommands.ts +21 -0
  387. package/src/datagrid/hooks/useGridData.ts +8 -0
  388. package/src/datagrid/hooks/useGridDataState.ts +8 -0
  389. package/src/datagrid/hooks/useGridExtraFilter.ts +6 -0
  390. package/src/datagrid/hooks/useGridOptions.ts +3 -0
  391. package/src/datagrid/hooks/useGridPagination.ts +3 -0
  392. package/src/datagrid/hooks/useGridRefresh.ts +19 -0
  393. package/src/datagrid/hooks/useGridSchema.ts +13 -0
  394. package/src/datagrid/hooks/useGridSelection.ts +28 -0
  395. package/src/datagrid/hooks/useGridSorting.ts +23 -0
  396. package/src/datagrid/hooks/useGridViewLookupData.ts +10 -0
  397. package/src/datagrid/hooks/useLoadMainGridPage.ts +90 -0
  398. package/src/datagrid/hooks/useMainGridCommands.ts +255 -0
  399. package/src/datagrid/hooks/useMaxRecords.ts +6 -0
  400. package/src/datagrid/hooks/useSearchText.ts +22 -0
  401. package/src/datagrid/hooks/useSelectedView.ts +14 -0
  402. package/src/datagrid/hooks/useSubGridCommands.ts +104 -0
  403. package/src/dialog/DialogProvider.tsx +20 -0
  404. package/src/dialog/context.ts +14 -0
  405. package/src/dialog/hooks/index.ts +8 -0
  406. package/src/dialog/hooks/useCloseDialog.ts +36 -0
  407. package/src/dialog/hooks/useDialogItem.ts +8 -0
  408. package/src/dialog/hooks/useDialogItems.ts +6 -0
  409. package/src/dialog/hooks/useOpenAlertDialog.ts +30 -0
  410. package/src/dialog/hooks/useOpenConfirmDialog.ts +45 -0
  411. package/src/dialog/hooks/useOpenDialog.ts +39 -0
  412. package/src/dialog/hooks/useOpenErrorDialog.ts +26 -0
  413. package/src/dialog/hooks/useOpenPromptDialog.ts +46 -0
  414. package/src/dialog/index.ts +7 -0
  415. package/src/form/FormValidationStringContext.ts +30 -0
  416. package/src/hooks/index.ts +5 -0
  417. package/src/hooks/useDebouncedValue.ts +38 -0
  418. package/src/hooks/useElementLayout.ts +49 -0
  419. package/src/hooks/useIsMobile.ts +21 -0
  420. package/src/hooks/useStorageState.ts +36 -0
  421. package/src/hooks/useSystemColorScheme.ts +38 -0
  422. package/src/index.css +4 -0
  423. package/src/insights/context.ts +5 -0
  424. package/src/locale/context.ts +7 -0
  425. package/src/locale/index.ts +3 -0
  426. package/src/locale/types.ts +3 -0
  427. package/src/locale/useLocale.ts +13 -0
  428. package/src/metadata/MetadataProvider.tsx +51 -0
  429. package/src/metadata/context.ts +15 -0
  430. package/src/metadata/hooks/index.ts +8 -0
  431. package/src/metadata/hooks/useAppStore.ts +6 -0
  432. package/src/metadata/hooks/useExperienceStore.ts +6 -0
  433. package/src/metadata/hooks/useExperienceView.ts +36 -0
  434. package/src/metadata/hooks/useExperienceViewCommands.ts +20 -0
  435. package/src/metadata/hooks/useExperienceViewLookup.ts +33 -0
  436. package/src/metadata/hooks/useExperienceViewSubgridCommands.ts +20 -0
  437. package/src/metadata/hooks/useMetadata.ts +44 -0
  438. package/src/metadata/hooks/useSchema.ts +11 -0
  439. package/src/metadata/index.ts +3 -0
  440. package/src/mutable/context.ts +71 -0
  441. package/src/mutable/index.ts +9 -0
  442. package/src/mutable/state.ts +13 -0
  443. package/src/mutable/type.ts +9 -0
  444. package/src/mutable/utils.ts +80 -0
  445. package/src/navigation/hooks/useOpenForm.ts +34 -0
  446. package/src/progress-indicator/ProgressIndicatorProvider.tsx +77 -0
  447. package/src/progress-indicator/context.ts +12 -0
  448. package/src/progress-indicator/hooks/index.ts +1 -0
  449. package/src/progress-indicator/hooks/useProgressIndicator.ts +15 -0
  450. package/src/progress-indicator/index.ts +6 -0
  451. package/src/providers/PageEntityFormProvider/index.tsx +34 -0
  452. package/src/providers/PageEntityViewProvider/index.tsx +39 -0
  453. package/src/recordset/RecordSetProvider.tsx +55 -0
  454. package/src/recordset/context.ts +12 -0
  455. package/src/recordset/hooks/index.ts +3 -0
  456. package/src/recordset/hooks/useRecordSetResult.ts +94 -0
  457. package/src/recordset/hooks/useRecordSetSetter.ts +21 -0
  458. package/src/recordset/hooks/useRecordSetVisibility.ts +24 -0
  459. package/src/recordset/index.ts +3 -0
  460. package/src/route/RouteProvider.tsx +76 -0
  461. package/src/route/context.ts +39 -0
  462. package/src/route/hooks/index.ts +4 -0
  463. package/src/route/hooks/useBasePath.ts +7 -0
  464. package/src/route/hooks/usePathname.ts +7 -0
  465. package/src/route/hooks/useRouteResolver.ts +7 -0
  466. package/src/route/hooks/useRouter.ts +7 -0
  467. package/src/route/hooks/useSearchParams.ts +7 -0
  468. package/src/route/index.ts +2 -0
  469. package/src/route/types.ts +1 -0
  470. package/src/store/ClientAppStore.ts +20 -0
  471. package/src/store/ComponentStore.tsx +22 -0
  472. package/src/store/EventManager.ts +33 -0
  473. package/src/store/SchemaExperienceStore.ts +374 -0
  474. package/src/store/index.ts +4 -0
  475. package/src/toast-notification/ToastNotificationProvider.tsx +23 -0
  476. package/src/toast-notification/context.ts +17 -0
  477. package/src/toast-notification/hooks/index.ts +3 -0
  478. package/src/toast-notification/hooks/useCloseToastNotification.ts +36 -0
  479. package/src/toast-notification/hooks/useOpenToastNotification.ts +38 -0
  480. package/src/toast-notification/hooks/useToastNotificationItems.ts +6 -0
  481. package/src/toast-notification/index.ts +7 -0
  482. package/src/transport/InMemoryDataService/index.ts +157 -0
  483. package/src/transport/RestDataService/index.ts +151 -0
  484. package/src/transport/context.ts +6 -0
  485. package/src/transport/hooks/index.ts +1 -0
  486. package/src/transport/hooks/useDataService.ts +13 -0
  487. package/src/transport/index.ts +2 -0
  488. package/src/utils/calculateColumnWidths.ts +72 -0
  489. package/src/utils/index.ts +1 -0
  490. package/src/widget/context.ts +5 -0
  491. package/src/widget/hooks/index.ts +11 -0
  492. package/src/widget/index.ts +1 -0
  493. package/tsconfig.json +9 -0
  494. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,20 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+
3
+ import { useExperienceStore } from './useExperienceStore';
4
+
5
+ /** @todo move in different dir */
6
+ export function useExperienceViewCommands(logicalName: string) {
7
+ const experienceStore = useExperienceStore();
8
+
9
+ const { data: commands } = useQuery({
10
+ queryKey: ['experience-schema-view-commands', logicalName],
11
+ queryFn: async () => {
12
+ return experienceStore.getViewCommands(logicalName);
13
+ },
14
+ initialData: [],
15
+ });
16
+
17
+ return {
18
+ commands,
19
+ };
20
+ }
@@ -0,0 +1,33 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+
3
+ import { useExperienceStore } from './useExperienceStore';
4
+
5
+ /** @todo move in different dir */
6
+ export function useExperienceViewLookup(
7
+ logicalName: string,
8
+ associated?: boolean,
9
+ viewIds?: string[]
10
+ ) {
11
+ const experienceStore = useExperienceStore();
12
+
13
+ const { data: viewLookup } = useQuery({
14
+ queryKey: [
15
+ 'experience-schema-view-lookup',
16
+ logicalName,
17
+ associated,
18
+ viewIds,
19
+ ],
20
+ queryFn: async () => {
21
+ if (associated) {
22
+ return experienceStore.getAssociatedViewLookup(logicalName, viewIds);
23
+ }
24
+
25
+ return experienceStore.getPublicViewLookup(logicalName, viewIds);
26
+ },
27
+ initialData: [],
28
+ });
29
+
30
+ return {
31
+ viewLookup,
32
+ };
33
+ }
@@ -0,0 +1,20 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+
3
+ import { useExperienceStore } from './useExperienceStore';
4
+
5
+ /** @todo move in different dir */
6
+ export function useExperienceViewSubgridCommands(logicalName: string) {
7
+ const experienceStore = useExperienceStore();
8
+
9
+ const { data: commands } = useQuery({
10
+ queryKey: ['experience-schema-view-subgrid-commands', logicalName],
11
+ queryFn: async () => {
12
+ return experienceStore.getSubgridCommands(logicalName);
13
+ },
14
+ initialData: [],
15
+ });
16
+
17
+ return {
18
+ commands,
19
+ };
20
+ }
@@ -0,0 +1,44 @@
1
+ import { SchemaAttributes } from '@headless-adminapp/core/schema';
2
+ import { useCallback } from 'react';
3
+
4
+ import { useContextSelector } from '../../mutable/context';
5
+ import { MetadataContext } from '../context';
6
+
7
+ export function useMetadata() {
8
+ const schemaStore = useContextSelector(
9
+ MetadataContext,
10
+ (state) => state.schemaStore
11
+ );
12
+ const appStore = useContextSelector(
13
+ MetadataContext,
14
+ (state) => state.appStore
15
+ );
16
+ const experienceStore = useContextSelector(
17
+ MetadataContext,
18
+ (state) => state.experienceStore
19
+ );
20
+ // const schemaLoading = useContextSelector(
21
+ // MetadataContext,
22
+ // (state) => state.schemaLoading
23
+ // );
24
+
25
+ const schemaLoading = false;
26
+
27
+ const schemas = schemaStore.getAllSchema();
28
+
29
+ const getSchema = useCallback(
30
+ <S extends SchemaAttributes = SchemaAttributes>(logicalName: string) => {
31
+ return schemaStore.getSchema<S>(logicalName);
32
+ },
33
+ [schemaStore]
34
+ );
35
+
36
+ return {
37
+ schemas,
38
+ schemaLoading,
39
+ getSchema,
40
+ schemaStore,
41
+ appStore,
42
+ experienceStore,
43
+ };
44
+ }
@@ -0,0 +1,11 @@
1
+ import { SchemaAttributes } from '@headless-adminapp/core/schema';
2
+
3
+ import { useMetadata } from './useMetadata';
4
+
5
+ export function useSchema<S extends SchemaAttributes = SchemaAttributes>(
6
+ logicalName: string
7
+ ) {
8
+ const { getSchema } = useMetadata();
9
+
10
+ return getSchema<S>(logicalName);
11
+ }
@@ -0,0 +1,3 @@
1
+ export { MetadataProvider } from './MetadataProvider';
2
+ export { MetadataContext, type MetadataContextState } from './context';
3
+ export * from './hooks';
@@ -0,0 +1,71 @@
1
+ import {
2
+ createContext as createReactContext,
3
+ useCallback,
4
+ useContext,
5
+ useRef,
6
+ useState,
7
+ } from 'react';
8
+
9
+ import { MutableValue } from './type';
10
+ import { createMutableValue, useMutableValueSelector } from './utils';
11
+
12
+ export type ContextValue<T> = MutableValue<T>;
13
+ const createContextValue = createMutableValue;
14
+ export const useContextSelectorInternal = useMutableValueSelector;
15
+
16
+ export function createContext<T>() {
17
+ const context = createReactContext<ContextValue<T>>(null as any);
18
+ return context;
19
+ }
20
+
21
+ export function useCreateContextStore<T>(initialValue: T) {
22
+ const [state] = useState(() => createContextValue(initialValue));
23
+ return state;
24
+ }
25
+
26
+ export function useContextSelector<T, R>(
27
+ context: React.Context<ContextValue<T>>,
28
+ selector: (state: T) => R
29
+ ) {
30
+ const contextValue = useContext(context);
31
+
32
+ if (!contextValue) {
33
+ throw new Error('useContextSelector must be used within a Provider');
34
+ }
35
+
36
+ return useContextSelectorInternal(contextValue, selector);
37
+ }
38
+
39
+ export function useContextSetValue<T>(context: React.Context<ContextValue<T>>) {
40
+ const contextValue = useContext(context);
41
+
42
+ if (!contextValue) {
43
+ throw new Error('useContextSetValue must be used within a Provider');
44
+ }
45
+
46
+ return contextValue.setValue;
47
+ }
48
+
49
+ type Setter<T, U extends unknown[]> = (
50
+ setValue: ContextValue<T>['setValue']
51
+ ) => (...args: U) => void;
52
+
53
+ export function useContextValueSetter<T, U extends unknown[]>(
54
+ context: React.Context<ContextValue<T>>,
55
+ setter: Setter<T, U>
56
+ ) {
57
+ const contextValue = useContext(context);
58
+
59
+ if (!contextValue) {
60
+ throw new Error('useContextValueSetter must be used within a Provider');
61
+ }
62
+
63
+ const setterRef = useRef(setter);
64
+ setterRef.current = setter;
65
+
66
+ const setterWrapper = useCallback((...args: U) => {
67
+ return setterRef.current(contextValue.setValue)(...args);
68
+ }, []);
69
+
70
+ return setterWrapper;
71
+ }
@@ -0,0 +1,9 @@
1
+ export {
2
+ createContext,
3
+ useContextSelector,
4
+ useContextSetValue,
5
+ useCreateContextStore,
6
+ type ContextValue,
7
+ } from './context';
8
+ export { useMutableState, useMutableStateSelector } from './state';
9
+ export * from './type';
@@ -0,0 +1,13 @@
1
+ import { useState } from 'react';
2
+
3
+ import { MutableValue } from './type';
4
+ import { createMutableValue, useMutableValueSelector } from './utils';
5
+
6
+ export type MutableState<T> = MutableValue<T>;
7
+ export const createMutableState = createMutableValue;
8
+ export const useMutableStateSelector = useMutableValueSelector;
9
+
10
+ export function useMutableState<T>(initialValue: T, isArray?: boolean) {
11
+ const [state] = useState(() => createMutableState(initialValue, isArray));
12
+ return state;
13
+ }
@@ -0,0 +1,9 @@
1
+ type Listener<T> = (state: T) => void;
2
+
3
+ export interface MutableValue<T> {
4
+ value: { current: T };
5
+ setValue: (value: Partial<T> | ((state: T) => Partial<T>)) => void;
6
+ listeners: Set<Listener<T>>;
7
+ addListener: (listener: Listener<T>) => void;
8
+ removeListener: (listener: Listener<T>) => void;
9
+ }
@@ -0,0 +1,80 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+
3
+ import { MutableValue } from './type';
4
+
5
+ export function createMutableValue<T>(
6
+ initialValue: T,
7
+ isArray?: boolean
8
+ ): MutableValue<T> {
9
+ let storeValue = {
10
+ current: initialValue,
11
+ };
12
+
13
+ type StoreListener = (state: T) => void;
14
+
15
+ const listeners = new Set<StoreListener>();
16
+
17
+ return {
18
+ value: storeValue,
19
+ setValue: (value) => {
20
+ if (typeof value === 'function') {
21
+ if (isArray) {
22
+ storeValue.current = value(storeValue.current) as T;
23
+ } else {
24
+ storeValue.current = {
25
+ ...storeValue.current,
26
+ ...value(storeValue.current),
27
+ };
28
+ }
29
+ } else {
30
+ if (isArray) {
31
+ storeValue.current = value as T;
32
+ } else {
33
+ storeValue.current = { ...storeValue.current, ...value };
34
+ }
35
+ }
36
+
37
+ listeners.forEach((listener) => listener(storeValue.current));
38
+ },
39
+ listeners,
40
+ addListener: (listener) => listeners.add(listener),
41
+ removeListener: (listener) => listeners.delete(listener),
42
+ };
43
+ }
44
+
45
+ export function useMutableValueSelector<T, R>(
46
+ mutableValue: MutableValue<T>,
47
+ selector: (state: T) => R
48
+ ) {
49
+ const selectorRef = useRef(selector);
50
+ selectorRef.current = selector;
51
+
52
+ const [value, setValue] = useState({
53
+ innerValue: selectorRef.current(mutableValue.value.current),
54
+ });
55
+
56
+ const valueRef = useRef(value);
57
+ valueRef.current = value;
58
+
59
+ useEffect(() => {
60
+ const listener = (state: T) => {
61
+ const newValue = selectorRef.current(state);
62
+ if (newValue !== valueRef.current.innerValue) {
63
+ setValue({
64
+ innerValue: newValue,
65
+ });
66
+ }
67
+ };
68
+
69
+ mutableValue.addListener(listener);
70
+
71
+ // Trigger value which update while adding listener
72
+ listener(mutableValue.value.current);
73
+
74
+ return () => {
75
+ mutableValue.removeListener(listener);
76
+ };
77
+ }, [mutableValue]);
78
+
79
+ return value.innerValue;
80
+ }
@@ -0,0 +1,34 @@
1
+ import {
2
+ PageEntiyForm,
3
+ PageType,
4
+ } from '@headless-adminapp/core/experience/app';
5
+ import { useCallback } from 'react';
6
+
7
+ import { useRouter } from '../../route/hooks/';
8
+ import { useRouteResolver } from '../../route/hooks/useRouteResolver';
9
+
10
+ export function useOpenForm() {
11
+ const routeResolver = useRouteResolver();
12
+ const router = useRouter();
13
+
14
+ return useCallback(
15
+ (
16
+ formOptions: Omit<PageEntiyForm, 'type'>,
17
+ navigationOptions: {
18
+ replace?: boolean;
19
+ }
20
+ ) => {
21
+ const path = routeResolver({
22
+ type: PageType.EntityForm,
23
+ ...formOptions,
24
+ });
25
+
26
+ if (navigationOptions.replace) {
27
+ router.replace(path);
28
+ } else {
29
+ router.push(path);
30
+ }
31
+ },
32
+ [routeResolver, router]
33
+ );
34
+ }
@@ -0,0 +1,77 @@
1
+ import {
2
+ FC,
3
+ PropsWithChildren,
4
+ useCallback,
5
+ useMemo,
6
+ useRef,
7
+ useState,
8
+ } from 'react';
9
+
10
+ import { ProgressIndicatorContext } from './context';
11
+
12
+ export const ProgressIndicatorProvider: FC<PropsWithChildren> = ({
13
+ children,
14
+ }) => {
15
+ const [overlayVisible, setOverlayVisible] = useState(false);
16
+ const [visible, setVisible] = useState(false);
17
+ const [message, setMessage] = useState<string | undefined>(undefined);
18
+
19
+ const showTimeoutRef = useRef<NodeJS.Timeout>();
20
+
21
+ const showProgressIndicator = useCallback(
22
+ (message?: string, delay?: number) => {
23
+ setOverlayVisible(true);
24
+ setMessage(message);
25
+
26
+ if (delay) {
27
+ if (!showTimeoutRef.current) {
28
+ showTimeoutRef.current = setTimeout(() => {
29
+ setVisible(true);
30
+ showTimeoutRef.current = undefined;
31
+ }, delay);
32
+ }
33
+ } else {
34
+ if (showTimeoutRef.current) {
35
+ clearTimeout(showTimeoutRef.current);
36
+ showTimeoutRef.current = undefined;
37
+ }
38
+
39
+ setVisible(true);
40
+ }
41
+ },
42
+ []
43
+ );
44
+
45
+ const hideProgressIndicator = useCallback(() => {
46
+ setVisible(false);
47
+ setOverlayVisible(false);
48
+
49
+ if (showTimeoutRef.current) {
50
+ clearTimeout(showTimeoutRef.current);
51
+ showTimeoutRef.current = undefined;
52
+ }
53
+ }, []);
54
+
55
+ const contextValue = useMemo(
56
+ () => ({
57
+ overlayVisible,
58
+ visible,
59
+ message,
60
+ showProgressIndicator,
61
+ hideProgressIndicator,
62
+ }),
63
+ [
64
+ visible,
65
+ overlayVisible,
66
+ message,
67
+ showProgressIndicator,
68
+ hideProgressIndicator,
69
+ ]
70
+ );
71
+
72
+ return (
73
+ <ProgressIndicatorContext.Provider value={contextValue}>
74
+ {children}
75
+ </ProgressIndicatorContext.Provider>
76
+ );
77
+ };
@@ -0,0 +1,12 @@
1
+ import { createContext } from 'react';
2
+
3
+ export interface ProgressIndicatorContextState {
4
+ overlayVisible: boolean;
5
+ visible: boolean;
6
+ message?: string;
7
+ showProgressIndicator: (message?: string, delay?: number) => void;
8
+ hideProgressIndicator: () => void;
9
+ }
10
+
11
+ export const ProgressIndicatorContext =
12
+ createContext<ProgressIndicatorContextState>(null as any);
@@ -0,0 +1 @@
1
+ export * from './useProgressIndicator';
@@ -0,0 +1,15 @@
1
+ import { useContext } from 'react';
2
+
3
+ import { ProgressIndicatorContext } from '../context';
4
+
5
+ export function useProgressIndicator() {
6
+ const context = useContext(ProgressIndicatorContext);
7
+
8
+ if (!context) {
9
+ throw new Error(
10
+ 'useProgressIndicator must be used within a ProgressIndicatorProvider'
11
+ );
12
+ }
13
+
14
+ return context;
15
+ }
@@ -0,0 +1,6 @@
1
+ export {
2
+ ProgressIndicatorContext,
3
+ type ProgressIndicatorContextState,
4
+ } from './context';
5
+ export { ProgressIndicatorProvider } from './ProgressIndicatorProvider';
6
+ export * from './hooks';
@@ -0,0 +1,34 @@
1
+ import {
2
+ EntityMainFormCommandItemExperience,
3
+ Form,
4
+ } from '@headless-adminapp/core/experience/form';
5
+ import { Schema, SchemaAttributes } from '@headless-adminapp/core/schema';
6
+ import { PropsWithChildren } from 'react';
7
+
8
+ import { DataFormProvider } from '../../dataform/DataFormProvider';
9
+
10
+ interface PageEntityFormProviderProps<S extends SchemaAttributes> {
11
+ schema: Schema<S>;
12
+ form: Form<S>;
13
+ recordId?: string;
14
+ commands: EntityMainFormCommandItemExperience[][];
15
+ }
16
+
17
+ export function PageEntityFormProvider<S extends SchemaAttributes>({
18
+ schema,
19
+ form,
20
+ recordId,
21
+ children,
22
+ commands,
23
+ }: PropsWithChildren<PageEntityFormProviderProps<S>>) {
24
+ return (
25
+ <DataFormProvider
26
+ schema={schema}
27
+ form={form}
28
+ recordId={recordId}
29
+ commands={commands}
30
+ >
31
+ {children}
32
+ </DataFormProvider>
33
+ );
34
+ }
@@ -0,0 +1,39 @@
1
+ import { LocalizedDataLookup } from '@headless-adminapp/core/attributes';
2
+ import {
3
+ EntityMainGridCommandItemExperience,
4
+ View,
5
+ } from '@headless-adminapp/core/experience/view';
6
+ import { Schema, SchemaAttributes } from '@headless-adminapp/core/schema';
7
+ import { PropsWithChildren } from 'react';
8
+
9
+ import { DataGridProvider } from '../../datagrid/DataGridProvider';
10
+
11
+ interface PageEntityViewProviderProps<S extends SchemaAttributes> {
12
+ schema: Schema<S>;
13
+ view: View<S>;
14
+ commands: EntityMainGridCommandItemExperience[][];
15
+ availableViews: LocalizedDataLookup[];
16
+ onChangeView: (viewId: string) => void;
17
+ }
18
+
19
+ export function PageEntityViewProvider<S extends SchemaAttributes>({
20
+ availableViews,
21
+ commands,
22
+ schema,
23
+ view,
24
+ children,
25
+ onChangeView,
26
+ }: PropsWithChildren<PageEntityViewProviderProps<S>>) {
27
+ return (
28
+ <DataGridProvider
29
+ schema={schema}
30
+ view={view}
31
+ views={availableViews}
32
+ onChangeView={onChangeView}
33
+ commands={commands}
34
+ allowViewSelection
35
+ >
36
+ {children}
37
+ </DataGridProvider>
38
+ );
39
+ }
@@ -0,0 +1,55 @@
1
+ import { FC, PropsWithChildren, useEffect } from 'react';
2
+
3
+ import { useMetadata } from '../metadata/hooks/useMetadata';
4
+ import {
5
+ useContextSelector,
6
+ useContextSetValue,
7
+ useCreateContextStore,
8
+ } from '../mutable/context';
9
+ import { RecordSetContext, RecordSetContextState } from './context';
10
+
11
+ export const RecordSetProvider: FC<PropsWithChildren> = ({ children }) => {
12
+ const contextValue = useCreateContextStore<RecordSetContextState>({
13
+ logicalName: '',
14
+ ids: [],
15
+ cardView: null,
16
+ visibleNavigator: false,
17
+ });
18
+
19
+ return (
20
+ <RecordSetContext.Provider value={contextValue}>
21
+ <CardViewSetter />
22
+ {children}
23
+ </RecordSetContext.Provider>
24
+ );
25
+ };
26
+
27
+ const CardViewSetter: FC = () => {
28
+ const { experienceStore } = useMetadata();
29
+ const setValue = useContextSetValue(RecordSetContext);
30
+ const logicalName = useContextSelector(
31
+ RecordSetContext,
32
+ (state) => state.logicalName
33
+ );
34
+
35
+ useEffect(() => {
36
+ setValue({
37
+ cardView: null,
38
+ });
39
+
40
+ if (!logicalName) {
41
+ return;
42
+ }
43
+
44
+ experienceStore
45
+ .getViewLookupV2(logicalName)
46
+ .then((view) => {
47
+ setValue({
48
+ cardView: view.experience.card,
49
+ });
50
+ })
51
+ .catch(console.error);
52
+ }, [experienceStore, logicalName]);
53
+
54
+ return null;
55
+ };
@@ -0,0 +1,12 @@
1
+ import { CardView } from '@headless-adminapp/core/experience/view';
2
+
3
+ import { createContext } from '../mutable/context';
4
+
5
+ export interface RecordSetContextState {
6
+ logicalName: string;
7
+ ids: (string | number)[];
8
+ cardView: CardView | null;
9
+ visibleNavigator: boolean;
10
+ }
11
+
12
+ export const RecordSetContext = createContext<RecordSetContextState>();
@@ -0,0 +1,3 @@
1
+ export * from './useRecordSetResult';
2
+ export * from './useRecordSetSetter';
3
+ export * from './useRecordSetVisibility';