@headless-adminapp/fluent 0.0.17-alpha.2 → 0.0.17-alpha.22

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 (63) hide show
  1. package/App/AppHeaderContianer.js +1 -1
  2. package/App/NavigationContainer.js +2 -2
  3. package/App/QuickActionItem.js +1 -1
  4. package/CommandBar/MenuButton.js +1 -1
  5. package/CommandBar/MenuItem.js +2 -2
  6. package/DataGrid/CustomizeColumns/AddColumns.js +4 -5
  7. package/DataGrid/CustomizeColumns/ColumnItem.js +3 -1
  8. package/DataGrid/GridColumnHeader/OperatorSelect.js +9 -2
  9. package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +3 -3
  10. package/DataGrid/GridHeaderDesktop.js +0 -1
  11. package/DataGrid/GridTableContainer.js +5 -15
  12. package/DataGrid/useTableColumns.js +9 -21
  13. package/DialogContainer/PromptDialog.d.ts +3 -2
  14. package/DialogContainer/PromptDialog.js +9 -6
  15. package/PageEntityForm/CommandContainer.js +9 -1
  16. package/PageEntityForm/FormTabRelated.js +1 -2
  17. package/PageEntityForm/PageEntityFormDesktopContainer.js +6 -7
  18. package/PageEntityForm/RecordSetNavigatorContainer.js +4 -7
  19. package/PageEntityForm/RelatedViewSelector.js +0 -1
  20. package/PageEntityForm/SectionContainer.js +13 -4
  21. package/PageEntityForm/StandardControl.d.ts +1 -2
  22. package/PageEntityForm/StandardControl.js +64 -112
  23. package/PageEntityForm/SubgridControl.js +2 -2
  24. package/componentStore.d.ts +2 -0
  25. package/componentStore.js +5 -0
  26. package/components/PageLogin.js +0 -1
  27. package/form/FormControl.js +1 -1
  28. package/form/controls/AttachmentsControl.d.ts +8 -0
  29. package/form/controls/AttachmentsControl.js +75 -0
  30. package/form/controls/CurrencyControl.d.ts +1 -1
  31. package/form/controls/CurrencyControl.js +8 -3
  32. package/form/controls/DateControl.d.ts +1 -1
  33. package/form/controls/DateControl.js +1 -1
  34. package/form/controls/DateTimeControl.d.ts +1 -1
  35. package/form/controls/DateTimeControl.js +1 -1
  36. package/form/controls/EmailControl.d.ts +1 -1
  37. package/form/controls/EmailControl.js +1 -1
  38. package/form/controls/LookupControl.js +2 -3
  39. package/form/controls/MultiSelectControl.d.ts +1 -1
  40. package/form/controls/MultiSelectControl.js +1 -1
  41. package/form/controls/MultiSelectLookupControl.js +1 -2
  42. package/form/controls/NumberControl.js +1 -0
  43. package/form/controls/PasswordControl.d.ts +1 -1
  44. package/form/controls/PasswordControl.js +1 -1
  45. package/form/controls/SelectControl.d.ts +1 -1
  46. package/form/controls/SelectControl.js +1 -1
  47. package/form/controls/SwitchControl.d.ts +1 -1
  48. package/form/controls/SwitchControl.js +1 -1
  49. package/form/controls/TelephoneControl.d.ts +1 -1
  50. package/form/controls/TelephoneControl.js +1 -1
  51. package/form/controls/TextAreaControl.d.ts +1 -1
  52. package/form/controls/TextAreaControl.js +1 -1
  53. package/form/layout/FormSection/FormSection.js +1 -2
  54. package/form/layout/FormSection/FormSectionColumn.js +1 -1
  55. package/form/layout/FormSection/FormSectionLoading.js +1 -1
  56. package/form/layout/FormTab/FormTab.js +1 -1
  57. package/index.css +27 -0
  58. package/package.json +21 -3
  59. package/types/index.d.ts +5 -0
  60. package/App/AppProvider.d.ts +0 -9
  61. package/App/AppProvider.js +0 -50
  62. package/DataGrid/getAttributeFormattedValue.d.ts +0 -16
  63. package/DataGrid/getAttributeFormattedValue.js +0 -92
@@ -61,7 +61,7 @@ const AppHeaderContainer = () => {
61
61
  }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Caption1Strong, { children: authSession === null || authSession === void 0 ? void 0 : authSession.fullName }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { textOverflow: 'ellipsis', overflow: 'hidden' }, children: authSession === null || authSession === void 0 ? void 0 : authSession.email })] })] }), (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, { style: { marginInline: 0 } }), (0, jsx_runtime_1.jsxs)(react_components_1.MenuList, { style: { width: 200, marginBottom: 4 }, children: [(_b = app.accountMenuItems) === null || _b === void 0 ? void 0 : _b.map((item, index) => {
62
62
  var _a, _b;
63
63
  const Icon = item.icon;
64
- return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, {}), onClick: () => { var _a; return (_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item); }, children: (_b = (_a = item.localizedLabel) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.label }, index));
64
+ return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, { size: "inherit" }), onClick: () => { var _a; return (_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item); }, children: (_b = (_a = item.localizedLabel) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.label }, index));
65
65
  }), (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.SignOut, {}), onClick: () => logout(), children: strings.logout })] })] })] })] })] }));
66
66
  };
67
67
  exports.AppHeaderContainer = AppHeaderContainer;
@@ -43,14 +43,14 @@ const NavigationContainer = () => {
43
43
  const isRouteActive = (0, hooks_1.useIsRouteActive)();
44
44
  const routeResolver = (0, hooks_1.useRouteResolver)();
45
45
  return ((0, jsx_runtime_1.jsx)("div", { className: styles.root, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavDrawer, { selectedValue: "active", open: isOpen, type: type, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavDrawerBody, { style: { paddingTop: 8 }, children: app.navItems.map((area) => ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: area.groups.map((group) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [!group.hideLabel && ((0, jsx_runtime_1.jsx)(react_nav_preview_1.NavSectionHeader, { children: group.label })), group.items.map((item, index) => {
46
- var _a;
46
+ var _a, _b;
47
47
  const navItem = (0, utils_1.transformNavPageItem)({
48
48
  item,
49
49
  schemaMetadataDic: schemaMetadataDic,
50
50
  language,
51
51
  routeResolver,
52
52
  });
53
- const Icon = (_a = navItem.icon) !== null && _a !== void 0 ? _a : icons_1.IconPlaceholder;
53
+ const Icon = (_b = (_a = navItem.icon) !== null && _a !== void 0 ? _a : icons_1.Icons.Entity) !== null && _b !== void 0 ? _b : icons_1.IconPlaceholder;
54
54
  const isActive = isRouteActive(selectedPath, item);
55
55
  return ((0, jsx_runtime_1.jsx)(react_nav_preview_1.NavItem, { href: navItem.link, onClick: (event) => {
56
56
  event.preventDefault();
@@ -24,7 +24,7 @@ const useStyles = (0, react_components_1.makeStyles)({
24
24
  });
25
25
  const QuickActionItem = ({ label, Icon, onClick, link, }) => {
26
26
  const styles = useStyles();
27
- return ((0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(Icon, {}), appearance: "transparent", as: "a", href: link, title: label, className: styles.root, onClick: (event) => {
27
+ return ((0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(Icon, { size: "inherit" }), appearance: "transparent", as: "a", href: link, title: label, className: styles.root, onClick: (event) => {
28
28
  event.preventDefault();
29
29
  onClick === null || onClick === void 0 ? void 0 : onClick();
30
30
  } }));
@@ -36,7 +36,7 @@ exports.CommandMenuButton = (0, react_1.forwardRef)(function CommandMenuButton({
36
36
  const styles = useStyles();
37
37
  return (
38
38
  // <div ref={ref}>
39
- (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { hasIcons: true, positioning: "below-end", children: [onClick ? ((0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { disableButtonEnhancement: true, children: (triggerProps) => ((0, jsx_runtime_1.jsx)(react_components_1.SplitButton, { ref: ref, icon: (0, jsx_runtime_1.jsx)(Icon, {}), appearance: "subtle", className: (0, react_components_1.mergeClasses)(styles.splitButton, danger && styles.splitButtonDanger), menuButton: triggerProps, children: text })) })) : ((0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.MenuButton, { ref: ref, appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(Icon, {}), className: (0, react_components_1.mergeClasses)(styles.menuButton), children: text }) })), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(MenuList_1.MenuList, { items: items }) })] })
39
+ (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { hasIcons: true, positioning: "below-end", children: [onClick ? ((0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { disableButtonEnhancement: true, children: (triggerProps) => ((0, jsx_runtime_1.jsx)(react_components_1.SplitButton, { ref: ref, icon: (0, jsx_runtime_1.jsx)(Icon, { size: 20 }), appearance: "subtle", className: (0, react_components_1.mergeClasses)(styles.splitButton, danger && styles.splitButtonDanger), menuButton: triggerProps, disabled: disabled, children: text })) })) : ((0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.MenuButton, { ref: ref, appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(Icon, { size: 20 }), className: (0, react_components_1.mergeClasses)(styles.menuButton), children: text }) })), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(MenuList_1.MenuList, { items: items }) })] })
40
40
  // </div>
41
41
  );
42
42
  });
@@ -30,8 +30,8 @@ const useStyles = (0, react_components_1.makeStyles)({
30
30
  const MenuItem = ({ Icon, text, disabled, danger, onClick, items, }) => {
31
31
  const styles = useStyles();
32
32
  if (!(items === null || items === void 0 ? void 0 : items.length)) {
33
- return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { disabled: disabled, onClick: onClick, icon: (0, jsx_runtime_1.jsx)(Icon, {}), className: (0, react_components_1.mergeClasses)(danger && styles.danger), children: text }));
33
+ return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { disabled: disabled, onClick: onClick, icon: (0, jsx_runtime_1.jsx)(Icon, { size: 20 }), className: (0, react_components_1.mergeClasses)(danger && styles.danger), children: text }));
34
34
  }
35
- return ((0, jsx_runtime_1.jsxs)(react_components_1.Menu, { hasIcons: true, children: [onClick ? ((0, jsx_runtime_1.jsxs)(react_components_1.MenuSplitGroup, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, {}), className: (0, react_components_1.mergeClasses)(danger && styles.danger), children: text }), (0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { className: (0, react_components_1.mergeClasses)(styles.splitMenuRight) }) })] })) : ((0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, {}), children: text }) })), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(MenuList_1.MenuList, { items: items }) })] }));
35
+ return ((0, jsx_runtime_1.jsxs)(react_components_1.Menu, { hasIcons: true, children: [onClick ? ((0, jsx_runtime_1.jsxs)(react_components_1.MenuSplitGroup, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, { size: 20 }), className: (0, react_components_1.mergeClasses)(danger && styles.danger), children: text }), (0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { className: (0, react_components_1.mergeClasses)(styles.splitMenuRight) }) })] })) : ((0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, { size: 20 }), children: text }) })), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(MenuList_1.MenuList, { items: items }) })] }));
36
36
  };
37
37
  exports.MenuItem = MenuItem;
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AddColumns = AddColumns;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
- const builders_1 = require("@headless-adminapp/app/builders");
7
6
  const datagrid_1 = require("@headless-adminapp/app/datagrid");
8
7
  const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
9
8
  const locale_1 = require("@headless-adminapp/app/locale");
9
+ const utils_1 = require("@headless-adminapp/app/locale/utils");
10
10
  const hooks_2 = require("@headless-adminapp/app/metadata/hooks");
11
11
  const icons_1 = require("@headless-adminapp/icons");
12
12
  const react_1 = require("react");
@@ -26,7 +26,7 @@ function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, })
26
26
  }))
27
27
  .filter(({ attribute }) => attribute.type === 'lookup');
28
28
  const columnGroups = Object.assign({ root: {
29
- label: (0, builders_1.localizedLabel)(language, schema),
29
+ label: (0, utils_1.localizedLabel)(language, schema),
30
30
  columns: (0, datagrid_1.transformViewColumns)(schema.logicalName, Object.keys(schema.attributes).map((key) => ({
31
31
  name: key,
32
32
  })), schemaStore, language),
@@ -37,9 +37,9 @@ function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, })
37
37
  expandedKey: nestedKey,
38
38
  })), schemaStore, language);
39
39
  acc[key] = {
40
- label: (0, builders_1.localizedLabel)(language, attribute) +
40
+ label: (0, utils_1.localizedLabel)(language, attribute) +
41
41
  ' (' +
42
- (0, builders_1.localizedLabel)(language, lookupSchema) +
42
+ (0, utils_1.localizedLabel)(language, lookupSchema) +
43
43
  ')',
44
44
  columns,
45
45
  };
@@ -64,7 +64,6 @@ function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, })
64
64
  gap: 8,
65
65
  marginBottom: react_components_1.tokens.spacingVerticalXS,
66
66
  paddingInline: react_components_1.tokens.spacingHorizontalS,
67
- width: '100%',
68
67
  }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Input, { contentBefore: (0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 16 }), placeholder: appStrings.searchPlaceholder, value: searchText, onChange: (e) => setSearchText(e.target.value) }), (0, jsx_runtime_1.jsx)(react_components_1.Dropdown, { value: (_a = selectedGroupItem === null || selectedGroupItem === void 0 ? void 0 : selectedGroupItem.label) !== null && _a !== void 0 ? _a : '', selectedOptions: selectedGroupItem ? [String(selectedGroupItem.key)] : [], onOptionSelect: (event, data) => {
69
68
  setSelectedGroup(data.optionValue);
70
69
  }, style: { flex: 1, minWidth: 'unset' }, positioning: {
@@ -71,12 +71,14 @@ const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSe
71
71
  drag(drop(ref));
72
72
  return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: {
73
73
  background: react_components_1.tokens.colorNeutralBackground4,
74
- padding: react_components_1.tokens.spacingHorizontalXS,
74
+ paddingBlock: react_components_1.tokens.spacingVerticalXS,
75
+ paddingLeft: react_components_1.tokens.spacingHorizontalS,
75
76
  cursor: 'move',
76
77
  opacity,
77
78
  borderRadius: react_components_1.tokens.borderRadiusMedium,
78
79
  display: 'flex',
79
80
  flexDirection: 'row',
81
+ alignItems: 'center',
80
82
  }, "data-handler-id": handlerId, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { flex: 1 }, children: item.label }), (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { positioning: "below-start", children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.MoreVertical, {}), appearance: "transparent", size: "small" }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsxs)(react_components_1.MenuList, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Delete, {}), onClick: onRemove, children: stringSet.remove }), !isFirst && ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), onClick: () => {
81
83
  moveItem(index, index - 1);
82
84
  }, children: stringSet.moveUp })), !isLast && ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), onClick: () => {
@@ -6,16 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.OperatorSelect = OperatorSelect;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const column_filter_1 = require("@headless-adminapp/app/datagrid/column-filter");
9
+ const transport_1 = require("@headless-adminapp/app/transport");
9
10
  const react_1 = require("react");
10
11
  const AppStringContext_1 = require("../../App/AppStringContext");
11
12
  const SelectControl_1 = __importDefault(require("../../form/controls/SelectControl"));
12
13
  function OperatorSelect({ attribute, value, onChange, }) {
13
14
  const { operatorStrings } = (0, AppStringContext_1.useAppStrings)();
15
+ const dataService = (0, transport_1.useDataService)();
14
16
  const operatorOptions = (0, react_1.useMemo)(() => {
15
17
  return (0, column_filter_1.getLocalizedOperatorOptions)(operatorStrings);
16
18
  }, [operatorStrings]);
17
19
  const options = (0, react_1.useMemo)(() => {
18
- return operatorOptions[attribute.type];
19
- }, [attribute.type, operatorOptions]);
20
+ const supportedOperators = dataService.supportedOperators;
21
+ let operators = operatorOptions[attribute.type];
22
+ if (supportedOperators) {
23
+ operators = operators.filter((option) => supportedOperators[attribute.type].includes(option.value));
24
+ }
25
+ return operators;
26
+ }, [attribute.type, operatorOptions, dataService]);
20
27
  return ((0, jsx_runtime_1.jsx)(SelectControl_1.default, { options: options, onChange: (value) => onChange === null || onChange === void 0 ? void 0 : onChange(value), value: value }));
21
28
  }
@@ -61,7 +61,7 @@ minWidth,
61
61
  column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) => {
62
62
  const [visible, setVisible] = (0, react_1.useState)(false);
63
63
  const schema = (0, hooks_1.useDataGridSchema)();
64
- const { getSchema } = (0, hooks_2.useMetadata)();
64
+ const { schemaStore } = (0, hooks_2.useMetadata)();
65
65
  const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
66
66
  const attribute = (0, react_1.useMemo)(() => {
67
67
  const _attribute = schema.attributes[column.name];
@@ -71,9 +71,9 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
71
71
  if (_attribute.type !== 'lookup') {
72
72
  throw new Error('Invalid attribute type');
73
73
  }
74
- const lookupSchema = getSchema(_attribute.entity);
74
+ const lookupSchema = schemaStore.getSchema(_attribute.entity);
75
75
  return lookupSchema.attributes[column.expandedKey];
76
- }, [column.expandedKey, column.name, getSchema, schema.attributes]);
76
+ }, [column.expandedKey, column.name, schemaStore, schema.attributes]);
77
77
  const align = (0, react_1.useMemo)(() => {
78
78
  switch (attribute.type) {
79
79
  case 'money':
@@ -24,7 +24,6 @@ const GridHeaderDesktop = (props) => {
24
24
  alignItems: 'center',
25
25
  paddingInline: 8,
26
26
  gap: 16,
27
- width: '100%',
28
27
  display: 'flex',
29
28
  }, children: [(0, jsx_runtime_1.jsx)(CustomizeColumns_1.CustomizeColumns, { opened: isColumnCustomizationOpen, onClose: () => setIsColumnCustomizationOpen(false) }), (0, jsx_runtime_1.jsx)("div", { style: {
30
29
  flex: 1,
@@ -7,9 +7,8 @@ const datagrid_1 = require("@headless-adminapp/app/datagrid");
7
7
  const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
8
8
  const locale_1 = require("@headless-adminapp/app/locale");
9
9
  const mutable_1 = require("@headless-adminapp/app/mutable");
10
+ const navigation_1 = require("@headless-adminapp/app/navigation");
10
11
  const hooks_2 = require("@headless-adminapp/app/recordset/hooks");
11
- const hooks_3 = require("@headless-adminapp/app/route/hooks");
12
- const app_1 = require("@headless-adminapp/core/experience/app");
13
12
  const react_table_1 = require("@tanstack/react-table");
14
13
  const react_virtual_1 = require("@tanstack/react-virtual");
15
14
  const react_1 = require("react");
@@ -73,25 +72,16 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
73
72
  }));
74
73
  }, [sorting]);
75
74
  const tableWrapperRef = (0, react_1.useRef)(null);
76
- const routeResolver = (0, hooks_3.useRouteResolver)();
77
- const router = (0, hooks_3.useRouter)();
78
75
  const recordSetSetter = (0, hooks_2.useRecordSetSetter)();
76
+ const openFormInternal = (0, navigation_1.useOpenForm)();
79
77
  const openRecord = (0, react_1.useCallback)((id) => {
80
78
  var _a, _b;
81
- const path = routeResolver({
79
+ recordSetSetter(schema.logicalName, (_b = (_a = dataRef.current) === null || _a === void 0 ? void 0 : _a.records.map((x) => x[schema.idAttribute])) !== null && _b !== void 0 ? _b : []);
80
+ openFormInternal({
82
81
  logicalName: schema.logicalName,
83
- type: app_1.PageType.EntityForm,
84
82
  id,
85
83
  });
86
- recordSetSetter(schema.logicalName, (_b = (_a = dataRef.current) === null || _a === void 0 ? void 0 : _a.records.map((x) => x[schema.idAttribute])) !== null && _b !== void 0 ? _b : []);
87
- router.push(path);
88
- }, [
89
- recordSetSetter,
90
- routeResolver,
91
- router,
92
- schema.idAttribute,
93
- schema.logicalName,
94
- ]);
84
+ }, [openFormInternal, recordSetSetter, schema.idAttribute, schema.logicalName]);
95
85
  const { direction } = (0, locale_1.useLocale)();
96
86
  const dataRef = (0, react_1.useRef)(data);
97
87
  dataRef.current = data;
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
6
  const datagrid_1 = require("@headless-adminapp/app/datagrid");
7
7
  const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
8
+ const useOpenRecord_1 = require("@headless-adminapp/app/datagrid/hooks/useOpenRecord");
8
9
  const hooks_2 = require("@headless-adminapp/app/hooks");
9
10
  const locale_1 = require("@headless-adminapp/app/locale");
10
11
  const hooks_3 = require("@headless-adminapp/app/metadata/hooks");
@@ -36,14 +37,16 @@ function useTableColumns({ disableSelection, disableContextMenu, disableColumnRe
36
37
  const columns = (0, hooks_1.useGridColumns)();
37
38
  const [, setSorting] = (0, hooks_1.useGridSorting)();
38
39
  const schema = (0, hooks_1.useDataGridSchema)();
39
- const { getSchema } = (0, hooks_3.useMetadata)();
40
+ const { schemaStore } = (0, hooks_3.useMetadata)();
40
41
  const [, setSelectedIds] = (0, hooks_1.useGridSelection)();
41
42
  const setSelectedIdsRef = (0, react_1.useRef)(setSelectedIds);
42
43
  setSelectedIdsRef.current = setSelectedIds;
43
44
  const isSubgrid = (0, mutable_1.useContextSelector)(datagrid_1.GridContext, (state) => state.isSubGrid);
44
45
  const contextCommands = isSubgrid
45
- ? (0, hooks_1.useSubGridCommands)()
46
- : (0, hooks_1.useMainGridContextCommands)();
46
+ ? // eslint-disable-next-line react-hooks/rules-of-hooks
47
+ (0, hooks_1.useSubGridCommands)()
48
+ : // eslint-disable-next-line react-hooks/rules-of-hooks
49
+ (0, hooks_1.useMainGridContextCommands)();
47
50
  const mutableContextCommandState = (0, mutable_1.useMutableState)(contextCommands, true);
48
51
  (0, react_1.useEffect)(() => {
49
52
  mutableContextCommandState.setValue(contextCommands);
@@ -69,22 +72,7 @@ function useTableColumns({ disableSelection, disableContextMenu, disableColumnRe
69
72
  const routeResolver = (0, hooks_5.useRouteResolver)();
70
73
  const router = (0, hooks_5.useRouter)();
71
74
  const recordSetSetter = (0, hooks_4.useRecordSetSetter)();
72
- const openRecord = (0, react_1.useCallback)((id) => {
73
- var _a, _b;
74
- const path = routeResolver({
75
- logicalName: schema.logicalName,
76
- type: app_1.PageType.EntityForm,
77
- id,
78
- });
79
- recordSetSetter(schema.logicalName, (_b = (_a = dataRef.current) === null || _a === void 0 ? void 0 : _a.records.map((x) => x[schema.idAttribute])) !== null && _b !== void 0 ? _b : []);
80
- router.push(path);
81
- }, [
82
- recordSetSetter,
83
- routeResolver,
84
- router,
85
- schema.idAttribute,
86
- schema.logicalName,
87
- ]);
75
+ const openRecord = (0, useOpenRecord_1.useOpenRecord)();
88
76
  const { currency, dateFormats } = (0, locale_1.useLocale)();
89
77
  const dataRef = (0, react_1.useRef)(data);
90
78
  dataRef.current = data;
@@ -149,7 +137,7 @@ function useTableColumns({ disableSelection, disableContextMenu, disableColumnRe
149
137
  const field = column.expandedKey;
150
138
  const entity = schema.attributes[lookup]
151
139
  .entity;
152
- const lookupSchema = getSchema(entity);
140
+ const lookupSchema = schemaStore.getSchema(entity);
153
141
  attribute = lookupSchema.attributes[field];
154
142
  value = (_b = (_a = info.row.original.$expand) === null || _a === void 0 ? void 0 : _a[lookup]) === null || _b === void 0 ? void 0 : _b[field];
155
143
  }
@@ -241,7 +229,7 @@ function useTableColumns({ disableSelection, disableContextMenu, disableColumnRe
241
229
  setSorting,
242
230
  currency.currency,
243
231
  dateFormats.short,
244
- getSchema,
232
+ schemaStore,
245
233
  routeResolver,
246
234
  openRecord,
247
235
  recordSetSetter,
@@ -1,3 +1,4 @@
1
+ import { FormValidationStringSet } from '@headless-adminapp/app/form';
1
2
  import { PromptDialogOptions } from '@headless-adminapp/core/experience/dialog';
2
3
  import { SchemaAttributes } from '@headless-adminapp/core/schema';
3
4
  import * as yup from 'yup';
@@ -14,12 +15,12 @@ interface PromptDialogProps<SA extends SchemaAttributes = SchemaAttributes> {
14
15
  onDismiss?: PromptDialogOptions<SA>['onDismiss'];
15
16
  }
16
17
  export declare function PromptDialog(props: PromptDialogProps): import("react/jsx-runtime").JSX.Element;
17
- export declare const formValidator: (<A extends SchemaAttributes = SchemaAttributes>(attributes: A) => (values: Record<string, any>, context: any, options: any) => Promise<import("react-hook-form").ResolverResult<{
18
+ export declare const formValidator: (<A extends SchemaAttributes = SchemaAttributes>(attributes: A, language: string, strings: FormValidationStringSet) => (values: Record<string, any>, context: any, options: any) => Promise<import("react-hook-form").ResolverResult<{
18
19
  [x: string]: any;
19
20
  [x: number]: any;
20
21
  [x: symbol]: any;
21
22
  }>>) & import("lodash").MemoizedFunction;
22
- export declare const generateValidationSchema: (<A extends SchemaAttributes = SchemaAttributes>(attributes: A) => yup.ObjectSchema<{
23
+ export declare const generateValidationSchema: (<A extends SchemaAttributes = SchemaAttributes>(attributes: A, language: string, strings: FormValidationStringSet) => yup.ObjectSchema<{
23
24
  [x: string]: any;
24
25
  }, yup.AnyObject, {
25
26
  [x: string]: any;
@@ -37,6 +37,8 @@ exports.PromptDialog = PromptDialog;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const react_components_1 = require("@fluentui/react-components");
39
39
  const utils_1 = require("@headless-adminapp/app/dataform/utils");
40
+ const form_1 = require("@headless-adminapp/app/form");
41
+ const locale_1 = require("@headless-adminapp/app/locale");
40
42
  const yup_1 = require("@hookform/resolvers/yup");
41
43
  const lodash_1 = require("lodash");
42
44
  const react_hook_form_1 = require("react-hook-form");
@@ -45,11 +47,13 @@ const SectionControl_1 = require("../DataForm/SectionControl");
45
47
  const StandardControl_1 = require("../PageEntityForm/StandardControl");
46
48
  function PromptDialog(props) {
47
49
  var _a, _b;
50
+ const { language } = (0, locale_1.useLocale)();
51
+ const formValidationStrings = (0, form_1.useFormValidationStrings)();
48
52
  const form = (0, react_hook_form_1.useForm)({
49
53
  mode: 'all',
50
54
  defaultValues: props.defaultValues,
51
55
  shouldUnregister: false,
52
- resolver: (0, exports.formValidator)(props.attributes),
56
+ resolver: (0, exports.formValidator)(props.attributes, language, formValidationStrings),
53
57
  });
54
58
  return ((0, jsx_runtime_1.jsx)(react_components_1.Dialog, { open: props.open, onOpenChange: () => {
55
59
  var _a;
@@ -80,20 +84,19 @@ function PromptDialog(props) {
80
84
  }))();
81
85
  }), children: (_b = props.confirmText) !== null && _b !== void 0 ? _b : 'Confirm' })] })] }) }) }));
82
86
  }
83
- exports.formValidator = (0, lodash_1.memoize)(function formValidator(attributes) {
87
+ exports.formValidator = (0, lodash_1.memoize)(function formValidator(attributes, language, strings) {
84
88
  return (values, context, options) => __awaiter(this, void 0, void 0, function* () {
85
- const validator = (0, exports.generateValidationSchema)(attributes);
89
+ const validator = (0, exports.generateValidationSchema)(attributes, language, strings);
86
90
  const resolver = (0, yup_1.yupResolver)(validator);
87
91
  const result = yield resolver(values, context, options);
88
- // console.log(result);
89
92
  return result;
90
93
  });
91
94
  }, (attributes) => JSON.stringify({ attributes }));
92
- exports.generateValidationSchema = (0, lodash_1.memoize)(function generateValidationSchema(attributes) {
95
+ exports.generateValidationSchema = (0, lodash_1.memoize)(function generateValidationSchema(attributes, language, strings) {
93
96
  const columns = Object.keys(attributes);
94
97
  return yup.object().shape(Object.assign({}, columns.reduce((acc, column) => {
95
98
  const attribute = attributes[column];
96
- const validationSchema = (0, utils_1.generateAttributeValidationSchema)(attribute, 'en', {});
99
+ const validationSchema = (0, utils_1.generateAttributeValidationSchema)(attribute, language, strings);
97
100
  return Object.assign(Object.assign({}, acc), { [column]: validationSchema });
98
101
  }, {})));
99
102
  }, (attributes) => JSON.stringify({ attributes }));
@@ -43,7 +43,15 @@ const CommandContainer = () => {
43
43
  : []),
44
44
  ...gridCommands,
45
45
  ];
46
- }, [gridCommands, recordSetContext, recordSetVisible, schema.logicalName]);
46
+ }, [
47
+ gridCommands,
48
+ recordSetContext.ids.length,
49
+ recordSetContext.logicalName,
50
+ recordSetVisible,
51
+ router,
52
+ schema.logicalName,
53
+ setRecordSetVisible,
54
+ ]);
47
55
  return (0, jsx_runtime_1.jsx)(OverflowCommandBar_1.OverflowCommandBar, { commands: extendedCommands });
48
56
  };
49
57
  exports.CommandContainer = CommandContainer;
@@ -4,11 +4,10 @@ exports.FormTabRelated = FormTabRelated;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
6
  const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
7
- const hooks_2 = require("@headless-adminapp/app/dataform/hooks");
8
7
  const FormTab_1 = require("../form/layout/FormTab");
9
8
  const SubgridControl_1 = require("./SubgridControl");
10
9
  function FormTabRelated({ selectedRelatedItem }) {
11
- const recordId = (0, hooks_2.useRecordId)();
10
+ const recordId = (0, hooks_1.useRecordId)();
12
11
  const schema = (0, hooks_1.useDataFormSchema)();
13
12
  return ((0, jsx_runtime_1.jsx)(FormTab_1.FormTab, { value: "related", noWrapper: true, children: (0, jsx_runtime_1.jsx)("div", { style: {
14
13
  display: 'flex',
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PageEntityFormDesktopContainer = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
- const builders_1 = require("@headless-adminapp/app/builders");
7
6
  const dataform_1 = require("@headless-adminapp/app/dataform");
8
7
  const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
9
8
  const locale_1 = require("@headless-adminapp/app/locale");
9
+ const utils_1 = require("@headless-adminapp/app/locale/utils");
10
10
  const mutable_1 = require("@headless-adminapp/app/mutable");
11
- const utils_1 = require("@headless-adminapp/app/utils");
11
+ const utils_2 = require("@headless-adminapp/app/utils");
12
12
  const react_1 = require("react");
13
13
  const react_hook_form_1 = require("react-hook-form");
14
14
  const PageBroken_1 = require("../components/PageBroken");
@@ -21,7 +21,7 @@ const PageEntityFormStringContext_1 = require("./PageEntityFormStringContext");
21
21
  const RelatedViewSelector_1 = require("./RelatedViewSelector");
22
22
  const SectionContainer_1 = require("./SectionContainer");
23
23
  const PageEntityFormDesktopContainer = () => {
24
- var _a, _b;
24
+ var _a, _b, _c;
25
25
  const dataState = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.dataState);
26
26
  const strings = (0, PageEntityFormStringContext_1.usePageEntityFormStrings)();
27
27
  const recordId = (0, hooks_1.useRecordId)();
@@ -51,7 +51,6 @@ const PageEntityFormDesktopContainer = () => {
51
51
  if (recordId && !record) {
52
52
  return ((0, jsx_runtime_1.jsx)(PageBroken_1.PageBroken, { title: "Record not found", message: "Requested record not found in system or you may not have enought permission." }));
53
53
  }
54
- // console.log('render');
55
54
  return ((0, jsx_runtime_1.jsxs)("div", { style: {
56
55
  display: 'flex',
57
56
  flex: 1,
@@ -93,15 +92,15 @@ const PageEntityFormDesktopContainer = () => {
93
92
  ? `- ${strings.unsaved}`
94
93
  : !!record
95
94
  ? `- ${strings.saved}`
96
- : '' })] }), (0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { color: react_components_1.tokens.colorNeutralForeground3 }, children: (0, builders_1.localizedLabel)(language, schema) })] }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'row' }, children: formConfig.experience.headerControls.map((controlName, index) => {
95
+ : '' })] }), (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: (_a = formConfig.experience.headerControls) === null || _a === void 0 ? void 0 : _a.map((controlName, index) => {
97
96
  const attribute = schema.attributes[controlName];
98
97
  return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [index > 0 && ((0, jsx_runtime_1.jsx)(react_components_1.Divider, { vertical: true, style: {
99
98
  width: react_components_1.tokens.spacingHorizontalXXL,
100
99
  opacity: 0.5,
101
100
  } })), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: attribute.label }), (0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: formInstance.control, name: controlName, render: ({ field }) => {
102
- return ((0, jsx_runtime_1.jsx)(react_components_1.Body1, { children: (0, utils_1.getAttributeFormattedValue)(attribute, field.value) }));
101
+ return ((0, jsx_runtime_1.jsx)(react_components_1.Body1, { children: (0, utils_2.getAttributeFormattedValue)(attribute, field.value) }));
103
102
  } })] })] }, controlName));
104
- }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', paddingBottom: react_components_1.tokens.spacingVerticalS }, children: [(0, jsx_runtime_1.jsxs)(react_components_1.TabList, { selectedValue: activeTab, onTabSelect: (e, value) => setActiveTab(value.value), children: [formConfig.experience.tabs.map((tab) => ((0, jsx_runtime_1.jsx)(react_components_1.Tab, { value: tab.name, children: (0, builders_1.localizedLabel)(language, tab) }, tab.name))), !!selectedRelatedItem && ((0, jsx_runtime_1.jsx)(react_components_1.Tab, { value: "related", children: (_b = (_a = selectedRelatedItem.localizedPluralLabels) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : selectedRelatedItem.pluralLabel }))] }), (0, jsx_runtime_1.jsx)(RelatedViewSelector_1.RelatedViewSelector, { onSelect: (item) => {
103
+ }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', paddingBottom: react_components_1.tokens.spacingVerticalS }, children: [(0, jsx_runtime_1.jsxs)(react_components_1.TabList, { selectedValue: activeTab, onTabSelect: (e, value) => setActiveTab(value.value), children: [formConfig.experience.tabs.map((tab) => ((0, jsx_runtime_1.jsx)(react_components_1.Tab, { value: tab.name, children: (0, utils_1.localizedLabel)(language, tab) }, tab.name))), !!selectedRelatedItem && ((0, jsx_runtime_1.jsx)(react_components_1.Tab, { value: "related", children: (_c = (_b = selectedRelatedItem.localizedPluralLabels) === null || _b === void 0 ? void 0 : _b[language]) !== null && _c !== void 0 ? _c : selectedRelatedItem.pluralLabel }))] }), (0, jsx_runtime_1.jsx)(RelatedViewSelector_1.RelatedViewSelector, { onSelect: (item) => {
105
104
  setSelectedRelatedItem(item);
106
105
  setActiveTab('related');
107
106
  } })] })] })] }), (0, jsx_runtime_1.jsxs)(FormBody_1.FormBody, { children: [formConfig.experience.tabs.map((tab) => ((0, jsx_runtime_1.jsx)(FormTab_1.FormTab, { value: tab.name, columnCount: tab.columnCount, columnWidths: tab.columnWidths, children: tab.tabColumns.map((tabColumn, index) => ((0, jsx_runtime_1.jsx)(FormTab_1.FormTab.Column, { children: tabColumn.sections.map((section) => ((0, jsx_runtime_1.jsx)(SectionContainer_1.SectionContainer, { section: section, readOnly: false }, section.name))) }, index))) }, tab.name))), (0, jsx_runtime_1.jsx)(FormTabRelated_1.FormTabRelated, { selectedRelatedItem: selectedRelatedItem })] })] }));
@@ -6,9 +6,8 @@ const react_components_1 = require("@fluentui/react-components");
6
6
  const ScrollView_1 = require("@headless-adminapp/app/components/ScrollView");
7
7
  const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
8
8
  const locale_1 = require("@headless-adminapp/app/locale");
9
+ const navigation_1 = require("@headless-adminapp/app/navigation");
9
10
  const hooks_2 = require("@headless-adminapp/app/recordset/hooks");
10
- const hooks_3 = require("@headless-adminapp/app/route/hooks");
11
- const app_1 = require("@headless-adminapp/core/experience/app");
12
11
  const react_1 = require("react");
13
12
  const RecordCard_1 = require("./RecordCard");
14
13
  const useStyles = (0, react_components_1.makeStyles)({
@@ -31,8 +30,7 @@ const RecordSetNavigatorContainer = () => {
31
30
  const [visible] = (0, hooks_2.useRecordSetVisibility)();
32
31
  const recordId = (0, hooks_1.useRecordId)();
33
32
  const styles = useStyles();
34
- const routeResolver = (0, hooks_3.useRouteResolver)();
35
- const router = (0, hooks_3.useRouter)();
33
+ const openForm = (0, navigation_1.useOpenForm)();
36
34
  const { language, direction } = (0, locale_1.useLocale)();
37
35
  if (!schema) {
38
36
  return null;
@@ -60,12 +58,11 @@ const RecordSetNavigatorContainer = () => {
60
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 ===
61
59
  record[schema.idAttribute] &&
62
60
  styles.selected), onClick: () => {
63
- const path = routeResolver({
64
- type: app_1.PageType.EntityForm,
61
+ openForm({
65
62
  logicalName: schema.logicalName,
66
63
  id: record[schema.idAttribute],
64
+ replace: true,
67
65
  });
68
- router.replace(path);
69
66
  }, children: (0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: cardView, record: record, schema: schema, selected: recordId ===
70
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]))) }) })] }) }));
71
68
  };
@@ -18,7 +18,6 @@ function getRelatedItems(currentSchema, schemas) {
18
18
  if (!(0, utils_1.isLookupAttribute)(attribute)) {
19
19
  return null;
20
20
  }
21
- // console.log('temp.a ', attribute);
22
21
  if (attribute.entity !== currentSchema.logicalName) {
23
22
  return null;
24
23
  }
@@ -2,10 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SectionContainer = SectionContainer;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const builders_1 = require("@headless-adminapp/app/builders");
6
5
  const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
7
6
  const locale_1 = require("@headless-adminapp/app/locale");
7
+ const utils_1 = require("@headless-adminapp/app/locale/utils");
8
8
  const react_hook_form_1 = require("react-hook-form");
9
+ const componentStore_1 = require("../componentStore");
9
10
  const SectionControl_1 = require("../DataForm/SectionControl");
10
11
  const layout_1 = require("../form/layout");
11
12
  const StandardControl_1 = require("./StandardControl");
@@ -16,11 +17,18 @@ function SectionContainer({ section }) {
16
17
  const recordId = (0, hooks_1.useRecordId)();
17
18
  const readonly = (0, hooks_1.useFormIsReadonly)();
18
19
  const { language } = (0, locale_1.useLocale)();
19
- return ((0, jsx_runtime_1.jsx)(layout_1.FormSection, { title: (0, builders_1.localizedLabel)(language, section), columnCount: section.columnCount, labelPosition: section.labelPosition, noPadding: section.noPadding, hideLabel: section.hideLabel, children: section.controls.map((control, index) => {
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) => {
20
21
  var _a;
21
22
  switch (control.type) {
22
- case 'standard':
23
+ case 'standard': {
23
24
  const attribute = schema.attributes[control.attributeName];
25
+ let Control = StandardControl_1.StandardControl;
26
+ if (control.component) {
27
+ const OverrideControl = componentStore_1.componentStore.getComponent(control.component);
28
+ if (OverrideControl) {
29
+ Control = OverrideControl;
30
+ }
31
+ }
24
32
  return ((0, jsx_runtime_1.jsx)("div", { style: {
25
33
  gridColumn: control.span
26
34
  ? `var(--section-item-span-${control.span})`
@@ -33,8 +41,9 @@ function SectionContainer({ section }) {
33
41
  ? (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message
34
42
  : '';
35
43
  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;
36
- 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)(StandardControl_1.StandardControl, { 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 }) }));
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 }) }));
37
45
  } }, control.attributeName) }, control.attributeName));
46
+ }
38
47
  case 'editablegrid': {
39
48
  return null;
40
49
  }
@@ -1,6 +1,6 @@
1
1
  import type { Attribute } from '@headless-adminapp/core/attributes';
2
2
  import { FC } from 'react';
3
- interface StandardControlProps {
3
+ export interface StandardControlProps {
4
4
  attribute: Attribute;
5
5
  label?: string;
6
6
  isError: boolean;
@@ -21,4 +21,3 @@ interface StandardControlProps {
21
21
  allowNewRecord?: boolean;
22
22
  }
23
23
  export declare const StandardControl: FC<StandardControlProps>;
24
- export {};