@headless-adminapp/fluent 0.0.17-alpha.3 → 0.0.17-alpha.30

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 (89) 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/Button.d.ts +2 -1
  5. package/CommandBar/Button.js +2 -2
  6. package/CommandBar/Divider.d.ts +2 -1
  7. package/CommandBar/Divider.js +2 -2
  8. package/CommandBar/IconButton.d.ts +2 -1
  9. package/CommandBar/IconButton.js +2 -2
  10. package/CommandBar/Label.d.ts +2 -1
  11. package/CommandBar/Label.js +2 -2
  12. package/CommandBar/MenuButton.d.ts +2 -1
  13. package/CommandBar/MenuButton.js +3 -3
  14. package/CommandBar/MenuItem.js +6 -5
  15. package/CommandBar/MenuItems.js +3 -3
  16. package/CommandBar/MenuList.js +4 -3
  17. package/CommandBar/Wrapper.d.ts +2 -2
  18. package/CommandBar/Wrapper.js +2 -2
  19. package/CommandBar/index.d.ts +6 -6
  20. package/DataGrid/ActionCell.d.ts +1 -1
  21. package/DataGrid/ActionCell.js +8 -4
  22. package/DataGrid/CustomizeColumns/AddColumns.js +4 -5
  23. package/DataGrid/CustomizeColumns/ColumnItem.js +3 -1
  24. package/DataGrid/GridColumnHeader/FilterForm.js +3 -1
  25. package/DataGrid/GridColumnHeader/OperatorSelect.js +9 -2
  26. package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +8 -8
  27. package/DataGrid/GridHeaderDesktop.js +0 -1
  28. package/DataGrid/GridTableContainer.js +22 -23
  29. package/DataGrid/TableCell/TableCellCheckbox.js +4 -3
  30. package/DataGrid/TableCell/TableCellLink.js +4 -3
  31. package/DataGrid/TableCell/TableCellText.js +9 -4
  32. package/DataGrid/useTableColumns.d.ts +4 -1
  33. package/DataGrid/useTableColumns.js +184 -167
  34. package/DialogContainer/PromptDialog.d.ts +3 -2
  35. package/DialogContainer/PromptDialog.js +10 -6
  36. package/PageEntityForm/CommandContainer.js +9 -1
  37. package/PageEntityForm/FormTabRelated.js +1 -2
  38. package/PageEntityForm/PageEntityFormDesktopContainer.js +6 -6
  39. package/PageEntityForm/RecordSetNavigatorContainer.js +4 -7
  40. package/PageEntityForm/RelatedViewSelector.js +4 -2
  41. package/PageEntityForm/SectionContainer.js +18 -4
  42. package/PageEntityForm/StandardControl.d.ts +2 -2
  43. package/PageEntityForm/StandardControl.js +75 -112
  44. package/PageEntityForm/SubgridControl.js +1 -1
  45. package/componentStore.d.ts +2 -0
  46. package/componentStore.js +5 -0
  47. package/components/PageLogin.js +0 -1
  48. package/form/FormControl.js +1 -1
  49. package/form/controls/AttachmentControl.d.ts +17 -0
  50. package/form/controls/AttachmentControl.js +225 -0
  51. package/form/controls/AttachmentsControl.d.ts +6 -0
  52. package/form/controls/AttachmentsControl.js +45 -0
  53. package/form/controls/CurrencyControl.js +38 -6
  54. package/form/controls/DateControl.d.ts +1 -1
  55. package/form/controls/DateControl.js +7 -3
  56. package/form/controls/DateTimeControl.d.ts +1 -1
  57. package/form/controls/DateTimeControl.js +1 -1
  58. package/form/controls/EmailControl.d.ts +1 -1
  59. package/form/controls/EmailControl.js +1 -1
  60. package/form/controls/LookupControl.js +2 -2
  61. package/form/controls/MultiSelectControl.d.ts +1 -1
  62. package/form/controls/MultiSelectControl.js +1 -1
  63. package/form/controls/MultiSelectLookupControl.js +1 -1
  64. package/form/controls/NumberControl.js +1 -0
  65. package/form/controls/PasswordControl.d.ts +1 -1
  66. package/form/controls/PasswordControl.js +1 -1
  67. package/form/controls/RichTextControl.d.ts +5 -0
  68. package/form/controls/RichTextControl.js +33 -0
  69. package/form/controls/SelectControl.d.ts +1 -1
  70. package/form/controls/SelectControl.js +1 -1
  71. package/form/controls/SwitchControl.d.ts +1 -1
  72. package/form/controls/SwitchControl.js +4 -2
  73. package/form/controls/TelephoneControl.d.ts +1 -1
  74. package/form/controls/TelephoneControl.js +1 -1
  75. package/form/controls/TextAreaControl.d.ts +1 -1
  76. package/form/controls/TextAreaControl.js +1 -1
  77. package/form/controls/utils.d.ts +4 -0
  78. package/form/controls/utils.js +42 -0
  79. package/form/layout/FormSection/FormSection.js +1 -1
  80. package/form/layout/FormSection/FormSectionColumn.js +1 -1
  81. package/form/layout/FormSection/FormSectionLoading.js +1 -1
  82. package/form/layout/FormTab/FormTab.js +1 -0
  83. package/package.json +24 -3
  84. package/styles.css +100 -0
  85. package/types/index.d.ts +12 -0
  86. package/App/AppProvider.d.ts +0 -9
  87. package/App/AppProvider.js +0 -50
  88. package/DataGrid/getAttributeFormattedValue.d.ts +0 -16
  89. 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
  } }));
@@ -1,5 +1,6 @@
1
1
  import { ForwardRefComponent } from '@fluentui/react-components';
2
2
  import { Icon } from '@headless-adminapp/icons';
3
+ import { MemoExoticComponent } from 'react';
3
4
  export interface CommandButtonProps {
4
5
  Icon: Icon;
5
6
  iconPosition?: 'before' | 'after';
@@ -8,4 +9,4 @@ export interface CommandButtonProps {
8
9
  onClick?: () => void;
9
10
  disabled?: boolean;
10
11
  }
11
- export declare const CommandButton: ForwardRefComponent<CommandButtonProps>;
12
+ export declare const CommandButton: MemoExoticComponent<ForwardRefComponent<CommandButtonProps>>;
@@ -29,8 +29,8 @@ const useStyles = (0, react_components_1.makeStyles)({
29
29
  },
30
30
  });
31
31
  const ToolbarButtonInternal = react_components_1.ToolbarButton;
32
- exports.CommandButton = (0, react_1.forwardRef)(function CommandButton({ Icon, text, danger, onClick, disabled, iconPosition = 'before' }, ref) {
32
+ exports.CommandButton = (0, react_1.memo)((0, react_1.forwardRef)(function CommandButton({ Icon, text, danger, onClick, disabled, iconPosition = 'before' }, ref) {
33
33
  const styles = useStyles();
34
34
  return ((0, jsx_runtime_1.jsx)(ToolbarButtonInternal, { ref: ref, type: "button", icon: !!Icon ? (0, jsx_runtime_1.jsx)(Icon, { size: 20 }) : undefined, iconPosition: iconPosition, disabled: disabled, onClick: onClick, className: (0, react_components_1.mergeClasses)(styles.root, danger && styles.danger), children: text }));
35
- });
35
+ }));
36
36
  exports.CommandButton.displayName = 'CommandButton';
@@ -1,2 +1,3 @@
1
1
  import { ForwardRefComponent } from '@fluentui/react-components';
2
- export declare const CommandDivider: ForwardRefComponent<{}>;
2
+ import { MemoExoticComponent } from 'react';
3
+ export declare const CommandDivider: MemoExoticComponent<ForwardRefComponent<{}>>;
@@ -4,7 +4,7 @@ exports.CommandDivider = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
6
  const react_1 = require("react");
7
- exports.CommandDivider = (0, react_1.forwardRef)(function CommandDivider(_, ref) {
7
+ exports.CommandDivider = (0, react_1.memo)((0, react_1.forwardRef)(function CommandDivider(_, ref) {
8
8
  return ((0, jsx_runtime_1.jsx)(react_components_1.ToolbarDivider, { ref: ref, style: { paddingInline: react_components_1.tokens.spacingHorizontalXS } }));
9
- });
9
+ }));
10
10
  exports.CommandDivider.displayName = 'CommandDivider';
@@ -1,9 +1,10 @@
1
1
  import { ForwardRefComponent } from '@fluentui/react-components';
2
2
  import { Icon } from '@headless-adminapp/icons';
3
+ import { MemoExoticComponent } from 'react';
3
4
  export interface CommandIconButtonProps {
4
5
  Icon: Icon;
5
6
  disabled?: boolean;
6
7
  onClick?: () => void;
7
8
  danger?: boolean;
8
9
  }
9
- export declare const CommandIconButton: ForwardRefComponent<CommandIconButtonProps>;
10
+ export declare const CommandIconButton: MemoExoticComponent<ForwardRefComponent<CommandIconButtonProps>>;
@@ -25,8 +25,8 @@ const useStyles = (0, react_components_1.makeStyles)({
25
25
  },
26
26
  },
27
27
  });
28
- exports.CommandIconButton = (0, react_1.forwardRef)(function CommandIconButton({ Icon, disabled, onClick, danger }, ref) {
28
+ exports.CommandIconButton = (0, react_1.memo)((0, react_1.forwardRef)(function CommandIconButton({ Icon, disabled, onClick, danger }, ref) {
29
29
  const styles = useStyles();
30
30
  return ((0, jsx_runtime_1.jsx)(react_components_1.ToolbarButton, { ref: ref, icon: (0, jsx_runtime_1.jsx)(Icon, { size: 20 }), disabled: disabled, onClick: onClick, className: (0, react_components_1.mergeClasses)(styles.root, danger && styles.danger) }));
31
- });
31
+ }));
32
32
  exports.CommandIconButton.displayName = 'CommandIconButton';
@@ -1,7 +1,8 @@
1
1
  import { ForwardRefComponent } from '@fluentui/react-components';
2
2
  import { Icon } from '@headless-adminapp/icons';
3
+ import { MemoExoticComponent } from 'react';
3
4
  export interface CommandLabelProps {
4
5
  Icon?: Icon;
5
6
  text: string;
6
7
  }
7
- export declare const CommandLabel: ForwardRefComponent<CommandLabelProps>;
8
+ export declare const CommandLabel: MemoExoticComponent<ForwardRefComponent<CommandLabelProps>>;
@@ -16,8 +16,8 @@ const useStyles = (0, react_components_1.makeStyles)({
16
16
  },
17
17
  },
18
18
  });
19
- exports.CommandLabel = (0, react_1.forwardRef)(function CommandLabel({ Icon, text }, ref) {
19
+ exports.CommandLabel = (0, react_1.memo)((0, react_1.forwardRef)(function CommandLabel({ Icon, text }, ref) {
20
20
  const styles = useStyles();
21
21
  return ((0, jsx_runtime_1.jsx)(react_components_1.ToolbarButton, { ref: ref, type: "button", icon: !!Icon ? (0, jsx_runtime_1.jsx)(Icon, { size: 20 }) : undefined, className: (0, react_components_1.mergeClasses)(styles.root), children: text }));
22
- });
22
+ }));
23
23
  exports.CommandLabel.displayName = 'CommandLabel';
@@ -1,6 +1,7 @@
1
1
  import { ForwardRefComponent } from '@fluentui/react-components';
2
2
  import { ArrayGroupWithAtLeastOne } from '@headless-adminapp/core/types';
3
3
  import { Icon } from '@headless-adminapp/icons';
4
+ import { MemoExoticComponent } from 'react';
4
5
  import { MenuItemProps } from './MenuItem';
5
6
  export interface CommandMenuButtonProps {
6
7
  Icon: Icon;
@@ -10,4 +11,4 @@ export interface CommandMenuButtonProps {
10
11
  onClick?: () => void;
11
12
  items: ArrayGroupWithAtLeastOne<MenuItemProps>;
12
13
  }
13
- export declare const CommandMenuButton: ForwardRefComponent<CommandMenuButtonProps>;
14
+ export declare const CommandMenuButton: MemoExoticComponent<ForwardRefComponent<CommandMenuButtonProps>>;
@@ -32,12 +32,12 @@ const useStyles = (0, react_components_1.makeStyles)({
32
32
  },
33
33
  },
34
34
  });
35
- exports.CommandMenuButton = (0, react_1.forwardRef)(function CommandMenuButton({ Icon, items, text, danger, disabled, onClick }, ref) {
35
+ exports.CommandMenuButton = (0, react_1.memo)((0, react_1.forwardRef)(function CommandMenuButton({ Icon, items, text, danger, disabled, onClick }, ref) {
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
+ }));
43
43
  exports.CommandMenuButton.displayName = 'CommandMenuButton';
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MenuItem = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
+ const react_1 = require("react");
6
7
  const MenuList_1 = require("./MenuList");
7
8
  const useStyles = (0, react_components_1.makeStyles)({
8
9
  splitMenuRight: {
@@ -27,11 +28,11 @@ const useStyles = (0, react_components_1.makeStyles)({
27
28
  },
28
29
  },
29
30
  });
30
- const MenuItem = ({ Icon, text, disabled, danger, onClick, items, }) => {
31
+ exports.MenuItem = (0, react_1.memo)(({ Icon, text, disabled, danger, onClick, items }) => {
31
32
  const styles = useStyles();
32
33
  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 }));
34
+ 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
35
  }
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 }) })] }));
36
- };
37
- exports.MenuItem = MenuItem;
36
+ 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 }) })] }));
37
+ });
38
+ exports.MenuItem.displayName = 'MenuItem';
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
6
  const react_1 = require("react");
7
7
  const MenuItem_1 = require("./MenuItem");
8
- const MenuItems = ({ items }) => {
8
+ exports.MenuItems = (0, react_1.memo)(({ items }) => {
9
9
  return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: items === null || items === void 0 ? void 0 : items.map((group, index) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [index > 0 && (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, {}), group.map((item, index) => ((0, jsx_runtime_1.jsx)(MenuItem_1.MenuItem, { Icon: item.Icon, onClick: item.onClick, text: item.text, danger: item.danger, disabled: item.disabled, items: item.items }, index)))] }, index))) }));
10
- };
11
- exports.MenuItems = MenuItems;
10
+ });
11
+ exports.MenuItems.displayName = 'MenuItems';
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MenuList = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
+ const react_1 = require("react");
6
7
  const MenuItems_1 = require("./MenuItems");
7
- const MenuList = ({ items }) => {
8
+ exports.MenuList = (0, react_1.memo)(({ items }) => {
8
9
  return ((0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: !(items === null || items === void 0 ? void 0 : items.length) ? ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { style: {
9
10
  color: react_components_1.tokens.colorNeutralForegroundDisabled,
10
11
  fontStyle: 'italic',
11
12
  }, children: "No items" })) : ((0, jsx_runtime_1.jsx)(MenuItems_1.MenuItems, { items: items })) }));
12
- };
13
- exports.MenuList = MenuList;
13
+ });
14
+ exports.MenuList.displayName = 'MenuList';
@@ -1,8 +1,8 @@
1
1
  import { ForwardRefComponent } from '@fluentui/react-components';
2
- import { PropsWithChildren } from 'react';
2
+ import { MemoExoticComponent, PropsWithChildren } from 'react';
3
3
  export interface CommandBarWrapperProps {
4
4
  overflow?: 'hidden' | 'auto';
5
5
  className?: string;
6
6
  align?: 'start' | 'end';
7
7
  }
8
- export declare const CommandBarWrapper: ForwardRefComponent<PropsWithChildren<CommandBarWrapperProps>>;
8
+ export declare const CommandBarWrapper: MemoExoticComponent<ForwardRefComponent<PropsWithChildren<CommandBarWrapperProps>>>;
@@ -17,8 +17,8 @@ const useStyles = (0, react_components_1.makeStyles)({
17
17
  overflow: 'auto',
18
18
  },
19
19
  });
20
- exports.CommandBarWrapper = (0, react_1.forwardRef)(function CommandBarWrapper({ children, overflow, className, align = 'start' }, ref) {
20
+ exports.CommandBarWrapper = (0, react_1.memo)((0, react_1.forwardRef)(function CommandBarWrapper({ children, overflow, className, align = 'start' }, ref) {
21
21
  const styles = useStyles();
22
22
  return ((0, jsx_runtime_1.jsx)(react_components_1.Toolbar, { ref: ref, style: { justifyContent: 'flex-' + align }, className: (0, react_components_1.mergeClasses)(styles.root, overflow === 'hidden' ? styles.overflowHidden : styles.overflowAuto, className), children: children }));
23
- });
23
+ }));
24
24
  exports.CommandBarWrapper.displayName = 'CommandBarWrapper';
@@ -1,9 +1,9 @@
1
1
  declare const CommandBar: {
2
- Wrapper: import("@fluentui/react-components").ForwardRefComponent<import("react").PropsWithChildren<import("./Wrapper").CommandBarWrapperProps>>;
3
- Button: import("@fluentui/react-components").ForwardRefComponent<import("./Button").CommandButtonProps>;
4
- MenuButton: import("@fluentui/react-components").ForwardRefComponent<import("./MenuButton").CommandMenuButtonProps>;
5
- Divider: import("@fluentui/react-components").ForwardRefComponent<{}>;
6
- IconButton: import("@fluentui/react-components").ForwardRefComponent<import("./IconButton").CommandIconButtonProps>;
7
- Label: import("@fluentui/react-components").ForwardRefComponent<import("./Label").CommandLabelProps>;
2
+ Wrapper: import("react").MemoExoticComponent<import("@fluentui/react-components").ForwardRefComponent<import("react").PropsWithChildren<import("./Wrapper").CommandBarWrapperProps>>>;
3
+ Button: import("react").MemoExoticComponent<import("@fluentui/react-components").ForwardRefComponent<import("./Button").CommandButtonProps>>;
4
+ MenuButton: import("react").MemoExoticComponent<import("@fluentui/react-components").ForwardRefComponent<import("./MenuButton").CommandMenuButtonProps>>;
5
+ Divider: import("react").MemoExoticComponent<import("@fluentui/react-components").ForwardRefComponent<{}>>;
6
+ IconButton: import("react").MemoExoticComponent<import("@fluentui/react-components").ForwardRefComponent<import("./IconButton").CommandIconButtonProps>>;
7
+ Label: import("react").MemoExoticComponent<import("@fluentui/react-components").ForwardRefComponent<import("./Label").CommandLabelProps>>;
8
8
  };
9
9
  export default CommandBar;
@@ -4,5 +4,5 @@ interface ActionCellProps {
4
4
  onOpen: () => void;
5
5
  mutableState: MutableState<MenuItemCommandState[][]>;
6
6
  }
7
- export declare function ActionCell({ onOpen, mutableState }: ActionCellProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare const ActionCell: import("react").NamedExoticComponent<ActionCellProps>;
8
8
  export {};
@@ -1,11 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActionCell = ActionCell;
3
+ exports.ActionCell = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const locale_1 = require("@headless-adminapp/app/locale");
5
6
  const mutable_1 = require("@headless-adminapp/app/mutable");
7
+ const react_1 = require("react");
6
8
  const TableCell_1 = require("../DataGrid/TableCell");
7
9
  const OverflowCommandBar_1 = require("../OverflowCommandBar");
8
- function ActionCell({ onOpen, mutableState }) {
10
+ exports.ActionCell = (0, react_1.memo)(function ActionCell({ onOpen, mutableState, }) {
9
11
  const transformedCommands = (0, mutable_1.useMutableStateSelector)(mutableState, (state) => state);
10
- return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellAction, { onOpen: onOpen, items: transformedCommands.map((item) => (0, OverflowCommandBar_1.transformMenuItems)(item, 'en')) }));
11
- }
12
+ const { language } = (0, locale_1.useLocale)();
13
+ return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellAction, { onOpen: onOpen, items: transformedCommands.map((item) => (0, OverflowCommandBar_1.transformMenuItems)(item, language)) }));
14
+ });
15
+ exports.ActionCell.displayName = 'ActionCell';
@@ -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: () => {
@@ -34,7 +34,9 @@ const FilterForm = ({ defaultValue, attribute, onApply, onCancel, }) => {
34
34
  };
35
35
  const isValid = (0, react_1.useMemo)(() => {
36
36
  return (!!selectedOption &&
37
- values.filter(Boolean).length === selectedOption.controls.length);
37
+ values.filter((value) => {
38
+ return value !== null && value !== undefined;
39
+ }).length === selectedOption.controls.length);
38
40
  }, [selectedOption, values]);
39
41
  return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.DialogContent, { style: { paddingBlock: 8 }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
40
42
  display: 'flex',
@@ -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':
@@ -100,7 +100,7 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
100
100
  if (!disableFilter) {
101
101
  menuItems.push(filterMenuItems);
102
102
  }
103
- const headerCell = ((0, jsx_runtime_1.jsxs)(react_components_1.TableHeaderCell, { className: (0, react_components_1.mergeClasses)(styles.root, align === 'right' && styles.right), style: {
103
+ const headerCell = ((0, jsx_runtime_1.jsxs)(react_components_1.TableHeaderCell, { as: "div", className: (0, react_components_1.mergeClasses)(styles.root, align === 'right' && styles.right), style: {
104
104
  textAlign: align,
105
105
  width: minWidth,
106
106
  minWidth: minWidth,
@@ -144,9 +144,9 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
144
144
  if (disableFilter && disableSort) {
145
145
  return headerCell;
146
146
  }
147
- return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_components_1.Menu, { positioning: "below-start", children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: headerCell }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: menuItems.map((x, i) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [i > 0 && (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, {}), x] }, i))) }) })] }), (0, jsx_runtime_1.jsx)(react_components_1.Dialog, { open: visible, onOpenChange: () => setVisible(false), children: (0, jsx_runtime_1.jsx)(react_components_1.DialogSurface, { style: { maxWidth: 400 }, children: (0, jsx_runtime_1.jsxs)(react_components_1.DialogBody, { children: [(0, jsx_runtime_1.jsx)(react_components_1.DialogTitle, { children: strings.filterBy }), (0, jsx_runtime_1.jsx)(FilterForm_1.FilterForm, { attribute: attribute, defaultValue: filterCondition, onApply: (condition) => {
148
- onChangeFilterCondition === null || onChangeFilterCondition === void 0 ? void 0 : onChangeFilterCondition(condition);
149
- setVisible(false);
150
- }, onCancel: () => setVisible(false) })] }) }) })] }));
147
+ return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("th", { children: [(0, jsx_runtime_1.jsxs)(react_components_1.Menu, { positioning: "below-start", children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: headerCell }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: menuItems.map((x, i) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [i > 0 && (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, {}), x] }, i))) }) })] }), (0, jsx_runtime_1.jsx)(react_components_1.Dialog, { open: visible, onOpenChange: () => setVisible(false), children: (0, jsx_runtime_1.jsx)(react_components_1.DialogSurface, { style: { maxWidth: 400 }, children: (0, jsx_runtime_1.jsxs)(react_components_1.DialogBody, { children: [(0, jsx_runtime_1.jsx)(react_components_1.DialogTitle, { children: strings.filterBy }), (0, jsx_runtime_1.jsx)(FilterForm_1.FilterForm, { attribute: attribute, defaultValue: filterCondition, onApply: (condition) => {
148
+ onChangeFilterCondition === null || onChangeFilterCondition === void 0 ? void 0 : onChangeFilterCondition(condition);
149
+ setVisible(false);
150
+ }, onCancel: () => setVisible(false) })] }) }) })] }) }));
151
151
  };
152
152
  exports.TableHeaderFilterCell = TableHeaderFilterCell;
@@ -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,12 +7,12 @@ 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");
15
+ const uuid_1 = require("uuid");
16
16
  const ScrollbarWithMoreDataRequest_1 = require("./ScrollbarWithMoreDataRequest");
17
17
  const useTableColumns_1 = require("./useTableColumns");
18
18
  const utils_1 = require("./utils");
@@ -55,7 +55,7 @@ const useStyles = (0, react_components_1.makeStyles)({
55
55
  });
56
56
  const fallbackData = [];
57
57
  const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort, disableColumnResize, disableContextMenu, disableSelection, }) => {
58
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
58
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
59
59
  const styles = useStyles();
60
60
  const data = (0, hooks_1.useGridData)();
61
61
  const dataState = (0, hooks_1.useGridDataState)();
@@ -73,25 +73,16 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
73
73
  }));
74
74
  }, [sorting]);
75
75
  const tableWrapperRef = (0, react_1.useRef)(null);
76
- const routeResolver = (0, hooks_3.useRouteResolver)();
77
- const router = (0, hooks_3.useRouter)();
78
76
  const recordSetSetter = (0, hooks_2.useRecordSetSetter)();
77
+ const openFormInternal = (0, navigation_1.useOpenForm)();
79
78
  const openRecord = (0, react_1.useCallback)((id) => {
80
79
  var _a, _b;
81
- const path = routeResolver({
80
+ 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 : []);
81
+ openFormInternal({
82
82
  logicalName: schema.logicalName,
83
- type: app_1.PageType.EntityForm,
84
83
  id,
85
84
  });
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
- ]);
85
+ }, [openFormInternal, recordSetSetter, schema.idAttribute, schema.logicalName]);
95
86
  const { direction } = (0, locale_1.useLocale)();
96
87
  const dataRef = (0, react_1.useRef)(data);
97
88
  dataRef.current = data;
@@ -103,16 +94,24 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
103
94
  disableSelection,
104
95
  tableWrapperRef,
105
96
  });
97
+ const uniqueRecords = (0, react_1.useMemo)(() => {
98
+ var _a;
99
+ return ((_a = data === null || data === void 0 ? void 0 : data.records.map((record) => (Object.assign(Object.assign({}, record), { __uuid: (0, uuid_1.v4)() })))) !== null && _a !== void 0 ? _a : fallbackData);
100
+ }, [data === null || data === void 0 ? void 0 : data.records]);
101
+ const idMapping = (0, react_1.useMemo)(() => uniqueRecords.reduce((acc, record) => {
102
+ acc[record[schema.idAttribute]] = record.__uuid;
103
+ return acc;
104
+ }, {}), [uniqueRecords, schema.idAttribute]);
106
105
  const rowSelection = (0, react_1.useMemo)(() => {
107
106
  return selectedIds.reduce((acc, id) => {
108
- acc[id] = true;
107
+ acc[idMapping[id]] = true;
109
108
  return acc;
110
109
  }, {});
111
- }, [selectedIds]);
110
+ }, [selectedIds, idMapping]);
112
111
  const table = (0, react_table_1.useReactTable)({
113
- data: (_a = data === null || data === void 0 ? void 0 : data.records) !== null && _a !== void 0 ? _a : fallbackData,
112
+ data: uniqueRecords,
114
113
  columns: tableColumns,
115
- getRowId: (row) => row[schema.idAttribute],
114
+ getRowId: (row) => row.__uuid,
116
115
  enableRowSelection: true,
117
116
  getCoreRowModel: (0, react_table_1.getCoreRowModel)(),
118
117
  columnResizeMode: 'onChange',
@@ -175,9 +174,9 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
175
174
  if (isScrollNearBottom)
176
175
  handlePseudoResize();
177
176
  }, [isScrollNearBottom, virtualItems.length, handlePseudoResize]);
178
- const isScrolledToRight = ((_d = (_c = (_b = tableWrapperRef.current) === null || _b === void 0 ? void 0 : _b.parentElement) === null || _c === void 0 ? void 0 : _c.parentElement) === null || _d === void 0 ? void 0 : _d.scrollLeft) ===
179
- ((_h = (_g = (_f = (_e = tableWrapperRef.current) === null || _e === void 0 ? void 0 : _e.parentElement) === null || _f === void 0 ? void 0 : _f.parentElement) === null || _g === void 0 ? void 0 : _g.scrollWidth) !== null && _h !== void 0 ? _h : 0) -
180
- ((_m = (_l = (_k = (_j = tableWrapperRef.current) === null || _j === void 0 ? void 0 : _j.parentElement) === null || _k === void 0 ? void 0 : _k.parentElement) === null || _l === void 0 ? void 0 : _l.clientWidth) !== null && _m !== void 0 ? _m : 0);
177
+ const isScrolledToRight = ((_c = (_b = (_a = tableWrapperRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement) === null || _c === void 0 ? void 0 : _c.scrollLeft) ===
178
+ ((_g = (_f = (_e = (_d = tableWrapperRef.current) === null || _d === void 0 ? void 0 : _d.parentElement) === null || _e === void 0 ? void 0 : _e.parentElement) === null || _f === void 0 ? void 0 : _f.scrollWidth) !== null && _g !== void 0 ? _g : 0) -
179
+ ((_l = (_k = (_j = (_h = tableWrapperRef.current) === null || _h === void 0 ? void 0 : _h.parentElement) === null || _j === void 0 ? void 0 : _j.parentElement) === null || _k === void 0 ? void 0 : _k.clientWidth) !== null && _l !== void 0 ? _l : 0);
181
180
  return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(ScrollbarWithMoreDataRequest_1.ScrollbarWithMoreDataRequest, { data: data === null || data === void 0 ? void 0 : data.records, hasMore: dataState === null || dataState === void 0 ? void 0 : dataState.hasNextPage, rtl: direction === 'rtl', onRequestMore: () => {
182
181
  fetchNextPage();
183
182
  }, children: (0, jsx_runtime_1.jsx)("div", { style: {
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TableCellCheckbox = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
- const TableCellCheckbox = ({ checked, onChange, }) => {
6
+ const react_1 = require("react");
7
+ exports.TableCellCheckbox = (0, react_1.memo)(({ checked, onChange }) => {
7
8
  return ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { style: { display: 'flex', alignItems: 'center' }, onClick: (event) => {
8
9
  event.stopPropagation();
9
10
  }, children: (0, jsx_runtime_1.jsx)(react_components_1.Checkbox, { checked: checked !== null && checked !== void 0 ? checked : false, onChange: (event) => {
10
11
  event.stopPropagation();
11
12
  onChange === null || onChange === void 0 ? void 0 : onChange(event);
12
13
  } }) }));
13
- };
14
- exports.TableCellCheckbox = TableCellCheckbox;
14
+ });
15
+ exports.TableCellCheckbox.displayName = 'TableCellCheckbox';
@@ -4,7 +4,8 @@ exports.TableCellLink = void 0;
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/route/hooks");
7
- const TableCellLink = ({ value, href, onClick, width, }) => {
7
+ const react_1 = require("react");
8
+ exports.TableCellLink = (0, react_1.memo)(({ value, href, onClick, width }) => {
8
9
  const router = (0, hooks_1.useRouter)();
9
10
  return ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { style: {
10
11
  textOverflow: 'ellipsis',
@@ -29,5 +30,5 @@ const TableCellLink = ({ value, href, onClick, width, }) => {
29
30
  event.preventDefault();
30
31
  }
31
32
  }, children: value }) }));
32
- };
33
- exports.TableCellLink = TableCellLink;
33
+ });
34
+ exports.TableCellLink.displayName = 'TableCellLink';