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

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 (106) hide show
  1. package/App/AppHeaderContianer.js +13 -11
  2. package/App/AppLogo.js +1 -2
  3. package/App/LayoutProvider.js +3 -15
  4. package/App/NavigationContainer.js +2 -6
  5. package/App/QuickActionItem.js +1 -1
  6. package/App/utils.d.ts +1 -1
  7. package/App/utils.js +3 -4
  8. package/CommandBar/MenuItem.js +1 -1
  9. package/CommandBar/MenuItems.js +1 -4
  10. package/CommandBar/MenuList.js +1 -1
  11. package/DataGrid/CustomizeColumns/AddColumns.js +33 -34
  12. package/DataGrid/CustomizeColumns/ColumnItem.js +5 -5
  13. package/DataGrid/CustomizeColumns/CustomizeColumns.js +2 -3
  14. package/DataGrid/FormSubgridViewSelector.js +1 -5
  15. package/DataGrid/GridColumnHeader/ConditionValueControl.js +19 -25
  16. package/DataGrid/GridColumnHeader/FilterForm.js +6 -9
  17. package/DataGrid/GridColumnHeader/OperatorSelect.js +1 -1
  18. package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +4 -4
  19. package/DataGrid/GridHeaderDesktop.js +1 -5
  20. package/DataGrid/GridHeaderMobile.js +1 -4
  21. package/DataGrid/GridListContainer.js +9 -7
  22. package/DataGrid/GridPaginationContainer.js +1 -2
  23. package/DataGrid/GridTableContainer.js +25 -20
  24. package/DataGrid/TableCell/TableCellBase.js +6 -1
  25. package/DataGrid/TableCell/TableCellCheckbox.js +2 -2
  26. package/DataGrid/TableCell/TableCellChoice.js +1 -2
  27. package/DataGrid/TableCell/TableCellLink.d.ts +1 -1
  28. package/DataGrid/TableCell/TableCellLink.js +5 -1
  29. package/DataGrid/useTableColumns.js +85 -41
  30. package/DialogContainer/AlertDialog.js +3 -6
  31. package/DialogContainer/ConfirmDialog.js +5 -9
  32. package/DialogContainer/DialogContainer.js +2 -13
  33. package/DialogContainer/ErrorDialog.js +3 -6
  34. package/DialogContainer/PromptDialog.js +22 -31
  35. package/Insights/CommandBarContainer.js +4 -1
  36. package/Insights/FilterBarContainer.js +12 -20
  37. package/Insights/WidgetDataGridContainer.js +11 -2
  38. package/Insights/WidgetTableContainer.js +2 -3
  39. package/Insights/WidgetTitleBar.js +1 -2
  40. package/Insights/charts/ComposedChart.js +1 -2
  41. package/Insights/charts/CustomTooltipContent.js +1 -1
  42. package/Insights/charts/OhlcChart.js +8 -7
  43. package/Insights/charts/PieChart.js +4 -8
  44. package/Insights/charts/RadarChart.js +2 -3
  45. package/Insights/charts/ScatterChart.js +4 -9
  46. package/Insights/charts/formatters.js +4 -6
  47. package/Insights/charts/renderers.js +1 -2
  48. package/Insights/hooks/useQueriesData.js +3 -12
  49. package/Insights/hooks/useWidgetDetail.js +9 -3
  50. package/OverflowCommandBar/OverflowMenu.js +4 -16
  51. package/OverflowCommandBar/render.js +3 -4
  52. package/OverflowCommandBar/utils.js +2 -3
  53. package/PageBoard/BoardColumnCard.d.ts +1 -1
  54. package/PageBoard/BoardColumnCard.js +3 -2
  55. package/PageBoard/BoardColumnUI.js +12 -17
  56. package/PageBoard/Header.js +3 -12
  57. package/PageBoard/PageBoard.d.ts +1 -1
  58. package/PageBoard/PageBoard.js +2 -3
  59. package/PageEntityForm/PageEntityFormDesktopContainer.js +8 -5
  60. package/PageEntityForm/RecordCard.js +8 -4
  61. package/PageEntityForm/RecordCardLoading.js +1 -2
  62. package/PageEntityForm/RecordSetNavigatorContainer.js +1 -2
  63. package/PageEntityForm/RelatedViewSelector.js +5 -10
  64. package/PageEntityForm/SectionContainer.js +7 -6
  65. package/PageEntityForm/StandardControl.d.ts +3 -3
  66. package/PageEntityForm/StandardControl.js +33 -32
  67. package/PageEntityForm/SubgridControl.js +2 -3
  68. package/ToastNotificationContainer/index.js +1 -2
  69. package/components/DndProvider.d.ts +12 -0
  70. package/components/DndProvider.js +68 -0
  71. package/components/LoginForm.js +5 -21
  72. package/form/FormControl.js +17 -28
  73. package/form/controls/AttachmentControl.js +13 -22
  74. package/form/controls/AttachmentsControl.js +8 -18
  75. package/form/controls/CurrencyControl.js +4 -4
  76. package/form/controls/DateControl.js +2 -2
  77. package/form/controls/DateRangeControl.js +4 -6
  78. package/form/controls/DateTimeControl.js +7 -7
  79. package/form/controls/DecimalControl.js +4 -4
  80. package/form/controls/DurationControl.js +3 -3
  81. package/form/controls/EmailControl.js +4 -4
  82. package/form/controls/IntegerControl.js +5 -5
  83. package/form/controls/LookupControl.d.ts +1 -0
  84. package/form/controls/LookupControl.js +50 -11
  85. package/form/controls/MultiSelectControl.js +3 -3
  86. package/form/controls/MultiSelectLookupControl.js +16 -17
  87. package/form/controls/PasswordControl.js +1 -1
  88. package/form/controls/RichTextControl.js +1 -1
  89. package/form/controls/SelectControl.js +4 -5
  90. package/form/controls/SwitchControl.js +1 -1
  91. package/form/controls/TelephoneControl.js +1 -1
  92. package/form/controls/TextAreaControl.js +4 -4
  93. package/form/controls/TextControl.js +4 -4
  94. package/form/controls/UrlControl.js +1 -1
  95. package/form/controls/useLookupData.js +26 -41
  96. package/form/layout/FormSection/FormSection.js +10 -3
  97. package/form/layout/FormTab/FormTab.js +2 -2
  98. package/package.json +4 -11
  99. package/utils/avatar.d.ts +2 -0
  100. package/utils/avatar.js +45 -0
  101. package/DataGrid/ScrollbarWithMoreDataRequest.d.ts +0 -9
  102. package/DataGrid/ScrollbarWithMoreDataRequest.js +0 -33
  103. package/form/controls/NumberControl.d.ts +0 -4
  104. package/form/controls/NumberControl.js +0 -16
  105. package/form/controls/utils.d.ts +0 -4
  106. package/form/controls/utils.js +0 -42
@@ -23,8 +23,12 @@ const AppHeaderContainer = ({ onNavToggle, }) => {
23
23
  const { language } = (0, locale_1.useLocale)();
24
24
  const isMobile = (0, hooks_2.useIsMobile)();
25
25
  const initials = (0, react_1.useMemo)(() => {
26
- return authSession === null || authSession === void 0 ? void 0 : authSession.fullName.split(' ').map((item) => item[0]).slice(0, 2).join('');
27
- }, [authSession === null || authSession === void 0 ? void 0 : authSession.fullName]);
26
+ return authSession?.fullName
27
+ .split(' ')
28
+ .map((item) => item[0])
29
+ .slice(0, 2)
30
+ .join('');
31
+ }, [authSession?.fullName]);
28
32
  const quickActionItems = (0, hooks_2.useItemsWithKey)(app.quickActionItems);
29
33
  const accountMenuItems = (0, hooks_2.useItemsWithKey)(app.accountMenuItems);
30
34
  return ((0, jsx_runtime_1.jsxs)("div", { style: {
@@ -46,11 +50,10 @@ const AppHeaderContainer = ({ onNavToggle, }) => {
46
50
  paddingLeft: 8,
47
51
  display: 'flex',
48
52
  gap: 16,
49
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', gap: 8 }, children: quickActionItems === null || quickActionItems === void 0 ? void 0 : quickActionItems.map((item) => {
50
- var _a, _b;
51
- return ((0, jsx_runtime_1.jsx)(QuickActionItem_1.QuickActionItem, { Icon: item.icon, label: (_b = (_a = item.localizedLabel) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.label, onClick: () => { var _a; return (_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item); }, link: item.link }, item.__key));
52
- }) }), (!isSkipAuthCheck || !!(accountMenuItems === null || accountMenuItems === void 0 ? void 0 : accountMenuItems.length)) && ((0, jsx_runtime_1.jsxs)(react_components_1.Popover, { children: [(0, jsx_runtime_1.jsx)(react_components_1.PopoverTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.Avatar, { initials: initials, color: "neutral", style: { cursor: 'pointer' }, image: {
53
- src: authSession === null || authSession === void 0 ? void 0 : authSession.profilePicture,
53
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', gap: 8 }, children: quickActionItems?.map((item) => {
54
+ return ((0, jsx_runtime_1.jsx)(QuickActionItem_1.QuickActionItem, { Icon: item.icon, label: item.localizedLabel?.[language] ?? item.label, onClick: () => item.onClick?.(), link: item.link }, item.__key));
55
+ }) }), (!isSkipAuthCheck || !!accountMenuItems?.length) && ((0, jsx_runtime_1.jsxs)(react_components_1.Popover, { children: [(0, jsx_runtime_1.jsx)(react_components_1.PopoverTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.Avatar, { initials: initials, color: "neutral", style: { cursor: 'pointer' }, image: {
56
+ src: authSession?.profilePicture,
54
57
  } }) }), (0, jsx_runtime_1.jsxs)(react_components_1.PopoverSurface, { tabIndex: -1, style: { padding: 0 }, children: [!isSkipAuthCheck && ((0, jsx_runtime_1.jsxs)("div", { style: {
55
58
  display: 'flex',
56
59
  gap: 8,
@@ -58,16 +61,15 @@ const AppHeaderContainer = ({ onNavToggle, }) => {
58
61
  overflow: 'hidden',
59
62
  width: 200,
60
63
  }, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Avatar, { initials: initials, color: "neutral", image: {
61
- src: authSession === null || authSession === void 0 ? void 0 : authSession.profilePicture,
64
+ src: authSession?.profilePicture,
62
65
  } }) }), (0, jsx_runtime_1.jsxs)("div", { style: {
63
66
  display: 'flex',
64
67
  flexDirection: 'column',
65
68
  overflow: 'hidden',
66
69
  flex: 1,
67
- }, 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 })] })] })), !isSkipAuthCheck && (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: [accountMenuItems === null || accountMenuItems === void 0 ? void 0 : accountMenuItems.map((item) => {
68
- var _a, _b;
70
+ }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Caption1Strong, { children: authSession?.fullName }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { textOverflow: 'ellipsis', overflow: 'hidden' }, children: authSession?.email })] })] })), !isSkipAuthCheck && (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: [accountMenuItems?.map((item) => {
69
71
  const Icon = item.icon;
70
- 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 }, item.__key));
72
+ return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, { size: "inherit" }), onClick: () => item.onClick?.(), children: item.localizedLabel?.[language] ?? item.label }, item.__key));
71
73
  }), !isSkipAuthCheck && ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.SignOut, {}), onClick: () => logout(), children: strings.logout }))] })] })] }))] })] }));
72
74
  };
73
75
  exports.AppHeaderContainer = AppHeaderContainer;
package/App/AppLogo.js CHANGED
@@ -4,9 +4,8 @@ exports.AppLogo = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const icons_1 = require("@headless-adminapp/icons");
6
6
  const AppLogo = ({ logo, title }) => {
7
- var _a;
8
7
  if (logo.Icon) {
9
- const Icon = (_a = logo.Icon) !== null && _a !== void 0 ? _a : icons_1.IconPlaceholder;
8
+ const Icon = logo.Icon ?? icons_1.IconPlaceholder;
10
9
  return ((0, jsx_runtime_1.jsx)("div", { style: {
11
10
  display: 'flex',
12
11
  alignItems: 'center',
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
3
  exports.LayoutProvider = void 0;
15
4
  const jsx_runtime_1 = require("react/jsx-runtime");
@@ -18,12 +7,11 @@ const LayoutProvider_1 = require("@headless-adminapp/app/app/LayoutProvider");
18
7
  const DialogContainer_1 = require("../DialogContainer");
19
8
  const ProgressIndicatorContainer_1 = require("../ProgressIndicatorContainer");
20
9
  const ToastNotificationContainer_1 = require("../ToastNotificationContainer");
21
- const LayoutProvider = (_a) => {
22
- var { children, theme } = _a, rest = __rest(_a, ["children", "theme"]);
23
- return ((0, jsx_runtime_1.jsx)(react_components_1.FluentProvider, { theme: theme !== null && theme !== void 0 ? theme : react_components_1.webLightTheme, children: (0, jsx_runtime_1.jsx)(LayoutProvider_1.LayoutProvider, Object.assign({}, rest, { containers: {
10
+ const LayoutProvider = ({ children, theme, ...rest }) => {
11
+ return ((0, jsx_runtime_1.jsx)(react_components_1.FluentProvider, { theme: theme ?? react_components_1.webLightTheme, children: (0, jsx_runtime_1.jsx)(LayoutProvider_1.LayoutProvider, { ...rest, containers: {
24
12
  DialogContainer: DialogContainer_1.DialogContainer,
25
13
  ProgressIndicatorContainer: ProgressIndicatorContainer_1.ProgressIndicatorContainer,
26
14
  ToastNotificationContainer: ToastNotificationContainer_1.ToastNotificationContainer,
27
- }, children: children })) }));
15
+ }, children: children }) }));
28
16
  };
29
17
  exports.LayoutProvider = LayoutProvider;
@@ -34,14 +34,10 @@ const useStyles = (0, react_components_1.makeStyles)({
34
34
  const NavigationContainer = ({ open, type, onOpenChange, }) => {
35
35
  const styles = useStyles();
36
36
  const { app } = (0, app_1.useAppContext)();
37
- return ((0, jsx_runtime_1.jsx)("div", { className: styles.root, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavDrawer, { selectedValue: "active", open: open, type: type, onOpenChange: (value, data) => onOpenChange(data.open), 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) => {
38
- var _a;
39
- return ((0, jsx_runtime_1.jsx)(Test, { item: item, drawerType: type, onOpenChange: onOpenChange }, ((_a = item.label) !== null && _a !== void 0 ? _a : '') + String(index)));
40
- })] }, group.label))) }, area.label))) }) }) }));
37
+ return ((0, jsx_runtime_1.jsx)("div", { className: styles.root, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavDrawer, { selectedValue: "active", open: open, type: type, onOpenChange: (value, data) => onOpenChange(data.open), 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) => ((0, jsx_runtime_1.jsx)(Test, { item: item, drawerType: type, onOpenChange: onOpenChange }, (item.label ?? '') + String(index))))] }, group.label))) }, area.label))) }) }) }));
41
38
  };
42
39
  exports.NavigationContainer = NavigationContainer;
43
40
  const Test = ({ item, onOpenChange, drawerType }) => {
44
- var _a, _b;
45
41
  const { schemaMetadataDic } = (0, app_1.useAppContext)();
46
42
  const router = (0, hooks_1.useRouter)();
47
43
  const pathname = (0, hooks_1.usePathname)();
@@ -55,7 +51,7 @@ const Test = ({ item, onOpenChange, drawerType }) => {
55
51
  language,
56
52
  routeResolver,
57
53
  });
58
- const Icon = (_b = (_a = navItem.icon) !== null && _a !== void 0 ? _a : icons_1.Icons.Entity) !== null && _b !== void 0 ? _b : icons_1.IconPlaceholder;
54
+ const Icon = navItem.icon ?? icons_1.Icons.Entity ?? icons_1.IconPlaceholder;
59
55
  const isActive = isRouteActive(selectedPath, item);
60
56
  return ((0, jsx_runtime_1.jsx)(react_nav_preview_1.NavItem, { href: navItem.link, onClick: (event) => {
61
57
  if (drawerType === 'overlay') {
@@ -26,7 +26,7 @@ const QuickActionItem = ({ label, Icon, onClick, link, }) => {
26
26
  const styles = useStyles();
27
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
- onClick === null || onClick === void 0 ? void 0 : onClick();
29
+ onClick?.();
30
30
  } }));
31
31
  };
32
32
  exports.QuickActionItem = QuickActionItem;
package/App/utils.d.ts CHANGED
@@ -8,7 +8,7 @@ export declare function transformNavPageItem({ item, schemaMetadataDic: schemaMe
8
8
  routeResolver: InternalRouteResolver;
9
9
  }): {
10
10
  label: string | undefined;
11
- icon: import("@headless-adminapp/icons").Icon | undefined;
11
+ icon: any;
12
12
  link: string;
13
13
  isExternal: boolean;
14
14
  };
package/App/utils.js CHANGED
@@ -2,16 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformNavPageItem = transformNavPageItem;
4
4
  function transformNavPageItem({ item, schemaMetadataDic: schemaMetadataObject, language, routeResolver, }) {
5
- var _a, _b, _c, _d;
6
5
  let icon = item.icon;
7
- let label = (_b = (_a = item.localizedLabel) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.label;
6
+ let label = item.localizedLabel?.[language] ?? item.label;
8
7
  let link = routeResolver(item);
9
8
  if (item.type === 'entityview') {
10
- const metadata = schemaMetadataObject === null || schemaMetadataObject === void 0 ? void 0 : schemaMetadataObject[item.logicalName];
9
+ const metadata = schemaMetadataObject?.[item.logicalName];
11
10
  if (metadata) {
12
11
  if (!label) {
13
12
  label =
14
- (_d = (_c = metadata.localizedPluralLabels) === null || _c === void 0 ? void 0 : _c[language]) !== null && _d !== void 0 ? _d : metadata.pluralLabel;
13
+ metadata.localizedPluralLabels?.[language] ?? metadata.pluralLabel;
15
14
  }
16
15
  if (!icon) {
17
16
  icon = metadata.icon;
@@ -30,7 +30,7 @@ const useStyles = (0, react_components_1.makeStyles)({
30
30
  });
31
31
  exports.MenuItem = (0, react_1.memo)(({ Icon, text, disabled, danger, onClick, items }) => {
32
32
  const styles = useStyles();
33
- if (!(items === null || items === void 0 ? void 0 : items.length)) {
33
+ if (!items?.length) {
34
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 }));
35
35
  }
36
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 }) })] }));
@@ -6,9 +6,6 @@ const react_components_1 = require("@fluentui/react-components");
6
6
  const react_1 = require("react");
7
7
  const MenuItem_1 = require("./MenuItem");
8
8
  exports.MenuItems = (0, react_1.memo)(({ items }) => {
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) => {
10
- var _a;
11
- return ((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 }, ((_a = item.text) !== null && _a !== void 0 ? _a : '') + index));
12
- })] }, index))) }));
9
+ return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: 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 }, (item.text ?? '') + index)))] }, index))) }));
13
10
  });
14
11
  exports.MenuItems.displayName = 'MenuItems';
@@ -6,7 +6,7 @@ const react_components_1 = require("@fluentui/react-components");
6
6
  const react_1 = require("react");
7
7
  const MenuItems_1 = require("./MenuItems");
8
8
  exports.MenuList = (0, react_1.memo)(({ items }) => {
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
+ return ((0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: !items?.length ? ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { style: {
10
10
  color: react_components_1.tokens.colorNeutralForegroundDisabled,
11
11
  fontStyle: 'italic',
12
12
  }, children: "No items" })) : ((0, jsx_runtime_1.jsx)(MenuItems_1.MenuItems, { items: items })) }));
@@ -13,7 +13,6 @@ const react_1 = require("react");
13
13
  const AppStringContext_1 = require("../../App/AppStringContext");
14
14
  const PageEntityViewStringContext_1 = require("../../PageEntityView/PageEntityViewStringContext");
15
15
  function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, }) {
16
- var _a;
17
16
  const schema = (0, hooks_1.useDataGridSchema)();
18
17
  const { schemaStore } = (0, hooks_2.useMetadata)();
19
18
  const { language } = (0, locale_1.useLocale)();
@@ -25,26 +24,29 @@ function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, })
25
24
  attribute,
26
25
  }))
27
26
  .filter(({ attribute }) => attribute.type === 'lookup');
28
- const columnGroups = Object.assign({ root: {
27
+ const columnGroups = {
28
+ root: {
29
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),
33
- } }, lookupAttributes.reduce((acc, { key, attribute }) => {
34
- const lookupSchema = schemaStore.getSchema(attribute.entity);
35
- const columns = (0, datagrid_1.transformViewColumns)(schema.logicalName, Object.keys(lookupSchema.attributes).map((nestedKey) => ({
36
- name: key,
37
- expandedKey: nestedKey,
38
- })), schemaStore, language);
39
- acc[key] = {
40
- label: (0, utils_1.localizedLabel)(language, attribute) +
41
- ' (' +
42
- (0, utils_1.localizedLabel)(language, lookupSchema) +
43
- ')',
44
- columns,
45
- };
46
- return acc;
47
- }, {}));
33
+ },
34
+ ...lookupAttributes.reduce((acc, { key, attribute }) => {
35
+ const lookupSchema = schemaStore.getSchema(attribute.entity);
36
+ const columns = (0, datagrid_1.transformViewColumns)(schema.logicalName, Object.keys(lookupSchema.attributes).map((nestedKey) => ({
37
+ name: key,
38
+ expandedKey: nestedKey,
39
+ })), schemaStore, language);
40
+ acc[key] = {
41
+ label: (0, utils_1.localizedLabel)(language, attribute) +
42
+ ' (' +
43
+ (0, utils_1.localizedLabel)(language, lookupSchema) +
44
+ ')',
45
+ columns,
46
+ };
47
+ return acc;
48
+ }, {}),
49
+ };
48
50
  const tableItems = Object.entries(columnGroups).map(([key, group]) => ({
49
51
  key,
50
52
  label: group.label,
@@ -64,27 +66,24 @@ function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, })
64
66
  gap: 8,
65
67
  marginBottom: react_components_1.tokens.spacingVerticalXS,
66
68
  paddingInline: react_components_1.tokens.spacingHorizontalS,
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
+ }, 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: selectedGroupItem?.label ?? '', selectedOptions: selectedGroupItem ? [String(selectedGroupItem.key)] : [], onOptionSelect: (event, data) => {
68
70
  setSelectedGroup(data.optionValue);
69
71
  }, style: { flex: 1, minWidth: 'unset' }, positioning: {
70
72
  align: 'bottom',
71
73
  position: 'below',
72
- }, children: tableItems.map((x) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: x.key, children: x.label }, x.key))) })] }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, {})] }), (0, jsx_runtime_1.jsx)(react_components_1.DrawerBody, { style: { paddingInline: 0 }, children: filteredColumns.map((column) => {
73
- var _a;
74
- return ((0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "transparent", icon: (0, jsx_runtime_1.jsx)(react_components_1.Checkbox, { checked: (_a = includedColumnsObj[column.id]) !== null && _a !== void 0 ? _a : false }), style: {
75
- fontWeight: react_components_1.tokens.fontSizeBase400,
76
- width: '100%',
77
- justifyContent: 'flex-start',
78
- paddingInline: react_components_1.tokens.spacingHorizontalS,
79
- }, onClick: () => {
80
- if (includedColumnsObj[column.id]) {
81
- onColumnRemove(column);
82
- }
83
- else {
84
- onColumnAdd(column);
85
- }
86
- }, children: column.label }, column.id));
87
- }) }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, {}), (0, jsx_runtime_1.jsx)("div", { style: {
74
+ }, children: tableItems.map((x) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: x.key, children: x.label }, x.key))) })] }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, {})] }), (0, jsx_runtime_1.jsx)(react_components_1.DrawerBody, { style: { paddingInline: 0 }, children: filteredColumns.map((column) => ((0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "transparent", icon: (0, jsx_runtime_1.jsx)(react_components_1.Checkbox, { checked: includedColumnsObj[column.id] ?? false }), style: {
75
+ fontWeight: react_components_1.tokens.fontSizeBase400,
76
+ width: '100%',
77
+ justifyContent: 'flex-start',
78
+ paddingInline: react_components_1.tokens.spacingHorizontalS,
79
+ }, onClick: () => {
80
+ if (includedColumnsObj[column.id]) {
81
+ onColumnRemove(column);
82
+ }
83
+ else {
84
+ onColumnAdd(column);
85
+ }
86
+ }, children: column.label }, column.id))) }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, {}), (0, jsx_runtime_1.jsx)("div", { style: {
88
87
  display: 'flex',
89
88
  padding: 8,
90
89
  gap: 8,
@@ -5,14 +5,15 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
6
  const icons_1 = require("@headless-adminapp/icons");
7
7
  const react_1 = require("react");
8
- const react_dnd_1 = require("react-dnd");
8
+ const DndProvider_1 = require("../../components/DndProvider");
9
9
  exports.ItemTypes = {
10
10
  CARD: 'column',
11
11
  };
12
12
  const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSet = {}, // defaultCustomizeColumnStrings,
13
13
  }) => {
14
+ const { useDrag, useDrop } = (0, DndProvider_1.useDndContext)();
14
15
  const ref = (0, react_1.useRef)(null);
15
- const [{ handlerId }, drop] = (0, react_dnd_1.useDrop)({
16
+ const [{ handlerId }, drop] = useDrop({
16
17
  accept: exports.ItemTypes.CARD,
17
18
  collect(monitor) {
18
19
  return {
@@ -20,7 +21,6 @@ const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSe
20
21
  };
21
22
  },
22
23
  hover(item, monitor) {
23
- var _a;
24
24
  if (!ref.current) {
25
25
  return;
26
26
  }
@@ -31,7 +31,7 @@ const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSe
31
31
  return;
32
32
  }
33
33
  // Determine rectangle on screen
34
- const hoverBoundingRect = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
34
+ const hoverBoundingRect = ref.current?.getBoundingClientRect();
35
35
  // Get vertical middle
36
36
  const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
37
37
  // Determine mouse position
@@ -58,7 +58,7 @@ const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSe
58
58
  item.index = hoverIndex;
59
59
  },
60
60
  });
61
- const [{ isDragging }, drag] = (0, react_dnd_1.useDrag)({
61
+ const [{ isDragging }, drag] = useDrag({
62
62
  type: exports.ItemTypes.CARD,
63
63
  item: () => {
64
64
  return { id: item.id, index };
@@ -12,8 +12,7 @@ const mutable_1 = require("@headless-adminapp/app/mutable");
12
12
  const icons_1 = require("@headless-adminapp/icons");
13
13
  const immutability_helper_1 = __importDefault(require("immutability-helper"));
14
14
  const react_1 = require("react");
15
- const react_dnd_1 = require("react-dnd");
16
- const react_dnd_html5_backend_1 = require("react-dnd-html5-backend");
15
+ const DndProvider_1 = require("../../components/DndProvider");
17
16
  const PageEntityViewStringContext_1 = require("../../PageEntityView/PageEntityViewStringContext");
18
17
  const AddColumns_1 = require("./AddColumns");
19
18
  const ColumnItem_1 = require("./ColumnItem");
@@ -55,7 +54,7 @@ function CustomizeColumns({ onClose, opened }) {
55
54
  minWidth: 'unset',
56
55
  }, onClick: () => setShowAddColumns(true), children: strings.add }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Edit, {}), style: { fontWeight: react_components_1.tokens.fontSizeBase400, minWidth: 'unset' }, disabled: !isDirty, onClick: () => {
57
56
  setItems(columns);
58
- }, children: strings.reset })] }), (0, jsx_runtime_1.jsx)(AddColumns_1.AddColumns, { onColumnAdd: onColumnAdd, onColumnRemove: onColumnRemove, columns: items, opened: showAddColumns, onClose: () => setShowAddColumns(false) }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, {})] }), (0, jsx_runtime_1.jsx)(react_components_1.DrawerBody, { style: { paddingInline: react_components_1.tokens.spacingHorizontalS }, children: (0, jsx_runtime_1.jsx)(react_dnd_1.DndProvider, { backend: react_dnd_html5_backend_1.HTML5Backend, children: (0, jsx_runtime_1.jsx)("div", { style: {
57
+ }, children: strings.reset })] }), (0, jsx_runtime_1.jsx)(AddColumns_1.AddColumns, { onColumnAdd: onColumnAdd, onColumnRemove: onColumnRemove, columns: items, opened: showAddColumns, onClose: () => setShowAddColumns(false) }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, {})] }), (0, jsx_runtime_1.jsx)(react_components_1.DrawerBody, { style: { paddingInline: react_components_1.tokens.spacingHorizontalS }, children: (0, jsx_runtime_1.jsx)(DndProvider_1.DndProvider, { children: (0, jsx_runtime_1.jsx)("div", { style: {
59
58
  display: 'flex',
60
59
  flexDirection: 'column',
61
60
  width: '100%',
@@ -9,7 +9,6 @@ const locale_1 = require("@headless-adminapp/app/locale");
9
9
  const mutable_1 = require("@headless-adminapp/app/mutable");
10
10
  const icons_1 = require("@headless-adminapp/icons");
11
11
  const FormSubgridViewSelector = () => {
12
- var _a, _b;
13
12
  const viewLookup = (0, hooks_1.useGridViewLookupData)();
14
13
  const selectedView = (0, hooks_1.useSelectedView)();
15
14
  const changeView = (0, hooks_1.useChangeView)();
@@ -33,9 +32,6 @@ const FormSubgridViewSelector = () => {
33
32
  paddingInline: 8,
34
33
  paddingBlock: 4,
35
34
  pointerEvents: allowViewSelection ? 'auto' : 'none',
36
- }, children: (_b = (_a = selectedView.localizedNames) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : selectedView.name }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: viewLookup.map((view) => {
37
- var _a, _b;
38
- return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => changeView(view.id), children: (_b = (_a = view.localizedNames) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : view.name }, view.id));
39
- }) }) })] }) }) }));
35
+ }, children: selectedView.localizedNames?.[language] ?? selectedView.name }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: viewLookup.map((view) => ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => changeView(view.id), children: view.localizedNames?.[language] ?? view.name }, view.id))) }) })] }) }) }));
40
36
  };
41
37
  exports.FormSubgridViewSelector = FormSubgridViewSelector;
@@ -9,28 +9,27 @@ const hooks_1 = require("@headless-adminapp/app/metadata/hooks");
9
9
  const transport_1 = require("@headless-adminapp/app/transport");
10
10
  const FormControl_1 = __importDefault(require("../../form/FormControl"));
11
11
  function ConditionValueControl({ attribute, type, value, onChange, }) {
12
- var _a, _b, _c, _d;
13
12
  const dataService = (0, transport_1.useDataService)();
14
13
  const { schemaStore, experienceStore } = (0, hooks_1.useMetadata)();
15
14
  switch (type) {
16
15
  case 'string':
17
- return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "text", value: value !== null && value !== void 0 ? value : null, onChange: (value) => {
18
- onChange === null || onChange === void 0 ? void 0 : onChange(value);
16
+ return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "text", value: value ?? null, onChange: (value) => {
17
+ onChange?.(value);
19
18
  } }));
20
19
  case 'number':
21
- return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "number", value: value !== null && value !== void 0 ? value : null, onChange: (value) => {
22
- onChange === null || onChange === void 0 ? void 0 : onChange(value);
20
+ return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "number", value: value ?? null, onChange: (value) => {
21
+ onChange?.(value);
23
22
  } }));
24
23
  case 'money':
25
- return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "currency", value: value !== null && value !== void 0 ? value : null, onChange: (value) => {
26
- onChange === null || onChange === void 0 ? void 0 : onChange(value);
24
+ return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "currency", value: value ?? null, onChange: (value) => {
25
+ onChange?.(value);
27
26
  } }));
28
27
  case 'lookup':
29
28
  if (attribute.type !== 'lookup') {
30
29
  return null;
31
30
  }
32
- return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "lookups", async: true, dataService: dataService, schema: schemaStore.getSchema(attribute.entity), experienceStore: experienceStore, value: value !== null && value !== void 0 ? value : null, onChange: (value) => {
33
- onChange === null || onChange === void 0 ? void 0 : onChange(value !== null && value !== void 0 ? value : []);
31
+ return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "lookups", async: true, dataService: dataService, schema: schemaStore.getSchema(attribute.entity), experienceStore: experienceStore, value: value ?? null, onChange: (value) => {
32
+ onChange?.(value ?? []);
34
33
  } }));
35
34
  // return (
36
35
  // <FormControl
@@ -46,8 +45,8 @@ function ConditionValueControl({ attribute, type, value, onChange, }) {
46
45
  // />
47
46
  // );
48
47
  case 'date':
49
- return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "date", value: value !== null && value !== void 0 ? value : null, onChange: (value) => {
50
- onChange === null || onChange === void 0 ? void 0 : onChange(value);
48
+ return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "date", value: value ?? null, onChange: (value) => {
49
+ onChange?.(value);
51
50
  } }));
52
51
  case 'boolean':
53
52
  if (attribute.type !== 'boolean') {
@@ -55,16 +54,15 @@ function ConditionValueControl({ attribute, type, value, onChange, }) {
55
54
  }
56
55
  return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "multi-select", options: [
57
56
  {
58
- label: (_a = attribute.trueLabel) !== null && _a !== void 0 ? _a : 'Yes',
57
+ label: attribute.trueLabel ?? 'Yes',
59
58
  value: 'true',
60
59
  },
61
60
  {
62
- label: (_b = attribute.falseLabel) !== null && _b !== void 0 ? _b : 'No',
61
+ label: attribute.falseLabel ?? 'No',
63
62
  value: 'false',
64
63
  },
65
- ], value: (_c = value === null || value === void 0 ? void 0 : value.map((x) => (x === true ? 'true' : 'false'))) !== null && _c !== void 0 ? _c : [], onChange: (value) => {
66
- var _a;
67
- onChange === null || onChange === void 0 ? void 0 : onChange((_a = value === null || value === void 0 ? void 0 : value.map((x) => x === 'true')) !== null && _a !== void 0 ? _a : []);
64
+ ], value: value?.map((x) => (x === true ? 'true' : 'false')) ?? [], onChange: (value) => {
65
+ onChange?.(value?.map((x) => x === 'true') ?? []);
68
66
  } }));
69
67
  case 'choice':
70
68
  case 'choices':
@@ -73,15 +71,11 @@ function ConditionValueControl({ attribute, type, value, onChange, }) {
73
71
  }
74
72
  const isNumeric = 'number' in attribute && attribute.number === true;
75
73
  // const isString = 'string' in attribute && attribute.string === true;
76
- return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "multi-select", options: attribute.options.map((x) => {
77
- var _a;
78
- return ({
79
- label: x.label,
80
- value: isNumeric ? (_a = x.value) === null || _a === void 0 ? void 0 : _a.toString() : x.value,
81
- });
82
- }), value: (_d = value === null || value === void 0 ? void 0 : value.map((x) => (isNumeric ? x.toString() : x))) !== null && _d !== void 0 ? _d : [], onChange: (value) => {
83
- var _a;
84
- onChange === null || onChange === void 0 ? void 0 : onChange((_a = value === null || value === void 0 ? void 0 : value.map((x) => (isNumeric ? +x : x))) !== null && _a !== void 0 ? _a : []);
74
+ return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "multi-select", options: attribute.options.map((x) => ({
75
+ label: x.label,
76
+ value: isNumeric ? x.value?.toString() : x.value,
77
+ })), value: value?.map((x) => (isNumeric ? x.toString() : x)) ?? [], onChange: (value) => {
78
+ onChange?.(value?.map((x) => (isNumeric ? +x : x)) ?? []);
85
79
  } }));
86
80
  default:
87
81
  return null;
@@ -11,7 +11,7 @@ const ConditionValueControl_1 = require("./ConditionValueControl");
11
11
  const OperatorSelect_1 = require("./OperatorSelect");
12
12
  const utils_1 = require("./utils");
13
13
  const FilterForm = ({ defaultValue, attribute, onApply, onCancel, }) => {
14
- const [operator, setOperator] = (0, react_1.useState)((0, utils_1.getDefaultOperator)(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.operator, attribute.type));
14
+ const [operator, setOperator] = (0, react_1.useState)((0, utils_1.getDefaultOperator)(defaultValue?.operator, attribute.type));
15
15
  const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
16
16
  const { operatorStrings } = (0, AppStringContext_1.useAppStrings)();
17
17
  const operatorOptions = (0, react_1.useMemo)(() => {
@@ -20,7 +20,7 @@ const FilterForm = ({ defaultValue, attribute, onApply, onCancel, }) => {
20
20
  const selectedOption = (0, react_1.useMemo)(() => {
21
21
  return operatorOptions[attribute.type].find((option) => option.value === operator);
22
22
  }, [operator, attribute.type, operatorOptions]);
23
- const [values, setValues] = (0, react_1.useState)((0, utils_1.getDefaultValues)(selectedOption, defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.value, attribute.type));
23
+ const [values, setValues] = (0, react_1.useState)((0, utils_1.getDefaultValues)(selectedOption, defaultValue?.value, attribute.type));
24
24
  const handleChangeOperator = (operator) => {
25
25
  setOperator(operator);
26
26
  setValues([]);
@@ -42,13 +42,10 @@ const FilterForm = ({ defaultValue, attribute, onApply, onCancel, }) => {
42
42
  display: 'flex',
43
43
  flexDirection: 'column',
44
44
  gap: react_components_1.tokens.spacingVerticalS,
45
- }, children: [(0, jsx_runtime_1.jsx)(OperatorSelect_1.OperatorSelect, { attribute: attribute, onChange: (value) => handleChangeOperator(value), value: operator }), selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.controls.map((x, i) => {
46
- var _a;
47
- return ((0, jsx_runtime_1.jsx)(ConditionValueControl_1.ConditionValueControl, { type: x, attribute: attribute, value: (_a = values[i]) !== null && _a !== void 0 ? _a : null, onChange: (value) => {
48
- handleChangeValue(value, i);
49
- } }, x + String(i)));
50
- })] }) }), (0, jsx_runtime_1.jsxs)(react_components_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(react_components_1.DialogTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "secondary", onClick: onCancel, children: strings.cancel }) }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { type: "submit", appearance: "primary", disabled: !isValid, onClick: () => {
51
- onApply === null || onApply === void 0 ? void 0 : onApply({
45
+ }, children: [(0, jsx_runtime_1.jsx)(OperatorSelect_1.OperatorSelect, { attribute: attribute, onChange: (value) => handleChangeOperator(value), value: operator }), selectedOption?.controls.map((x, i) => ((0, jsx_runtime_1.jsx)(ConditionValueControl_1.ConditionValueControl, { type: x, attribute: attribute, value: values[i] ?? null, onChange: (value) => {
46
+ handleChangeValue(value, i);
47
+ } }, x + String(i))))] }) }), (0, jsx_runtime_1.jsxs)(react_components_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(react_components_1.DialogTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "secondary", onClick: onCancel, children: strings.cancel }) }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { type: "submit", appearance: "primary", disabled: !isValid, onClick: () => {
48
+ onApply?.({
52
49
  operator,
53
50
  value: values,
54
51
  });
@@ -24,5 +24,5 @@ function OperatorSelect({ attribute, value, onChange, }) {
24
24
  }
25
25
  return operators;
26
26
  }, [attribute.type, operatorOptions, dataService]);
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 }));
27
+ return ((0, jsx_runtime_1.jsx)(SelectControl_1.default, { options: options, onChange: (value) => onChange?.(value), value: value }));
28
28
  }
@@ -90,7 +90,7 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
90
90
  const onChangeFilterCondition = (condition) => {
91
91
  setColumnFilters(column.id, condition);
92
92
  };
93
- const sortMenuItems = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ArrowUp, { size: 16 }), onClick: () => onChangeSortDirection === null || onChangeSortDirection === void 0 ? void 0 : onChangeSortDirection('asc'), children: strings.sortByAscending }), (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ArrowDown, { size: 16 }), onClick: () => onChangeSortDirection === null || onChangeSortDirection === void 0 ? void 0 : onChangeSortDirection('desc'), children: strings.sortByDescending })] }));
93
+ const sortMenuItems = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ArrowUp, { size: 16 }), onClick: () => onChangeSortDirection?.('asc'), children: strings.sortByAscending }), (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ArrowDown, { size: 16 }), onClick: () => onChangeSortDirection?.('desc'), children: strings.sortByDescending })] }));
94
94
  const filterMenuItems = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Filter, { size: 16 }), onClick: () => setVisible(!visible), children: strings.filter }), !!filterCondition && ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.FilterDismiss, { size: 16 }), onClick: () => {
95
95
  onChangeFilterCondition(undefined);
96
96
  }, children: strings.clearFilter }))] }));
@@ -118,18 +118,18 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
118
118
  }, onDoubleClick: (event) => {
119
119
  event.stopPropagation();
120
120
  event.preventDefault();
121
- onResetSize === null || onResetSize === void 0 ? void 0 : onResetSize();
121
+ onResetSize?.();
122
122
  }, onMouseDown: (event) => {
123
123
  event.stopPropagation();
124
124
  event.preventDefault();
125
- resizeHandler === null || resizeHandler === void 0 ? void 0 : resizeHandler(event);
125
+ resizeHandler?.(event);
126
126
  }, onMouseUp: (event) => {
127
127
  event.stopPropagation();
128
128
  event.preventDefault();
129
129
  }, onTouchStart: (event) => {
130
130
  event.stopPropagation();
131
131
  event.preventDefault();
132
- resizeHandler === null || resizeHandler === void 0 ? void 0 : resizeHandler(event);
132
+ resizeHandler?.(event);
133
133
  }, children: (0, jsx_runtime_1.jsx)("div", { className: (0, react_components_1.mergeClasses)(styles.resizeHandleInner) }) })) : null, onMouseUp: (event) => {
134
134
  event.preventDefault();
135
135
  if (isResizingRef.current) {
@@ -11,7 +11,6 @@ const AppStringContext_1 = require("../App/AppStringContext");
11
11
  const PageEntityViewStringContext_1 = require("../PageEntityView/PageEntityViewStringContext");
12
12
  const CustomizeColumns_1 = require("./CustomizeColumns");
13
13
  const GridHeaderDesktop = (props) => {
14
- var _a, _b;
15
14
  const viewLookup = (0, hooks_1.useGridViewLookupData)();
16
15
  const selectedView = (0, hooks_1.useSelectedView)();
17
16
  const changeView = (0, hooks_1.useChangeView)();
@@ -34,9 +33,6 @@ const GridHeaderDesktop = (props) => {
34
33
  }, children: (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronDown, {}), iconPosition: "after", style: {
35
34
  fontSize: react_components_1.tokens.fontSizeBase400,
36
35
  fontWeight: react_components_1.tokens.fontWeightMedium,
37
- }, children: (_b = (_a = selectedView.localizedNames) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : selectedView.name }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: viewLookup.map((view) => {
38
- var _a, _b;
39
- return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => changeView(view.id), children: (_b = (_a = view.localizedNames) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : view.name }, view.id));
40
- }) }) })] }) }), (0, jsx_runtime_1.jsxs)("div", { style: { alignItems: 'center', display: 'flex', gap: 16 }, children: [props.headingRight, (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.EditColumns, { size: 24 }), onClick: () => setIsColumnCustomizationOpen(true), children: strings.editColumns }), (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), appearance: "filled-darker" })] })] }));
36
+ }, children: selectedView.localizedNames?.[language] ?? selectedView.name }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: viewLookup.map((view) => ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => changeView(view.id), children: view.localizedNames?.[language] ?? view.name }, view.id))) }) })] }) }), (0, jsx_runtime_1.jsxs)("div", { style: { alignItems: 'center', display: 'flex', gap: 16 }, children: [props.headingRight, (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.EditColumns, { size: 24 }), onClick: () => setIsColumnCustomizationOpen(true), children: strings.editColumns }), (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), appearance: "filled-darker" })] })] }));
41
37
  };
42
38
  exports.GridHeaderDesktop = GridHeaderDesktop;