@headless-adminapp/fluent 0.0.17-alpha.7 → 1.0.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 (270) hide show
  1. package/App/App.d.ts +0 -1
  2. package/App/App.js +2 -4
  3. package/App/AppHeaderContianer.d.ts +5 -1
  4. package/App/AppHeaderContianer.js +43 -26
  5. package/App/AppLogo.js +15 -4
  6. package/App/AppUI.js +9 -1
  7. package/App/LayoutProvider.d.ts +7 -0
  8. package/App/LayoutProvider.js +17 -0
  9. package/App/NavigationContainer.d.ts +10 -1
  10. package/App/NavigationContainer.js +22 -22
  11. package/App/QuickActionItem.js +2 -2
  12. package/App/utils.js +3 -4
  13. package/CommandBar/Button.d.ts +2 -1
  14. package/CommandBar/Button.js +2 -2
  15. package/CommandBar/Divider.d.ts +2 -1
  16. package/CommandBar/Divider.js +2 -2
  17. package/CommandBar/IconButton.d.ts +2 -1
  18. package/CommandBar/IconButton.js +2 -2
  19. package/CommandBar/Label.d.ts +2 -1
  20. package/CommandBar/Label.js +2 -2
  21. package/CommandBar/MenuButton.d.ts +2 -1
  22. package/CommandBar/MenuButton.js +3 -3
  23. package/CommandBar/MenuItem.js +5 -4
  24. package/CommandBar/MenuItems.js +4 -4
  25. package/CommandBar/MenuList.js +5 -4
  26. package/CommandBar/Wrapper.d.ts +2 -2
  27. package/CommandBar/Wrapper.js +2 -2
  28. package/CommandBar/index.d.ts +6 -6
  29. package/DataGrid/ActionCell.d.ts +1 -1
  30. package/DataGrid/ActionCell.js +8 -4
  31. package/DataGrid/CustomizeColumns/AddColumns.js +35 -37
  32. package/DataGrid/CustomizeColumns/ColumnItem.js +8 -6
  33. package/DataGrid/CustomizeColumns/CustomizeColumns.d.ts +2 -2
  34. package/DataGrid/CustomizeColumns/CustomizeColumns.js +3 -6
  35. package/DataGrid/FormSubgridViewSelector.js +1 -5
  36. package/DataGrid/GridColumnHeader/ConditionValueControl.js +19 -25
  37. package/DataGrid/GridColumnHeader/FilterForm.js +9 -10
  38. package/DataGrid/GridColumnHeader/OperatorSelect.js +10 -3
  39. package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +22 -13
  40. package/DataGrid/GridColumnHeader/utils.js +10 -7
  41. package/DataGrid/GridHeaderDesktop.js +4 -5
  42. package/DataGrid/GridHeaderMobile.d.ts +5 -0
  43. package/DataGrid/GridHeaderMobile.js +29 -0
  44. package/DataGrid/GridListContainer.d.ts +12 -0
  45. package/DataGrid/GridListContainer.js +93 -0
  46. package/DataGrid/GridPaginationContainer.js +1 -2
  47. package/DataGrid/GridTableContainer.js +113 -77
  48. package/DataGrid/TableCell/TableCellBase.d.ts +2 -2
  49. package/DataGrid/TableCell/TableCellBase.js +6 -1
  50. package/DataGrid/TableCell/TableCellCheckbox.js +6 -5
  51. package/DataGrid/TableCell/TableCellChoice.d.ts +15 -0
  52. package/DataGrid/TableCell/TableCellChoice.js +30 -0
  53. package/DataGrid/TableCell/TableCellLink.d.ts +2 -1
  54. package/DataGrid/TableCell/TableCellLink.js +13 -5
  55. package/DataGrid/TableCell/TableCellText.js +9 -4
  56. package/DataGrid/types.d.ts +5 -0
  57. package/DataGrid/types.js +2 -0
  58. package/DataGrid/useTableColumns.d.ts +2 -3
  59. package/DataGrid/useTableColumns.js +297 -155
  60. package/DialogContainer/AlertDialog.js +3 -6
  61. package/DialogContainer/ConfirmDialog.js +5 -9
  62. package/DialogContainer/DialogContainer.js +2 -13
  63. package/DialogContainer/ErrorDialog.js +3 -6
  64. package/DialogContainer/PromptDialog.d.ts +13 -2
  65. package/DialogContainer/PromptDialog.js +44 -39
  66. package/Insights/CommandBarContainer.d.ts +1 -0
  67. package/Insights/CommandBarContainer.js +18 -0
  68. package/Insights/FilterBarContainer.d.ts +1 -0
  69. package/Insights/FilterBarContainer.js +99 -0
  70. package/Insights/Grid.d.ts +6 -0
  71. package/Insights/Grid.js +26 -0
  72. package/Insights/InsightsContainer.d.ts +1 -0
  73. package/Insights/InsightsContainer.js +35 -0
  74. package/Insights/WidgetChartContainer.d.ts +7 -0
  75. package/Insights/WidgetChartContainer.js +56 -0
  76. package/Insights/WidgetDataGridContainer.d.ts +4 -0
  77. package/Insights/WidgetDataGridContainer.js +80 -0
  78. package/Insights/WidgetTableContainer.d.ts +7 -0
  79. package/Insights/WidgetTableContainer.js +57 -0
  80. package/Insights/WidgetTileContainer.d.ts +7 -0
  81. package/Insights/WidgetTileContainer.js +24 -0
  82. package/Insights/WidgetTitleBar.d.ts +7 -0
  83. package/Insights/WidgetTitleBar.js +21 -0
  84. package/Insights/Widgets.d.ts +4 -0
  85. package/Insights/Widgets.js +57 -0
  86. package/Insights/charts/AreaChart.d.ts +5 -0
  87. package/Insights/charts/AreaChart.js +20 -0
  88. package/Insights/charts/BarChart.d.ts +5 -0
  89. package/Insights/charts/BarChart.js +20 -0
  90. package/Insights/charts/ComposedChart.d.ts +5 -0
  91. package/Insights/charts/ComposedChart.js +19 -0
  92. package/Insights/charts/CustomTooltipContent.d.ts +7 -0
  93. package/Insights/charts/CustomTooltipContent.js +25 -0
  94. package/Insights/charts/GaugeChart.d.ts +5 -0
  95. package/Insights/charts/GaugeChart.js +8 -0
  96. package/Insights/charts/LineChart.d.ts +5 -0
  97. package/Insights/charts/LineChart.js +21 -0
  98. package/Insights/charts/OhlcChart.d.ts +6 -0
  99. package/Insights/charts/OhlcChart.js +119 -0
  100. package/Insights/charts/PieChart.d.ts +5 -0
  101. package/Insights/charts/PieChart.js +54 -0
  102. package/Insights/charts/RadarChart.d.ts +5 -0
  103. package/Insights/charts/RadarChart.js +38 -0
  104. package/Insights/charts/ScatterChart.d.ts +5 -0
  105. package/Insights/charts/ScatterChart.js +81 -0
  106. package/Insights/charts/constants.d.ts +1 -0
  107. package/Insights/charts/constants.js +25 -0
  108. package/Insights/charts/formatters.d.ts +14 -0
  109. package/Insights/charts/formatters.js +186 -0
  110. package/Insights/charts/index.d.ts +4 -0
  111. package/Insights/charts/index.js +13 -0
  112. package/Insights/charts/renderers.d.ts +10 -0
  113. package/Insights/charts/renderers.js +64 -0
  114. package/Insights/hooks/useQueriesData.d.ts +7 -0
  115. package/Insights/hooks/useQueriesData.js +90 -0
  116. package/Insights/hooks/useWidgetDetail.d.ts +10 -0
  117. package/Insights/hooks/useWidgetDetail.js +39 -0
  118. package/OverflowCommandBar/OverflowCommandBar.js +1 -4
  119. package/OverflowCommandBar/OverflowMenu.js +5 -17
  120. package/OverflowCommandBar/render.js +3 -4
  121. package/OverflowCommandBar/utils.js +2 -3
  122. package/PageBoard/BoardColumn.d.ts +5 -0
  123. package/PageBoard/BoardColumn.js +9 -0
  124. package/PageBoard/BoardColumnCard.d.ts +12 -0
  125. package/PageBoard/BoardColumnCard.js +29 -0
  126. package/PageBoard/BoardColumnUI.d.ts +2 -0
  127. package/PageBoard/BoardColumnUI.js +76 -0
  128. package/PageBoard/BoardingColumnCardLoading.d.ts +1 -0
  129. package/PageBoard/BoardingColumnCardLoading.js +21 -0
  130. package/PageBoard/Header.d.ts +7 -0
  131. package/PageBoard/Header.js +31 -0
  132. package/PageBoard/PageBoard.d.ts +7 -0
  133. package/PageBoard/PageBoard.js +46 -0
  134. package/PageBoard/index.d.ts +1 -0
  135. package/PageBoard/index.js +5 -0
  136. package/PageCalendar/CalendarSection.d.ts +20 -0
  137. package/PageCalendar/CalendarSection.js +108 -0
  138. package/PageCalendar/EventDialog/AttributeController.d.ts +10 -0
  139. package/PageCalendar/EventDialog/AttributeController.js +17 -0
  140. package/PageCalendar/EventDialog/EventDialog.d.ts +25 -0
  141. package/PageCalendar/EventDialog/EventDialog.js +21 -0
  142. package/PageCalendar/EventDialog/EventFormBody.d.ts +18 -0
  143. package/PageCalendar/EventDialog/EventFormBody.js +69 -0
  144. package/PageCalendar/EventDialog/EventFormContent.d.ts +10 -0
  145. package/PageCalendar/EventDialog/EventFormContent.js +27 -0
  146. package/PageCalendar/EventDialog/types.d.ts +3 -0
  147. package/PageCalendar/EventDialog/types.js +2 -0
  148. package/PageCalendar/EventDialog/utils.d.ts +23 -0
  149. package/PageCalendar/EventDialog/utils.js +57 -0
  150. package/PageCalendar/Header.d.ts +8 -0
  151. package/PageCalendar/Header.js +35 -0
  152. package/PageCalendar/PageCalendar.d.ts +7 -0
  153. package/PageCalendar/PageCalendar.js +231 -0
  154. package/PageCalendar/TitleSelector.d.ts +10 -0
  155. package/PageCalendar/TitleSelector.js +73 -0
  156. package/PageCalendar/ViewSelector.d.ts +8 -0
  157. package/PageCalendar/ViewSelector.js +52 -0
  158. package/PageCalendar/baseEventAttributes.d.ts +35 -0
  159. package/PageCalendar/baseEventAttributes.js +38 -0
  160. package/PageCalendar/context.d.ts +20 -0
  161. package/PageCalendar/context.js +5 -0
  162. package/PageCalendar/hooks/index.d.ts +1 -0
  163. package/PageCalendar/hooks/index.js +17 -0
  164. package/PageCalendar/hooks/useConfig.d.ts +3 -0
  165. package/PageCalendar/hooks/useConfig.js +8 -0
  166. package/PageCalendar/index.d.ts +1 -0
  167. package/PageCalendar/index.js +5 -0
  168. package/PageCalendar/renderEventContent.d.ts +2 -0
  169. package/PageCalendar/renderEventContent.js +22 -0
  170. package/PageCalendar/types.d.ts +5 -0
  171. package/PageCalendar/types.js +9 -0
  172. package/PageCalendar/utils.d.ts +3 -0
  173. package/PageCalendar/utils.js +17 -0
  174. package/PageEntityForm/CommandContainer.js +9 -5
  175. package/PageEntityForm/PageCustomEntityForm.d.ts +15 -0
  176. package/PageEntityForm/PageCustomEntityForm.js +17 -0
  177. package/PageEntityForm/PageEntityFormDesktopContainer.js +42 -22
  178. package/PageEntityForm/ProcessFlow.d.ts +10 -0
  179. package/PageEntityForm/ProcessFlow.js +84 -0
  180. package/PageEntityForm/RecordAvatar.d.ts +2 -0
  181. package/PageEntityForm/RecordAvatar.js +83 -0
  182. package/PageEntityForm/RecordCard.d.ts +1 -1
  183. package/PageEntityForm/RecordCard.js +60 -53
  184. package/PageEntityForm/RecordCardLoading.d.ts +8 -0
  185. package/PageEntityForm/RecordCardLoading.js +24 -0
  186. package/PageEntityForm/RecordSetNavigatorContainer.js +1 -2
  187. package/PageEntityForm/RelatedViewSelector.d.ts +0 -2
  188. package/PageEntityForm/RelatedViewSelector.js +37 -11
  189. package/PageEntityForm/SectionContainer.d.ts +2 -2
  190. package/PageEntityForm/SectionContainer.js +77 -13
  191. package/PageEntityForm/StandardControl.d.ts +1 -22
  192. package/PageEntityForm/StandardControl.js +103 -117
  193. package/PageEntityForm/SubgridControl.d.ts +1 -0
  194. package/PageEntityForm/SubgridControl.js +4 -2
  195. package/PageEntityForm/UploadImageDialog.d.ts +12 -0
  196. package/PageEntityForm/UploadImageDialog.js +114 -0
  197. package/PageEntityView/FormSubgridContainer.js +5 -2
  198. package/PageEntityView/FormSubgridNotAvailableContainer.d.ts +2 -0
  199. package/PageEntityView/FormSubgridNotAvailableContainer.js +48 -0
  200. package/PageEntityView/PageEntityView.js +4 -1
  201. package/PageEntityView/PageEntityViewDesktopFrame.js +1 -0
  202. package/PageEntityView/PageEntityViewMobileContainer.d.ts +2 -0
  203. package/PageEntityView/PageEntityViewMobileContainer.js +14 -0
  204. package/PageEntityView/PageEntityViewStringContext.d.ts +2 -0
  205. package/PageEntityView/PageEntityViewStringContext.js +2 -0
  206. package/PageInsights/PageInsights.d.ts +9 -0
  207. package/PageInsights/PageInsights.js +25 -0
  208. package/PageInsights/index.d.ts +1 -0
  209. package/PageInsights/index.js +6 -0
  210. package/ToastNotificationContainer/index.js +1 -2
  211. package/componentStore.d.ts +2 -0
  212. package/componentStore.js +5 -0
  213. package/components/BodyLoading.d.ts +1 -1
  214. package/components/BodyLoading.js +13 -8
  215. package/components/DndProvider.d.ts +12 -0
  216. package/components/DndProvider.js +68 -0
  217. package/components/LoginForm.js +5 -21
  218. package/form/FormControl.js +19 -41
  219. package/form/controls/AttachmentControl.d.ts +27 -0
  220. package/form/controls/AttachmentControl.js +220 -0
  221. package/form/controls/AttachmentsControl.d.ts +6 -0
  222. package/form/controls/AttachmentsControl.js +35 -0
  223. package/form/controls/CurrencyControl.js +38 -6
  224. package/form/controls/DateControl.d.ts +1 -1
  225. package/form/controls/DateControl.js +15 -3
  226. package/form/controls/DateRangeControl.js +4 -6
  227. package/form/controls/DateTimeControl.d.ts +1 -1
  228. package/form/controls/DateTimeControl.js +107 -12
  229. package/form/controls/DecimalControl.d.ts +5 -0
  230. package/form/controls/DecimalControl.js +52 -0
  231. package/form/controls/DurationControl.d.ts +4 -0
  232. package/form/controls/DurationControl.js +209 -0
  233. package/form/controls/EmailControl.d.ts +1 -1
  234. package/form/controls/EmailControl.js +5 -5
  235. package/form/controls/IntegerControl.d.ts +4 -0
  236. package/form/controls/IntegerControl.js +25 -0
  237. package/form/controls/LookupControl.d.ts +1 -0
  238. package/form/controls/LookupControl.js +57 -13
  239. package/form/controls/MultiSelectControl.js +3 -3
  240. package/form/controls/MultiSelectLookupControl.js +16 -17
  241. package/form/controls/PasswordControl.js +1 -1
  242. package/form/controls/RichTextControl.d.ts +5 -0
  243. package/form/controls/RichTextControl.js +33 -0
  244. package/form/controls/SelectControl.js +4 -5
  245. package/form/controls/SwitchControl.d.ts +1 -1
  246. package/form/controls/SwitchControl.js +4 -2
  247. package/form/controls/TelephoneControl.d.ts +1 -1
  248. package/form/controls/TelephoneControl.js +26 -4
  249. package/form/controls/TextAreaControl.d.ts +1 -1
  250. package/form/controls/TextAreaControl.js +6 -6
  251. package/form/controls/TextControl.js +4 -4
  252. package/form/controls/UrlControl.d.ts +4 -0
  253. package/form/controls/UrlControl.js +16 -0
  254. package/form/controls/useLookupData.js +26 -41
  255. package/form/layout/FormSection/FormSection.js +10 -3
  256. package/form/layout/FormTab/FormTab.js +4 -4
  257. package/form/types.d.ts +2 -2
  258. package/package.json +17 -12
  259. package/styles.css +149 -0
  260. package/types/index.d.ts +18 -0
  261. package/utils/avatar.d.ts +2 -0
  262. package/utils/avatar.js +45 -0
  263. package/App/AppProvider.d.ts +0 -9
  264. package/App/AppProvider.js +0 -50
  265. package/DataGrid/ScrollbarWithMoreDataRequest.d.ts +0 -9
  266. package/DataGrid/ScrollbarWithMoreDataRequest.js +0 -33
  267. package/DataGrid/getAttributeFormattedValue.d.ts +0 -16
  268. package/DataGrid/getAttributeFormattedValue.js +0 -92
  269. package/form/controls/NumberControl.d.ts +0 -4
  270. package/form/controls/NumberControl.js +0 -16
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BoardColumnUI = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const context_1 = require("@headless-adminapp/app/board/context");
7
+ const hooks_1 = require("@headless-adminapp/app/board/hooks");
8
+ const hooks_2 = require("@headless-adminapp/app/command/hooks");
9
+ const ScrollbarWithMoreDataRequest_1 = require("@headless-adminapp/app/components/ScrollbarWithMoreDataRequest");
10
+ const context_2 = require("@headless-adminapp/app/mutable/context");
11
+ const react_1 = require("react");
12
+ const DndProvider_1 = require("../components/DndProvider");
13
+ const BoardColumnCard_1 = require("./BoardColumnCard");
14
+ const BoardingColumnCardLoading_1 = require("./BoardingColumnCardLoading");
15
+ const BoardColumnUI = () => {
16
+ const data = (0, hooks_1.useBoardColumnData)();
17
+ const dataState = (0, hooks_1.useBoardColumnDataState)();
18
+ const fetchNextPage = (0, context_2.useContextSelector)(context_1.BoardColumnContext, (state) => state.fetchNextPage);
19
+ const { columnId, acceptSourceIds, title, updateFn } = (0, hooks_1.useBoardColumnConfig)();
20
+ const { PreviewComponent, schema, columnConfigs } = (0, hooks_1.useBoardConfig)();
21
+ const baseContext = (0, hooks_2.useBaseCommandHandlerContext)();
22
+ const { useDrop } = (0, DndProvider_1.useDndContext)();
23
+ const ref = (0, react_1.useRef)(null);
24
+ const [{ handlerId, over, canDrop }, drop] = useDrop({
25
+ accept: acceptSourceIds,
26
+ collect(monitor) {
27
+ return {
28
+ handlerId: monitor.getHandlerId(),
29
+ over: monitor.isOver(),
30
+ canDrop: monitor.canDrop(),
31
+ };
32
+ },
33
+ drop: (item) => {
34
+ (async () => {
35
+ await updateFn?.({
36
+ ...baseContext,
37
+ primaryControl: {
38
+ logicalName: schema.logicalName,
39
+ id: item.id,
40
+ schema: schema,
41
+ },
42
+ });
43
+ })().catch(console.error);
44
+ },
45
+ });
46
+ const canDrag = (0, react_1.useMemo)(() => {
47
+ return columnConfigs.some((config) => config.acceptSourceIds.length > 0);
48
+ }, [columnConfigs]);
49
+ drop(ref);
50
+ return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: {
51
+ display: 'flex',
52
+ flexDirection: 'column',
53
+ flex: 1,
54
+ borderRadius: react_components_1.tokens.borderRadiusXLarge,
55
+ outline: over
56
+ ? `2px dashed ${react_components_1.tokens.colorBrandBackground}`
57
+ : canDrop
58
+ ? `2px dashed ${react_components_1.tokens.colorNeutralStroke1}`
59
+ : 'none',
60
+ outlineOffset: -5,
61
+ paddingTop: react_components_1.tokens.spacingVerticalS,
62
+ }, "data-handler-id": handlerId, children: [(0, jsx_runtime_1.jsx)("div", { style: {
63
+ display: 'flex',
64
+ paddingInline: react_components_1.tokens.spacingHorizontalS,
65
+ alignItems: 'center',
66
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: title }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } })] }) }), (0, jsx_runtime_1.jsx)(ScrollbarWithMoreDataRequest_1.ScrollbarWithMoreDataRequest, { data: data?.records, hasMore: dataState?.hasNextPage, onRequestMore: () => {
67
+ fetchNextPage();
68
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
69
+ display: 'flex',
70
+ flexDirection: 'column',
71
+ gap: react_components_1.tokens.spacingHorizontalM,
72
+ padding: react_components_1.tokens.spacingHorizontalS,
73
+ }, children: [data?.records.map((record, index) => ((0, jsx_runtime_1.jsx)(BoardColumnCard_1.BoardColumnCard, { record: record, index: index, columnId: columnId, canDrag: canDrag, PreviewComponent: PreviewComponent, schema: schema }, index))), dataState.isFetching &&
74
+ Array.from({ length: 5 }).map((_, index) => ((0, jsx_runtime_1.jsx)(BoardingColumnCardLoading_1.BoardingColumnCardLoading, {}, index)))] }) })] }));
75
+ };
76
+ exports.BoardColumnUI = BoardColumnUI;
@@ -0,0 +1 @@
1
+ export declare function BoardingColumnCardLoading(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BoardingColumnCardLoading = BoardingColumnCardLoading;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ function BoardingColumnCardLoading() {
7
+ return ((0, jsx_runtime_1.jsxs)(react_components_1.Skeleton, { style: {
8
+ backgroundColor: react_components_1.tokens.colorNeutralBackground1,
9
+ borderRadius: react_components_1.tokens.borderRadiusLarge,
10
+ padding: react_components_1.tokens.spacingHorizontalM,
11
+ display: 'flex',
12
+ flexDirection: 'column',
13
+ gap: react_components_1.tokens.spacingVerticalM,
14
+ }, children: [(0, jsx_runtime_1.jsx)(react_components_1.SkeletonItem, { style: {
15
+ height: 16,
16
+ width: '100%',
17
+ } }), (0, jsx_runtime_1.jsx)(react_components_1.SkeletonItem, { style: {
18
+ height: 16,
19
+ width: '50%',
20
+ } })] }));
21
+ }
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ interface HeaderProps {
3
+ title: string;
4
+ subtitle: string;
5
+ }
6
+ export declare const Header: FC<HeaderProps>;
7
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Header = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ // eslint-disable-next-line simple-import-sort/imports
6
+ const react_components_1 = require("@fluentui/react-components");
7
+ const react_query_1 = require("@tanstack/react-query");
8
+ const hooks_1 = require("@headless-adminapp/app/board/hooks");
9
+ const icons_1 = require("@headless-adminapp/icons");
10
+ const AppStringContext_1 = require("../App/AppStringContext");
11
+ const Header = ({ title, subtitle }) => {
12
+ const client = (0, react_query_1.useQueryClient)();
13
+ const schema = (0, hooks_1.useBoardSchema)();
14
+ const [searchText, setSearchText] = (0, hooks_1.useSearchText)();
15
+ const appStrings = (0, AppStringContext_1.useAppStrings)();
16
+ const refresh = async () => {
17
+ await client.invalidateQueries({
18
+ queryKey: ['data', 'retriveRecords', schema.logicalName],
19
+ });
20
+ };
21
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
22
+ display: 'flex',
23
+ alignItems: 'center',
24
+ gap: react_components_1.tokens.spacingHorizontalM,
25
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Subtitle2, { style: { color: react_components_1.tokens.colorNeutralForeground1 }, children: title }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground2 }, children: subtitle })] }) }) }), (0, jsx_runtime_1.jsxs)("div", { style: {
26
+ display: 'flex',
27
+ alignItems: 'center',
28
+ gap: react_components_1.tokens.spacingHorizontalS,
29
+ }, children: [(0, jsx_runtime_1.jsx)(react_components_1.SearchBox, { appearance: "filled-darker", placeholder: appStrings.searchPlaceholder, value: searchText, onChange: (e, data) => setSearchText(data.value) }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Refresh, { size: 20 }), onClick: refresh })] })] }));
30
+ };
31
+ exports.Header = Header;
@@ -0,0 +1,7 @@
1
+ import { BoardConfig } from '@headless-adminapp/app/board/types';
2
+ import { SchemaAttributes } from '@headless-adminapp/core/schema';
3
+ interface PageBoardProps<S extends SchemaAttributes = SchemaAttributes> {
4
+ config: BoardConfig<S>;
5
+ }
6
+ export declare function PageBoard<S extends SchemaAttributes = SchemaAttributes>(props: Readonly<PageBoardProps<S>>): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageBoard = PageBoard;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const context_1 = require("@headless-adminapp/app/board/context");
7
+ const context_2 = require("@headless-adminapp/app/mutable/context");
8
+ const react_1 = require("react");
9
+ const DndProvider_1 = require("../components/DndProvider");
10
+ const BoardColumn_1 = require("./BoardColumn");
11
+ const Header_1 = require("./Header");
12
+ function PageBoard(props) {
13
+ const contextValue = (0, context_2.useCreateContextStore)({
14
+ config: props.config,
15
+ searchText: '',
16
+ });
17
+ (0, react_1.useEffect)(() => {
18
+ contextValue.setValue({
19
+ config: props.config,
20
+ searchText: '',
21
+ });
22
+ }, [contextValue, props.config]);
23
+ return ((0, jsx_runtime_1.jsx)(context_1.BoardContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(DndProvider_1.DndProvider, { children: (0, jsx_runtime_1.jsxs)("div", { style: {
24
+ display: 'flex',
25
+ flexDirection: 'column',
26
+ flex: 1,
27
+ gap: react_components_1.tokens.spacingVerticalM,
28
+ padding: react_components_1.tokens.spacingHorizontalL,
29
+ background: react_components_1.tokens.colorNeutralBackground3,
30
+ }, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("div", { style: {
31
+ display: 'flex',
32
+ flexDirection: 'column',
33
+ background: react_components_1.tokens.colorNeutralBackground1,
34
+ borderRadius: react_components_1.tokens.borderRadiusLarge,
35
+ paddingBlock: react_components_1.tokens.spacingVerticalM,
36
+ paddingInline: react_components_1.tokens.spacingHorizontalM,
37
+ gap: react_components_1.tokens.spacingVerticalM,
38
+ boxShadow: react_components_1.tokens.shadow4,
39
+ }, children: (0, jsx_runtime_1.jsx)(Header_1.Header, { title: props.config.title, subtitle: props.config.description }) }) }), (0, jsx_runtime_1.jsx)("div", { style: {
40
+ display: 'flex',
41
+ flexDirection: 'row',
42
+ flex: 1,
43
+ marginInline: -6,
44
+ marginTop: react_components_1.tokens.spacingVerticalM,
45
+ }, children: props.config.columnConfigs.map((config) => ((0, jsx_runtime_1.jsx)(BoardColumn_1.BoardColumn, { config: config }, config.columnId))) })] }) }) }));
46
+ }
@@ -0,0 +1 @@
1
+ export { PageBoard } from './PageBoard';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageBoard = void 0;
4
+ var PageBoard_1 = require("./PageBoard");
5
+ Object.defineProperty(exports, "PageBoard", { enumerable: true, get: function () { return PageBoard_1.PageBoard; } });
@@ -0,0 +1,20 @@
1
+ import { DateSelectArg, EventClickArg, EventInput } from '@fullcalendar/core';
2
+ import { ViewType } from './types';
3
+ interface CalendarSectionProps {
4
+ startDate: Date | null;
5
+ endDate: Date | null;
6
+ viewType: ViewType;
7
+ onRangeChange?: (props: {
8
+ currentStart: Date;
9
+ currentEnd: Date;
10
+ activeStart: Date;
11
+ activeEnd: Date;
12
+ viewType: ViewType;
13
+ }) => void;
14
+ events: EventInput[];
15
+ onEventClick?: (event: EventClickArg) => void;
16
+ onDateSelect?: (event: DateSelectArg) => void;
17
+ loading?: boolean;
18
+ }
19
+ export declare const CalendarSection: ({ startDate, endDate, viewType, onRangeChange, events, onDateSelect, onEventClick, loading, }: Readonly<CalendarSectionProps>) => import("react/jsx-runtime").JSX.Element;
20
+ export {};
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CalendarSection = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_components_1 = require("@fluentui/react-components");
9
+ const daygrid_1 = __importDefault(require("@fullcalendar/daygrid"));
10
+ const interaction_1 = __importDefault(require("@fullcalendar/interaction"));
11
+ const react_1 = __importDefault(require("@fullcalendar/react"));
12
+ const timegrid_1 = __importDefault(require("@fullcalendar/timegrid"));
13
+ const locale_1 = require("@headless-adminapp/app/locale");
14
+ const icons_1 = require("@headless-adminapp/icons");
15
+ const dayjs_1 = __importDefault(require("dayjs"));
16
+ const isoWeek_1 = __importDefault(require("dayjs/plugin/isoWeek"));
17
+ const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
18
+ const utc_1 = __importDefault(require("dayjs/plugin/utc"));
19
+ const react_2 = require("react");
20
+ const BodyLoading_1 = require("../components/BodyLoading");
21
+ const renderEventContent_1 = require("./renderEventContent");
22
+ const TitleSelector_1 = require("./TitleSelector");
23
+ const types_1 = require("./types");
24
+ const ViewSelector_1 = require("./ViewSelector");
25
+ dayjs_1.default.extend(utc_1.default);
26
+ dayjs_1.default.extend(timezone_1.default);
27
+ dayjs_1.default.extend(isoWeek_1.default);
28
+ const CalendarSection = ({ startDate, endDate, viewType, onRangeChange, events, onDateSelect, onEventClick, loading, }) => {
29
+ const calendarRef = (0, react_2.useRef)(null);
30
+ const { timezone } = (0, locale_1.useLocale)();
31
+ const isToday = (0, react_2.useMemo)(() => {
32
+ if (!startDate || !endDate) {
33
+ return false;
34
+ }
35
+ let today = (0, dayjs_1.default)().tz(timezone);
36
+ if (viewType === types_1.ViewType.Month) {
37
+ today = today.startOf('month');
38
+ }
39
+ else if (viewType === types_1.ViewType.Week) {
40
+ today = today.startOf('isoWeek');
41
+ }
42
+ return (today.format('YYYY-MM-DD') ===
43
+ (0, dayjs_1.default)(startDate).tz(timezone).format('YYYY-MM-DD'));
44
+ }, [startDate, endDate, timezone, viewType]);
45
+ function handleDateRangeChange(props) {
46
+ const currentStart = props.view.currentStart;
47
+ const currentEnd = props.view.currentEnd;
48
+ const activeStart = props.view.activeStart;
49
+ const activeEnd = props.view.activeEnd;
50
+ switch (props.view.type) {
51
+ case types_1.ViewType.Month:
52
+ onRangeChange?.({
53
+ currentStart: currentStart, //dayjs(currentStart).tz(timezone).startOf('month').toDate(),
54
+ currentEnd: currentEnd, // dayjs(currentEnd).tz(timezone).endOf('month').toDate(),
55
+ activeStart: activeStart, // dayjs(activeStart).tz(timezone).startOf('day').toDate(),
56
+ activeEnd: activeEnd, // dayjs(activeEnd).tz(timezone).endOf('day').toDate(),
57
+ viewType: types_1.ViewType.Month,
58
+ });
59
+ break;
60
+ case types_1.ViewType.Week:
61
+ onRangeChange?.({
62
+ currentStart: (0, dayjs_1.default)(currentStart)
63
+ .tz(timezone)
64
+ .startOf('isoWeek')
65
+ .toDate(),
66
+ currentEnd: (0, dayjs_1.default)(currentEnd).tz(timezone).endOf('isoWeek').toDate(),
67
+ activeStart: (0, dayjs_1.default)(activeStart).tz(timezone).startOf('day').toDate(),
68
+ activeEnd: (0, dayjs_1.default)(activeEnd).tz(timezone).endOf('day').toDate(),
69
+ viewType: types_1.ViewType.Week,
70
+ });
71
+ break;
72
+ case types_1.ViewType.Day:
73
+ onRangeChange?.({
74
+ currentStart: (0, dayjs_1.default)(currentStart)
75
+ .tz(timezone)
76
+ .startOf('day')
77
+ .toDate(),
78
+ currentEnd: (0, dayjs_1.default)(currentEnd).tz(timezone).endOf('day').toDate(),
79
+ activeStart: (0, dayjs_1.default)(activeStart).tz(timezone).startOf('day').toDate(),
80
+ activeEnd: (0, dayjs_1.default)(activeEnd).tz(timezone).endOf('day').toDate(),
81
+ viewType: types_1.ViewType.Day,
82
+ });
83
+ break;
84
+ }
85
+ }
86
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
87
+ display: 'flex',
88
+ flexDirection: 'column',
89
+ flex: 1,
90
+ position: 'relative',
91
+ background: react_components_1.tokens.colorNeutralBackground1,
92
+ padding: react_components_1.tokens.spacingHorizontalL,
93
+ borderRadius: react_components_1.tokens.borderRadiusMedium,
94
+ boxShadow: react_components_1.tokens.shadow2,
95
+ gap: react_components_1.tokens.spacingVerticalM,
96
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', gap: react_components_1.tokens.spacingHorizontalS }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { flex: 1, display: 'flex', gap: react_components_1.tokens.spacingHorizontalS }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "outline", style: { fontWeight: react_components_1.tokens.fontWeightMedium }, icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Calendar, {}), onClick: () => calendarRef.current?.getApi().today(), disabled: isToday, children: "Today" }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronLeft, {}), onClick: () => calendarRef.current?.getApi().prev() }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronRight, {}), onClick: () => calendarRef.current?.getApi().next() })] }), (0, jsx_runtime_1.jsx)(TitleSelector_1.TitleSelector, { start: startDate, end: endDate, onChange: (start) => {
97
+ const api = calendarRef.current?.getApi();
98
+ if (!api) {
99
+ return;
100
+ }
101
+ api.gotoDate(start);
102
+ }, viewType: viewType }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, justifyContent: 'flex-end' }, children: (0, jsx_runtime_1.jsx)(ViewSelector_1.ViewSelector, { viewType: viewType, onChange: (viewType) => {
103
+ calendarRef.current?.getApi().changeView(viewType);
104
+ } }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: { flex: 1, position: 'relative' }, children: [(0, jsx_runtime_1.jsx)("div", { style: { position: 'absolute', inset: 0 }, children: (0, jsx_runtime_1.jsx)(react_1.default, { ref: calendarRef, plugins: [daygrid_1.default, timegrid_1.default, interaction_1.default], initialView: types_1.ViewType.Month, weekends: true, firstDay: 1, events: events, datesSet: handleDateRangeChange, select: onDateSelect, eventClick: onEventClick, eventContent: renderEventContent_1.renderEventContent, timeZone: timezone, height: "100%", editable: false, selectable: true, selectMirror: true, dayMaxEvents: true, eventMinHeight: 24, eventTimeFormat: (props) => {
105
+ return (0, dayjs_1.default)(props.start.marker).tz(timezone).format('hh:mm A');
106
+ }, headerToolbar: false }) }), (0, jsx_runtime_1.jsx)(BodyLoading_1.BodyLoading, { loading: loading })] })] }));
107
+ };
108
+ exports.CalendarSection = CalendarSection;
@@ -0,0 +1,10 @@
1
+ import { Attribute } from '@headless-adminapp/core';
2
+ import { Path, UseFormReturn } from 'react-hook-form';
3
+ import { BaseFieldValues } from './types';
4
+ interface AttributeControllerProps {
5
+ attribute: Attribute;
6
+ attributeName: Path<BaseFieldValues>;
7
+ form: UseFormReturn<BaseFieldValues>;
8
+ }
9
+ export declare function AttributeController({ attribute, attributeName, form, }: Readonly<AttributeControllerProps>): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AttributeController = AttributeController;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_hook_form_1 = require("react-hook-form");
6
+ const SectionControl_1 = require("../../DataForm/SectionControl");
7
+ const StandardControl_1 = require("../../PageEntityForm/StandardControl");
8
+ function AttributeController({ attribute, attributeName, form, }) {
9
+ return ((0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: form.control, name: attributeName, render: ({ field, fieldState, formState }) => {
10
+ const isError = (fieldState.isTouched || formState.isSubmitted) &&
11
+ !!fieldState.error?.message;
12
+ const errorMessage = fieldState.isTouched || formState.isSubmitted
13
+ ? fieldState.error?.message
14
+ : '';
15
+ return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: attribute.label, labelPosition: "left", required: attribute.required, isError: isError, errorMessage: errorMessage, children: (0, jsx_runtime_1.jsx)(StandardControl_1.StandardControl, { attribute: attribute, name: attributeName, value: field.value, onChange: field.onChange, onBlur: field.onBlur, errorMessage: errorMessage, isError: isError, readOnly: attribute.readonly }) }));
16
+ } }));
17
+ }
@@ -0,0 +1,25 @@
1
+ import { BaseEventAttributes } from '@headless-adminapp/app/calendar/baseEventAttributes';
2
+ import { CalendarConfig, CalendarEventResolverFn } from '@headless-adminapp/app/calendar/types';
3
+ import { InferredSchemaType, SchemaAttributes } from '@headless-adminapp/core/schema';
4
+ import { Nullable } from '@headless-adminapp/core/types';
5
+ export declare function defineEventAttributes<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes>(beforeDescriptionAttributes?: SA1, afterDescriptionAttributes?: SA2): BaseEventAttributes & SA1 & SA2;
6
+ interface EventDialogProps<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes> {
7
+ isOpen: boolean;
8
+ title?: string;
9
+ beforeDescriptionAttributes?: SA1;
10
+ afterDescriptionAttributes?: SA2;
11
+ values: Partial<Nullable<InferredSchemaType<BaseEventAttributes>>>;
12
+ onSubmit?: (data: {
13
+ modifiedValues: Partial<Nullable<InferredSchemaType<BaseEventAttributes>>>;
14
+ values: Nullable<InferredSchemaType<BaseEventAttributes>>;
15
+ }) => Promise<void>;
16
+ onCancel?: () => void;
17
+ onDismiss?: () => void;
18
+ allowOpenRecord?: boolean;
19
+ onOpenRecord?: (id: string) => void;
20
+ onDelete?: (id: string) => void;
21
+ eventResolver?: CalendarEventResolverFn;
22
+ config: CalendarConfig;
23
+ }
24
+ export declare function EventDialog<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes>(props: Readonly<EventDialogProps<SA1, SA2>>): import("react/jsx-runtime").JSX.Element;
25
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineEventAttributes = defineEventAttributes;
4
+ exports.EventDialog = EventDialog;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_components_1 = require("@fluentui/react-components");
7
+ const baseEventAttributes_1 = require("@headless-adminapp/app/calendar/baseEventAttributes");
8
+ const utils_1 = require("@headless-adminapp/core/schema/utils");
9
+ const EventFormBody_1 = require("./EventFormBody");
10
+ function defineEventAttributes(beforeDescriptionAttributes, afterDescriptionAttributes) {
11
+ return (0, utils_1.defineSchemaAttributes)({
12
+ ...baseEventAttributes_1.baseEventAttributes,
13
+ ...beforeDescriptionAttributes,
14
+ ...afterDescriptionAttributes,
15
+ });
16
+ }
17
+ function EventDialog(props) {
18
+ return ((0, jsx_runtime_1.jsx)(react_components_1.Dialog, { open: props.isOpen, onOpenChange: () => {
19
+ props.onDismiss?.();
20
+ }, children: (0, jsx_runtime_1.jsx)(react_components_1.DialogSurface, { style: { maxWidth: 480 }, children: (0, jsx_runtime_1.jsx)(EventFormBody_1.EventFormBody, { values: props.values, config: props.config, onCancel: props.onCancel, onSubmit: props.onSubmit, allowOpenRecord: props.allowOpenRecord, onOpenRecord: props.onOpenRecord, onDelete: props.onDelete }) }) }));
21
+ }
@@ -0,0 +1,18 @@
1
+ import { BaseEventAttributes } from '@headless-adminapp/app/calendar/baseEventAttributes';
2
+ import { CalendarConfig } from '@headless-adminapp/app/calendar/types';
3
+ import { InferredSchemaType, SchemaAttributes } from '@headless-adminapp/core/schema';
4
+ import { Nullable } from '@headless-adminapp/core/types';
5
+ interface EventFormBodyProps<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes> {
6
+ values: Partial<Nullable<InferredSchemaType<BaseEventAttributes> & InferredSchemaType<SA1> & InferredSchemaType<SA2>>>;
7
+ onSubmit?: (data: {
8
+ modifiedValues: Partial<Nullable<InferredSchemaType<BaseEventAttributes>>>;
9
+ values: Nullable<InferredSchemaType<BaseEventAttributes>>;
10
+ }) => Promise<void>;
11
+ onCancel?: () => void;
12
+ allowOpenRecord?: boolean;
13
+ onOpenRecord?: (id: string) => void;
14
+ onDelete?: (id: string) => void;
15
+ config: CalendarConfig;
16
+ }
17
+ export declare function EventFormBody(props: Readonly<EventFormBodyProps>): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventFormBody = EventFormBody;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const baseEventAttributes_1 = require("@headless-adminapp/app/calendar/baseEventAttributes");
7
+ const saveRecord_1 = require("@headless-adminapp/app/dataform/utils/saveRecord");
8
+ const form_1 = require("@headless-adminapp/app/form");
9
+ const locale_1 = require("@headless-adminapp/app/locale");
10
+ const icons_fluent_1 = require("@headless-adminapp/icons-fluent");
11
+ const react_query_1 = require("@tanstack/react-query");
12
+ const react_1 = require("react");
13
+ const react_hook_form_1 = require("react-hook-form");
14
+ const BodyLoading_1 = require("../../components/BodyLoading");
15
+ const EventFormContent_1 = require("./EventFormContent");
16
+ const utils_1 = require("./utils");
17
+ function EventFormBody(props) {
18
+ const { language, region } = (0, locale_1.useLocale)();
19
+ const formValidationStrings = (0, form_1.useFormValidationStrings)();
20
+ const { data: record, isPending } = (0, react_query_1.useQuery)({
21
+ queryKey: ['calendar-events', 'event', props.values.id],
22
+ queryFn: async () => {
23
+ if (props.values.id && props.config.eventResolver) {
24
+ return props.config.eventResolver(props.values.id);
25
+ }
26
+ return null;
27
+ },
28
+ });
29
+ const form = (0, react_hook_form_1.useForm)({
30
+ mode: 'all',
31
+ defaultValues: props.values,
32
+ shouldUnregister: false,
33
+ resolver: (0, utils_1.formValidator)({
34
+ attributes: baseEventAttributes_1.baseEventAttributes,
35
+ language,
36
+ strings: formValidationStrings,
37
+ region,
38
+ }),
39
+ });
40
+ const formRef = (0, react_1.useRef)(form);
41
+ formRef.current = form;
42
+ const defaultValues = (0, react_1.useMemo)(() => {
43
+ return {
44
+ ...props.values,
45
+ ...record,
46
+ id: props.values.id,
47
+ title: props.values.title,
48
+ description: props.values.description,
49
+ start: props.values.start,
50
+ end: props.values.end,
51
+ allDay: props.values.allDay,
52
+ };
53
+ }, [record, props.values]);
54
+ (0, react_1.useEffect)(() => {
55
+ formRef.current.reset(defaultValues);
56
+ }, [defaultValues]);
57
+ return ((0, jsx_runtime_1.jsxs)(react_components_1.DialogBody, { children: [(0, jsx_runtime_1.jsxs)(react_components_1.DialogTitle, { action: props.values.id ? ((0, jsx_runtime_1.jsxs)(react_components_1.Menu, { positioning: "below-end", children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", "aria-label": "close", icon: (0, jsx_runtime_1.jsx)(icons_fluent_1.iconSet.MoreVertical, {}) }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsxs)(react_components_1.MenuList, { children: [props.allowOpenRecord && ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_fluent_1.iconSet.OpenInNew, { size: 20 }), onClick: () => props.onOpenRecord?.(props.values.id), children: "Open" })), (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_fluent_1.iconSet.Delete, { size: 20 }), onClick: () => props.onDelete?.(props.values.id), children: "Delete" })] }) })] })) : null, children: [props.values.id ? 'Edit' : 'New', ' ', props.config.eventLabel.toLowerCase()] }), (0, jsx_runtime_1.jsx)(EventFormContent_1.EventFormContent, { form: form, afterDescriptionAttributes: props.config.afterDescriptionAttributes, beforeDescriptionAttributes: props.config.beforeDescriptionAttributes }), (0, jsx_runtime_1.jsxs)(react_components_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "primary", disabled: form.formState.submitCount > 0 && !form.formState.isValid, onClick: async () => {
58
+ await form.handleSubmit(async (values) => {
59
+ await props.onSubmit?.({
60
+ modifiedValues: values.id
61
+ ? (0, saveRecord_1.getModifiedValues)(defaultValues, values)
62
+ : values,
63
+ values,
64
+ });
65
+ })();
66
+ }, children: props.values.id ? 'Save' : 'Create' }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "secondary", type: "button", onClick: () => {
67
+ props.onCancel?.();
68
+ }, children: props.values.id ? 'Close' : 'Cancel' })] }), (0, jsx_runtime_1.jsx)(BodyLoading_1.BodyLoading, { loading: isPending })] }));
69
+ }
@@ -0,0 +1,10 @@
1
+ import { SchemaAttributes } from '@headless-adminapp/core/schema';
2
+ import { UseFormReturn } from 'react-hook-form';
3
+ import { BaseFieldValues } from './types';
4
+ interface EventFormContentProps<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes> {
5
+ form: UseFormReturn<BaseFieldValues>;
6
+ beforeDescriptionAttributes?: SA1;
7
+ afterDescriptionAttributes?: SA2;
8
+ }
9
+ export declare function EventFormContent<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes>({ form, afterDescriptionAttributes, beforeDescriptionAttributes, }: Readonly<EventFormContentProps<SA1, SA2>>): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventFormContent = EventFormContent;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const baseEventAttributes_1 = require("@headless-adminapp/app/calendar/baseEventAttributes");
7
+ const AttributeController_1 = require("./AttributeController");
8
+ function EventFormContent({ form, afterDescriptionAttributes, beforeDescriptionAttributes, }) {
9
+ const allDay = form.watch('allDay');
10
+ return ((0, jsx_runtime_1.jsx)(react_components_1.DialogContent, { children: (0, jsx_runtime_1.jsxs)("div", { style: {
11
+ display: 'flex',
12
+ flexDirection: 'column',
13
+ gap: react_components_1.tokens.spacingVerticalM,
14
+ marginTop: react_components_1.tokens.spacingVerticalL,
15
+ marginBottom: react_components_1.tokens.spacingVerticalL,
16
+ }, children: [(0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: "title", attribute: baseEventAttributes_1.baseEventAttributes.title }), (0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: "start", attribute: {
17
+ ...baseEventAttributes_1.baseEventAttributes.start,
18
+ ...(allDay ? { format: 'date' } : { format: 'datetime' }),
19
+ } }), (0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: "end", attribute: {
20
+ ...baseEventAttributes_1.baseEventAttributes.end,
21
+ ...(allDay ? { format: 'date' } : { format: 'datetime' }),
22
+ } }), (0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: "allDay", attribute: baseEventAttributes_1.baseEventAttributes.allDay }), Object.entries(beforeDescriptionAttributes ?? {}).map(([attributeName, attribute]) => {
23
+ return ((0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: attributeName, attribute: attribute }, attributeName));
24
+ }), (0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: "description", attribute: baseEventAttributes_1.baseEventAttributes.description }), Object.entries(afterDescriptionAttributes ?? {}).map(([attributeName, attribute]) => {
25
+ return ((0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: attributeName, attribute: attribute }, attributeName));
26
+ })] }) }));
27
+ }
@@ -0,0 +1,3 @@
1
+ import { BaseEventAttributes } from '@headless-adminapp/app/calendar/baseEventAttributes';
2
+ import { InferredSchemaType } from '@headless-adminapp/core/schema';
3
+ export type BaseFieldValues = InferredSchemaType<BaseEventAttributes>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,23 @@
1
+ import { FormValidationStringSet } from '@headless-adminapp/app/form';
2
+ import { SchemaAttributes } from '@headless-adminapp/core/schema';
3
+ import * as yup from 'yup';
4
+ export declare const formValidator: (<A extends SchemaAttributes = SchemaAttributes>({ attributes, language, strings, region, }: {
5
+ attributes: A;
6
+ language: string;
7
+ strings: FormValidationStringSet;
8
+ region: string;
9
+ }) => (values: Record<string, any>, context: any, options: any) => Promise<import("react-hook-form").ResolverResult<{
10
+ [x: string]: any;
11
+ [x: number]: any;
12
+ [x: symbol]: any;
13
+ }>>) & import("lodash").MemoizedFunction;
14
+ export declare const generateValidationSchema: (<A extends SchemaAttributes = SchemaAttributes>({ attributes, language, strings, region, }: {
15
+ attributes: A;
16
+ language: string;
17
+ strings: FormValidationStringSet;
18
+ region: string;
19
+ }) => yup.ObjectSchema<{
20
+ [x: string]: any;
21
+ }, yup.AnyObject, {
22
+ [x: string]: any;
23
+ }, "">) & import("lodash").MemoizedFunction;