@headless-adminapp/fluent 0.0.17-alpha.3 → 0.0.17-alpha.31
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.
- package/App/AppHeaderContianer.d.ts +5 -1
- package/App/AppHeaderContianer.js +15 -12
- package/App/AppLogo.js +14 -2
- package/App/AppUI.js +9 -1
- package/App/NavigationContainer.d.ts +10 -1
- package/App/NavigationContainer.js +7 -6
- package/App/QuickActionItem.js +1 -1
- package/CommandBar/Button.d.ts +2 -1
- package/CommandBar/Button.js +2 -2
- package/CommandBar/Divider.d.ts +2 -1
- package/CommandBar/Divider.js +2 -2
- package/CommandBar/IconButton.d.ts +2 -1
- package/CommandBar/IconButton.js +2 -2
- package/CommandBar/Label.d.ts +2 -1
- package/CommandBar/Label.js +2 -2
- package/CommandBar/MenuButton.d.ts +2 -1
- package/CommandBar/MenuButton.js +3 -3
- package/CommandBar/MenuItem.js +6 -5
- package/CommandBar/MenuItems.js +3 -3
- package/CommandBar/MenuList.js +4 -3
- package/CommandBar/Wrapper.d.ts +2 -2
- package/CommandBar/Wrapper.js +2 -2
- package/CommandBar/index.d.ts +6 -6
- package/DataGrid/ActionCell.d.ts +1 -1
- package/DataGrid/ActionCell.js +8 -4
- package/DataGrid/CustomizeColumns/AddColumns.js +4 -5
- package/DataGrid/CustomizeColumns/ColumnItem.js +3 -1
- package/DataGrid/GridColumnHeader/FilterForm.js +3 -1
- package/DataGrid/GridColumnHeader/OperatorSelect.js +9 -2
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +8 -8
- package/DataGrid/GridHeaderDesktop.js +0 -1
- package/DataGrid/GridTableContainer.js +22 -23
- package/DataGrid/TableCell/TableCellCheckbox.js +4 -3
- package/DataGrid/TableCell/TableCellLink.js +4 -3
- package/DataGrid/TableCell/TableCellText.js +9 -4
- package/DataGrid/useTableColumns.d.ts +4 -1
- package/DataGrid/useTableColumns.js +184 -167
- package/DialogContainer/PromptDialog.d.ts +3 -2
- package/DialogContainer/PromptDialog.js +10 -6
- package/PageEntityForm/CommandContainer.js +18 -6
- package/PageEntityForm/FormTabRelated.js +1 -2
- package/PageEntityForm/PageEntityFormDesktopContainer.js +6 -6
- package/PageEntityForm/RecordSetNavigatorContainer.js +4 -7
- package/PageEntityForm/RelatedViewSelector.js +4 -2
- package/PageEntityForm/SectionContainer.js +18 -4
- package/PageEntityForm/StandardControl.d.ts +2 -2
- package/PageEntityForm/StandardControl.js +75 -112
- package/PageEntityForm/SubgridControl.js +1 -1
- package/componentStore.d.ts +2 -0
- package/componentStore.js +5 -0
- package/components/PageLogin.js +0 -1
- package/form/FormControl.js +1 -1
- package/form/controls/AttachmentControl.d.ts +17 -0
- package/form/controls/AttachmentControl.js +225 -0
- package/form/controls/AttachmentsControl.d.ts +6 -0
- package/form/controls/AttachmentsControl.js +45 -0
- package/form/controls/CurrencyControl.js +38 -6
- package/form/controls/DateControl.d.ts +1 -1
- package/form/controls/DateControl.js +7 -3
- package/form/controls/DateTimeControl.d.ts +1 -1
- package/form/controls/DateTimeControl.js +1 -1
- package/form/controls/EmailControl.d.ts +1 -1
- package/form/controls/EmailControl.js +1 -1
- package/form/controls/LookupControl.js +2 -2
- package/form/controls/MultiSelectControl.d.ts +1 -1
- package/form/controls/MultiSelectControl.js +1 -1
- package/form/controls/MultiSelectLookupControl.js +1 -1
- package/form/controls/NumberControl.js +1 -0
- package/form/controls/PasswordControl.d.ts +1 -1
- package/form/controls/PasswordControl.js +1 -1
- package/form/controls/RichTextControl.d.ts +5 -0
- package/form/controls/RichTextControl.js +33 -0
- package/form/controls/SelectControl.d.ts +1 -1
- package/form/controls/SelectControl.js +1 -1
- package/form/controls/SwitchControl.d.ts +1 -1
- package/form/controls/SwitchControl.js +4 -2
- package/form/controls/TelephoneControl.d.ts +1 -1
- package/form/controls/TelephoneControl.js +1 -1
- package/form/controls/TextAreaControl.d.ts +1 -1
- package/form/controls/TextAreaControl.js +1 -1
- package/form/controls/utils.d.ts +4 -0
- package/form/controls/utils.js +42 -0
- package/form/layout/FormSection/FormSection.js +1 -1
- package/form/layout/FormSection/FormSectionColumn.js +1 -1
- package/form/layout/FormSection/FormSectionLoading.js +1 -1
- package/form/layout/FormTab/FormTab.js +1 -0
- package/package.json +24 -3
- package/styles.css +100 -0
- package/types/index.d.ts +12 -0
- package/App/AppProvider.d.ts +0 -9
- package/App/AppProvider.js +0 -50
- package/DataGrid/getAttributeFormattedValue.d.ts +0 -16
- package/DataGrid/getAttributeFormattedValue.js +0 -92
|
@@ -3,21 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AppHeaderContainer = 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_nav_preview_1 = require("@fluentui/react-nav-preview");
|
|
6
7
|
const app_1 = require("@headless-adminapp/app/app");
|
|
7
8
|
const hooks_1 = require("@headless-adminapp/app/auth/hooks");
|
|
9
|
+
const hooks_2 = require("@headless-adminapp/app/hooks");
|
|
8
10
|
const locale_1 = require("@headless-adminapp/app/locale");
|
|
9
11
|
const icons_1 = require("@headless-adminapp/icons");
|
|
10
12
|
const react_1 = require("react");
|
|
11
13
|
const AppLogo_1 = require("./AppLogo");
|
|
12
14
|
const AppStringContext_1 = require("./AppStringContext");
|
|
13
15
|
const QuickActionItem_1 = require("./QuickActionItem");
|
|
14
|
-
const AppHeaderContainer = () => {
|
|
16
|
+
const AppHeaderContainer = ({ onNavToggle, }) => {
|
|
15
17
|
var _a, _b;
|
|
16
18
|
const { app } = (0, app_1.useAppContext)();
|
|
17
19
|
const authSession = (0, hooks_1.useAuthSession)();
|
|
18
20
|
const logout = (0, hooks_1.useLogout)();
|
|
19
21
|
const strings = (0, AppStringContext_1.useAppStrings)();
|
|
20
22
|
const { language } = (0, locale_1.useLocale)();
|
|
23
|
+
const isMobile = (0, hooks_2.useIsMobile)();
|
|
21
24
|
const initials = (0, react_1.useMemo)(() => {
|
|
22
25
|
return authSession === null || authSession === void 0 ? void 0 : authSession.fullName.split(' ').map((item) => item[0]).slice(0, 2).join('');
|
|
23
26
|
}, [authSession === null || authSession === void 0 ? void 0 : authSession.fullName]);
|
|
@@ -27,17 +30,17 @@ const AppHeaderContainer = () => {
|
|
|
27
30
|
height: 50,
|
|
28
31
|
minHeight: 50,
|
|
29
32
|
background: react_components_1.tokens.colorBrandBackground,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
paddingInline: 8,
|
|
34
|
+
gap: 8,
|
|
35
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flex: 1, alignItems: 'center', gap: 8 }, children: [isMobile && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
36
|
+
cursor: 'pointer',
|
|
37
|
+
}, onClick: onNavToggle, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.Hamburger, { style: { color: 'white' } }) })), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
38
|
+
display: 'flex',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
cursor: 'pointer',
|
|
41
|
+
color: 'white',
|
|
42
|
+
}, children: [(0, jsx_runtime_1.jsx)(AppLogo_1.AppLogo, { logo: app.logo, title: app.title }), (0, jsx_runtime_1.jsx)(react_components_1.Subtitle2, { style: { paddingLeft: 4 }, children: app.title })] })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
39
43
|
paddingLeft: 8,
|
|
40
|
-
paddingRight: 8,
|
|
41
44
|
display: 'flex',
|
|
42
45
|
gap: 16,
|
|
43
46
|
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', gap: 8 }, children: (_a = app.quickActionItems) === null || _a === void 0 ? void 0 : _a.map((item, index) => {
|
|
@@ -61,7 +64,7 @@ const AppHeaderContainer = () => {
|
|
|
61
64
|
}, 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
65
|
var _a, _b;
|
|
63
66
|
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));
|
|
67
|
+
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
68
|
}), (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
69
|
};
|
|
67
70
|
exports.AppHeaderContainer = AppHeaderContainer;
|
package/App/AppLogo.js
CHANGED
|
@@ -7,10 +7,22 @@ const AppLogo = ({ logo, title }) => {
|
|
|
7
7
|
var _a;
|
|
8
8
|
if (logo.Icon) {
|
|
9
9
|
const Icon = (_a = logo.Icon) !== null && _a !== void 0 ? _a : icons_1.IconPlaceholder;
|
|
10
|
-
return (0, jsx_runtime_1.jsx)(
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
width: 32,
|
|
15
|
+
height: 32,
|
|
16
|
+
}, children: (0, jsx_runtime_1.jsx)(Icon, { size: 24 }) }));
|
|
11
17
|
}
|
|
12
18
|
if (logo.image) {
|
|
13
|
-
return ((0, jsx_runtime_1.jsx)("
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
20
|
+
display: 'flex',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
justifyContent: 'center',
|
|
23
|
+
width: 32,
|
|
24
|
+
height: 32,
|
|
25
|
+
}, children: (0, jsx_runtime_1.jsx)("img", { src: logo.image, alt: title, style: { width: 24, height: 24 } }) }));
|
|
14
26
|
}
|
|
15
27
|
return null;
|
|
16
28
|
};
|
package/App/AppUI.js
CHANGED
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AppUI = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const hooks_1 = require("@headless-adminapp/app/hooks");
|
|
6
|
+
const react_1 = require("react");
|
|
5
7
|
const AppHeaderContianer_1 = require("./AppHeaderContianer");
|
|
6
8
|
const NavigationContainer_1 = require("./NavigationContainer");
|
|
7
9
|
const AppUI = ({ children }) => {
|
|
8
|
-
|
|
10
|
+
const isMobile = (0, hooks_1.useIsMobile)();
|
|
11
|
+
const [isNavOpen, setIsNavOpen] = (0, react_1.useState)(!isMobile);
|
|
12
|
+
const navType = (0, react_1.useMemo)(() => (isMobile ? 'overlay' : 'inline'), [isMobile]);
|
|
13
|
+
(0, react_1.useEffect)(() => {
|
|
14
|
+
setIsNavOpen(!isMobile);
|
|
15
|
+
}, [isMobile]);
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)("main", { style: { display: 'flex', flexDirection: 'column', height: '100vh' }, children: [(0, jsx_runtime_1.jsx)(AppHeaderContianer_1.AppHeaderContainer, { onNavToggle: () => setIsNavOpen(!isNavOpen) }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flex: 1, overflow: 'hidden' }, children: [(0, jsx_runtime_1.jsx)(NavigationContainer_1.NavigationContainer, { open: isNavOpen, type: navType, onOpenChange: (open) => setIsNavOpen(open) }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
9
17
|
display: 'flex',
|
|
10
18
|
flexDirection: 'column',
|
|
11
19
|
flex: 1,
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { DrawerProps } from '@fluentui/react-components';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
type DrawerType = Required<DrawerProps>['type'];
|
|
4
|
+
interface NavigationContainerProps {
|
|
5
|
+
open: boolean;
|
|
6
|
+
type: DrawerType;
|
|
7
|
+
onOpenChange: (open: boolean) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const NavigationContainer: FC<NavigationContainerProps>;
|
|
10
|
+
export {};
|
|
@@ -31,28 +31,29 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
31
31
|
gridRowGap: react_components_1.tokens.spacingVerticalS,
|
|
32
32
|
},
|
|
33
33
|
});
|
|
34
|
-
const NavigationContainer = () => {
|
|
34
|
+
const NavigationContainer = ({ open, type, onOpenChange, }) => {
|
|
35
35
|
const styles = useStyles();
|
|
36
36
|
const { app, schemaMetadataDic } = (0, app_1.useAppContext)();
|
|
37
|
-
const [isOpen] = (0, react_1.useState)(true);
|
|
38
|
-
const [type] = (0, react_1.useState)('inline');
|
|
39
37
|
const router = (0, hooks_1.useRouter)();
|
|
40
38
|
const pathname = (0, hooks_1.usePathname)();
|
|
41
39
|
const selectedPath = pathname;
|
|
42
40
|
const { language } = (0, locale_1.useLocale)();
|
|
43
41
|
const isRouteActive = (0, hooks_1.useIsRouteActive)();
|
|
44
42
|
const routeResolver = (0, hooks_1.useRouteResolver)();
|
|
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:
|
|
46
|
-
var _a;
|
|
43
|
+
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) => {
|
|
44
|
+
var _a, _b;
|
|
47
45
|
const navItem = (0, utils_1.transformNavPageItem)({
|
|
48
46
|
item,
|
|
49
47
|
schemaMetadataDic: schemaMetadataDic,
|
|
50
48
|
language,
|
|
51
49
|
routeResolver,
|
|
52
50
|
});
|
|
53
|
-
const Icon = (_a = navItem.icon) !== null && _a !== void 0 ? _a : icons_1.IconPlaceholder;
|
|
51
|
+
const Icon = (_b = (_a = navItem.icon) !== null && _a !== void 0 ? _a : icons_1.Icons.Entity) !== null && _b !== void 0 ? _b : icons_1.IconPlaceholder;
|
|
54
52
|
const isActive = isRouteActive(selectedPath, item);
|
|
55
53
|
return ((0, jsx_runtime_1.jsx)(react_nav_preview_1.NavItem, { href: navItem.link, onClick: (event) => {
|
|
54
|
+
if (type === 'overlay') {
|
|
55
|
+
onOpenChange(false);
|
|
56
|
+
}
|
|
56
57
|
event.preventDefault();
|
|
57
58
|
router.push(navItem.link);
|
|
58
59
|
}, icon: (0, jsx_runtime_1.jsx)(Icon, { size: 20, filled: isActive, color: isActive
|
package/App/QuickActionItem.js
CHANGED
|
@@ -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
|
} }));
|
package/CommandBar/Button.d.ts
CHANGED
|
@@ -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>>;
|
package/CommandBar/Button.js
CHANGED
|
@@ -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';
|
package/CommandBar/Divider.d.ts
CHANGED
package/CommandBar/Divider.js
CHANGED
|
@@ -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>>;
|
package/CommandBar/IconButton.js
CHANGED
|
@@ -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';
|
package/CommandBar/Label.d.ts
CHANGED
|
@@ -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>>;
|
package/CommandBar/Label.js
CHANGED
|
@@ -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>>;
|
package/CommandBar/MenuButton.js
CHANGED
|
@@ -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';
|
package/CommandBar/MenuItem.js
CHANGED
|
@@ -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
|
-
|
|
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';
|
package/CommandBar/MenuItems.js
CHANGED
|
@@ -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
|
-
|
|
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';
|
package/CommandBar/MenuList.js
CHANGED
|
@@ -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
|
-
|
|
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';
|
package/CommandBar/Wrapper.d.ts
CHANGED
|
@@ -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>>>;
|
package/CommandBar/Wrapper.js
CHANGED
|
@@ -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';
|
package/CommandBar/index.d.ts
CHANGED
|
@@ -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;
|
package/DataGrid/ActionCell.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ interface ActionCellProps {
|
|
|
4
4
|
onOpen: () => void;
|
|
5
5
|
mutableState: MutableState<MenuItemCommandState[][]>;
|
|
6
6
|
}
|
|
7
|
-
export declare
|
|
7
|
+
export declare const ActionCell: import("react").NamedExoticComponent<ActionCellProps>;
|
|
8
8
|
export {};
|
package/DataGrid/ActionCell.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.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
|
-
|
|
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,
|
|
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,
|
|
40
|
+
label: (0, utils_1.localizedLabel)(language, attribute) +
|
|
41
41
|
' (' +
|
|
42
|
-
(0,
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
19
|
-
|
|
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 {
|
|
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,
|
|
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.
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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,
|