@headless-adminapp/fluent 0.0.17-alpha.52 → 0.0.17-alpha.53

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 (174) hide show
  1. package/App/App.js +7 -11
  2. package/App/AppHeaderContianer.js +38 -42
  3. package/App/AppLogo.js +8 -12
  4. package/App/AppStringContext.js +9 -13
  5. package/App/AppUI.js +11 -15
  6. package/App/LayoutProvider.js +11 -15
  7. package/App/NavigationContainer.js +25 -29
  8. package/App/QuickActionItem.js +5 -9
  9. package/App/index.js +1 -5
  10. package/App/utils.js +1 -4
  11. package/CommandBar/Button.js +14 -17
  12. package/CommandBar/Divider.js +6 -9
  13. package/CommandBar/IconButton.js +13 -16
  14. package/CommandBar/Label.js +8 -11
  15. package/CommandBar/MenuButton.js +17 -20
  16. package/CommandBar/MenuItem.js +15 -18
  17. package/CommandBar/MenuItems.js +8 -11
  18. package/CommandBar/MenuList.js +9 -12
  19. package/CommandBar/Wrapper.js +7 -10
  20. package/CommandBar/index.js +13 -15
  21. package/DataForm/SectionControl.js +4 -7
  22. package/DataGrid/ActionCell.js +11 -14
  23. package/DataGrid/CommandContainer.js +6 -10
  24. package/DataGrid/CustomizeColumns/AddColumns.js +34 -37
  25. package/DataGrid/CustomizeColumns/ColumnItem.js +19 -23
  26. package/DataGrid/CustomizeColumns/CustomizeColumns.js +36 -42
  27. package/DataGrid/CustomizeColumns/index.js +1 -5
  28. package/DataGrid/FormSubgridCommandContainer.js +13 -17
  29. package/DataGrid/FormSubgridViewSelector.js +18 -22
  30. package/DataGrid/GridColumnHeader/ConditionValueControl.js +14 -20
  31. package/DataGrid/GridColumnHeader/FilterForm.js +23 -27
  32. package/DataGrid/GridColumnHeader/OperatorSelect.js +13 -19
  33. package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +28 -32
  34. package/DataGrid/GridColumnHeader/index.js +1 -5
  35. package/DataGrid/GridColumnHeader/utils.js +2 -6
  36. package/DataGrid/GridHeaderContainer.js +4 -8
  37. package/DataGrid/GridHeaderDesktop.js +26 -30
  38. package/DataGrid/GridHeaderMobile.js +17 -21
  39. package/DataGrid/GridListContainer.js +39 -43
  40. package/DataGrid/GridPaginationContainer.js +12 -16
  41. package/DataGrid/GridTableContainer.js +74 -78
  42. package/DataGrid/TableCell/TableCellAction.js +11 -15
  43. package/DataGrid/TableCell/TableCellBase.js +4 -8
  44. package/DataGrid/TableCell/TableCellCheckbox.js +7 -10
  45. package/DataGrid/TableCell/TableCellChoice.js +11 -14
  46. package/DataGrid/TableCell/TableCellLink.d.ts +1 -1
  47. package/DataGrid/TableCell/TableCellLink.js +13 -12
  48. package/DataGrid/TableCell/TableCellText.js +7 -10
  49. package/DataGrid/TableCell/index.js +4 -20
  50. package/DataGrid/index.js +4 -11
  51. package/DataGrid/types.js +1 -2
  52. package/DataGrid/useTableColumns.js +139 -90
  53. package/DataGrid/utils.js +1 -5
  54. package/DialogContainer/AlertDialog.js +5 -8
  55. package/DialogContainer/ConfirmDialog.js +6 -9
  56. package/DialogContainer/DialogContainer.js +14 -18
  57. package/DialogContainer/ErrorDialog.js +9 -12
  58. package/DialogContainer/PromptDialog.js +30 -57
  59. package/DialogContainer/index.js +1 -5
  60. package/Insights/CommandBarContainer.js +11 -14
  61. package/Insights/FilterBarContainer.js +17 -20
  62. package/Insights/Grid.js +9 -13
  63. package/Insights/InsightsContainer.js +19 -22
  64. package/Insights/WidgetChartContainer.js +30 -34
  65. package/Insights/WidgetDataGridContainer.js +32 -35
  66. package/Insights/WidgetTableContainer.js +24 -28
  67. package/Insights/WidgetTileContainer.js +12 -16
  68. package/Insights/WidgetTitleBar.js +9 -15
  69. package/Insights/Widgets.js +25 -28
  70. package/Insights/charts/AreaChart.js +12 -15
  71. package/Insights/charts/BarChart.js +12 -15
  72. package/Insights/charts/ComposedChart.js +12 -15
  73. package/Insights/charts/CustomTooltipContent.js +8 -12
  74. package/Insights/charts/GaugeChart.js +3 -6
  75. package/Insights/charts/LineChart.js +12 -15
  76. package/Insights/charts/OhlcChart.js +36 -41
  77. package/Insights/charts/PieChart.js +23 -26
  78. package/Insights/charts/RadarChart.js +16 -19
  79. package/Insights/charts/ScatterChart.js +23 -26
  80. package/Insights/charts/constants.js +1 -4
  81. package/Insights/charts/formatters.js +17 -29
  82. package/Insights/charts/index.js +1 -2
  83. package/Insights/charts/renderers.js +25 -36
  84. package/Insights/hooks/useQueriesData.js +19 -25
  85. package/Insights/hooks/useWidgetDetail.js +13 -16
  86. package/OverflowCommandBar/OverflowCommandBar.js +12 -19
  87. package/OverflowCommandBar/OverflowMenu.js +16 -20
  88. package/OverflowCommandBar/OverflowMenuDivider.js +6 -10
  89. package/OverflowCommandBar/index.js +3 -9
  90. package/OverflowCommandBar/render.js +9 -15
  91. package/OverflowCommandBar/utils.js +1 -4
  92. package/PageBoard/BoardColumn.js +5 -8
  93. package/PageBoard/BoardColumnCard.js +12 -15
  94. package/PageBoard/BoardColumnUI.js +34 -38
  95. package/PageBoard/BoardingColumnCardLoading.js +10 -13
  96. package/PageBoard/Header.js +16 -20
  97. package/PageBoard/PageBoard.d.ts +1 -1
  98. package/PageBoard/PageBoard.js +26 -29
  99. package/PageBoard/index.js +1 -5
  100. package/PageEntityForm/CommandContainer.js +21 -25
  101. package/PageEntityForm/FormTabRelated.js +17 -20
  102. package/PageEntityForm/PageEntityForm.js +16 -20
  103. package/PageEntityForm/PageEntityFormDesktopContainer.js +68 -72
  104. package/PageEntityForm/PageEntityFormStringContext.js +5 -9
  105. package/PageEntityForm/ProcessFlow.js +21 -24
  106. package/PageEntityForm/RecordCard.js +21 -24
  107. package/PageEntityForm/RecordCardLoading.js +10 -13
  108. package/PageEntityForm/RecordSetNavigatorContainer.js +30 -34
  109. package/PageEntityForm/RelatedViewSelector.js +28 -31
  110. package/PageEntityForm/SectionContainer.js +25 -28
  111. package/PageEntityForm/StandardControl.d.ts +3 -3
  112. package/PageEntityForm/StandardControl.js +74 -81
  113. package/PageEntityForm/SubgridControl.js +20 -23
  114. package/PageEntityForm/index.js +1 -5
  115. package/PageEntityView/FormSubgridContainer.js +22 -26
  116. package/PageEntityView/PageEntityView.js +15 -19
  117. package/PageEntityView/PageEntityViewDesktopContainer.js +9 -13
  118. package/PageEntityView/PageEntityViewDesktopFrame.js +17 -21
  119. package/PageEntityView/PageEntityViewMobileContainer.js +9 -13
  120. package/PageEntityView/PageEntityViewStringContext.js +5 -9
  121. package/PageEntityView/index.js +1 -5
  122. package/PageInsights/PageInsights.js +9 -13
  123. package/PageInsights/index.js +1 -6
  124. package/ProgressIndicatorContainer/index.js +10 -14
  125. package/ToastNotificationContainer/index.js +14 -18
  126. package/componentStore.js +2 -5
  127. package/components/BodyLoading.js +7 -11
  128. package/components/DialogLogin.js +5 -8
  129. package/components/LoginForm.js +21 -47
  130. package/components/PageBroken.js +5 -8
  131. package/components/PageLoading.js +5 -8
  132. package/components/PageLogin.js +14 -17
  133. package/form/FormControl.js +39 -44
  134. package/form/FormControlLoading.js +4 -8
  135. package/form/controls/AttachmentControl.js +56 -60
  136. package/form/controls/AttachmentsControl.js +15 -19
  137. package/form/controls/CurrencyControl.js +10 -13
  138. package/form/controls/DateControl.js +18 -24
  139. package/form/controls/DateRangeControl.js +14 -20
  140. package/form/controls/DateTimeControl.js +39 -45
  141. package/form/controls/DecimalControl.js +8 -11
  142. package/form/controls/DurationControl.js +11 -15
  143. package/form/controls/EmailControl.js +7 -10
  144. package/form/controls/IntegerControl.js +4 -7
  145. package/form/controls/LookupControl.d.ts +1 -0
  146. package/form/controls/LookupControl.js +75 -38
  147. package/form/controls/MultiSelectControl.js +8 -11
  148. package/form/controls/MultiSelectLookupControl.js +40 -43
  149. package/form/controls/PasswordControl.js +8 -11
  150. package/form/controls/RichTextControl.js +5 -32
  151. package/form/controls/SelectControl.js +8 -11
  152. package/form/controls/SwitchControl.js +4 -7
  153. package/form/controls/TelephoneControl.js +7 -10
  154. package/form/controls/TextAreaControl.js +4 -7
  155. package/form/controls/TextControl.js +5 -8
  156. package/form/controls/UrlControl.js +7 -10
  157. package/form/controls/types.js +1 -2
  158. package/form/controls/useLookupData.js +14 -18
  159. package/form/layout/FormBody/FormBody.js +6 -10
  160. package/form/layout/FormBody/index.js +1 -17
  161. package/form/layout/FormSection/FormSection.js +18 -22
  162. package/form/layout/FormSection/FormSectionColumn.js +3 -7
  163. package/form/layout/FormSection/FormSectionLoading.js +1 -5
  164. package/form/layout/FormSection/index.js +1 -5
  165. package/form/layout/FormTab/FormTab.js +16 -20
  166. package/form/layout/FormTab/FormTabColumn.js +5 -9
  167. package/form/layout/FormTab/index.js +1 -5
  168. package/form/layout/TabContext.js +2 -5
  169. package/form/layout/index.js +3 -9
  170. package/form/types.js +1 -2
  171. package/package.json +3 -2
  172. package/types/index.js +1 -2
  173. package/utils/avatar.d.ts +2 -0
  174. package/utils/avatar.js +42 -0
@@ -1,18 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RecordCard = RecordCard;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_components_1 = require("@fluentui/react-components");
6
- const utils_1 = require("@headless-adminapp/app/utils");
7
- const color_1 = require("@headless-adminapp/app/utils/color");
8
- const useStyles = (0, react_components_1.makeStyles)({
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Avatar, Body1, Body1Strong, Caption1, makeStyles, mergeClasses, Tag, tokens, } from '@fluentui/react-components';
3
+ import { getAttributeFormattedValue } from '@headless-adminapp/app/utils';
4
+ import { isColorDark } from '@headless-adminapp/app/utils/color';
5
+ const useStyles = makeStyles({
9
6
  root: {
10
7
  width: '100%',
11
8
  display: 'flex',
12
9
  flexDirection: 'row',
13
- paddingInline: react_components_1.tokens.spacingHorizontalL,
14
- paddingBlock: react_components_1.tokens.spacingVerticalS,
15
- gap: react_components_1.tokens.spacingHorizontalS,
10
+ paddingInline: tokens.spacingHorizontalL,
11
+ paddingBlock: tokens.spacingVerticalS,
12
+ gap: tokens.spacingHorizontalS,
16
13
  // cursor: 'pointer',
17
14
  // '&:hover': {
18
15
  // background: tokens.colorNeutralBackground1Hover,
@@ -29,7 +26,7 @@ const useStyles = (0, react_components_1.makeStyles)({
29
26
  function createIntial(name) {
30
27
  return name === null || name === void 0 ? void 0 : name.split(' ').map((x) => x[0]).slice(0, 2).join('').toUpperCase();
31
28
  }
32
- function RecordCard({ schema, cardView, record, selected, }) {
29
+ export function RecordCard({ schema, cardView, record, selected, }) {
33
30
  var _a, _b, _c;
34
31
  const styles = useStyles();
35
32
  const _record = record;
@@ -47,13 +44,13 @@ function RecordCard({ schema, cardView, record, selected, }) {
47
44
  avatarSrc = _record[cardView.avatarColumn];
48
45
  }
49
46
  }
50
- 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: {
47
+ return (_jsxs("div", { className: mergeClasses(styles.root, selected && styles.selected), children: [cardView.showAvatar && (_jsx(Avatar, { initials: initials, color: "neutral", style: { cursor: 'pointer' }, image: {
51
48
  src: avatarSrc,
52
- } })), (0, jsx_runtime_1.jsxs)("div", { style: {
49
+ } })), _jsxs("div", { style: {
53
50
  display: 'flex',
54
51
  flexDirection: 'column',
55
52
  flex: 1,
56
- }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { wordBreak: 'break-all' }, children: _record[cardView.primaryColumn] }), (_b = cardView.secondaryColumns) === null || _b === void 0 ? void 0 : _b.map((column) => ((0, jsx_runtime_1.jsx)(SecondaryColumnContent, { record: _record, column: column, schema: schema }, column.name)))] }), !!((_c = cardView.rightColumn) === null || _c === void 0 ? void 0 : _c.length) && ((0, jsx_runtime_1.jsx)("div", { style: {
53
+ }, children: [_jsx(Body1, { style: { wordBreak: 'break-all' }, children: _record[cardView.primaryColumn] }), (_b = cardView.secondaryColumns) === null || _b === void 0 ? void 0 : _b.map((column) => (_jsx(SecondaryColumnContent, { record: _record, column: column, schema: schema }, column.name)))] }), !!((_c = cardView.rightColumn) === null || _c === void 0 ? void 0 : _c.length) && (_jsx("div", { style: {
57
54
  display: 'flex',
58
55
  flexDirection: 'column',
59
56
  alignItems: 'flex-end',
@@ -69,7 +66,7 @@ function RecordCard({ schema, cardView, record, selected, }) {
69
66
  if (!choice) {
70
67
  return null;
71
68
  }
72
- return ((0, jsx_runtime_1.jsx)(react_components_1.Tag, { size: "extra-small", appearance: "filled", style: {
69
+ return (_jsx(Tag, { size: "extra-small", appearance: "filled", style: {
73
70
  background: choice.color,
74
71
  color: 'white',
75
72
  height: 16,
@@ -80,9 +77,9 @@ function RecordCard({ schema, cardView, record, selected, }) {
80
77
  }
81
78
  }
82
79
  if (column.variant === 'strong') {
83
- return ((0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: (0, utils_1.getAttributeFormattedValue)(value, attribute) }, column.name));
80
+ return (_jsx(Body1Strong, { children: getAttributeFormattedValue(value, attribute) }, column.name));
84
81
  }
85
- return ((0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: (0, utils_1.getAttributeFormattedValue)(value, attribute) }, column.name));
82
+ return (_jsx(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: getAttributeFormattedValue(value, attribute) }, column.name));
86
83
  }) }))] }));
87
84
  }
88
85
  function SecondaryColumnContent({ record: _record, column, schema, }) {
@@ -100,21 +97,21 @@ function SecondaryColumnContent({ record: _record, column, schema, }) {
100
97
  }
101
98
  if (column.variant === 'choice') {
102
99
  if (attribute.type === 'choice') {
103
- return (0, jsx_runtime_1.jsx)(ChoiceTag, { attribute: attribute, value: value });
100
+ return _jsx(ChoiceTag, { attribute: attribute, value: value });
104
101
  }
105
102
  if (attribute.type === 'choices') {
106
103
  const choices = attribute.options.filter((option) => value.includes(option.value));
107
104
  if (!choices.length) {
108
105
  return null;
109
106
  }
110
- return ((0, jsx_runtime_1.jsx)("div", { style: {
107
+ return (_jsx("div", { style: {
111
108
  display: 'flex',
112
109
  flexDirection: 'row',
113
110
  gap: 4,
114
- }, children: choices.map((choice) => ((0, jsx_runtime_1.jsx)(ChoiceTag, { attribute: attribute, value: choice.value }, choice.value))) }, column.name));
111
+ }, children: choices.map((choice) => (_jsx(ChoiceTag, { attribute: attribute, value: choice.value }, choice.value))) }, column.name));
115
112
  }
116
113
  }
117
- return ((0, jsx_runtime_1.jsxs)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: [!!label && `${label}: `, (0, utils_1.getAttributeFormattedValue)(attribute, value)] }, column.name));
114
+ return (_jsxs(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: [!!label && `${label}: `, getAttributeFormattedValue(attribute, value)] }, column.name));
118
115
  }
119
116
  const ChoiceTag = ({ attribute, value, }) => {
120
117
  const choice = attribute.options.find((option) => option.value === value);
@@ -124,9 +121,9 @@ const ChoiceTag = ({ attribute, value, }) => {
124
121
  const bgColor = choice.color;
125
122
  let color;
126
123
  if (bgColor) {
127
- color = (0, color_1.isColorDark)(bgColor) ? '#FFFFFF' : '#000000';
124
+ color = isColorDark(bgColor) ? '#FFFFFF' : '#000000';
128
125
  }
129
- return ((0, jsx_runtime_1.jsx)(react_components_1.Tag, { size: "extra-small", appearance: "filled", style: {
126
+ return (_jsx(Tag, { size: "extra-small", appearance: "filled", style: {
130
127
  background: bgColor,
131
128
  color: color,
132
129
  height: 16,
@@ -1,25 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RecordCardLoading = RecordCardLoading;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_components_1 = require("@fluentui/react-components");
6
- const useStyles = (0, react_components_1.makeStyles)({
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Avatar, makeStyles, mergeClasses, SkeletonItem, tokens, } from '@fluentui/react-components';
3
+ const useStyles = makeStyles({
7
4
  root: {
8
5
  width: '100%',
9
6
  display: 'flex',
10
7
  flexDirection: 'row',
11
- paddingInline: react_components_1.tokens.spacingHorizontalL,
12
- paddingBlock: react_components_1.tokens.spacingVerticalS,
13
- gap: react_components_1.tokens.spacingHorizontalS,
8
+ paddingInline: tokens.spacingHorizontalL,
9
+ paddingBlock: tokens.spacingVerticalS,
10
+ gap: tokens.spacingHorizontalS,
14
11
  },
15
12
  });
16
- function RecordCardLoading({ cardView }) {
13
+ export function RecordCardLoading({ cardView }) {
17
14
  var _a;
18
15
  const styles = useStyles();
19
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, react_components_1.mergeClasses)(styles.root), children: [cardView.showAvatar && ((0, jsx_runtime_1.jsx)(react_components_1.Avatar, { color: "neutral", style: { cursor: 'pointer' } })), (0, jsx_runtime_1.jsxs)("div", { style: {
16
+ return (_jsxs("div", { className: mergeClasses(styles.root), children: [cardView.showAvatar && (_jsx(Avatar, { color: "neutral", style: { cursor: 'pointer' } })), _jsxs("div", { style: {
20
17
  display: 'flex',
21
18
  flexDirection: 'column',
22
19
  flex: 1,
23
- gap: react_components_1.tokens.spacingVerticalXXS,
24
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: { paddingBlock: 2 }, children: (0, jsx_runtime_1.jsx)(react_components_1.SkeletonItem, { size: 16, style: { height: 16 } }) }), (_a = cardView.secondaryColumns) === null || _a === void 0 ? void 0 : _a.map((_, index) => ((0, jsx_runtime_1.jsx)("div", { style: { paddingBlock: 2 }, children: (0, jsx_runtime_1.jsx)(react_components_1.SkeletonItem, { size: 16, style: { width: 160, height: 12 } }) }, index)))] })] }));
20
+ gap: tokens.spacingVerticalXXS,
21
+ }, children: [_jsx("div", { style: { paddingBlock: 2 }, children: _jsx(SkeletonItem, { size: 16, style: { height: 16 } }) }), (_a = cardView.secondaryColumns) === null || _a === void 0 ? void 0 : _a.map((_, index) => (_jsx("div", { style: { paddingBlock: 2 }, children: _jsx(SkeletonItem, { size: 16, style: { width: 160, height: 12 } }) }, index)))] })] }));
25
22
  }
@@ -1,61 +1,58 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RecordSetNavigatorContainer = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_components_1 = require("@fluentui/react-components");
6
- const ScrollView_1 = require("@headless-adminapp/app/components/ScrollView");
7
- const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
8
- const locale_1 = require("@headless-adminapp/app/locale");
9
- const navigation_1 = require("@headless-adminapp/app/navigation");
10
- const hooks_2 = require("@headless-adminapp/app/recordset/hooks");
11
- const react_1 = require("react");
12
- const RecordCard_1 = require("./RecordCard");
13
- const useStyles = (0, react_components_1.makeStyles)({
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Body1Strong, Divider, makeStyles, mergeClasses, tokens, } from '@fluentui/react-components';
3
+ import { ScrollView } from '@headless-adminapp/app/components/ScrollView';
4
+ import { useRecordId } from '@headless-adminapp/app/dataform/hooks';
5
+ import { useLocale } from '@headless-adminapp/app/locale';
6
+ import { useOpenForm } from '@headless-adminapp/app/navigation';
7
+ import { useRecordSetResult, useRecordSetVisibility, } from '@headless-adminapp/app/recordset/hooks';
8
+ import { Fragment } from 'react';
9
+ import { RecordCard } from './RecordCard';
10
+ const useStyles = makeStyles({
14
11
  item: {
15
12
  cursor: 'pointer',
16
13
  '&:hover': {
17
- background: react_components_1.tokens.colorNeutralBackground1Hover,
14
+ background: tokens.colorNeutralBackground1Hover,
18
15
  },
19
16
  '&:active': {
20
- background: react_components_1.tokens.colorNeutralBackground1Pressed,
17
+ background: tokens.colorNeutralBackground1Pressed,
21
18
  },
22
19
  },
23
20
  selected: {
24
- background: react_components_1.tokens.colorNeutralBackground1Selected,
21
+ background: tokens.colorNeutralBackground1Selected,
25
22
  },
26
23
  });
27
- const RecordSetNavigatorContainer = () => {
24
+ export const RecordSetNavigatorContainer = () => {
28
25
  var _a, _b;
29
- const { data, cardView, schema } = (0, hooks_2.useRecordSetResult)();
30
- const [visible] = (0, hooks_2.useRecordSetVisibility)();
31
- const recordId = (0, hooks_1.useRecordId)();
26
+ const { data, cardView, schema } = useRecordSetResult();
27
+ const [visible] = useRecordSetVisibility();
28
+ const recordId = useRecordId();
32
29
  const styles = useStyles();
33
- const openForm = (0, navigation_1.useOpenForm)();
34
- const { language, direction } = (0, locale_1.useLocale)();
30
+ const openForm = useOpenForm();
31
+ const { language, direction } = useLocale();
35
32
  if (!schema) {
36
33
  return null;
37
34
  }
38
35
  if (!visible) {
39
36
  return null;
40
37
  }
41
- return ((0, jsx_runtime_1.jsx)("div", { style: {
42
- [direction === 'rtl' ? 'paddingRight' : 'paddingLeft']: react_components_1.tokens.spacingVerticalM,
43
- paddingBlock: react_components_1.tokens.spacingVerticalM,
38
+ return (_jsx("div", { style: {
39
+ [direction === 'rtl' ? 'paddingRight' : 'paddingLeft']: tokens.spacingVerticalM,
40
+ paddingBlock: tokens.spacingVerticalM,
44
41
  display: 'flex',
45
42
  // display: 'none',
46
- }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
47
- boxShadow: react_components_1.tokens.shadow2,
48
- borderRadius: react_components_1.tokens.borderRadiusMedium,
49
- background: react_components_1.tokens.colorNeutralBackground1,
43
+ }, children: _jsxs("div", { style: {
44
+ boxShadow: tokens.shadow2,
45
+ borderRadius: tokens.borderRadiusMedium,
46
+ background: tokens.colorNeutralBackground1,
50
47
  display: 'flex',
51
48
  minWidth: 320,
52
49
  flexDirection: 'column',
53
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
50
+ }, children: [_jsx("div", { style: {
54
51
  display: 'flex',
55
52
  flexDirection: 'column',
56
53
  paddingInline: 16,
57
54
  paddingBlock: 8,
58
- }, children: (0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: (_b = (_a = schema.localizedPluralLabels) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : schema === null || schema === void 0 ? void 0 : schema.pluralLabel }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { vertical: false, style: { opacity: 0.2 } }) }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(ScrollView_1.ScrollView, { autoHide: true, rtl: direction === 'rtl', children: data === null || data === void 0 ? void 0 : data.map((record) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { role: "button", className: (0, react_components_1.mergeClasses)(styles.item, recordId ===
55
+ }, children: _jsx(Body1Strong, { children: (_b = (_a = schema.localizedPluralLabels) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : schema === null || schema === void 0 ? void 0 : schema.pluralLabel }) }), _jsx("div", { children: _jsx(Divider, { vertical: false, style: { opacity: 0.2 } }) }), _jsx("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: _jsx(ScrollView, { autoHide: true, rtl: direction === 'rtl', children: data === null || data === void 0 ? void 0 : data.map((record) => (_jsxs(Fragment, { children: [_jsx("div", { role: "button", className: mergeClasses(styles.item, recordId ===
59
56
  record[schema.idAttribute] &&
60
57
  styles.selected), onClick: () => {
61
58
  openForm({
@@ -63,7 +60,6 @@ const RecordSetNavigatorContainer = () => {
63
60
  id: record[schema.idAttribute],
64
61
  replace: true,
65
62
  });
66
- }, children: (0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: cardView, record: record, schema: schema, selected: recordId ===
67
- record[schema.idAttribute] }) }), (0, jsx_runtime_1.jsx)("div", { style: { paddingInline: react_components_1.tokens.spacingHorizontalL }, children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { vertical: false, style: { opacity: 0.2 } }) })] }, record[schema.idAttribute]))) }) })] }) }));
63
+ }, children: _jsx(RecordCard, { cardView: cardView, record: record, schema: schema, selected: recordId ===
64
+ record[schema.idAttribute] }) }), _jsx("div", { style: { paddingInline: tokens.spacingHorizontalL }, children: _jsx(Divider, { vertical: false, style: { opacity: 0.2 } }) })] }, record[schema.idAttribute]))) }) })] }) }));
68
65
  };
69
- exports.RecordSetNavigatorContainer = RecordSetNavigatorContainer;
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RelatedViewSelector = RelatedViewSelector;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_components_1 = require("@fluentui/react-components");
6
- const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
7
- const locale_1 = require("@headless-adminapp/app/locale");
8
- const hooks_2 = require("@headless-adminapp/app/metadata/hooks");
9
- const utils_1 = require("@headless-adminapp/core/attributes/utils");
10
- const icons_1 = require("@headless-adminapp/icons");
11
- const react_1 = require("react");
12
- const PageEntityFormStringContext_1 = require("./PageEntityFormStringContext");
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Menu, MenuItem, MenuList, MenuPopover, MenuTrigger, tokens, } from '@fluentui/react-components';
3
+ import { useDataFormSchema, useSelectedForm, } from '@headless-adminapp/app/dataform/hooks';
4
+ import { useLocale } from '@headless-adminapp/app/locale';
5
+ import { useMetadata } from '@headless-adminapp/app/metadata/hooks';
6
+ import { isLookupAttribute } from '@headless-adminapp/core/attributes/utils';
7
+ import { Icons } from '@headless-adminapp/icons';
8
+ import { useMemo } from 'react';
9
+ import { usePageEntityFormStrings } from './PageEntityFormStringContext';
13
10
  function getRelatedItems(currentSchema, schemas, relatedItems) {
14
11
  if (relatedItems === null) {
15
12
  return [];
@@ -25,7 +22,7 @@ function getRelatedItems(currentSchema, schemas, relatedItems) {
25
22
  throw new Error(`Attribute not found: ${item.logicalName}.${item.attributeName}`);
26
23
  }
27
24
  const attribute = schema.attributes[item.attributeName];
28
- if (!(0, utils_1.isLookupAttribute)(attribute)) {
25
+ if (!isLookupAttribute(attribute)) {
29
26
  throw new Error(`Attribute is not a lookup: ${item.logicalName}.${item.attributeName}`);
30
27
  }
31
28
  if (attribute.entity !== currentSchema.logicalName) {
@@ -44,7 +41,7 @@ function getRelatedItems(currentSchema, schemas, relatedItems) {
44
41
  .map((s) => {
45
42
  return Object.entries(s.attributes)
46
43
  .map(([key, attribute]) => {
47
- if (!(0, utils_1.isLookupAttribute)(attribute)) {
44
+ if (!isLookupAttribute(attribute)) {
48
45
  return null;
49
46
  }
50
47
  if (attribute.entity !== currentSchema.logicalName) {
@@ -72,24 +69,24 @@ function getRelatedItems(currentSchema, schemas, relatedItems) {
72
69
  })
73
70
  .flat();
74
71
  }
75
- function RelatedViewSelector(props) {
76
- const schema = (0, hooks_1.useDataFormSchema)();
77
- const formConfig = (0, hooks_1.useSelectedForm)();
78
- const { schemas } = (0, hooks_2.useMetadata)();
79
- const strings = (0, PageEntityFormStringContext_1.usePageEntityFormStrings)();
80
- const { language } = (0, locale_1.useLocale)();
81
- const data = (0, react_1.useMemo)(() => getRelatedItems(schema, schemas, formConfig.experience.relatedItems), [formConfig.experience.relatedItems, schema, schemas]);
72
+ export function RelatedViewSelector(props) {
73
+ const schema = useDataFormSchema();
74
+ const formConfig = useSelectedForm();
75
+ const { schemas } = useMetadata();
76
+ const strings = usePageEntityFormStrings();
77
+ const { language } = useLocale();
78
+ const data = useMemo(() => getRelatedItems(schema, schemas, formConfig.experience.relatedItems), [formConfig.experience.relatedItems, schema, schemas]);
82
79
  if (!data.length) {
83
80
  return null;
84
81
  }
85
- return ((0, jsx_runtime_1.jsxs)(react_components_1.Menu, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsxs)("button", { style: {
82
+ return (_jsxs(Menu, { children: [_jsx(MenuTrigger, { children: _jsxs("button", { style: {
86
83
  border: 'none',
87
84
  overflow: 'hidden',
88
- borderRadius: react_components_1.tokens.borderRadiusMedium,
89
- padding: `${react_components_1.tokens.spacingVerticalM} ${react_components_1.tokens.spacingHorizontalMNudge}`,
90
- fontFamily: react_components_1.tokens.fontFamilyBase,
91
- lineHeight: react_components_1.tokens.lineHeightBase300,
92
- backgroundColor: react_components_1.tokens.colorTransparentBackground,
85
+ borderRadius: tokens.borderRadiusMedium,
86
+ padding: `${tokens.spacingVerticalM} ${tokens.spacingHorizontalMNudge}`,
87
+ fontFamily: tokens.fontFamilyBase,
88
+ lineHeight: tokens.lineHeightBase300,
89
+ backgroundColor: tokens.colorTransparentBackground,
93
90
  alignItems: 'center',
94
91
  position: 'relative',
95
92
  display: 'flex',
@@ -98,10 +95,10 @@ function RelatedViewSelector(props) {
98
95
  cursor: 'pointer',
99
96
  outlineStyle: 'none',
100
97
  textTransform: 'none',
101
- columnGap: react_components_1.tokens.spacingHorizontalSNudge,
102
- color: react_components_1.tokens.colorNeutralForeground2,
103
- }, children: [strings.related, (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronDown, { size: 16 })] }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: data.map((item) => {
98
+ columnGap: tokens.spacingHorizontalSNudge,
99
+ color: tokens.colorNeutralForeground2,
100
+ }, children: [strings.related, _jsx(Icons.ChevronDown, { size: 16 })] }) }), _jsx(MenuPopover, { children: _jsx(MenuList, { children: data.map((item) => {
104
101
  var _a, _b;
105
- return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => props.onSelect(item), children: (_b = (_a = item.localizedPluralLabels) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.pluralLabel }, item.key));
102
+ return (_jsx(MenuItem, { onClick: () => props.onSelect(item), children: (_b = (_a = item.localizedPluralLabels) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.pluralLabel }, item.key));
106
103
  }) }) })] }));
107
104
  }
@@ -1,39 +1,36 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SectionContainer = SectionContainer;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
6
- const locale_1 = require("@headless-adminapp/app/locale");
7
- const utils_1 = require("@headless-adminapp/app/locale/utils");
8
- const react_hook_form_1 = require("react-hook-form");
9
- const componentStore_1 = require("../componentStore");
10
- const SectionControl_1 = require("../DataForm/SectionControl");
11
- const layout_1 = require("../form/layout");
12
- const StandardControl_1 = require("./StandardControl");
13
- const SubgridControl_1 = require("./SubgridControl");
14
- function SectionContainer({ section }) {
15
- const schema = (0, hooks_1.useDataFormSchema)();
16
- const formInstance = (0, hooks_1.useFormInstance)();
17
- const recordId = (0, hooks_1.useRecordId)();
18
- const readonly = (0, hooks_1.useFormIsReadonly)();
19
- const { language } = (0, locale_1.useLocale)();
20
- return ((0, jsx_runtime_1.jsx)(layout_1.FormSection, { title: (0, utils_1.localizedLabel)(language, section), columnCount: section.columnCount, labelPosition: section.labelPosition, noPadding: section.noPadding, hideLabel: section.hideLabel, children: section.controls.map((control, index) => {
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useDataFormSchema, useFormInstance, useFormIsReadonly, useRecordId, } from '@headless-adminapp/app/dataform/hooks';
3
+ import { useLocale } from '@headless-adminapp/app/locale';
4
+ import { localizedLabel } from '@headless-adminapp/app/locale/utils';
5
+ import { Controller } from 'react-hook-form';
6
+ import { componentStore } from '../componentStore';
7
+ import { SectionControlWrapper } from '../DataForm/SectionControl';
8
+ import { FormSection } from '../form/layout';
9
+ import { StandardControl } from './StandardControl';
10
+ import { SubgridControl } from './SubgridControl';
11
+ export function SectionContainer({ section }) {
12
+ const schema = useDataFormSchema();
13
+ const formInstance = useFormInstance();
14
+ const recordId = useRecordId();
15
+ const readonly = useFormIsReadonly();
16
+ const { language } = useLocale();
17
+ return (_jsx(FormSection, { title: localizedLabel(language, section), columnCount: section.columnCount, labelPosition: section.labelPosition, noPadding: section.noPadding, hideLabel: section.hideLabel, children: section.controls.map((control, index) => {
21
18
  var _a;
22
19
  switch (control.type) {
23
20
  case 'standard': {
24
21
  const attribute = schema.attributes[control.attributeName];
25
- let Control = StandardControl_1.StandardControl;
22
+ let Control = StandardControl;
26
23
  if (control.component) {
27
- const OverrideControl = componentStore_1.componentStore.getComponent(control.component);
24
+ const OverrideControl = componentStore.getComponent(control.component);
28
25
  if (OverrideControl) {
29
26
  Control = OverrideControl;
30
27
  }
31
28
  }
32
- return ((0, jsx_runtime_1.jsx)("div", { style: {
29
+ return (_jsx("div", { style: {
33
30
  gridColumn: control.span
34
31
  ? `var(--section-item-span-${control.span})`
35
32
  : undefined,
36
- }, children: (0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: formInstance.control, name: control.attributeName, render: ({ field, fieldState, formState }) => {
33
+ }, children: _jsx(Controller, { control: formInstance.control, name: control.attributeName, render: ({ field, fieldState, formState }) => {
37
34
  var _a, _b, _c, _d, _e, _f, _g;
38
35
  const isError = (fieldState.isTouched || formState.isSubmitted) &&
39
36
  !!((_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message);
@@ -41,7 +38,7 @@ function SectionContainer({ section }) {
41
38
  ? (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message
42
39
  : '';
43
40
  const label = (_g = (_f = (_d = (_c = control.localizedLabels) === null || _c === void 0 ? void 0 : _c[language]) !== null && _d !== void 0 ? _d : (_e = attribute.localizedLabels) === null || _e === void 0 ? void 0 : _e[language]) !== null && _f !== void 0 ? _f : control.label) !== null && _g !== void 0 ? _g : attribute.label;
44
- return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: label, labelPosition: section.labelPosition, required: attribute.required, isError: isError, errorMessage: errorMessage, children: (0, jsx_runtime_1.jsx)(Control, { attribute: attribute, name: control.attributeName, value: field.value, onChange: field.onChange, onBlur: field.onBlur, errorMessage: errorMessage, isError: isError, disabled: readonly, label: label, placeholder: label, allowNavigation: true, allowNewRecord: true, fileServiceContext: {
41
+ return (_jsx(SectionControlWrapper, { label: label, labelPosition: section.labelPosition, required: attribute.required, isError: isError, errorMessage: errorMessage, children: _jsx(Control, { attribute: attribute, name: control.attributeName, value: field.value, onChange: field.onChange, onBlur: field.onBlur, errorMessage: errorMessage, isError: isError, disabled: readonly, label: label, placeholder: label, allowNavigation: true, allowNewRecord: true, fileServiceContext: {
45
42
  type: 'entity-form',
46
43
  recordId,
47
44
  attributeName: control.attributeName,
@@ -57,9 +54,9 @@ function SectionContainer({ section }) {
57
54
  case 'subgrid':
58
55
  let ContainerComponent = null;
59
56
  if (control.component) {
60
- ContainerComponent = componentStore_1.componentStore.getComponent(control.component);
57
+ ContainerComponent = componentStore.getComponent(control.component);
61
58
  }
62
- return ((0, jsx_runtime_1.jsx)(SubgridControl_1.SubgridControl, { logicalName: control.logicalName, allowViewSelection: control.allowViewSelection, viewId: control.viewId, availableViewIds: control.availableViewIds, ContainerComponent: ContainerComponent, associated: !control.associatedAttribute
59
+ return (_jsx(SubgridControl, { logicalName: control.logicalName, allowViewSelection: control.allowViewSelection, viewId: control.viewId, availableViewIds: control.availableViewIds, ContainerComponent: ContainerComponent, associated: !control.associatedAttribute
63
60
  ? false
64
61
  : {
65
62
  logicalName: schema.logicalName,
@@ -67,7 +64,7 @@ function SectionContainer({ section }) {
67
64
  refAttributeName: control.associatedAttribute,
68
65
  } }, index));
69
66
  case 'spacer':
70
- return ((0, jsx_runtime_1.jsx)("div", { style: {
67
+ return (_jsx("div", { style: {
71
68
  gridColumn: control.span
72
69
  ? `var(--section-item-span-${control.span})`
73
70
  : undefined,
@@ -3,13 +3,13 @@ import { FC } from 'react';
3
3
  export interface StandardControlProps {
4
4
  attribute: Attribute;
5
5
  label?: string;
6
- isError: boolean;
7
- errorMessage: string | undefined;
6
+ isError?: boolean;
7
+ errorMessage?: string;
8
8
  name: string;
9
9
  value: any;
10
10
  placeholder?: string;
11
11
  onChange: (value: any) => void;
12
- onBlur: () => void;
12
+ onBlur?: () => void;
13
13
  fileServiceContext?: Record<string, unknown>;
14
14
  disabled?: boolean;
15
15
  borderOnFocusOnly?: boolean;