@headless-adminapp/fluent 1.0.3 → 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 (130) 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 -28
  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/PageEntityFormDesktopContainer.js +4 -0
  101. package/PageEntityForm/RecordAvatar.js +1 -2
  102. package/PageEntityForm/RecordCard.js +17 -28
  103. package/PageEntityForm/RelatedViewSelector.js +1 -0
  104. package/PageEntityForm/SectionContainer.js +7 -1
  105. package/PageEntityView/PageEntityView.d.ts +1 -0
  106. package/PageEntityView/PageEntityView.js +12 -2
  107. package/PageEntityView/PageEntityViewDesktopContainer.d.ts +1 -0
  108. package/PageEntityView/PageEntityViewDesktopContainer.js +7 -3
  109. package/PageEntityView/PageEntityViewDesktopFrame.js +1 -1
  110. package/PageEntityView/PageEntityViewDesktopFrameV2.d.ts +8 -0
  111. package/PageEntityView/PageEntityViewDesktopFrameV2.js +48 -0
  112. package/PageEntityView/PageEntityViewMobileContainer.js +2 -3
  113. package/PageEntityView/PageEntityViewMobileFrame.d.ts +8 -0
  114. package/PageEntityView/PageEntityViewMobileFrame.js +38 -0
  115. package/PageInsight/PageInsight.d.ts +7 -0
  116. package/PageInsight/PageInsight.js +31 -0
  117. package/PageInsight/index.d.ts +1 -0
  118. package/PageInsight/index.js +5 -0
  119. package/PageInsights/PageInsights.d.ts +5 -7
  120. package/PageInsights/PageInsights.js +24 -18
  121. package/PageInsights/index.d.ts +1 -1
  122. package/PageInsights/index.js +1 -2
  123. package/components/ComponentBroken.d.ts +7 -0
  124. package/components/ComponentBroken.js +16 -0
  125. package/components/ComponentErrorBoundary.d.ts +15 -0
  126. package/components/ComponentErrorBoundary.js +26 -0
  127. package/form/controls/DateTimeControl.js +17 -3
  128. package/form/controls/DurationControl.js +0 -2
  129. package/form/controls/LookupControl.js +6 -3
  130. package/package.json +3 -3
@@ -32,6 +32,7 @@ const react_components_1 = require("@fluentui/react-components");
32
32
  const auth_1 = require("@headless-adminapp/app/auth");
33
33
  const context_1 = require("@headless-adminapp/app/calendar/context");
34
34
  const dialog_1 = require("@headless-adminapp/app/dialog");
35
+ const hooks_1 = require("@headless-adminapp/app/hooks");
35
36
  const mutable_1 = require("@headless-adminapp/app/mutable");
36
37
  const progress_indicator_1 = require("@headless-adminapp/app/progress-indicator");
37
38
  const toast_notification_1 = require("@headless-adminapp/app/toast-notification");
@@ -64,11 +65,12 @@ function PageCalendar(props) {
64
65
  const openConfirmDialog = (0, dialog_1.useOpenConfirmDialog)();
65
66
  const openToastNotification = (0, toast_notification_1.useOpenToastNotification)();
66
67
  const { hideProgressIndicator, showProgressIndicator } = (0, progress_indicator_1.useProgressIndicator)();
68
+ const isMobile = (0, hooks_1.useIsMobile)();
67
69
  const [activeStartDate, setActiveStartDate] = (0, react_1.useState)(null);
68
70
  const [activeEndDate, setActiveEndDate] = (0, react_1.useState)(null);
69
71
  const [currentStartDate, setCurrentStartDate] = (0, react_1.useState)(null);
70
72
  const [currentEndDate, setCurrentEndDate] = (0, react_1.useState)(null);
71
- const [viewType, setViewType] = (0, react_1.useState)(types_1.ViewType.Month);
73
+ const [viewType, setViewType] = (0, react_1.useState)(isMobile ? types_1.ViewType.Day : types_1.ViewType.Month);
72
74
  const queryClient = (0, react_query_1.useQueryClient)();
73
75
  const filterForm = (0, react_hook_form_1.useForm)({
74
76
  mode: 'all',
@@ -184,6 +186,9 @@ function PageCalendar(props) {
184
186
  });
185
187
  }
186
188
  function handleDateSelect(selectInfo) {
189
+ if (config.disableCreate) {
190
+ return;
191
+ }
187
192
  openEventDetailModel({
188
193
  title: '',
189
194
  start: selectInfo.start.toISOString(),
@@ -7,6 +7,7 @@ exports.TitleSelector = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_calendar_compat_1 = require("@fluentui/react-calendar-compat");
9
9
  const react_components_1 = require("@fluentui/react-components");
10
+ const hooks_1 = require("@headless-adminapp/app/hooks");
10
11
  const locale_1 = require("@headless-adminapp/app/locale");
11
12
  const icons_fluent_1 = require("@headless-adminapp/icons-fluent");
12
13
  const dayjs_1 = __importDefault(require("dayjs"));
@@ -20,20 +21,24 @@ dayjs_1.default.extend(timezone_1.default);
20
21
  dayjs_1.default.extend(isoWeek_1.default);
21
22
  const TitleSelector = ({ start, end, onChange, viewType, }) => {
22
23
  const { timezone } = (0, locale_1.useLocale)();
24
+ const isMobile = (0, hooks_1.useIsMobile)();
23
25
  const label = (0, react_1.useMemo)(() => {
24
26
  if (!start || !end) {
25
27
  return '';
26
28
  }
27
29
  switch (viewType) {
28
30
  case types_1.ViewType.Day:
29
- return (0, dayjs_1.default)(start).format('MMM D, YYYY');
31
+ return (0, dayjs_1.default)(start).format(isMobile ? 'MMM D' : 'MMM D, YYYY');
30
32
  case types_1.ViewType.Week:
33
+ if (isMobile) {
34
+ return `${(0, dayjs_1.default)(start).format('MMM D')} - ${(0, dayjs_1.default)(end).format('D')}`;
35
+ }
31
36
  return `${(0, dayjs_1.default)(start).format('MMM D')} - ${(0, dayjs_1.default)(end).format('MMM D, YYYY')}`;
32
37
  case types_1.ViewType.Month:
33
- return (0, dayjs_1.default)(start).format('MMMM YYYY');
38
+ return (0, dayjs_1.default)(start).format(isMobile ? 'MMM YYYY' : 'MMMM YYYY');
34
39
  }
35
40
  return '';
36
- }, [start, end, viewType]);
41
+ }, [start, end, viewType, isMobile]);
37
42
  if (!start || !end) {
38
43
  return null;
39
44
  }
@@ -61,7 +66,6 @@ const TitleSelector = ({ start, end, onChange, viewType, }) => {
61
66
  .toDate();
62
67
  onChange(start, end);
63
68
  } })), viewType === types_1.ViewType.Day && ((0, jsx_runtime_1.jsx)(react_calendar_compat_1.Calendar, { dateRangeType: react_calendar_compat_1.DateRangeType.Day, firstDayOfWeek: 1, value: start ? (0, dayjs_1.default)(start).toDate() : new Date(), onSelectDate: (date) => {
64
- console.log('d', date);
65
69
  const start = (0, dayjs_1.default)(date)
66
70
  .tz(timezone, true)
67
71
  .startOf('day')
@@ -112,6 +112,10 @@ const PageEntityFormDesktopContainer = () => {
112
112
  ? `- ${strings.saved}`
113
113
  : '' })] }), (0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { color: react_components_1.tokens.colorNeutralForeground3 }, children: (0, utils_1.localizedLabel)(language, schema) })] }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'row' }, children: formConfig.experience.headerControls?.map((controlName, index) => {
114
114
  const attribute = schema.attributes[controlName];
115
+ if (!attribute) {
116
+ console.warn(`Attribute ${controlName} not found`);
117
+ return null;
118
+ }
115
119
  return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [index > 0 && ((0, jsx_runtime_1.jsx)(react_components_1.Divider, { vertical: true, style: {
116
120
  width: react_components_1.tokens.spacingHorizontalXXL,
117
121
  opacity: 0.5,
@@ -38,7 +38,6 @@ const RecordAvatar = () => {
38
38
  if (!recordId) {
39
39
  return;
40
40
  }
41
- console.log('onChange', value);
42
41
  try {
43
42
  showProgressIndicator();
44
43
  await dataService.updateRecord(schema.logicalName, recordId, {
@@ -61,7 +60,7 @@ const RecordAvatar = () => {
61
60
  return null;
62
61
  }
63
62
  if (isPlaceholder && !value) {
64
- const Icon = experienceSchema.icon ?? icons_1.Icons.Entity ?? icons_1.IconPlaceholder;
63
+ const Icon = experienceSchema.Icon ?? icons_1.Icons.Entity ?? icons_1.IconPlaceholder;
65
64
  return ((0, jsx_runtime_1.jsx)("div", { style: {
66
65
  display: 'flex',
67
66
  alignItems: 'flex-start',
@@ -40,24 +40,27 @@ function RecordCard({ schema, cardView, record, selected, }) {
40
40
  const recordTitle = _record[schema.primaryAttribute];
41
41
  const initials = createIntial(recordTitle);
42
42
  let avatarSrc = '';
43
- if (cardView.avatarColumn) {
44
- const avatarAttribute = schema.attributes[cardView.avatarColumn];
45
- if (avatarAttribute.type === 'attachment' &&
46
- avatarAttribute.format === 'image') {
47
- avatarSrc = _record[cardView.avatarColumn]?.url;
48
- }
49
- else if (avatarAttribute.type === 'string' &&
50
- avatarAttribute.format === 'url') {
51
- avatarSrc = _record[cardView.avatarColumn];
43
+ if (cardView.showAvatar) {
44
+ const avatarColumn = cardView.avatarColumn || schema.avatarAttribute;
45
+ if (avatarColumn) {
46
+ const avatarAttribute = schema.attributes[avatarColumn];
47
+ if (avatarAttribute.type === 'attachment' &&
48
+ avatarAttribute.format === 'image') {
49
+ avatarSrc = _record[avatarColumn]?.url;
50
+ }
51
+ else if (avatarAttribute.type === 'string' &&
52
+ avatarAttribute.format === 'url') {
53
+ avatarSrc = _record[avatarColumn];
54
+ }
52
55
  }
53
56
  }
54
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, react_components_1.mergeClasses)(styles.root, selected && styles.selected), children: [cardView.showAvatar && ((0, jsx_runtime_1.jsx)(react_components_1.Avatar, { initials: initials, color: "neutral", style: { cursor: 'pointer' }, image: {
57
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, react_components_1.mergeClasses)(styles.root, selected && styles.selected), children: [cardView.showAvatar && ((0, jsx_runtime_1.jsx)(react_components_1.Avatar, { initials: initials, color: "neutral", size: !cardView.secondaryColumns?.length ? 20 : 32, style: { cursor: 'pointer' }, image: {
55
58
  src: avatarSrc,
56
59
  } })), (0, jsx_runtime_1.jsxs)("div", { style: {
57
60
  display: 'flex',
58
61
  flexDirection: 'column',
59
62
  flex: 1,
60
- }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { wordBreak: 'break-all' }, children: _record[cardView.primaryColumn] }), cardView.secondaryColumns?.map((column) => ((0, jsx_runtime_1.jsx)(SecondaryColumnContent, { record: _record, column: column, schema: schema }, column.name)))] }), !!cardView.rightColumn?.length && ((0, jsx_runtime_1.jsx)("div", { style: {
63
+ }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { wordBreak: 'break-all' }, children: (0, utils_1.getAttributeFormattedValue)(schema.attributes[cardView.primaryColumn], _record[cardView.primaryColumn]) }), cardView.secondaryColumns?.map((column) => ((0, jsx_runtime_1.jsx)(SecondaryColumnContent, { record: _record, column: column, schema: schema }, column.name)))] }), !!cardView.rightColumn?.length && ((0, jsx_runtime_1.jsx)("div", { style: {
61
64
  display: 'flex',
62
65
  flexDirection: 'column',
63
66
  alignItems: 'flex-end',
@@ -69,18 +72,7 @@ function RecordCard({ schema, cardView, record, selected, }) {
69
72
  const attribute = schema.attributes[column.name];
70
73
  if (column.variant === 'choice') {
71
74
  if (attribute.type === 'choice') {
72
- const choice = attribute.options.find((option) => option.value === value);
73
- if (!choice) {
74
- return null;
75
- }
76
- return ((0, jsx_runtime_1.jsx)(react_components_1.Tag, { size: "extra-small", appearance: "filled", style: {
77
- background: choice.color,
78
- color: 'white',
79
- height: 16,
80
- display: 'flex',
81
- alignItems: 'center',
82
- justifyContent: 'center',
83
- }, children: choice.label }, column.name));
75
+ return ((0, jsx_runtime_1.jsx)(ChoiceTag, { attribute: attribute, value: value }, column.name));
84
76
  }
85
77
  }
86
78
  if (column.variant === 'strong') {
@@ -130,12 +122,9 @@ const ChoiceTag = ({ attribute, value, }) => {
130
122
  if (bgColor) {
131
123
  color = (0, color_1.isColorDark)(bgColor) ? '#FFFFFF' : '#000000';
132
124
  }
133
- return ((0, jsx_runtime_1.jsx)(react_components_1.Tag, { size: "extra-small", appearance: "filled", style: {
125
+ return ((0, jsx_runtime_1.jsx)(react_components_1.Badge, { size: "small", appearance: "filled", style: {
134
126
  background: bgColor,
135
127
  color: color,
136
- height: 16,
137
- display: 'flex',
138
- alignItems: 'center',
139
- justifyContent: 'center',
128
+ fontWeight: react_components_1.tokens.fontWeightRegular,
140
129
  }, children: choice.label }));
141
130
  };
@@ -88,6 +88,7 @@ function RelatedViewSelector(props) {
88
88
  padding: `${react_components_1.tokens.spacingVerticalM} ${react_components_1.tokens.spacingHorizontalMNudge}`,
89
89
  fontFamily: react_components_1.tokens.fontFamilyBase,
90
90
  lineHeight: react_components_1.tokens.lineHeightBase300,
91
+ fontSize: react_components_1.tokens.fontSizeBase300,
91
92
  backgroundColor: react_components_1.tokens.colorTransparentBackground,
92
93
  alignItems: 'center',
93
94
  position: 'relative',
@@ -7,6 +7,7 @@ const constants_1 = require("@headless-adminapp/app/dataform/constants");
7
7
  const utils_1 = require("@headless-adminapp/app/dataform/DataFormProvider/utils");
8
8
  const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
9
9
  const useEventManager_1 = require("@headless-adminapp/app/dataform/hooks/useEventManager");
10
+ const hooks_2 = require("@headless-adminapp/app/hooks");
10
11
  const locale_1 = require("@headless-adminapp/app/locale");
11
12
  const utils_2 = require("@headless-adminapp/app/locale/utils");
12
13
  const mutable_1 = require("@headless-adminapp/app/mutable");
@@ -24,6 +25,7 @@ function SectionContainer({ section }) {
24
25
  const isFormReadonly = (0, hooks_1.useFormIsReadonly)();
25
26
  const { language } = (0, locale_1.useLocale)();
26
27
  const eventManager = (0, useEventManager_1.useEventManager)();
28
+ const isMobile = (0, hooks_2.useIsMobile)();
27
29
  const disabledControls = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.disabledControls);
28
30
  const hiddenControls = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.hiddenControls);
29
31
  const requiredFields = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.requiredFields);
@@ -41,6 +43,10 @@ function SectionContainer({ section }) {
41
43
  switch (control.type) {
42
44
  case 'standard': {
43
45
  const attribute = schema.attributes[control.attributeName];
46
+ if (!attribute) {
47
+ console.warn(`Attribute ${control.attributeName} not found`);
48
+ return null;
49
+ }
44
50
  let Control = StandardControl_1.StandardControl;
45
51
  if (control.component) {
46
52
  if (typeof control.component === 'function') {
@@ -78,7 +84,7 @@ function SectionContainer({ section }) {
78
84
  attribute.localizedLabels?.[language] ??
79
85
  control.label ??
80
86
  attribute.label;
81
- return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: label, labelPosition: section.labelPosition, required: required, isError: isError, errorMessage: errorMessage, children: (0, jsx_runtime_1.jsx)(Control, { attribute: attribute, name: control.attributeName, value: field.value, onChange: (value) => {
87
+ return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: label, labelPosition: isMobile ? 'top' : section.labelPosition, required: required, isError: isError, errorMessage: errorMessage, children: (0, jsx_runtime_1.jsx)(Control, { attribute: attribute, name: control.attributeName, value: field.value, onChange: (value) => {
82
88
  const previousValue = field.value;
83
89
  field.onChange(value);
84
90
  eventManager.emit(constants_1.EVENT_KEY_ON_FIELD_CHANGE, control.attributeName, value, previousValue);
@@ -3,6 +3,7 @@ interface PageEntityViewProps {
3
3
  logicalName: string;
4
4
  viewId?: string;
5
5
  onChangeView?: (viewId: string) => void;
6
+ useV2?: boolean;
6
7
  }
7
8
  export declare const PageEntityView: FC<PageEntityViewProps>;
8
9
  export {};
@@ -10,7 +10,7 @@ const PageBroken_1 = require("../components/PageBroken");
10
10
  const PageLoading_1 = require("../components/PageLoading");
11
11
  const PageEntityViewDesktopContainer_1 = require("./PageEntityViewDesktopContainer");
12
12
  const PageEntityViewMobileContainer_1 = require("./PageEntityViewMobileContainer");
13
- const PageEntityView = ({ logicalName, viewId, onChangeView, }) => {
13
+ const PageEntityView = ({ logicalName, viewId, onChangeView, useV2, }) => {
14
14
  const result = (0, datagrid_1.useLoadMainGridPage)(logicalName, viewId);
15
15
  const isMobile = (0, hooks_1.useIsMobile)();
16
16
  if (result.loading) {
@@ -20,6 +20,16 @@ const PageEntityView = ({ logicalName, viewId, onChangeView, }) => {
20
20
  return ((0, jsx_runtime_1.jsx)(PageBroken_1.PageBroken, { Icon: icons_1.Icons.Error, title: result.title, message: result.message }));
21
21
  }
22
22
  const { schema, commands, viewLookup, view } = result;
23
- return ((0, jsx_runtime_1.jsx)(PageEntityViewProvider_1.PageEntityViewProvider, { schema: schema, view: view, availableViews: viewLookup, commands: commands, onChangeView: onChangeView, children: isMobile ? ((0, jsx_runtime_1.jsx)(PageEntityViewMobileContainer_1.PageEntityViewMobileContainer, {})) : ((0, jsx_runtime_1.jsx)(PageEntityViewDesktopContainer_1.PageEntityViewDesktopContainer, {})) }));
23
+ let content = null;
24
+ if (isMobile) {
25
+ content = (0, jsx_runtime_1.jsx)(PageEntityViewMobileContainer_1.PageEntityViewMobileContainer, {});
26
+ }
27
+ else if (!useV2) {
28
+ content = (0, jsx_runtime_1.jsx)(PageEntityViewDesktopContainer_1.PageEntityViewDesktopContainer, {});
29
+ }
30
+ else {
31
+ content = (0, jsx_runtime_1.jsx)(PageEntityViewDesktopContainer_1.PageEntityViewDesktopContainerV2, {});
32
+ }
33
+ return ((0, jsx_runtime_1.jsx)(PageEntityViewProvider_1.PageEntityViewProvider, { schema: schema, view: view, availableViews: viewLookup, commands: commands, onChangeView: onChangeView, children: content }));
24
34
  };
25
35
  exports.PageEntityView = PageEntityView;
@@ -1,2 +1,3 @@
1
1
  import { FC } from 'react';
2
2
  export declare const PageEntityViewDesktopContainer: FC;
3
+ export declare const PageEntityViewDesktopContainerV2: FC;
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PageEntityViewDesktopContainer = void 0;
3
+ exports.PageEntityViewDesktopContainerV2 = exports.PageEntityViewDesktopContainer = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
5
  const CommandContainer_1 = require("../DataGrid/CommandContainer");
7
6
  const GridHeaderContainer_1 = require("../DataGrid/GridHeaderContainer");
8
7
  const GridPaginationContainer_1 = require("../DataGrid/GridPaginationContainer");
9
8
  const GridTableContainer_1 = require("../DataGrid/GridTableContainer");
10
9
  const PageEntityViewDesktopFrame_1 = require("./PageEntityViewDesktopFrame");
10
+ const PageEntityViewDesktopFrameV2_1 = require("./PageEntityViewDesktopFrameV2");
11
11
  const PageEntityViewDesktopContainer = () => {
12
- return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(PageEntityViewDesktopFrame_1.PageEntityViewDesktopFrame, { commandBar: (0, jsx_runtime_1.jsx)(CommandContainer_1.CommandContainer, {}), header: (0, jsx_runtime_1.jsx)(GridHeaderContainer_1.GridHeaderContainer, {}), content: (0, jsx_runtime_1.jsx)(GridTableContainer_1.GridTableContainer, {}), footer: (0, jsx_runtime_1.jsx)(GridPaginationContainer_1.GridPaginationContainer, {}) }) }));
12
+ return ((0, jsx_runtime_1.jsx)(PageEntityViewDesktopFrame_1.PageEntityViewDesktopFrame, { commandBar: (0, jsx_runtime_1.jsx)(CommandContainer_1.CommandContainer, {}), header: (0, jsx_runtime_1.jsx)(GridHeaderContainer_1.GridHeaderContainer, {}), content: (0, jsx_runtime_1.jsx)(GridTableContainer_1.GridTableContainer, { headerHeight: 33, rowHeight: 44 }), footer: (0, jsx_runtime_1.jsx)(GridPaginationContainer_1.GridPaginationContainer, {}) }));
13
13
  };
14
14
  exports.PageEntityViewDesktopContainer = PageEntityViewDesktopContainer;
15
+ const PageEntityViewDesktopContainerV2 = () => {
16
+ return ((0, jsx_runtime_1.jsx)(PageEntityViewDesktopFrameV2_1.PageEntityViewDesktopFrameV2, { header: (0, jsx_runtime_1.jsx)(GridHeaderContainer_1.GridHeaderContainerV2, {}), content: (0, jsx_runtime_1.jsx)(GridTableContainer_1.GridTableContainer, { noPadding: true, headerHeight: 40, rowHeight: 44 }), footer: (0, jsx_runtime_1.jsx)(GridPaginationContainer_1.GridPaginationContainer, {}) }));
17
+ };
18
+ exports.PageEntityViewDesktopContainerV2 = PageEntityViewDesktopContainerV2;
@@ -44,6 +44,6 @@ const PageEntityViewDesktopFrame = ({ commandBar, header, content, footer }) =>
44
44
  display: 'flex',
45
45
  flexDirection: 'column',
46
46
  gap: 8,
47
- }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, {}), footer] })] })] }) }));
47
+ }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.5 } }), footer] })] })] }) }));
48
48
  };
49
49
  exports.PageEntityViewDesktopFrame = PageEntityViewDesktopFrame;
@@ -0,0 +1,8 @@
1
+ import React, { FC } from 'react';
2
+ interface PageEntityViewDesktopFrameProps {
3
+ header: React.ReactNode;
4
+ content: React.ReactNode;
5
+ footer: React.ReactNode;
6
+ }
7
+ export declare const PageEntityViewDesktopFrameV2: FC<PageEntityViewDesktopFrameProps>;
8
+ export {};
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageEntityViewDesktopFrameV2 = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ // Exprement component
7
+ const PageEntityViewDesktopFrameV2 = ({ header, content, footer }) => {
8
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
9
+ display: 'flex',
10
+ flex: 1,
11
+ flexDirection: 'column',
12
+ gap: 8,
13
+ backgroundColor: react_components_1.tokens.colorNeutralBackground2,
14
+ padding: 12,
15
+ overflow: 'hidden',
16
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
17
+ gap: 12,
18
+ flex: 1,
19
+ display: 'flex',
20
+ flexDirection: 'column',
21
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
22
+ display: 'flex',
23
+ flexDirection: 'column',
24
+ paddingBlock: 8,
25
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
26
+ gap: 16,
27
+ display: 'flex',
28
+ flexDirection: 'column',
29
+ flex: 1,
30
+ }, children: header }) }), (0, jsx_runtime_1.jsxs)("div", { style: {
31
+ flex: 1,
32
+ display: 'flex',
33
+ flexDirection: 'column',
34
+ boxShadow: react_components_1.tokens.shadow2,
35
+ borderRadius: react_components_1.tokens.borderRadiusMedium,
36
+ background: react_components_1.tokens.colorNeutralBackground1,
37
+ overflow: 'hidden',
38
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
39
+ gap: 16,
40
+ display: 'flex',
41
+ flexDirection: 'column',
42
+ flex: 1,
43
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, display: 'flex' }, children: content }) }), (0, jsx_runtime_1.jsxs)("div", { style: {
44
+ display: 'flex',
45
+ flexDirection: 'column',
46
+ }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.5 } }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', paddingInline: 8, paddingBlock: 8 }, children: footer })] })] })] }) }));
47
+ };
48
+ exports.PageEntityViewDesktopFrameV2 = PageEntityViewDesktopFrameV2;
@@ -6,9 +6,8 @@ const react_1 = require("react");
6
6
  const CommandContainer_1 = require("../DataGrid/CommandContainer");
7
7
  const GridHeaderMobile_1 = require("../DataGrid/GridHeaderMobile");
8
8
  const GridListContainer_1 = require("../DataGrid/GridListContainer");
9
- const GridPaginationContainer_1 = require("../DataGrid/GridPaginationContainer");
10
- const PageEntityViewDesktopFrame_1 = require("./PageEntityViewDesktopFrame");
9
+ const PageEntityViewMobileFrame_1 = require("./PageEntityViewMobileFrame");
11
10
  const PageEntityViewMobileContainer = () => {
12
- return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(PageEntityViewDesktopFrame_1.PageEntityViewDesktopFrame, { commandBar: (0, jsx_runtime_1.jsx)(CommandContainer_1.CommandContainer, {}), header: (0, jsx_runtime_1.jsx)(GridHeaderMobile_1.GridHeaderMobile, {}), content: (0, jsx_runtime_1.jsx)(GridListContainer_1.GridListContainer, {}), footer: (0, jsx_runtime_1.jsx)(GridPaginationContainer_1.GridPaginationContainer, {}) }) }));
11
+ return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(PageEntityViewMobileFrame_1.PageEntityViewMobileFrame, { commandBar: (0, jsx_runtime_1.jsx)(CommandContainer_1.CommandContainer, {}), header: (0, jsx_runtime_1.jsx)(GridHeaderMobile_1.GridHeaderMobile, {}), content: (0, jsx_runtime_1.jsx)(GridListContainer_1.GridListContainer, {}) }) }));
13
12
  };
14
13
  exports.PageEntityViewMobileContainer = PageEntityViewMobileContainer;
@@ -0,0 +1,8 @@
1
+ import React, { FC } from 'react';
2
+ interface PageEntityViewMobileFrameProps {
3
+ commandBar: React.ReactNode;
4
+ header: React.ReactNode;
5
+ content: React.ReactNode;
6
+ }
7
+ export declare const PageEntityViewMobileFrame: FC<PageEntityViewMobileFrameProps>;
8
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageEntityViewMobileFrame = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const PageEntityViewMobileFrame = ({ commandBar, header, content, }) => {
7
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
8
+ display: 'flex',
9
+ flex: 1,
10
+ flexDirection: 'column',
11
+ background: react_components_1.tokens.colorNeutralBackground1,
12
+ overflow: 'hidden',
13
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
14
+ gap: 4,
15
+ flex: 1,
16
+ display: 'flex',
17
+ flexDirection: 'column',
18
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
19
+ boxShadow: react_components_1.tokens.shadow2,
20
+ background: react_components_1.tokens.colorNeutralBackground1,
21
+ display: 'flex',
22
+ minHeight: 40,
23
+ flexDirection: 'column',
24
+ gap: 4,
25
+ paddingBottom: 8,
26
+ }, children: [commandBar, header] }), (0, jsx_runtime_1.jsx)("div", { style: {
27
+ flex: 1,
28
+ display: 'flex',
29
+ flexDirection: 'column',
30
+ borderRadius: react_components_1.tokens.borderRadiusMedium,
31
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
32
+ gap: 8,
33
+ display: 'flex',
34
+ flexDirection: 'column',
35
+ flex: 1,
36
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, display: 'flex' }, children: content }) }) })] }) }));
37
+ };
38
+ exports.PageEntityViewMobileFrame = PageEntityViewMobileFrame;
@@ -0,0 +1,7 @@
1
+ import { InsightConfig } from '@headless-adminapp/core/experience/insights';
2
+ import { SchemaAttributes } from '@headless-adminapp/core/schema';
3
+ interface PageInsightProps<S extends SchemaAttributes = SchemaAttributes> {
4
+ config: InsightConfig<S>;
5
+ }
6
+ export declare function PageInsight<S extends SchemaAttributes = SchemaAttributes>({ config, }: Readonly<PageInsightProps<S>>): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageInsight = PageInsight;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const insights_1 = require("@headless-adminapp/app/insights");
6
+ const mutable_1 = require("@headless-adminapp/app/mutable");
7
+ const store_1 = require("@headless-adminapp/app/store");
8
+ const react_1 = require("react");
9
+ const react_hook_form_1 = require("react-hook-form");
10
+ const InsightsContainer_1 = require("../Insights/InsightsContainer");
11
+ function PageInsight({ config, }) {
12
+ const filterForm = (0, react_hook_form_1.useForm)({
13
+ mode: 'all',
14
+ defaultValues: config.defaultFilter,
15
+ shouldUnregister: false,
16
+ });
17
+ const filterValues = filterForm.watch();
18
+ const eventManager = (0, react_1.useMemo)(() => new store_1.EventManager(), []);
19
+ const insightsValues = (0, mutable_1.useCreateContextStore)({
20
+ config,
21
+ filterValues,
22
+ eventManager,
23
+ });
24
+ (0, react_1.useEffect)(() => {
25
+ insightsValues.setValue({
26
+ config,
27
+ filterValues,
28
+ });
29
+ }, [config, filterValues, insightsValues]);
30
+ return ((0, jsx_runtime_1.jsx)(insights_1.InsightsContext.Provider, { value: insightsValues, children: (0, jsx_runtime_1.jsx)(react_hook_form_1.FormProvider, { ...filterForm, children: (0, jsx_runtime_1.jsx)(InsightsContainer_1.InsightsContainer, {}) }) }));
31
+ }
@@ -0,0 +1 @@
1
+ export { PageInsight } from './PageInsight';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageInsight = void 0;
4
+ var PageInsight_1 = require("./PageInsight");
5
+ Object.defineProperty(exports, "PageInsight", { enumerable: true, get: function () { return PageInsight_1.PageInsight; } });
@@ -1,9 +1,7 @@
1
- import { InsightExpereince, InsightLookup } from '@headless-adminapp/core/experience/insights';
2
- export declare function createInsightLookup(insights: InsightExpereince[]): InsightLookup[];
3
- interface PageInsightsProps {
4
- insights: InsightExpereince[];
5
- insightId: string;
6
- onChangeInsight: (id: string) => void;
1
+ import { InsightConfig } from '@headless-adminapp/core/experience/insights';
2
+ import { SchemaAttributes } from '@headless-adminapp/core/schema';
3
+ interface PageInsightsProps<S extends SchemaAttributes = SchemaAttributes> {
4
+ config: InsightConfig<S>;
7
5
  }
8
- export declare function PageInsights({ insightId, insights, onChangeInsight, }: PageInsightsProps): import("react/jsx-runtime").JSX.Element | null;
6
+ export declare function PageInsights<S extends SchemaAttributes = SchemaAttributes>({ config, }: Readonly<PageInsightsProps<S>>): import("react/jsx-runtime").JSX.Element;
9
7
  export {};
@@ -1,25 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createInsightLookup = createInsightLookup;
4
3
  exports.PageInsights = PageInsights;
5
4
  const jsx_runtime_1 = require("react/jsx-runtime");
6
- const InsightsProvider_1 = require("@headless-adminapp/app/insights/InsightsProvider");
5
+ const insights_1 = require("@headless-adminapp/app/insights");
6
+ const mutable_1 = require("@headless-adminapp/app/mutable");
7
+ const store_1 = require("@headless-adminapp/app/store");
7
8
  const react_1 = require("react");
9
+ const react_hook_form_1 = require("react-hook-form");
8
10
  const InsightsContainer_1 = require("../Insights/InsightsContainer");
9
- function createInsightLookup(insights) {
10
- return insights.map((insight) => ({
11
- id: insight.id,
12
- title: insight.title,
13
- subtitle: insight.subtitle,
14
- }));
15
- }
16
- function PageInsights({ insightId, insights, onChangeInsight, }) {
17
- const insightExpereince = (0, react_1.useMemo)(() => {
18
- return insights.find((insight) => insight.id === insightId);
19
- }, [insightId, insights]);
20
- const insightLookups = (0, react_1.useMemo)(() => createInsightLookup(insights), [insights]);
21
- if (!insightExpereince) {
22
- return null;
23
- }
24
- return ((0, jsx_runtime_1.jsx)(InsightsProvider_1.InsightsProvider, { experience: insightExpereince, insightLookup: insightLookups, onInsightSelect: onChangeInsight, children: (0, jsx_runtime_1.jsx)(InsightsContainer_1.InsightsContainer, {}) }));
11
+ function PageInsights({ config, }) {
12
+ const filterForm = (0, react_hook_form_1.useForm)({
13
+ mode: 'all',
14
+ defaultValues: config.defaultFilter,
15
+ shouldUnregister: false,
16
+ });
17
+ const filterValues = filterForm.watch();
18
+ const eventManager = (0, react_1.useMemo)(() => new store_1.EventManager(), []);
19
+ const insightsValues = (0, mutable_1.useCreateContextStore)({
20
+ config,
21
+ filterValues,
22
+ eventManager,
23
+ });
24
+ (0, react_1.useEffect)(() => {
25
+ insightsValues.setValue({
26
+ config,
27
+ filterValues,
28
+ });
29
+ }, [config, filterValues, insightsValues]);
30
+ return ((0, jsx_runtime_1.jsx)(insights_1.InsightsContext.Provider, { value: insightsValues, children: (0, jsx_runtime_1.jsx)(react_hook_form_1.FormProvider, { ...filterForm, children: (0, jsx_runtime_1.jsx)(InsightsContainer_1.InsightsContainer, {}) }) }));
25
31
  }
@@ -1 +1 @@
1
- export { PageInsights, createInsightLookup } from './PageInsights';
1
+ export { PageInsights } from './PageInsights';
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createInsightLookup = exports.PageInsights = void 0;
3
+ exports.PageInsights = void 0;
4
4
  var PageInsights_1 = require("./PageInsights");
5
5
  Object.defineProperty(exports, "PageInsights", { enumerable: true, get: function () { return PageInsights_1.PageInsights; } });
6
- Object.defineProperty(exports, "createInsightLookup", { enumerable: true, get: function () { return PageInsights_1.createInsightLookup; } });
@@ -0,0 +1,7 @@
1
+ import { Icon } from '@headless-adminapp/icons';
2
+ interface ComponentBrokenProps {
3
+ message?: string;
4
+ Icon?: Icon;
5
+ }
6
+ export declare function ComponentBroken({ message, Icon }: ComponentBrokenProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComponentBroken = ComponentBroken;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ function ComponentBroken({ message, Icon }) {
7
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
8
+ display: 'flex',
9
+ flex: 1,
10
+ flexDirection: 'column',
11
+ alignItems: 'center',
12
+ justifyContent: 'center',
13
+ gap: 16,
14
+ color: react_components_1.tokens.colorNeutralForeground3,
15
+ }, children: [!!Icon && (0, jsx_runtime_1.jsx)(Icon, { size: 40 }), (0, jsx_runtime_1.jsx)(react_components_1.Body1, { children: message })] }));
16
+ }
@@ -0,0 +1,15 @@
1
+ import { Component, PropsWithChildren } from 'react';
2
+ interface ErrorBoundaryProps {
3
+ }
4
+ interface ErrorBoundaryState {
5
+ hasError: boolean;
6
+ }
7
+ export declare class ComponentErrorBoundary extends Component<PropsWithChildren<ErrorBoundaryProps>, ErrorBoundaryState> {
8
+ constructor(props: PropsWithChildren<ErrorBoundaryProps>);
9
+ static getDerivedStateFromError(): {
10
+ hasError: boolean;
11
+ };
12
+ componentDidCatch(error: unknown, errorInfo: unknown): void;
13
+ render(): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | null | undefined;
14
+ }
15
+ export {};