@headless-adminapp/fluent 1.0.2 → 1.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 (132) hide show
  1. package/App/AppHeaderContianer.js +5 -1
  2. package/App/AppUI.js +7 -2
  3. package/App/Navigation/NavCategoryItemComponent.d.ts +8 -0
  4. package/App/Navigation/NavCategoryItemComponent.js +20 -0
  5. package/App/Navigation/NavItemComponent.d.ts +8 -0
  6. package/App/Navigation/NavItemComponent.js +19 -0
  7. package/App/Navigation/NavSubItemComponent.d.ts +8 -0
  8. package/App/Navigation/NavSubItemComponent.js +17 -0
  9. package/App/Navigation/NavigationContainer.d.ts +9 -0
  10. package/App/Navigation/NavigationContainer.js +85 -0
  11. package/App/Navigation/index.d.ts +1 -0
  12. package/App/Navigation/index.js +5 -0
  13. package/App/Navigation/types.d.ts +39 -0
  14. package/App/Navigation/types.js +2 -0
  15. package/App/Navigation/utils.d.ts +18 -0
  16. package/App/Navigation/utils.js +82 -0
  17. package/App/QuickActionItem.d.ts +3 -0
  18. package/App/QuickActionItem.js +12 -3
  19. package/CommandBar/Button.d.ts +1 -0
  20. package/CommandBar/Button.js +22 -2
  21. package/CommandBar/IconButton.d.ts +1 -0
  22. package/CommandBar/MenuButton.d.ts +1 -0
  23. package/CommandBar/MenuItem.d.ts +1 -0
  24. package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +3 -1
  25. package/DataGrid/GridHeaderContainer.d.ts +1 -0
  26. package/DataGrid/GridHeaderContainer.js +6 -1
  27. package/DataGrid/GridHeaderDesktopV2.d.ts +6 -0
  28. package/DataGrid/GridHeaderDesktopV2.js +54 -0
  29. package/DataGrid/GridListContainer.js +9 -5
  30. package/DataGrid/GridTableContainer.d.ts +2 -0
  31. package/DataGrid/GridTableContainer.js +37 -13
  32. package/DataGrid/TableCell/TableCellAction.js +2 -1
  33. package/DataGrid/TableCell/TableCellBase.js +1 -0
  34. package/DataGrid/TableCell/TableCellLink.js +1 -0
  35. package/DataGrid/constants.d.ts +2 -0
  36. package/DataGrid/constants.js +5 -0
  37. package/DataGrid/useTableColumns.js +23 -6
  38. package/Insights/CommandBarContainer.js +1 -1
  39. package/Insights/FilterBarContainer.js +8 -8
  40. package/Insights/Grid.d.ts +7 -1
  41. package/Insights/Grid.js +24 -8
  42. package/Insights/Header.d.ts +6 -0
  43. package/Insights/Header.js +50 -0
  44. package/Insights/InsightsContainer.js +19 -14
  45. package/Insights/WidgetChartContainer.d.ts +13 -3
  46. package/Insights/WidgetChartContainer.js +62 -38
  47. package/Insights/WidgetDataGridContainer.d.ts +11 -4
  48. package/Insights/WidgetDataGridContainer.js +7 -27
  49. package/Insights/WidgetSection.d.ts +2 -0
  50. package/Insights/WidgetSection.js +16 -0
  51. package/Insights/WidgetTableContainer.d.ts +9 -2
  52. package/Insights/WidgetTableContainer.js +7 -18
  53. package/Insights/WidgetTileContainer.d.ts +0 -2
  54. package/Insights/WidgetTileContainer.js +8 -11
  55. package/Insights/WidgetTitleBar.d.ts +1 -1
  56. package/Insights/WidgetTitleBar.js +1 -1
  57. package/Insights/Widgets.d.ts +2 -2
  58. package/Insights/Widgets.js +15 -48
  59. package/Insights/charts/AreaChart.d.ts +1 -0
  60. package/Insights/charts/AreaChart.js +4 -1
  61. package/Insights/charts/BarChart.d.ts +1 -0
  62. package/Insights/charts/BarChart.js +3 -2
  63. package/Insights/charts/ComposedChart.d.ts +1 -0
  64. package/Insights/charts/ComposedChart.js +4 -1
  65. package/Insights/charts/FunnelChart.d.ts +6 -0
  66. package/Insights/charts/FunnelChart.js +50 -0
  67. package/Insights/charts/FunnelCustomTooltipContent.d.ts +5 -0
  68. package/Insights/charts/FunnelCustomTooltipContent.js +27 -0
  69. package/Insights/charts/GaugeChart.d.ts +1 -0
  70. package/Insights/charts/GaugeChart.js +1 -0
  71. package/Insights/charts/LineChart.d.ts +1 -0
  72. package/Insights/charts/LineChart.js +2 -2
  73. package/Insights/charts/OhlcChart.d.ts +1 -0
  74. package/Insights/charts/OhlcChart.js +1 -1
  75. package/Insights/charts/PieChart.d.ts +1 -0
  76. package/Insights/charts/PieChart.js +2 -1
  77. package/Insights/charts/RadarChart.d.ts +1 -0
  78. package/Insights/charts/RadarChart.js +1 -0
  79. package/Insights/charts/ScatterChart.d.ts +1 -0
  80. package/Insights/charts/ScatterChart.js +2 -1
  81. package/Insights/charts/renderers.d.ts +6 -5
  82. package/Insights/charts/renderers.js +16 -13
  83. package/Insights/constants.d.ts +4 -0
  84. package/Insights/constants.js +7 -0
  85. package/Insights/hooks/useQueriesData.d.ts +2 -2
  86. package/Insights/hooks/useQueriesData.js +0 -1
  87. package/OverflowCommandBar/render.js +3 -3
  88. package/PageBoard/BoardColumnUI.js +36 -7
  89. package/PageBoard/Header.js +5 -3
  90. package/PageBoard/PageBoard.js +7 -1
  91. package/PageCalendar/CalendarSection.js +37 -8
  92. package/PageCalendar/EventDialog/AttributeController.d.ts +2 -1
  93. package/PageCalendar/EventDialog/AttributeController.js +2 -2
  94. package/PageCalendar/EventDialog/EventFormBody.js +17 -2
  95. package/PageCalendar/EventDialog/EventFormContent.d.ts +4 -1
  96. package/PageCalendar/EventDialog/EventFormContent.js +7 -7
  97. package/PageCalendar/Header.js +1 -1
  98. package/PageCalendar/PageCalendar.js +6 -1
  99. package/PageCalendar/TitleSelector.js +8 -4
  100. package/PageEntityForm/PageCustomEntityForm.d.ts +1 -2
  101. package/PageEntityForm/PageCustomEntityForm.js +3 -4
  102. package/PageEntityForm/PageEntityFormDesktopContainer.js +4 -0
  103. package/PageEntityForm/RecordAvatar.js +1 -2
  104. package/PageEntityForm/RecordCard.js +17 -28
  105. package/PageEntityForm/RelatedViewSelector.js +1 -0
  106. package/PageEntityForm/SectionContainer.js +7 -1
  107. package/PageEntityView/PageEntityView.d.ts +1 -0
  108. package/PageEntityView/PageEntityView.js +12 -2
  109. package/PageEntityView/PageEntityViewDesktopContainer.d.ts +1 -0
  110. package/PageEntityView/PageEntityViewDesktopContainer.js +7 -3
  111. package/PageEntityView/PageEntityViewDesktopFrame.js +1 -1
  112. package/PageEntityView/PageEntityViewDesktopFrameV2.d.ts +8 -0
  113. package/PageEntityView/PageEntityViewDesktopFrameV2.js +48 -0
  114. package/PageEntityView/PageEntityViewMobileContainer.js +2 -3
  115. package/PageEntityView/PageEntityViewMobileFrame.d.ts +8 -0
  116. package/PageEntityView/PageEntityViewMobileFrame.js +38 -0
  117. package/PageInsight/PageInsight.d.ts +7 -0
  118. package/PageInsight/PageInsight.js +31 -0
  119. package/PageInsight/index.d.ts +1 -0
  120. package/PageInsight/index.js +5 -0
  121. package/PageInsights/PageInsights.d.ts +5 -7
  122. package/PageInsights/PageInsights.js +24 -18
  123. package/PageInsights/index.d.ts +1 -1
  124. package/PageInsights/index.js +1 -2
  125. package/components/ComponentBroken.d.ts +7 -0
  126. package/components/ComponentBroken.js +16 -0
  127. package/components/ComponentErrorBoundary.d.ts +15 -0
  128. package/components/ComponentErrorBoundary.js +26 -0
  129. package/form/controls/DateTimeControl.js +17 -3
  130. package/form/controls/DurationControl.js +0 -2
  131. package/form/controls/LookupControl.js +6 -3
  132. package/package.json +3 -3
@@ -3,3 +3,4 @@ export declare function LineChart({ dataset, chartInfo, }: Readonly<{
3
3
  dataset: any[];
4
4
  chartInfo: LineChartInfo;
5
5
  }>): import("react/jsx-runtime").JSX.Element;
6
+ export default LineChart;
@@ -13,9 +13,9 @@ function LineChart({ dataset, chartInfo, }) {
13
13
  const lines = chartInfo.lines;
14
14
  const xAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(xAxis.tick);
15
15
  const yAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(yAxis.tick);
16
- console.log('dataset', dataset, chartInfo);
17
- return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.LineChart, { children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderYAxis)(yAxis), (0, renderers_1.renderXAxis)(xAxis), (0, renderers_1.renderLines)(lines, dataset), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
16
+ return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.LineChart, { data: dataset[0], children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderYAxis)(yAxis), (0, renderers_1.renderXAxis)(xAxis), (0, renderers_1.renderLines)(lines), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
18
17
  stroke: react_components_1.tokens.colorNeutralBackground6,
19
18
  opacity: 0.5,
20
19
  }, content: ({ active, payload, label }) => ((0, jsx_runtime_1.jsx)(CustomTooltipContent_1.CustomTooltipContent, { xAxisFormatter: xAxisFullFormatter, yAxisFormatter: yAxisFullFormatter, active: active, payload: payload, label: label })) })] }) }));
21
20
  }
21
+ exports.default = LineChart;
@@ -4,3 +4,4 @@ export declare function OhlcChart({ dataset, chartInfo, }: Readonly<{
4
4
  dataset: any[];
5
5
  chartInfo: OhlcChartInfo;
6
6
  }>): import("react/jsx-runtime").JSX.Element;
7
+ export default OhlcChart;
@@ -46,7 +46,6 @@ function OhlcChart({ dataset, chartInfo, }) {
46
46
  const xAxisFormatter = (0, formatters_1.createAxisFormatter)(xAxis.tick);
47
47
  const xAxisLongFormatter = (0, formatters_1.createLongAxisFormatter)(chartInfo.xAxis.tick);
48
48
  const yAxisLongFormatter = (0, formatters_1.createLongAxisFormatter)(chartInfo.yAxis.tick);
49
- console.log('temp.data', dataset, chartInfo);
50
49
  return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.ScatterChart, { data: data, children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderYAxis)({
51
50
  ...chartInfo.yAxis,
52
51
  domain,
@@ -117,3 +116,4 @@ function renderShape(props, { chartInfo, bar, }) {
117
116
  }
118
117
  return ((0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)(recharts_1.Rectangle, { x: x + width / 2, y: yAxis.scale(high), width: 1, height: yAxis.scale(low) - yAxis.scale(high), fill: color, stroke: color, strokeWidth: 1 }), (0, jsx_runtime_1.jsx)(recharts_1.Rectangle, { x: xPosition - xWidth / 2, y: Math.min(yAxis.scale(open), yAxis.scale(close)), width: xWidth, height: Math.abs(yAxis.scale(close) - yAxis.scale(open)), fill: color, stroke: color, strokeWidth: 1 })] }));
119
118
  }
119
+ exports.default = OhlcChart;
@@ -3,3 +3,4 @@ export declare function PieChart({ dataset, chartInfo, }: Readonly<{
3
3
  dataset: any[];
4
4
  chartInfo: PieChartInfo;
5
5
  }>): import("react/jsx-runtime").JSX.Element;
6
+ export default PieChart;
@@ -21,7 +21,7 @@ function PieChart({ dataset, chartInfo, }) {
21
21
  const item = chartInfo.pie[0];
22
22
  const nameFormatter = (0, formatters_1.createLongAxisFormatter)(item.nameTick);
23
23
  const valueFormatter = (0, formatters_1.createLongAxisFormatter)(item.dataTick);
24
- return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.PieChart, { children: [(0, jsx_runtime_1.jsx)(recharts_1.Pie, { data: dataset[item.dataIndex ?? 0], cx: "50%", cy: "50%", labelLine: false, label: renderCustomizedLabel, outerRadius: 80, dataKey: item.dataKey, nameKey: item.nameKey, children: dataset[item.dataIndex ?? 0].map((entry, index) => ((0, jsx_runtime_1.jsx)(recharts_1.Cell, { fill: item.colorKey && entry[item.colorKey]
24
+ return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.PieChart, { children: [(0, jsx_runtime_1.jsx)(recharts_1.Pie, { data: dataset[item.dataIndex ?? 0], cx: "50%", cy: "50%", labelLine: false, label: renderCustomizedLabel, outerRadius: 80, dataKey: item.dataKey, nameKey: item.nameKey, blendStroke: true, legendType: "circle", children: dataset[item.dataIndex ?? 0].map((entry, index) => ((0, jsx_runtime_1.jsx)(recharts_1.Cell, { fill: item.colorKey && entry[item.colorKey]
25
25
  ? entry[item.colorKey]
26
26
  : (item.colors ?? constants_1.defaultColors)[index % (item.colors ?? constants_1.defaultColors).length] }, 'cell-' + String(index)))) }), chartInfo.showLegend && ((0, jsx_runtime_1.jsx)(recharts_1.Legend, { align: "right", layout: "vertical", verticalAlign: "top", wrapperStyle: {
27
27
  fontSize: react_components_1.tokens.fontSizeBase100,
@@ -52,3 +52,4 @@ function renderTooltipContent({ payload, nameFormatter, valueFormatter, }) {
52
52
  marginLeft: 8,
53
53
  }, children: nameFormatter(item.name) }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, minWidth: 50 } }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: valueFormatter(item.value) })] }, index))) }) }));
54
54
  }
55
+ exports.default = PieChart;
@@ -3,3 +3,4 @@ export declare function RadarChart({ dataset, chartInfo, }: Readonly<{
3
3
  dataset: any[];
4
4
  chartInfo: RadarChartInfo;
5
5
  }>): import("react/jsx-runtime").JSX.Element;
6
+ export default RadarChart;
@@ -36,3 +36,4 @@ function renderTooltipContent({ payload, nameFormatter, valueFormatter, radar, }
36
36
  marginLeft: 8,
37
37
  }, children: nameFormatter(item.payload[radar.nameKey]) }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, minWidth: 50 } }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: valueFormatter(item.value) })] }, index))) }) }));
38
38
  }
39
+ exports.default = RadarChart;
@@ -3,3 +3,4 @@ export declare function ScatterChart({ dataset, chartInfo, }: Readonly<{
3
3
  dataset: any[];
4
4
  chartInfo: ScatterChartInfo;
5
5
  }>): import("react/jsx-runtime").JSX.Element;
6
+ export default ScatterChart;
@@ -9,7 +9,7 @@ const constants_1 = require("./constants");
9
9
  const formatters_1 = require("./formatters");
10
10
  const renderers_1 = require("./renderers");
11
11
  function ScatterChart({ dataset, chartInfo, }) {
12
- return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.ScatterChart, { children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderXAxis)(chartInfo.xAxis), (0, renderers_1.renderYAxis)(chartInfo.yAxis), (0, jsx_runtime_1.jsx)(recharts_1.ZAxis, { type: "number", dataKey: chartInfo.zAxis.dataKey, range: chartInfo.zAxis.range, name: chartInfo.zAxis.name }), chartInfo.scatters.map((scatter, index) => ((0, jsx_runtime_1.jsx)(recharts_1.Scatter, { yAxisId: "left", name: scatter.dataLabel, data: dataset[scatter.dataIndex ?? 0], dataKey: scatter.dataKey, fill: scatter.color ?? constants_1.defaultColors[index] }, index))), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: false, content: (props) => {
12
+ return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.ScatterChart, { children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderXAxis)(chartInfo.xAxis, false, { left: 10, right: 10 }), (0, renderers_1.renderYAxis)(chartInfo.yAxis), (0, jsx_runtime_1.jsx)(recharts_1.ZAxis, { type: "number", dataKey: chartInfo.zAxis.dataKey, range: chartInfo.zAxis.range, name: chartInfo.zAxis.name }), chartInfo.scatters.map((scatter, index) => ((0, jsx_runtime_1.jsx)(recharts_1.Scatter, { yAxisId: "left", name: scatter.dataLabel, data: dataset[scatter.dataIndex ?? 0], dataKey: scatter.dataKey, fill: scatter.color ?? constants_1.defaultColors[index] }, index))), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: false, content: (props) => {
13
13
  if (!props.active || !props.payload?.length) {
14
14
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
15
15
  }
@@ -79,3 +79,4 @@ const ScatterTooltipContent = (props) => {
79
79
  borderRadius: 4,
80
80
  } }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4, marginLeft: 8 }, children: item.name }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, minWidth: 50 } }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: zAxisFormatter(item.value) })] }, index)))] }) }));
81
81
  };
82
+ exports.default = ScatterChart;
@@ -1,10 +1,11 @@
1
1
  import { AreaInfo, BarInfo, LineInfo, XAxis, YAxis } from '@headless-adminapp/core/experience/insights';
2
- export declare function renderXAxis(axis: XAxis, forceCategory?: boolean): import("react/jsx-runtime").JSX.Element;
2
+ import { XAxisProps } from 'recharts';
3
+ export declare function renderXAxis(axis: XAxis, forceCategory?: boolean, padding?: XAxisProps['padding']): import("react/jsx-runtime").JSX.Element;
3
4
  export declare function renderYAxis(axis: YAxis): import("react/jsx-runtime").JSX.Element;
4
5
  export declare function renderGrid(): import("react/jsx-runtime").JSX.Element;
5
- export declare function renderLine(line: LineInfo, dataset: any[]): import("react/jsx-runtime").JSX.Element;
6
- export declare function renderLines(lines: LineInfo[], dataset: any[]): import("react/jsx-runtime").JSX.Element[];
7
- export declare function renderArea(area: AreaInfo, dataset: any[]): import("react/jsx-runtime").JSX.Element;
8
- export declare function renderAreas(areas: AreaInfo[], dataset: any[]): import("react/jsx-runtime").JSX.Element[];
6
+ export declare function renderLine(line: LineInfo): import("react/jsx-runtime").JSX.Element;
7
+ export declare function renderLines(lines: LineInfo[]): import("react/jsx-runtime").JSX.Element[];
8
+ export declare function renderArea(area: AreaInfo, chartId: string): import("react/jsx-runtime").JSX.Element;
9
+ export declare function renderAreas(areas: AreaInfo[], chartId: string): import("react/jsx-runtime").JSX.Element[];
9
10
  export declare function renderBar(bar: BarInfo, dataset: any[]): import("react/jsx-runtime").JSX.Element;
10
11
  export declare function renderBars(bars: BarInfo[], dataset: any[]): import("react/jsx-runtime").JSX.Element[];
@@ -11,13 +11,14 @@ exports.renderBar = renderBar;
11
11
  exports.renderBars = renderBars;
12
12
  const jsx_runtime_1 = require("react/jsx-runtime");
13
13
  const react_components_1 = require("@fluentui/react-components");
14
+ const react_1 = require("react");
14
15
  const recharts_1 = require("recharts");
15
16
  const formatters_1 = require("./formatters");
16
- function renderXAxis(axis, forceCategory = false) {
17
+ function renderXAxis(axis, forceCategory = false, padding = 'gap') {
17
18
  const xAxisFormatter = (0, formatters_1.createAxisFormatter)(axis.tick);
18
19
  return ((0, jsx_runtime_1.jsx)(recharts_1.XAxis, { dataKey: axis.dataKey, name: axis.name, tickFormatter: xAxisFormatter, tickLine: false, minTickGap: 10,
19
20
  // padding={{ left: 10, right: 10 }}
20
- padding: "gap", axisLine: {
21
+ padding: padding, axisLine: {
21
22
  stroke: react_components_1.tokens.colorNeutralBackground6,
22
23
  }, fontSize: react_components_1.tokens.fontSizeBase100, tick: {
23
24
  fill: react_components_1.tokens.colorNeutralForeground1,
@@ -35,28 +36,30 @@ function renderGrid() {
35
36
  return ((0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, { strokeDasharray: "8 4", vertical: false, strokeWidth: 0.2, stroke: react_components_1.tokens.colorNeutralBackground6 }));
36
37
  }
37
38
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
- function renderLine(line, dataset) {
39
- return ((0, jsx_runtime_1.jsx)(recharts_1.Line, { yAxisId: 'left', type: line.curveType, data: dataset[line.dataIndex ?? 0], dataKey: line.dataKey, name: line.dataLabel, stroke: line.color, strokeWidth: 2, dot: false, activeDot: {
39
+ function renderLine(line) {
40
+ return ((0, jsx_runtime_1.jsx)(recharts_1.Line, { yAxisId: 'left', type: line.curveType, dataKey: line.dataKey, name: line.dataLabel, stroke: line.color, strokeWidth: 2, dot: false, activeDot: {
40
41
  stroke: line.color,
41
42
  } }, line.dataKey));
42
43
  }
43
44
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
- function renderLines(lines, dataset) {
45
- return lines.map((line) => renderLine(line, dataset));
45
+ function renderLines(lines) {
46
+ return lines.map((line) => renderLine(line));
46
47
  }
47
48
  // eslint-disable-next-line unused-imports/no-unused-vars
48
- function renderArea(area, dataset) {
49
- return ((0, jsx_runtime_1.jsx)(recharts_1.Area, { yAxisId: 'left', type: area.curveType, dataKey: area.dataKey, name: area.dataLabel, stroke: area.color, fill: area.color, strokeWidth: 1, dot: false, activeDot: {
50
- stroke: area.color,
51
- } }, area.dataKey));
49
+ function renderArea(area, chartId) {
50
+ return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("linearGradient", { id: chartId + ':' + area.dataKey, x1: "0", y1: "0", x2: "0", y2: "1", children: [(0, jsx_runtime_1.jsx)("stop", { offset: "5%", stopColor: area.color, stopOpacity: 0.8 }), (0, jsx_runtime_1.jsx)("stop", { offset: "95%", stopColor: area.color, stopOpacity: 0 })] }) }), (0, jsx_runtime_1.jsx)(recharts_1.Area, { yAxisId: 'left', type: area.curveType, dataKey: area.dataKey, name: area.dataLabel, stroke: area.color,
51
+ // fill={area.color}
52
+ fill: `url(#${chartId}:${area.dataKey})`, strokeWidth: 2, dot: false, activeDot: {
53
+ stroke: area.color,
54
+ } })] }, area.dataKey));
52
55
  }
53
56
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
54
- function renderAreas(areas, dataset) {
55
- return areas.map((area) => renderArea(area, dataset));
57
+ function renderAreas(areas, chartId) {
58
+ return areas.map((area) => renderArea(area, chartId));
56
59
  }
57
60
  // eslint-disable-next-line unused-imports/no-unused-vars
58
61
  function renderBar(bar, dataset) {
59
- return ((0, jsx_runtime_1.jsx)(recharts_1.Bar, { yAxisId: 'left', type: bar.curveType, dataKey: bar.dataKey, name: bar.dataLabel, stroke: bar.color, fill: bar.color, strokeWidth: 1, stackId: bar.stackId }, bar.dataKey));
62
+ return ((0, jsx_runtime_1.jsx)(recharts_1.Bar, { yAxisId: 'left', type: bar.curveType, dataKey: bar.dataKey, name: bar.dataLabel, stroke: bar.color, fill: bar.color, strokeWidth: 1, stackId: bar.stackId, radius: bar.radius, barSize: bar.barSize }, bar.dataKey));
60
63
  }
61
64
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
65
  function renderBars(bars, dataset) {
@@ -0,0 +1,4 @@
1
+ export declare const ROW_HEIGHT = 100;
2
+ export declare const GAP = 20;
3
+ export declare const COLUMN_GAP = 20;
4
+ export declare const ROW_GAP = 20;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ROW_GAP = exports.COLUMN_GAP = exports.GAP = exports.ROW_HEIGHT = void 0;
4
+ exports.ROW_HEIGHT = 100;
5
+ exports.GAP = 20;
6
+ exports.COLUMN_GAP = exports.GAP;
7
+ exports.ROW_GAP = exports.GAP;
@@ -2,6 +2,6 @@ import { DataSetItemAllowFunction } from '@headless-adminapp/core/experience/ins
2
2
  export declare function useQueriesData(queries: DataSetItemAllowFunction[]): {
3
3
  isPending: boolean;
4
4
  isFetching: boolean;
5
- dataset: unknown[];
6
- refetch: () => Promise<import("@tanstack/react-query").QueryObserverResult<unknown, Error>>[];
5
+ dataset: any[];
6
+ refetch: () => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>[];
7
7
  };
@@ -19,7 +19,6 @@ function useQueriesData(queries) {
19
19
  const resolvedQueries = (0, react_1.useMemo)(() => {
20
20
  return queries.map((item) => {
21
21
  if (typeof item === 'function') {
22
- console.log('temp.item', item, item(insightsState, widgetState));
23
22
  return item(insightsState, widgetState);
24
23
  }
25
24
  return item;
@@ -12,13 +12,13 @@ function renderCommandItem(key, item, language) {
12
12
  const commandType = item.type;
13
13
  switch (item.type) {
14
14
  case 'menu':
15
- return ((0, jsx_runtime_1.jsx)(MenuButton_1.CommandMenuButton, { Icon: item.Icon, text: item.localizedTexts?.[language] ?? item.text ?? '', danger: item.danger, disabled: item.disabled, onClick: item.onClick, items: item.items?.map((x) => (0, utils_1.transformMenuItems)(x, language)) }, key));
15
+ return ((0, jsx_runtime_1.jsx)(MenuButton_1.CommandMenuButton, { Icon: item.Icon, text: item.localizedTexts?.[language] ?? item.text ?? '', danger: item.danger, disabled: item.disabled, appearance: item.appearance, onClick: item.onClick, items: item.items?.map((x) => (0, utils_1.transformMenuItems)(x, language)) }, key));
16
16
  case 'button':
17
- return ((0, jsx_runtime_1.jsx)(CommandBar_1.default.Button, { text: item.localizedTexts?.[language] ?? item.text ?? '', Icon: item.Icon, iconPosition: item.iconPosition ?? 'before', danger: item.danger, disabled: item.disabled, onClick: item.onClick }, key));
17
+ return ((0, jsx_runtime_1.jsx)(CommandBar_1.default.Button, { text: item.localizedTexts?.[language] ?? item.text ?? '', Icon: item.Icon, iconPosition: item.iconPosition ?? 'before', danger: item.danger, disabled: item.disabled, onClick: item.onClick, appearance: item.appearance }, key));
18
18
  case 'label':
19
19
  return ((0, jsx_runtime_1.jsx)(CommandBar_1.default.Label, { text: item.localizedTexts?.[language] ?? item.text ?? '', Icon: item.Icon }, key));
20
20
  case 'icon':
21
- return ((0, jsx_runtime_1.jsx)(CommandBar_1.default.IconButton, { Icon: item.Icon, danger: item.danger, disabled: item.disabled, onClick: item.onClick }, key));
21
+ return ((0, jsx_runtime_1.jsx)(CommandBar_1.default.IconButton, { Icon: item.Icon, danger: item.danger, disabled: item.disabled, onClick: item.onClick, appearance: item.appearance }, key));
22
22
  default:
23
23
  throw new Error(`Unknown command type: ${commandType}`);
24
24
  }
@@ -8,6 +8,7 @@ const hooks_1 = require("@headless-adminapp/app/board/hooks");
8
8
  const hooks_2 = require("@headless-adminapp/app/command/hooks");
9
9
  const ScrollbarWithMoreDataRequest_1 = require("@headless-adminapp/app/components/ScrollbarWithMoreDataRequest");
10
10
  const context_2 = require("@headless-adminapp/app/mutable/context");
11
+ const icons_1 = require("@headless-adminapp/icons");
11
12
  const react_1 = require("react");
12
13
  const DndProvider_1 = require("../components/DndProvider");
13
14
  const BoardColumnCard_1 = require("./BoardColumnCard");
@@ -16,8 +17,8 @@ const BoardColumnUI = () => {
16
17
  const data = (0, hooks_1.useBoardColumnData)();
17
18
  const dataState = (0, hooks_1.useBoardColumnDataState)();
18
19
  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)();
20
+ const { columnId, acceptSourceIds, updateFn } = (0, hooks_1.useBoardColumnConfig)();
21
+ const { PreviewComponent, HeaderComponent = ColumnHeaderComponent, emptyMessage = 'Nothing to show here. Drag and drop items from other columns.', schema, columnConfigs, minColumnWidth, maxColumnWidth, } = (0, hooks_1.useBoardConfig)();
21
22
  const baseContext = (0, hooks_2.useBaseCommandHandlerContext)();
22
23
  const { useDrop } = (0, DndProvider_1.useDndContext)();
23
24
  const ref = (0, react_1.useRef)(null);
@@ -47,6 +48,7 @@ const BoardColumnUI = () => {
47
48
  return columnConfigs.some((config) => config.acceptSourceIds.length > 0);
48
49
  }, [columnConfigs]);
49
50
  drop(ref);
51
+ const isEmpty = !data?.records.length && !dataState.isFetching;
50
52
  return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: {
51
53
  display: 'flex',
52
54
  flexDirection: 'column',
@@ -59,11 +61,24 @@ const BoardColumnUI = () => {
59
61
  : 'none',
60
62
  outlineOffset: -5,
61
63
  paddingTop: react_components_1.tokens.spacingVerticalS,
62
- }, "data-handler-id": handlerId, children: [(0, jsx_runtime_1.jsx)("div", { style: {
64
+ minWidth: minColumnWidth ?? 240,
65
+ maxWidth: maxColumnWidth ?? 400,
66
+ }, "data-handler-id": handlerId, children: [(0, jsx_runtime_1.jsx)(HeaderComponent, {}), isEmpty && ((0, jsx_runtime_1.jsx)("div", { style: {
67
+ padding: react_components_1.tokens.spacingHorizontalS,
63
68
  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: () => {
69
+ flex: 1,
70
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
71
+ display: 'flex',
72
+ flex: 1,
73
+ justifyContent: 'center',
74
+ alignItems: 'center',
75
+ flexDirection: 'column',
76
+ gap: react_components_1.tokens.spacingVerticalM,
77
+ color: react_components_1.tokens.colorNeutralForeground3,
78
+ padding: react_components_1.tokens.spacingVerticalXXXL,
79
+ borderRadius: react_components_1.tokens.borderRadiusLarge,
80
+ backgroundColor: react_components_1.tokens.colorNeutralBackground1,
81
+ }, children: [(0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 56, opacity: 0.8 }), (0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { textAlign: 'center' }, children: emptyMessage })] }) })), !isEmpty && ((0, jsx_runtime_1.jsx)(ScrollbarWithMoreDataRequest_1.ScrollbarWithMoreDataRequest, { data: data?.records, hasMore: dataState?.hasNextPage, onRequestMore: () => {
67
82
  fetchNextPage();
68
83
  }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
69
84
  display: 'flex',
@@ -71,6 +86,20 @@ const BoardColumnUI = () => {
71
86
  gap: react_components_1.tokens.spacingHorizontalM,
72
87
  padding: react_components_1.tokens.spacingHorizontalS,
73
88
  }, 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)))] }) })] }));
89
+ Array.from({ length: 5 }).map((_, index) => ((0, jsx_runtime_1.jsx)(BoardingColumnCardLoading_1.BoardingColumnCardLoading, {}, index)))] }) }))] }));
75
90
  };
76
91
  exports.BoardColumnUI = BoardColumnUI;
92
+ const ColumnHeaderComponent = () => {
93
+ const data = (0, hooks_1.useBoardColumnData)();
94
+ const { title } = (0, hooks_1.useBoardColumnConfig)();
95
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
96
+ display: 'flex',
97
+ paddingInline: react_components_1.tokens.spacingHorizontalS,
98
+ alignItems: 'center',
99
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
100
+ display: 'flex',
101
+ alignItems: 'center',
102
+ width: '100%',
103
+ gap: react_components_1.tokens.spacingHorizontalS,
104
+ }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: title }), !!data?.count && ((0, jsx_runtime_1.jsx)(react_components_1.CounterBadge, { color: "informative", children: data?.count })), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } })] }) }));
105
+ };
@@ -2,15 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Header = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- // eslint-disable-next-line simple-import-sort/imports
6
5
  const react_components_1 = require("@fluentui/react-components");
7
- const react_query_1 = require("@tanstack/react-query");
8
6
  const hooks_1 = require("@headless-adminapp/app/board/hooks");
7
+ const hooks_2 = require("@headless-adminapp/app/hooks");
9
8
  const icons_1 = require("@headless-adminapp/icons");
9
+ const react_query_1 = require("@tanstack/react-query");
10
10
  const AppStringContext_1 = require("../App/AppStringContext");
11
11
  const Header = ({ title, subtitle }) => {
12
12
  const client = (0, react_query_1.useQueryClient)();
13
13
  const schema = (0, hooks_1.useBoardSchema)();
14
+ const isMobile = (0, hooks_2.useIsMobile)();
14
15
  const [searchText, setSearchText] = (0, hooks_1.useSearchText)();
15
16
  const appStrings = (0, AppStringContext_1.useAppStrings)();
16
17
  const refresh = async () => {
@@ -20,7 +21,8 @@ const Header = ({ title, subtitle }) => {
20
21
  };
21
22
  return ((0, jsx_runtime_1.jsxs)("div", { style: {
22
23
  display: 'flex',
23
- alignItems: 'center',
24
+ flexDirection: isMobile ? 'column' : 'row',
25
+ alignItems: isMobile ? 'flex-start' : 'center',
24
26
  gap: react_components_1.tokens.spacingHorizontalM,
25
27
  }, 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
28
  display: 'flex',
@@ -4,6 +4,7 @@ exports.PageBoard = PageBoard;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
6
  const context_1 = require("@headless-adminapp/app/board/context");
7
+ const ScrollView_1 = require("@headless-adminapp/app/components/ScrollView");
7
8
  const context_2 = require("@headless-adminapp/app/mutable/context");
8
9
  const react_1 = require("react");
9
10
  const DndProvider_1 = require("../components/DndProvider");
@@ -42,5 +43,10 @@ function PageBoard(props) {
42
43
  flex: 1,
43
44
  marginInline: -6,
44
45
  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
+ }, children: (0, jsx_runtime_1.jsx)(ScrollView_1.ScrollView, { children: (0, jsx_runtime_1.jsx)("div", { style: {
47
+ display: 'flex',
48
+ flexDirection: 'row',
49
+ flex: 1,
50
+ height: '100%',
51
+ }, children: props.config.columnConfigs.map((config) => ((0, jsx_runtime_1.jsx)(BoardColumn_1.BoardColumn, { config: config }, config.columnId))) }) }) })] }) }) }));
46
52
  }
@@ -10,6 +10,7 @@ const daygrid_1 = __importDefault(require("@fullcalendar/daygrid"));
10
10
  const interaction_1 = __importDefault(require("@fullcalendar/interaction"));
11
11
  const react_1 = __importDefault(require("@fullcalendar/react"));
12
12
  const timegrid_1 = __importDefault(require("@fullcalendar/timegrid"));
13
+ const hooks_1 = require("@headless-adminapp/app/hooks");
13
14
  const locale_1 = require("@headless-adminapp/app/locale");
14
15
  const icons_1 = require("@headless-adminapp/icons");
15
16
  const dayjs_1 = __importDefault(require("dayjs"));
@@ -28,6 +29,7 @@ dayjs_1.default.extend(isoWeek_1.default);
28
29
  const CalendarSection = ({ startDate, endDate, viewType, onRangeChange, events, onDateSelect, onEventClick, loading, }) => {
29
30
  const calendarRef = (0, react_2.useRef)(null);
30
31
  const { timezone } = (0, locale_1.useLocale)();
32
+ const isMobile = (0, hooks_1.useIsMobile)();
31
33
  const isToday = (0, react_2.useMemo)(() => {
32
34
  if (!startDate || !endDate) {
33
35
  return false;
@@ -83,6 +85,18 @@ const CalendarSection = ({ startDate, endDate, viewType, onRangeChange, events,
83
85
  break;
84
86
  }
85
87
  }
88
+ const initialScrollTime = (0, react_2.useMemo)(() => {
89
+ const now = (0, dayjs_1.default)().tz(timezone);
90
+ if (now.hour() < 3) {
91
+ return '00:00:00';
92
+ }
93
+ const time = (0, dayjs_1.default)()
94
+ .tz(timezone)
95
+ .subtract(1, 'hour')
96
+ .startOf('hour')
97
+ .format('HH:mm:ss');
98
+ return time;
99
+ }, [timezone]);
86
100
  return ((0, jsx_runtime_1.jsxs)("div", { style: {
87
101
  display: 'flex',
88
102
  flexDirection: 'column',
@@ -93,15 +107,30 @@ const CalendarSection = ({ startDate, endDate, viewType, onRangeChange, events,
93
107
  borderRadius: react_components_1.tokens.borderRadiusMedium,
94
108
  boxShadow: react_components_1.tokens.shadow2,
95
109
  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) => {
110
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
111
+ display: 'flex',
112
+ gap: react_components_1.tokens.spacingHorizontalS,
113
+ flexDirection: isMobile ? 'column' : 'row',
114
+ }, 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() }), isMobile && ((0, jsx_runtime_1.jsx)("div", { style: { flex: 1, display: 'flex', justifyContent: 'flex-end' }, children: (0, jsx_runtime_1.jsx)(TitleSelector_1.TitleSelector, { start: startDate, end: endDate, onChange: (start) => {
115
+ const api = calendarRef.current?.getApi();
116
+ if (!api) {
117
+ return;
118
+ }
119
+ api.gotoDate(start);
120
+ }, viewType: viewType }) }))] }), !isMobile && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(TitleSelector_1.TitleSelector, { start: startDate, end: endDate, onChange: (start) => {
121
+ const api = calendarRef.current?.getApi();
122
+ if (!api) {
123
+ return;
124
+ }
125
+ api.gotoDate(start);
126
+ }, viewType: viewType }) })), (0, jsx_runtime_1.jsx)("div", { style: {
127
+ display: 'flex',
128
+ flex: 1,
129
+ justifyContent: isMobile ? 'flex-start' : 'flex-end',
130
+ }, children: (0, jsx_runtime_1.jsx)(ViewSelector_1.ViewSelector, { viewType: viewType, onChange: (viewType) => {
103
131
  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) => {
132
+ calendarRef.current?.getApi().scrollToTime(initialScrollTime);
133
+ } }) })] }), (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%", nowIndicator: true, scrollTime: initialScrollTime, scrollTimeReset: false, editable: false, selectable: true, selectMirror: true, dayMaxEvents: true, eventMinHeight: 24, eventTimeFormat: (props) => {
105
134
  return (0, dayjs_1.default)(props.start.marker).tz(timezone).format('hh:mm A');
106
135
  }, headerToolbar: false }) }), (0, jsx_runtime_1.jsx)(BodyLoading_1.BodyLoading, { loading: loading })] })] }));
107
136
  };
@@ -5,6 +5,7 @@ interface AttributeControllerProps {
5
5
  attribute: Attribute;
6
6
  attributeName: Path<BaseFieldValues>;
7
7
  form: UseFormReturn<BaseFieldValues>;
8
+ readOnly?: boolean;
8
9
  }
9
- export declare function AttributeController({ attribute, attributeName, form, }: Readonly<AttributeControllerProps>): import("react/jsx-runtime").JSX.Element;
10
+ export declare function AttributeController({ attribute, attributeName, form, readOnly, }: Readonly<AttributeControllerProps>): import("react/jsx-runtime").JSX.Element;
10
11
  export {};
@@ -5,13 +5,13 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_hook_form_1 = require("react-hook-form");
6
6
  const SectionControl_1 = require("../../DataForm/SectionControl");
7
7
  const StandardControl_1 = require("../../PageEntityForm/StandardControl");
8
- function AttributeController({ attribute, attributeName, form, }) {
8
+ function AttributeController({ attribute, attributeName, form, readOnly, }) {
9
9
  return ((0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: form.control, name: attributeName, render: ({ field, fieldState, formState }) => {
10
10
  const isError = (fieldState.isTouched || formState.isSubmitted) &&
11
11
  !!fieldState.error?.message;
12
12
  const errorMessage = fieldState.isTouched || formState.isSubmitted
13
13
  ? fieldState.error?.message
14
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 }) }));
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: readOnly || attribute.readonly }) }));
16
16
  } }));
17
17
  }
@@ -54,7 +54,22 @@ function EventFormBody(props) {
54
54
  (0, react_1.useEffect)(() => {
55
55
  formRef.current.reset(defaultValues);
56
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 () => {
57
+ const menuItems = [];
58
+ if (props.allowOpenRecord) {
59
+ menuItems.push((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" }, "open"));
60
+ }
61
+ if (!props.config.disableEdit) {
62
+ menuItems.push((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" }, "delete"));
63
+ }
64
+ let title = (props.values.id ? 'Edit' : 'New') +
65
+ ` ${props.config.eventLabel.toLowerCase()}`;
66
+ if (props.values.id && props.config.disableEdit) {
67
+ title = props.config.eventLabel;
68
+ }
69
+ let readOnly = props.values.id
70
+ ? props.config.disableEdit
71
+ : props.config.disableCreate;
72
+ return ((0, jsx_runtime_1.jsxs)(react_components_1.DialogBody, { children: [(0, jsx_runtime_1.jsx)(react_components_1.DialogTitle, { action: props.values.id && menuItems.length > 0 ? ((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.jsx)(react_components_1.MenuList, { children: menuItems }) })] })) : null, children: title }), (0, jsx_runtime_1.jsx)(EventFormContent_1.EventFormContent, { form: form, afterDescriptionAttributes: props.config.afterDescriptionAttributes, beforeDescriptionAttributes: props.config.beforeDescriptionAttributes, readOnly: readOnly, config: props.config }), (0, jsx_runtime_1.jsxs)(react_components_1.DialogActions, { children: [!readOnly && ((0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "primary", disabled: form.formState.submitCount > 0 && !form.formState.isValid, onClick: async () => {
58
73
  await form.handleSubmit(async (values) => {
59
74
  await props.onSubmit?.({
60
75
  modifiedValues: values.id
@@ -63,7 +78,7 @@ function EventFormBody(props) {
63
78
  values,
64
79
  });
65
80
  })();
66
- }, children: props.values.id ? 'Save' : 'Create' }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "secondary", type: "button", onClick: () => {
81
+ }, children: props.values.id ? 'Save' : 'Create' })), (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "secondary", type: "button", onClick: () => {
67
82
  props.onCancel?.();
68
83
  }, children: props.values.id ? 'Close' : 'Cancel' })] }), (0, jsx_runtime_1.jsx)(BodyLoading_1.BodyLoading, { loading: isPending })] }));
69
84
  }
@@ -1,3 +1,4 @@
1
+ import { CalendarConfig } from '@headless-adminapp/app/calendar/types';
1
2
  import { SchemaAttributes } from '@headless-adminapp/core/schema';
2
3
  import { UseFormReturn } from 'react-hook-form';
3
4
  import { BaseFieldValues } from './types';
@@ -5,6 +6,8 @@ interface EventFormContentProps<SA1 extends SchemaAttributes = SchemaAttributes,
5
6
  form: UseFormReturn<BaseFieldValues>;
6
7
  beforeDescriptionAttributes?: SA1;
7
8
  afterDescriptionAttributes?: SA2;
9
+ readOnly?: boolean;
10
+ config: CalendarConfig;
8
11
  }
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;
12
+ export declare function EventFormContent<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes>({ form, afterDescriptionAttributes, beforeDescriptionAttributes, readOnly, config, }: Readonly<EventFormContentProps<SA1, SA2>>): import("react/jsx-runtime").JSX.Element;
10
13
  export {};
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
6
  const baseEventAttributes_1 = require("@headless-adminapp/app/calendar/baseEventAttributes");
7
7
  const AttributeController_1 = require("./AttributeController");
8
- function EventFormContent({ form, afterDescriptionAttributes, beforeDescriptionAttributes, }) {
8
+ function EventFormContent({ form, afterDescriptionAttributes, beforeDescriptionAttributes, readOnly, config, }) {
9
9
  const allDay = form.watch('allDay');
10
10
  return ((0, jsx_runtime_1.jsx)(react_components_1.DialogContent, { children: (0, jsx_runtime_1.jsxs)("div", { style: {
11
11
  display: 'flex',
@@ -13,15 +13,15 @@ function EventFormContent({ form, afterDescriptionAttributes, beforeDescriptionA
13
13
  gap: react_components_1.tokens.spacingVerticalM,
14
14
  marginTop: react_components_1.tokens.spacingVerticalL,
15
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: {
16
+ }, children: [(0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: "title", attribute: baseEventAttributes_1.baseEventAttributes.title, readOnly: readOnly }), (0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: "start", attribute: {
17
17
  ...baseEventAttributes_1.baseEventAttributes.start,
18
18
  ...(allDay ? { format: 'date' } : { format: 'datetime' }),
19
- } }), (0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: "end", attribute: {
19
+ }, readOnly: readOnly }), (0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: "end", attribute: {
20
20
  ...baseEventAttributes_1.baseEventAttributes.end,
21
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));
22
+ }, readOnly: readOnly }), !config.disableAllDay && ((0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: "allDay", attribute: baseEventAttributes_1.baseEventAttributes.allDay, readOnly: readOnly })), Object.entries(beforeDescriptionAttributes ?? {}).map(([attributeName, attribute]) => {
23
+ return ((0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: attributeName, attribute: attribute, readOnly: readOnly }, attributeName));
24
+ }), (0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: "description", attribute: baseEventAttributes_1.baseEventAttributes.description, readOnly: readOnly }), Object.entries(afterDescriptionAttributes ?? {}).map(([attributeName, attribute]) => {
25
+ return ((0, jsx_runtime_1.jsx)(AttributeController_1.AttributeController, { form: form, attributeName: attributeName, attribute: attribute, readOnly: readOnly }, attributeName));
26
26
  })] }) }));
27
27
  }
@@ -27,7 +27,7 @@ function Header({ filterForm, onCreateButtonClick, }) {
27
27
  display: 'flex',
28
28
  alignItems: 'center',
29
29
  gap: react_components_1.tokens.spacingHorizontalS,
30
- }, children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { style: { fontWeight: react_components_1.tokens.fontWeightMedium }, icon: (0, jsx_runtime_1.jsx)(icons_fluent_1.iconSet.Add, {}), appearance: "primary", onClick: onCreateButtonClick, children: "Create" }) })] }), !!config.filterAttributes && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', gap: react_components_1.tokens.spacingHorizontalS }, children: Object.entries(config.filterAttributes).map(([attributeName, attribute]) => {
30
+ }, children: !config.disableCreate && ((0, jsx_runtime_1.jsx)(react_components_1.Button, { style: { fontWeight: react_components_1.tokens.fontWeightMedium }, icon: (0, jsx_runtime_1.jsx)(icons_fluent_1.iconSet.Add, {}), appearance: "primary", onClick: onCreateButtonClick, children: "Create" })) })] }), !!config.filterAttributes && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', gap: react_components_1.tokens.spacingHorizontalS }, children: Object.entries(config.filterAttributes).map(([attributeName, attribute]) => {
31
31
  return ((0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: filterForm.control, name: attributeName, render: ({ field }) => {
32
32
  return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(StandardControl_1.StandardControl, { attribute: attribute, name: attributeName, value: field.value, onChange: field.onChange, onBlur: field.onBlur }) }));
33
33
  } }, attributeName));