@headless-adminapp/fluent 1.4.12 → 1.4.13
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.js +105 -49
- package/App/QuickActionItem.d.ts +1 -0
- package/App/QuickActionItem.js +7 -3
- package/DataGrid/MobileHeaderRightContainer.d.ts +2 -0
- package/DataGrid/MobileHeaderRightContainer.js +11 -0
- package/Header/MobileHeaderCommandContainer.d.ts +7 -0
- package/Header/MobileHeaderCommandContainer.js +167 -0
- package/Header/MobileHeaderQuickActionButton.d.ts +10 -0
- package/Header/MobileHeaderQuickActionButton.js +36 -0
- package/PageEntityForm/CommandContainer.js +3 -3
- package/PageEntityForm/MobileHeaderRightContainer.d.ts +2 -0
- package/PageEntityForm/MobileHeaderRightContainer.js +11 -0
- package/PageEntityForm/MobileHeaderTitleContainer.d.ts +2 -0
- package/PageEntityForm/MobileHeaderTitleContainer.js +38 -0
- package/PageEntityForm/PageEntityForm.js +2 -0
- package/PageEntityForm/PageEntityFormDesktopContainer.js +89 -74
- package/PageEntityForm/TabContainer.d.ts +2 -0
- package/PageEntityForm/TabContainer.js +35 -0
- package/PageEntityView/PageEntityView.js +4 -1
- package/PageEntityView/PageEntityViewMobileContainer.js +1 -2
- package/PageEntityView/PageEntityViewMobileFrame.d.ts +0 -1
- package/PageEntityView/PageEntityViewMobileFrame.js +25 -23
- package/ToastNotificationContainer/index.js +7 -5
- package/components/DialogLogin.js +1 -1
- package/components/PageLogin.js +22 -2
- package/form/layout/FormBody/FormBody.js +16 -1
- package/package.json +2 -2
|
@@ -7,8 +7,10 @@ const react_nav_preview_1 = require("@fluentui/react-nav-preview");
|
|
|
7
7
|
const app_1 = require("@headless-adminapp/app/app");
|
|
8
8
|
const hooks_1 = require("@headless-adminapp/app/auth/hooks");
|
|
9
9
|
const useIsSkipAuthCheck_1 = require("@headless-adminapp/app/auth/hooks/useIsSkipAuthCheck");
|
|
10
|
+
const header_1 = require("@headless-adminapp/app/header");
|
|
10
11
|
const hooks_2 = require("@headless-adminapp/app/hooks");
|
|
11
12
|
const locale_1 = require("@headless-adminapp/app/locale");
|
|
13
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
12
14
|
const route_1 = require("@headless-adminapp/app/route");
|
|
13
15
|
const icons_1 = require("@headless-adminapp/icons");
|
|
14
16
|
const react_1 = require("react");
|
|
@@ -16,14 +18,48 @@ const AppLogo_1 = require("./AppLogo");
|
|
|
16
18
|
const AppStringContext_1 = require("./AppStringContext");
|
|
17
19
|
const QuickActionItem_1 = require("./QuickActionItem");
|
|
18
20
|
const AppHeaderContainer = ({ onNavToggle, }) => {
|
|
21
|
+
const isMobile = (0, hooks_2.useIsMobile)();
|
|
22
|
+
if (isMobile) {
|
|
23
|
+
return (0, jsx_runtime_1.jsx)(AppMobileHeader, { onNavToggle: onNavToggle });
|
|
24
|
+
}
|
|
25
|
+
return (0, jsx_runtime_1.jsx)(AppDesktopHeader, { onNavToggle: onNavToggle });
|
|
26
|
+
};
|
|
27
|
+
exports.AppHeaderContainer = AppHeaderContainer;
|
|
28
|
+
const NavHamburger = ({ onNavToggle }) => {
|
|
29
|
+
const isMobile = (0, hooks_2.useIsMobile)();
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(react_nav_preview_1.Hamburger, { style: {
|
|
31
|
+
color: 'inherit',
|
|
32
|
+
width: !isMobile ? 44 : undefined,
|
|
33
|
+
maxWidth: !isMobile ? 44 : undefined,
|
|
34
|
+
}, onClick: onNavToggle }));
|
|
35
|
+
};
|
|
36
|
+
const NavBackButton = () => {
|
|
37
|
+
const isMobile = (0, hooks_2.useIsMobile)();
|
|
38
|
+
const router = (0, route_1.useRouter)();
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(react_nav_preview_1.Hamburger, { style: {
|
|
40
|
+
color: 'inherit',
|
|
41
|
+
width: !isMobile ? 44 : undefined,
|
|
42
|
+
maxWidth: !isMobile ? 44 : undefined,
|
|
43
|
+
}, icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ArrowLeft, {}), onClick: () => {
|
|
44
|
+
router.back();
|
|
45
|
+
} }));
|
|
46
|
+
};
|
|
47
|
+
const NavTitle = () => {
|
|
48
|
+
const { appExperience: app } = (0, app_1.useAppContext)();
|
|
49
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
50
|
+
display: 'flex',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
cursor: 'pointer',
|
|
53
|
+
color: 'white',
|
|
54
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', paddingLeft: 4, paddingRight: 6 }, 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 })] }));
|
|
55
|
+
};
|
|
56
|
+
const NavActions = () => {
|
|
19
57
|
const { appExperience: app } = (0, app_1.useAppContext)();
|
|
20
58
|
const authSession = (0, hooks_1.useAuthSession)();
|
|
21
59
|
const isSkipAuthCheck = (0, useIsSkipAuthCheck_1.useIsSkipAuthCheck)();
|
|
22
60
|
const logout = (0, hooks_1.useLogout)();
|
|
23
61
|
const strings = (0, AppStringContext_1.useAppStrings)();
|
|
24
62
|
const { language } = (0, locale_1.useLocale)();
|
|
25
|
-
const isMobile = (0, hooks_2.useIsMobile)();
|
|
26
|
-
const isTablet = (0, hooks_2.useIsTablet)();
|
|
27
63
|
const initials = (0, react_1.useMemo)(() => {
|
|
28
64
|
return authSession?.fullName
|
|
29
65
|
.split(' ')
|
|
@@ -35,6 +71,60 @@ const AppHeaderContainer = ({ onNavToggle, }) => {
|
|
|
35
71
|
const accountMenuItems = (0, hooks_2.useItemsWithKey)(app.accountMenuItems);
|
|
36
72
|
const router = (0, route_1.useRouter)();
|
|
37
73
|
const basePath = (0, route_1.useBasePath)();
|
|
74
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
75
|
+
paddingLeft: 8,
|
|
76
|
+
display: 'flex',
|
|
77
|
+
gap: 16,
|
|
78
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', gap: 8 }, children: quickActionItems?.map((item) => {
|
|
79
|
+
if (item.type === 'custom') {
|
|
80
|
+
return (0, jsx_runtime_1.jsx)(item.Component, {}, item.__key);
|
|
81
|
+
}
|
|
82
|
+
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));
|
|
83
|
+
}) }), (!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: {
|
|
84
|
+
src: authSession?.profilePicture,
|
|
85
|
+
} }) }), (0, jsx_runtime_1.jsxs)(react_components_1.PopoverSurface, { tabIndex: -1, style: { padding: 0 }, children: [!isSkipAuthCheck && ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
86
|
+
display: 'flex',
|
|
87
|
+
gap: 8,
|
|
88
|
+
padding: 8,
|
|
89
|
+
overflow: 'hidden',
|
|
90
|
+
width: 200,
|
|
91
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Avatar, { initials: initials, color: "neutral", image: {
|
|
92
|
+
src: authSession?.profilePicture,
|
|
93
|
+
} }) }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
94
|
+
display: 'flex',
|
|
95
|
+
flexDirection: 'column',
|
|
96
|
+
overflow: 'hidden',
|
|
97
|
+
flex: 1,
|
|
98
|
+
}, 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) => {
|
|
99
|
+
const Icon = item.icon;
|
|
100
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, { size: "inherit" }), onClick: () => {
|
|
101
|
+
if (item.onClick) {
|
|
102
|
+
item.onClick();
|
|
103
|
+
}
|
|
104
|
+
else if (item.link) {
|
|
105
|
+
router.push(basePath + item.link);
|
|
106
|
+
}
|
|
107
|
+
}, children: item.localizedLabel?.[language] ?? item.label }, item.__key));
|
|
108
|
+
}), !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 }))] })] })] }))] }));
|
|
109
|
+
};
|
|
110
|
+
const AppDesktopHeader = ({ onNavToggle }) => {
|
|
111
|
+
const isTablet = (0, hooks_2.useIsTablet)();
|
|
112
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
113
|
+
display: 'flex',
|
|
114
|
+
alignItems: 'center',
|
|
115
|
+
height: 50,
|
|
116
|
+
minHeight: 50,
|
|
117
|
+
background: react_components_1.tokens.colorBrandBackground,
|
|
118
|
+
paddingInline: 8,
|
|
119
|
+
gap: 8,
|
|
120
|
+
color: 'white',
|
|
121
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flex: 1, alignItems: 'center', gap: 8 }, children: [isTablet && (0, jsx_runtime_1.jsx)(NavHamburger, { onNavToggle: onNavToggle }), (0, jsx_runtime_1.jsx)(NavTitle, {})] }), (0, jsx_runtime_1.jsx)(NavActions, {})] }));
|
|
122
|
+
};
|
|
123
|
+
const AppMobileHeader = ({ onNavToggle }) => {
|
|
124
|
+
const showCustomHeader = (0, mutable_1.useContextSelector)(header_1.HeaderContext, (state) => state.showBackButton.length > 0);
|
|
125
|
+
const headerTitle = (0, header_1.useHeaderValue)('title');
|
|
126
|
+
const rightComponent = (0, header_1.useHeaderValue)('rightComponent');
|
|
127
|
+
const showBackButton = (0, header_1.useHeaderValue)('showBackButton');
|
|
38
128
|
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
39
129
|
display: 'flex',
|
|
40
130
|
alignItems: 'center',
|
|
@@ -43,52 +133,18 @@ const AppHeaderContainer = ({ onNavToggle, }) => {
|
|
|
43
133
|
background: react_components_1.tokens.colorBrandBackground,
|
|
44
134
|
paddingInline: 8,
|
|
45
135
|
gap: 8,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
display: 'flex',
|
|
50
|
-
flexDirection: 'row',
|
|
51
|
-
justifyContent: 'center',
|
|
52
|
-
alignItems: 'center',
|
|
53
|
-
}, onClick: onNavToggle, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.Hamburger, { style: { color: 'white' } }) })), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
54
|
-
display: 'flex',
|
|
55
|
-
alignItems: 'center',
|
|
56
|
-
cursor: 'pointer',
|
|
57
|
-
color: 'white',
|
|
58
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', paddingLeft: 4, paddingRight: 6 }, 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: {
|
|
59
|
-
paddingLeft: 8,
|
|
136
|
+
color: 'white',
|
|
137
|
+
zIndex: 10,
|
|
138
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
60
139
|
display: 'flex',
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
gap: 8,
|
|
72
|
-
padding: 8,
|
|
73
|
-
overflow: 'hidden',
|
|
74
|
-
width: 200,
|
|
75
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Avatar, { initials: initials, color: "neutral", image: {
|
|
76
|
-
src: authSession?.profilePicture,
|
|
77
|
-
} }) }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
78
|
-
display: 'flex',
|
|
79
|
-
flexDirection: 'column',
|
|
80
|
-
overflow: 'hidden',
|
|
81
|
-
flex: 1,
|
|
82
|
-
}, 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) => {
|
|
83
|
-
const Icon = item.icon;
|
|
84
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, { size: "inherit" }), onClick: () => {
|
|
85
|
-
if (item.onClick) {
|
|
86
|
-
item.onClick();
|
|
87
|
-
}
|
|
88
|
-
else if (item.link) {
|
|
89
|
-
router.push(basePath + item.link);
|
|
90
|
-
}
|
|
91
|
-
}, children: item.localizedLabel?.[language] ?? item.label }, item.__key));
|
|
92
|
-
}), !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 }))] })] })] }))] })] }));
|
|
140
|
+
flex: 1,
|
|
141
|
+
alignItems: 'center',
|
|
142
|
+
gap: 8,
|
|
143
|
+
overflow: 'hidden',
|
|
144
|
+
}, children: [showBackButton ? ((0, jsx_runtime_1.jsx)(NavBackButton, {})) : ((0, jsx_runtime_1.jsx)(NavHamburger, { onNavToggle: onNavToggle })), showCustomHeader ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: typeof headerTitle === 'string' ? ((0, jsx_runtime_1.jsx)(react_components_1.Subtitle2, { style: {
|
|
145
|
+
textOverflow: 'ellipsis',
|
|
146
|
+
whiteSpace: 'nowrap',
|
|
147
|
+
overflow: 'hidden',
|
|
148
|
+
flex: 1,
|
|
149
|
+
}, children: headerTitle })) : (headerTitle) })) : ((0, jsx_runtime_1.jsx)(NavTitle, {}))] }), showCustomHeader ? rightComponent : (0, jsx_runtime_1.jsx)(NavActions, {})] }));
|
|
93
150
|
};
|
|
94
|
-
exports.AppHeaderContainer = AppHeaderContainer;
|
package/App/QuickActionItem.d.ts
CHANGED
package/App/QuickActionItem.js
CHANGED
|
@@ -23,12 +23,16 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
});
|
|
26
|
-
const QuickActionItem = ({ label, Icon, onClick, link, badgeCount, badgeColor = 'informative', }) => {
|
|
26
|
+
const QuickActionItem = ({ label, Icon, onClick, link, badgeCount, badgeColor = 'informative', type = 'icon', }) => {
|
|
27
27
|
const styles = useStyles();
|
|
28
28
|
const router = (0, route_1.useRouter)();
|
|
29
29
|
const basePath = (0, route_1.useBasePath)();
|
|
30
30
|
const fullLink = link ? `${basePath}${link}` : undefined;
|
|
31
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Icon, { size: "inherit" }), !!badgeCount && ((0, jsx_runtime_1.jsx)(react_components_1.Badge, { style: { position: 'absolute', top: 0, right: 0 }, color: badgeColor, size: "small", children: badgeCount }))] }), appearance: "transparent", style: {
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Icon, { size: "inherit" }), !!badgeCount && ((0, jsx_runtime_1.jsx)(react_components_1.Badge, { style: { position: 'absolute', top: 0, right: 0 }, color: badgeColor, size: "small", children: badgeCount }))] }), appearance: "transparent", style: {
|
|
32
|
+
position: 'relative',
|
|
33
|
+
fontWeight: react_components_1.tokens.fontWeightRegular,
|
|
34
|
+
minWidth: 'unset',
|
|
35
|
+
}, as: "a", href: fullLink, title: label, className: styles.root, onClick: (event) => {
|
|
32
36
|
event.preventDefault();
|
|
33
37
|
if (fullLink) {
|
|
34
38
|
router.push(fullLink);
|
|
@@ -36,6 +40,6 @@ const QuickActionItem = ({ label, Icon, onClick, link, badgeCount, badgeColor =
|
|
|
36
40
|
else if (onClick) {
|
|
37
41
|
onClick();
|
|
38
42
|
}
|
|
39
|
-
} }));
|
|
43
|
+
}, children: type === 'button' ? label : '' }));
|
|
40
44
|
};
|
|
41
45
|
exports.QuickActionItem = QuickActionItem;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileHeaderRightContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const datagrid_1 = require("@headless-adminapp/app/datagrid");
|
|
6
|
+
const MobileHeaderCommandContainer_1 = require("../Header/MobileHeaderCommandContainer");
|
|
7
|
+
const MobileHeaderRightContainer = () => {
|
|
8
|
+
const commands = (0, datagrid_1.useMainGridCommands)();
|
|
9
|
+
return (0, jsx_runtime_1.jsx)(MobileHeaderCommandContainer_1.MobileHeaderCommandContainer, { commands: commands });
|
|
10
|
+
};
|
|
11
|
+
exports.MobileHeaderRightContainer = MobileHeaderRightContainer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CommandItemState } from '@headless-adminapp/app/command';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
interface MobileHeaderCommandContainerProps {
|
|
4
|
+
commands: CommandItemState[][];
|
|
5
|
+
}
|
|
6
|
+
export declare const MobileHeaderCommandContainer: FC<MobileHeaderCommandContainerProps>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileHeaderCommandContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const MobileHeaderRightContent_1 = require("@headless-adminapp/app/header/components/MobileHeaderRightContent");
|
|
7
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const QuickActionItem_1 = require("../App/QuickActionItem");
|
|
10
|
+
const MobileHeaderQuickActionButton_1 = require("./MobileHeaderQuickActionButton");
|
|
11
|
+
const useStyles = (0, react_components_1.makeStyles)({
|
|
12
|
+
dangerMenuItem: {
|
|
13
|
+
color: react_components_1.tokens.colorStatusDangerForeground1,
|
|
14
|
+
'&:hover': {
|
|
15
|
+
backgroundColor: react_components_1.tokens.colorStatusDangerBackground3Hover,
|
|
16
|
+
},
|
|
17
|
+
'&:active': {
|
|
18
|
+
backgroundColor: react_components_1.tokens.colorStatusDangerBackground3Pressed,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
function isQuickAction(command) {
|
|
23
|
+
if (command.type === 'button') {
|
|
24
|
+
return command.isQuickAction ?? false;
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
const MobileHeaderCommandContainer = ({ commands }) => {
|
|
29
|
+
const [showMoreActions, setShowMoreActions] = (0, react_1.useState)(false);
|
|
30
|
+
const quickActions = (0, react_1.useMemo)(() => {
|
|
31
|
+
return commands.flat().filter((command) => isQuickAction(command));
|
|
32
|
+
}, [commands]);
|
|
33
|
+
const moreActions = (0, react_1.useMemo)(() => {
|
|
34
|
+
return commands
|
|
35
|
+
.map((group) => {
|
|
36
|
+
return group.filter((command) => {
|
|
37
|
+
if (isQuickAction(command)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (command.type === 'icon') {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
});
|
|
45
|
+
})
|
|
46
|
+
.filter((group) => group.length > 0);
|
|
47
|
+
}, [commands]);
|
|
48
|
+
return ((0, jsx_runtime_1.jsxs)(MobileHeaderRightContent_1.MobileHeaderRightContent, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
49
|
+
paddingLeft: 8,
|
|
50
|
+
display: 'flex',
|
|
51
|
+
gap: 16,
|
|
52
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', gap: 8 }, children: [quickActions.map((command, index) => {
|
|
53
|
+
if (command.hidden || command.type !== 'button') {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(MobileHeaderQuickActionButton_1.MobileHeaderQuickActionButton, { title: command.text, Icon: command.Icon, onClick: command.onClick }, index));
|
|
57
|
+
}), moreActions.length > 0 && ((0, jsx_runtime_1.jsx)(QuickActionItem_1.QuickActionItem, { Icon: icons_1.Icons.MoreVertical, label: "More Actions", onClick: () => setShowMoreActions(true) }))] }) }), (0, jsx_runtime_1.jsx)(BottomDrawerMenu, { open: showMoreActions, onClose: () => setShowMoreActions(false), actions: moreActions })] }));
|
|
58
|
+
};
|
|
59
|
+
exports.MobileHeaderCommandContainer = MobileHeaderCommandContainer;
|
|
60
|
+
const BottomDrawerMenu = ({ open, onClose, actions, }) => {
|
|
61
|
+
const [subMenuStack, setSubMenuStack] = (0, react_1.useState)([]);
|
|
62
|
+
(0, react_1.useEffect)(() => {
|
|
63
|
+
setSubMenuStack([]);
|
|
64
|
+
}, [open]);
|
|
65
|
+
const pushStack = (items) => {
|
|
66
|
+
setSubMenuStack((prev) => [items, ...prev]);
|
|
67
|
+
};
|
|
68
|
+
const popStack = () => {
|
|
69
|
+
setSubMenuStack((prev) => {
|
|
70
|
+
if (prev.length > 1) {
|
|
71
|
+
return prev.slice(1);
|
|
72
|
+
}
|
|
73
|
+
return [];
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Drawer, { separator: true, open: open, position: "bottom", size: "small", style: {
|
|
77
|
+
borderTopLeftRadius: react_components_1.tokens.borderRadiusXLarge,
|
|
78
|
+
borderTopRightRadius: react_components_1.tokens.borderRadiusXLarge,
|
|
79
|
+
height: 'unset',
|
|
80
|
+
}, onOpenChange: () => { }, children: (0, jsx_runtime_1.jsxs)(react_components_1.DrawerBody, { style: {
|
|
81
|
+
maxHeight: '70vh',
|
|
82
|
+
padding: 0,
|
|
83
|
+
overflowY: 'hidden',
|
|
84
|
+
display: 'flex',
|
|
85
|
+
flexDirection: 'column',
|
|
86
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
87
|
+
paddingInline: react_components_1.tokens.spacingHorizontalM,
|
|
88
|
+
paddingBlock: react_components_1.tokens.spacingVerticalS,
|
|
89
|
+
boxShadow: react_components_1.tokens.shadow2,
|
|
90
|
+
zIndex: 1,
|
|
91
|
+
display: 'flex',
|
|
92
|
+
justifyContent: 'space-between',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
}, children: [subMenuStack.length ? ((0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronLeft, { size: 20 }), appearance: "subtle", onClick: popStack })) : ((0, jsx_runtime_1.jsx)("div", {})), !subMenuStack.length && ((0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Close, { size: 20 }), appearance: "subtle", onClick: onClose }))] }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
95
|
+
overflowY: 'auto',
|
|
96
|
+
overflowX: 'hidden',
|
|
97
|
+
}, children: [!subMenuStack.length && ((0, jsx_runtime_1.jsx)(react_components_1.MenuList, { hasIcons: true, style: { gap: 0 }, children: actions.map((group, groupIndex) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [groupIndex > 0 && ((0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, { style: { opacity: 0.2, margin: '0px 5px' } })), group.map((item, index) => {
|
|
98
|
+
if (item.hidden) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
if (item.type === 'button') {
|
|
102
|
+
return ((0, jsx_runtime_1.jsx)(ButtonItem, { text: item.text, Icon: item.Icon, danger: item.danger, onClick: () => {
|
|
103
|
+
onClose();
|
|
104
|
+
item.onClick?.();
|
|
105
|
+
} }, `${groupIndex}-${index}`));
|
|
106
|
+
}
|
|
107
|
+
if (item.type === 'menu') {
|
|
108
|
+
return ((0, jsx_runtime_1.jsx)(NavigationMenu, { text: item.text, Icon: item.Icon, danger: item.danger, showDivider: item.items.length > 0 && !!item.onClick, showNavigateButton: item.items.length > 0, onNavigate: () => {
|
|
109
|
+
pushStack(item.items);
|
|
110
|
+
}, onClick: () => {
|
|
111
|
+
if (item.onClick) {
|
|
112
|
+
onClose();
|
|
113
|
+
item.onClick();
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
pushStack(item.items);
|
|
117
|
+
}
|
|
118
|
+
} }, `${groupIndex}-${index}`));
|
|
119
|
+
}
|
|
120
|
+
})] }, groupIndex))) })), subMenuStack.length > 0 && ((0, jsx_runtime_1.jsx)(react_components_1.MenuList, { hasIcons: true, style: { gap: 0 }, children: subMenuStack[0].map((group, groupIndex) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [groupIndex > 0 && ((0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, { style: { opacity: 0.2, margin: '0px 5px' } })), group.map((item, index) => {
|
|
121
|
+
if (item.hidden) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
return ((0, jsx_runtime_1.jsx)(NavigationMenu, { text: item.text, Icon: item.Icon, danger: item.danger, showDivider: !!item.items?.length && !!item.onClick, showNavigateButton: !!item.items?.length, onNavigate: () => {
|
|
125
|
+
if (!item.items?.length) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
pushStack(item.items);
|
|
129
|
+
}, onClick: () => {
|
|
130
|
+
if (item.onClick) {
|
|
131
|
+
onClose();
|
|
132
|
+
item.onClick();
|
|
133
|
+
}
|
|
134
|
+
else if (item.items?.length) {
|
|
135
|
+
pushStack(item.items);
|
|
136
|
+
}
|
|
137
|
+
} }, `${groupIndex}-${index}`));
|
|
138
|
+
})] }, groupIndex))) }))] })] }) }));
|
|
139
|
+
};
|
|
140
|
+
const NavigationMenu = ({ Icon, danger, text, onClick, onNavigate, showDivider, showNavigateButton, }) => {
|
|
141
|
+
const styles = useStyles();
|
|
142
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: Icon ? (0, jsx_runtime_1.jsx)(Icon, { size: 20 }) : (0, jsx_runtime_1.jsx)(icons_1.IconPlaceholder, { size: 20 }), className: (0, react_components_1.mergeClasses)(danger && styles.dangerMenuItem), style: {
|
|
143
|
+
maxWidth: 'unset',
|
|
144
|
+
minHeight: 48,
|
|
145
|
+
alignItems: 'center',
|
|
146
|
+
paddingInline: react_components_1.tokens.spacingHorizontalM,
|
|
147
|
+
}, onClick: () => {
|
|
148
|
+
onClick?.();
|
|
149
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
150
|
+
display: 'flex',
|
|
151
|
+
flexDirection: 'row',
|
|
152
|
+
alignItems: 'center',
|
|
153
|
+
gap: 8,
|
|
154
|
+
}, children: [(0, jsx_runtime_1.jsx)("span", { style: { flex: 1 }, children: text }), showNavigateButton && showDivider && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { vertical: true, style: { opacity: 0.5, height: '100%' } }) })), showNavigateButton && ((0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronRight, { size: 20 }), onClick: (e) => {
|
|
155
|
+
e.stopPropagation();
|
|
156
|
+
onNavigate?.();
|
|
157
|
+
}, appearance: "subtle" }))] }) }));
|
|
158
|
+
};
|
|
159
|
+
const ButtonItem = ({ Icon, danger, text, onClick }) => {
|
|
160
|
+
const styles = useStyles();
|
|
161
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: Icon ? (0, jsx_runtime_1.jsx)(Icon, { size: 20 }) : (0, jsx_runtime_1.jsx)(icons_1.IconPlaceholder, { size: 20 }), className: (0, react_components_1.mergeClasses)(danger && styles.dangerMenuItem), style: {
|
|
162
|
+
maxWidth: 'unset',
|
|
163
|
+
minHeight: 48,
|
|
164
|
+
alignItems: 'center',
|
|
165
|
+
paddingInline: react_components_1.tokens.spacingHorizontalM,
|
|
166
|
+
}, onClick: onClick, children: text }));
|
|
167
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Icon } from '@headless-adminapp/icons';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
interface MobileHeaderQuickActionButtonProps {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
title: string;
|
|
6
|
+
Icon: Icon;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const MobileHeaderQuickActionButton: FC<MobileHeaderQuickActionButtonProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileHeaderQuickActionButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const useStyles = (0, react_components_1.makeStyles)({
|
|
7
|
+
root: {
|
|
8
|
+
color: 'inherit !important',
|
|
9
|
+
background: 'rgba(0, 0, 0, 0)',
|
|
10
|
+
transition: 'background 0.3s',
|
|
11
|
+
'&:hover:enabled': {
|
|
12
|
+
color: 'rgba(255, 255, 255, 1)',
|
|
13
|
+
background: 'rgba(0, 0, 0, 0.1)',
|
|
14
|
+
},
|
|
15
|
+
'&:active:enabled': {
|
|
16
|
+
color: 'rgba(255, 255, 255, 1)',
|
|
17
|
+
background: 'rgba(0, 0, 0, 0.2)',
|
|
18
|
+
},
|
|
19
|
+
'&:focus:enabled': {
|
|
20
|
+
color: 'rgba(255, 255, 255, 1)',
|
|
21
|
+
background: 'rgba(0, 0, 0, 0.2)',
|
|
22
|
+
},
|
|
23
|
+
'&:disabled': {
|
|
24
|
+
color: `${react_components_1.tokens.colorNeutralForegroundDisabled} !important`,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
const MobileHeaderQuickActionButton = ({ disabled, title, Icon, onClick }) => {
|
|
29
|
+
const styles = useStyles();
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(Icon, { size: "inherit" }), disabled: disabled, appearance: "transparent", style: {
|
|
31
|
+
position: 'relative',
|
|
32
|
+
fontWeight: react_components_1.tokens.fontWeightRegular,
|
|
33
|
+
minWidth: 'unset',
|
|
34
|
+
}, className: styles.root, onClick: onClick, children: title }));
|
|
35
|
+
};
|
|
36
|
+
exports.MobileHeaderQuickActionButton = MobileHeaderQuickActionButton;
|
|
@@ -19,7 +19,7 @@ const CommandBar_1 = __importDefault(require("../CommandBar"));
|
|
|
19
19
|
const OverflowCommandBar_1 = require("../OverflowCommandBar");
|
|
20
20
|
const CommandContainer = ({ skeleton }) => {
|
|
21
21
|
const { language } = (0, locale_1.useLocale)();
|
|
22
|
-
const
|
|
22
|
+
const formCommands = (0, hooks_1.useMainFormCommands)();
|
|
23
23
|
const router = (0, hooks_4.useRouter)();
|
|
24
24
|
const isMobile = (0, hooks_2.useIsMobile)();
|
|
25
25
|
const schema = (0, hooks_1.useDataFormSchema)();
|
|
@@ -62,8 +62,8 @@ const CommandContainer = ({ skeleton }) => {
|
|
|
62
62
|
setRecordSetVisible,
|
|
63
63
|
]);
|
|
64
64
|
const extendedCommands = (0, react_1.useMemo)(() => {
|
|
65
|
-
return [...navigationCommands, ...
|
|
66
|
-
}, [
|
|
65
|
+
return [...navigationCommands, ...formCommands];
|
|
66
|
+
}, [formCommands, navigationCommands]);
|
|
67
67
|
if (skeleton) {
|
|
68
68
|
return ((0, jsx_runtime_1.jsxs)(CommandBar_1.default.Wrapper, { overflow: "hidden", children: [navigationCommands.map((group, groupIndex) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [groupIndex > 0 && (0, jsx_runtime_1.jsx)(CommandBar_1.default.Divider, {}), group.map((item, index) => {
|
|
69
69
|
const commandType = item.type;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileHeaderRightContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const dataform_1 = require("@headless-adminapp/app/dataform");
|
|
6
|
+
const MobileHeaderCommandContainer_1 = require("../Header/MobileHeaderCommandContainer");
|
|
7
|
+
const MobileHeaderRightContainer = () => {
|
|
8
|
+
const commands = (0, dataform_1.useMainFormCommands)();
|
|
9
|
+
return (0, jsx_runtime_1.jsx)(MobileHeaderCommandContainer_1.MobileHeaderCommandContainer, { commands: commands });
|
|
10
|
+
};
|
|
11
|
+
exports.MobileHeaderRightContainer = MobileHeaderRightContainer;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileHeaderTitleContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const dataform_1 = require("@headless-adminapp/app/dataform");
|
|
7
|
+
const useFormDataState_1 = require("@headless-adminapp/app/dataform/hooks/useFormDataState");
|
|
8
|
+
const MobileHeaderTitle_1 = require("@headless-adminapp/app/header/components/MobileHeaderTitle");
|
|
9
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
10
|
+
const utils_1 = require("@headless-adminapp/app/locale/utils");
|
|
11
|
+
const MobileHeaderTitleContainer = () => {
|
|
12
|
+
const [recordTitle] = (0, dataform_1.useRecordTitle)();
|
|
13
|
+
const { language } = (0, locale_1.useLocale)();
|
|
14
|
+
const schema = (0, dataform_1.useDataFormSchema)();
|
|
15
|
+
const dataState = (0, useFormDataState_1.useFormDataState)();
|
|
16
|
+
if (dataState.isFetching || dataState.isError) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(MobileHeaderTitle_1.MobileHeaderTitle, { order: 3, title: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'row',
|
|
22
|
+
flex: 1,
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
overflow: 'hidden',
|
|
28
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
29
|
+
display: 'flex',
|
|
30
|
+
gap: react_components_1.tokens.spacingHorizontalXS,
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Subtitle2, { style: {
|
|
33
|
+
textOverflow: 'ellipsis',
|
|
34
|
+
whiteSpace: 'nowrap',
|
|
35
|
+
overflow: 'hidden',
|
|
36
|
+
}, children: recordTitle }) }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { opacity: 0.8 }, children: (0, utils_1.localizedLabel)(language, schema) })] }) }) }));
|
|
37
|
+
};
|
|
38
|
+
exports.MobileHeaderTitleContainer = MobileHeaderTitleContainer;
|
|
@@ -4,6 +4,7 @@ exports.PageEntityForm = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
|
|
7
|
+
const hooks_2 = require("@headless-adminapp/app/header/hooks");
|
|
7
8
|
const historystate_1 = require("@headless-adminapp/app/historystate");
|
|
8
9
|
const PageEntityFormProvider_1 = require("@headless-adminapp/app/providers/PageEntityFormProvider");
|
|
9
10
|
const recordset_1 = require("@headless-adminapp/app/recordset");
|
|
@@ -14,6 +15,7 @@ const PageEntityFormDesktopContainer_1 = require("./PageEntityFormDesktopContain
|
|
|
14
15
|
const RecordSetNavigatorContainer_1 = require("./RecordSetNavigatorContainer");
|
|
15
16
|
const PageEntityForm = ({ logicalName, formId, recordId, }) => {
|
|
16
17
|
const result = (0, hooks_1.useLoadFormGridPage)(logicalName, formId);
|
|
18
|
+
(0, hooks_2.useMobileHeader)(true);
|
|
17
19
|
if (result.loading) {
|
|
18
20
|
return (0, jsx_runtime_1.jsx)(PageLoading_1.PageLoading, {});
|
|
19
21
|
}
|
|
@@ -3,9 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PageEntityFormDesktopContainer = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const ScrollView_1 = require("@headless-adminapp/app/components/ScrollView");
|
|
6
7
|
const dataform_1 = require("@headless-adminapp/app/dataform");
|
|
7
8
|
const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
|
|
8
9
|
const useFormDataState_1 = require("@headless-adminapp/app/dataform/hooks/useFormDataState");
|
|
10
|
+
const useMobileHeaderSetValue_1 = require("@headless-adminapp/app/header/hooks/useMobileHeaderSetValue");
|
|
11
|
+
const hooks_2 = require("@headless-adminapp/app/hooks");
|
|
9
12
|
const locale_1 = require("@headless-adminapp/app/locale");
|
|
10
13
|
const utils_1 = require("@headless-adminapp/app/locale/utils");
|
|
11
14
|
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
@@ -18,33 +21,27 @@ const FormTab_1 = require("../form/layout/FormTab");
|
|
|
18
21
|
const TextSkeleton_1 = require("../Skeleton/TextSkeleton");
|
|
19
22
|
const CommandContainer_1 = require("./CommandContainer");
|
|
20
23
|
const FormTabRelated_1 = require("./FormTabRelated");
|
|
24
|
+
const MobileHeaderRightContainer_1 = require("./MobileHeaderRightContainer");
|
|
25
|
+
const MobileHeaderTitleContainer_1 = require("./MobileHeaderTitleContainer");
|
|
21
26
|
const PageEntityFormStringContext_1 = require("./PageEntityFormStringContext");
|
|
22
27
|
const ProcessFlow_1 = require("./ProcessFlow");
|
|
23
28
|
const RecordAvatar_1 = require("./RecordAvatar");
|
|
24
|
-
const RelatedViewSelector_1 = require("./RelatedViewSelector");
|
|
25
29
|
const SectionContainer_1 = require("./SectionContainer");
|
|
30
|
+
const TabContainer_1 = require("./TabContainer");
|
|
26
31
|
const PageEntityFormDesktopContainer = () => {
|
|
32
|
+
const formHeaderDivRef = (0, react_1.useRef)(null);
|
|
27
33
|
const dataState = (0, useFormDataState_1.useFormDataState)();
|
|
34
|
+
const isMobile = (0, hooks_2.useIsMobile)();
|
|
28
35
|
const strings = (0, PageEntityFormStringContext_1.usePageEntityFormStrings)();
|
|
29
36
|
const locale = (0, locale_1.useLocale)();
|
|
30
37
|
const recordId = (0, hooks_1.useRecordId)();
|
|
31
38
|
const record = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.record);
|
|
32
|
-
const activeTab = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.activeTab);
|
|
33
39
|
const selectedRelatedItem = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.selectedRelatedItem);
|
|
34
40
|
const { language } = (0, locale_1.useLocale)();
|
|
35
41
|
const schema = (0, hooks_1.useDataFormSchema)();
|
|
42
|
+
(0, useMobileHeaderSetValue_1.useMobileHeaderSetValue)(schema.label, 2, 'title');
|
|
36
43
|
const formConfig = (0, hooks_1.useSelectedForm)();
|
|
37
44
|
const processFlowSteps = (0, hooks_1.useProcessFlowSteps)();
|
|
38
|
-
const setActiveTab = (0, mutable_1.useContextValueSetter)(dataform_1.DataFormContext, (setValue) => (value) => {
|
|
39
|
-
setValue(() => ({
|
|
40
|
-
activeTab: value,
|
|
41
|
-
}));
|
|
42
|
-
});
|
|
43
|
-
const setSelectedRelatedItem = (0, mutable_1.useContextValueSetter)(dataform_1.DataFormContext, (setValue) => (item) => {
|
|
44
|
-
setValue(() => ({
|
|
45
|
-
selectedRelatedItem: item,
|
|
46
|
-
}));
|
|
47
|
-
});
|
|
48
45
|
const [recordTitle] = (0, hooks_1.useRecordTitle)();
|
|
49
46
|
// const readonly = useIsFormReadonly();
|
|
50
47
|
const formInstance = (0, hooks_1.useFormInstance)();
|
|
@@ -56,72 +53,90 @@ const PageEntityFormDesktopContainer = () => {
|
|
|
56
53
|
if (recordId && !record && !dataState.isFetching) {
|
|
57
54
|
return ((0, jsx_runtime_1.jsx)(PageBroken_1.PageBroken, { title: "Record not found", message: "Requested record not found in system or you may not have enought permission." }));
|
|
58
55
|
}
|
|
59
|
-
return ((0, jsx_runtime_1.
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
60
57
|
display: 'flex',
|
|
61
58
|
flex: 1,
|
|
62
59
|
flexDirection: 'column',
|
|
63
60
|
// backgroundColor: tokens.colorNeutralBackground2,
|
|
64
61
|
overflow: 'hidden',
|
|
65
|
-
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
setActiveTab('related');
|
|
125
|
-
} })] })] })] }), (0, jsx_runtime_1.jsxs)(FormBody_1.FormBody, { children: [formConfig.experience.tabs.map((tab) => ((0, jsx_runtime_1.jsx)(FormTab_1.FormTab, { value: tab.name, columnCount: tab.columnCount, columnWidths: tab.columnWidths, children: tab.tabColumns.map((tabColumn, index) => ((0, jsx_runtime_1.jsx)(FormTab_1.FormTab.Column, { children: tabColumn.sections.map((section) => ((0, jsx_runtime_1.jsx)(SectionContainer_1.SectionContainer, { section: section, readOnly: false, skeleton: dataState.isFetching }, section.name))) }, index))) }, tab.name))), (0, jsx_runtime_1.jsx)(FormTabRelated_1.FormTabRelated, { selectedRelatedItem: selectedRelatedItem })] })] }));
|
|
62
|
+
}, children: (0, jsx_runtime_1.jsxs)(Wrapper, { formHeaderDivRef: formHeaderDivRef, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
63
|
+
display: 'flex',
|
|
64
|
+
flexDirection: 'column',
|
|
65
|
+
gap: react_components_1.tokens.spacingVerticalM,
|
|
66
|
+
paddingTop: react_components_1.tokens.spacingVerticalM,
|
|
67
|
+
paddingInline: react_components_1.tokens.spacingHorizontalM,
|
|
68
|
+
}, children: [!isMobile && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
69
|
+
// padding: 4,
|
|
70
|
+
boxShadow: react_components_1.tokens.shadow2,
|
|
71
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
72
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
73
|
+
display: 'flex',
|
|
74
|
+
// overflow: 'hidden',
|
|
75
|
+
}, children: (0, jsx_runtime_1.jsx)(CommandContainer_1.CommandContainer, { skeleton: dataState.isFetching }) })), notifications.length > 0 && ((0, jsx_runtime_1.jsx)("div", { children: notifications.map((notification, index) => ((0, jsx_runtime_1.jsx)(react_components_1.MessageBar, { intent: notification.level, icon: null, children: (0, jsx_runtime_1.jsx)(react_components_1.MessageBarBody, { children: notification.message }) }, index))) })), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
76
|
+
display: 'flex',
|
|
77
|
+
flexDirection: 'column',
|
|
78
|
+
boxShadow: react_components_1.tokens.shadow4,
|
|
79
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
80
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
81
|
+
overflow: 'hidden',
|
|
82
|
+
zIndex: 2,
|
|
83
|
+
}, ref: formHeaderDivRef, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
84
|
+
display: 'flex',
|
|
85
|
+
flexDirection: 'row',
|
|
86
|
+
paddingInline: react_components_1.tokens.spacingHorizontalM,
|
|
87
|
+
paddingTop: react_components_1.tokens.spacingVerticalS,
|
|
88
|
+
marginBottom: react_components_1.tokens.spacingVerticalS,
|
|
89
|
+
}, children: [!isMobile && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(RecordAvatar_1.RecordAvatar, {}), dataState.isFetching ? ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
90
|
+
display: 'flex',
|
|
91
|
+
flexDirection: 'column',
|
|
92
|
+
flex: 1,
|
|
93
|
+
}, children: [(0, jsx_runtime_1.jsx)(TextSkeleton_1.Subtitle2Skeleton, { width: 200 }), (0, jsx_runtime_1.jsx)(TextSkeleton_1.Body1Skeleton, { width: 80 })] })) : ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
94
|
+
display: 'flex',
|
|
95
|
+
flexDirection: 'column',
|
|
96
|
+
flex: 1,
|
|
97
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
98
|
+
display: 'flex',
|
|
99
|
+
gap: react_components_1.tokens.spacingHorizontalXS,
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Subtitle2, { children: recordTitle }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: isDirty
|
|
102
|
+
? `- ${strings.unsaved}`
|
|
103
|
+
: record
|
|
104
|
+
? `- ${strings.saved}`
|
|
105
|
+
: '' })] }), (0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { color: react_components_1.tokens.colorNeutralForeground3 }, children: (0, utils_1.localizedLabel)(language, schema) })] }))] })), (0, jsx_runtime_1.jsx)(MobileHeaderTitleContainer_1.MobileHeaderTitleContainer, {}), (0, jsx_runtime_1.jsx)(MobileHeaderRightContainer_1.MobileHeaderRightContainer, {}), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'row' }, children: formConfig.experience.headerControls?.map((controlName, index) => {
|
|
106
|
+
const attribute = schema.attributes[controlName];
|
|
107
|
+
if (!attribute) {
|
|
108
|
+
console.warn(`Attribute ${controlName} not found`);
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [index > 0 && ((0, jsx_runtime_1.jsx)(react_components_1.Divider, { vertical: true, style: {
|
|
112
|
+
width: react_components_1.tokens.spacingHorizontalXXL,
|
|
113
|
+
opacity: 0.5,
|
|
114
|
+
} })), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: attribute.label }), (0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: formInstance.control, name: controlName, render: ({ field }) => {
|
|
115
|
+
if (dataState.isFetching) {
|
|
116
|
+
return (0, jsx_runtime_1.jsx)(TextSkeleton_1.Body1Skeleton, { width: 100 });
|
|
117
|
+
}
|
|
118
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Body1, { children: (0, utils_2.getAttributeFormattedValue)(attribute, field.value, locale) }));
|
|
119
|
+
} })] })] }, controlName));
|
|
120
|
+
}) })] }), !!processFlowSteps?.length && ((0, jsx_runtime_1.jsx)(ProcessFlow_1.ProcessFlow, { height: 28, rounded: false, items: processFlowSteps, skeleton: dataState.isFetching })), (0, jsx_runtime_1.jsx)(TabContainer_1.TabContainer, {})] })] }), (0, jsx_runtime_1.jsxs)(FormBody_1.FormBody, { children: [formConfig.experience.tabs.map((tab) => ((0, jsx_runtime_1.jsx)(FormTab_1.FormTab, { value: tab.name, columnCount: tab.columnCount, columnWidths: tab.columnWidths, children: tab.tabColumns.map((tabColumn, index) => ((0, jsx_runtime_1.jsx)(FormTab_1.FormTab.Column, { children: tabColumn.sections.map((section) => ((0, jsx_runtime_1.jsx)(SectionContainer_1.SectionContainer, { section: section, readOnly: false, skeleton: dataState.isFetching }, section.name))) }, index))) }, tab.name))), (0, jsx_runtime_1.jsx)(FormTabRelated_1.FormTabRelated, { selectedRelatedItem: selectedRelatedItem })] })] }) }));
|
|
126
121
|
};
|
|
127
122
|
exports.PageEntityFormDesktopContainer = PageEntityFormDesktopContainer;
|
|
123
|
+
const Wrapper = ({ children, formHeaderDivRef, }) => {
|
|
124
|
+
const isMobile = (0, hooks_2.useIsMobile)();
|
|
125
|
+
const rect = (0, hooks_2.useElementSize)(formHeaderDivRef, isMobile ? 100 : 5000);
|
|
126
|
+
const headerHeight = 50;
|
|
127
|
+
const tabContainerHeight = 36;
|
|
128
|
+
const visible = !!rect && rect.bottom < headerHeight + tabContainerHeight;
|
|
129
|
+
if (isMobile) {
|
|
130
|
+
return ((0, jsx_runtime_1.jsxs)(ScrollView_1.ScrollView, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
131
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
132
|
+
position: 'fixed',
|
|
133
|
+
transition: 'all 0.2s',
|
|
134
|
+
top: visible ? headerHeight : -headerHeight,
|
|
135
|
+
left: 0,
|
|
136
|
+
right: 0,
|
|
137
|
+
zIndex: visible ? 3 : 0,
|
|
138
|
+
boxShadow: react_components_1.tokens.shadow4,
|
|
139
|
+
}, children: (0, jsx_runtime_1.jsx)(TabContainer_1.TabContainer, {}) }), children] }));
|
|
140
|
+
}
|
|
141
|
+
return children;
|
|
142
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TabContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const dataform_1 = require("@headless-adminapp/app/dataform");
|
|
7
|
+
const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
|
|
8
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
9
|
+
const utils_1 = require("@headless-adminapp/app/locale/utils");
|
|
10
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
11
|
+
const RelatedViewSelector_1 = require("./RelatedViewSelector");
|
|
12
|
+
const TabContainer = () => {
|
|
13
|
+
const formConfig = (0, hooks_1.useSelectedForm)();
|
|
14
|
+
const { language } = (0, locale_1.useLocale)();
|
|
15
|
+
const activeTab = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.activeTab);
|
|
16
|
+
const selectedRelatedItem = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.selectedRelatedItem);
|
|
17
|
+
const setActiveTab = (0, mutable_1.useContextValueSetter)(dataform_1.DataFormContext, (setValue) => (value) => {
|
|
18
|
+
setValue(() => ({
|
|
19
|
+
activeTab: value,
|
|
20
|
+
}));
|
|
21
|
+
});
|
|
22
|
+
const setSelectedRelatedItem = (0, mutable_1.useContextValueSetter)(dataform_1.DataFormContext, (setValue) => (item) => {
|
|
23
|
+
setValue(() => ({
|
|
24
|
+
selectedRelatedItem: item,
|
|
25
|
+
}));
|
|
26
|
+
});
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', paddingBottom: react_components_1.tokens.spacingVerticalS }, children: [(0, jsx_runtime_1.jsxs)(react_components_1.TabList, { selectedValue: activeTab, onTabSelect: (e, value) => {
|
|
28
|
+
setActiveTab(value.value);
|
|
29
|
+
}, children: [formConfig.experience.tabs.map((tab) => ((0, jsx_runtime_1.jsx)(react_components_1.Tab, { value: tab.name, children: (0, utils_1.localizedLabel)(language, tab) }, tab.name))), !!selectedRelatedItem && ((0, jsx_runtime_1.jsx)(react_components_1.Tab, { value: "related", children: selectedRelatedItem.localizedPluralLabels?.[language] ??
|
|
30
|
+
selectedRelatedItem.pluralLabel }))] }), (0, jsx_runtime_1.jsx)(RelatedViewSelector_1.RelatedViewSelector, { onSelect: (item) => {
|
|
31
|
+
setSelectedRelatedItem(item);
|
|
32
|
+
setActiveTab('related');
|
|
33
|
+
} })] }));
|
|
34
|
+
};
|
|
35
|
+
exports.TabContainer = TabContainer;
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PageEntityView = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const datagrid_1 = require("@headless-adminapp/app/datagrid");
|
|
6
|
+
const header_1 = require("@headless-adminapp/app/header");
|
|
7
|
+
const MobileHeaderTitle_1 = require("@headless-adminapp/app/header/components/MobileHeaderTitle");
|
|
6
8
|
const historystate_1 = require("@headless-adminapp/app/historystate");
|
|
7
9
|
const hooks_1 = require("@headless-adminapp/app/hooks");
|
|
8
10
|
const PageEntityViewProvider_1 = require("@headless-adminapp/app/providers/PageEntityViewProvider");
|
|
@@ -14,6 +16,7 @@ const PageEntityViewMobileContainer_1 = require("./PageEntityViewMobileContainer
|
|
|
14
16
|
const PageEntityView = ({ logicalName, viewId, onChangeView, useV2, }) => {
|
|
15
17
|
const result = (0, datagrid_1.useLoadMainGridPage)(logicalName, viewId);
|
|
16
18
|
const isMobile = (0, hooks_1.useIsMobile)();
|
|
19
|
+
(0, header_1.useMobileHeader)(false);
|
|
17
20
|
if (result.loading) {
|
|
18
21
|
return (0, jsx_runtime_1.jsx)(PageLoading_1.PageLoading, {});
|
|
19
22
|
}
|
|
@@ -31,6 +34,6 @@ const PageEntityView = ({ logicalName, viewId, onChangeView, useV2, }) => {
|
|
|
31
34
|
else {
|
|
32
35
|
content = (0, jsx_runtime_1.jsx)(PageEntityViewDesktopContainer_1.PageEntityViewDesktopContainerV2, {});
|
|
33
36
|
}
|
|
34
|
-
return ((0, jsx_runtime_1.jsx)(historystate_1.HistoryStateKeyProvider, { historyKey: 'page-entity-view.' + logicalName, children: (0, jsx_runtime_1.
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(historystate_1.HistoryStateKeyProvider, { historyKey: 'page-entity-view.' + logicalName, children: (0, jsx_runtime_1.jsxs)(PageEntityViewProvider_1.PageEntityViewProvider, { schema: schema, view: view, availableViews: viewLookup, commands: commands, onChangeView: onChangeView, children: [(0, jsx_runtime_1.jsx)(MobileHeaderTitle_1.MobileHeaderTitle, { title: schema.label, order: 2 }), content] }) }));
|
|
35
38
|
};
|
|
36
39
|
exports.PageEntityView = PageEntityView;
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PageEntityViewMobileContainer = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const CommandContainer_1 = require("../DataGrid/CommandContainer");
|
|
6
5
|
const GridHeaderMobile_1 = require("../DataGrid/GridHeaderMobile");
|
|
7
6
|
const GridListContainer_1 = require("../DataGrid/GridListContainer");
|
|
8
7
|
const PageEntityViewMobileFrame_1 = require("./PageEntityViewMobileFrame");
|
|
9
8
|
const PageEntityViewMobileContainer = () => {
|
|
10
|
-
return ((0, jsx_runtime_1.jsx)(PageEntityViewMobileFrame_1.PageEntityViewMobileFrame, {
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(PageEntityViewMobileFrame_1.PageEntityViewMobileFrame, { header: (0, jsx_runtime_1.jsx)(GridHeaderMobile_1.GridHeaderMobile, {}), content: (0, jsx_runtime_1.jsx)(GridListContainer_1.GridListContainer, {}) }));
|
|
11
10
|
};
|
|
12
11
|
exports.PageEntityViewMobileContainer = PageEntityViewMobileContainer;
|
|
@@ -3,36 +3,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PageEntityViewMobileFrame = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
const
|
|
7
|
-
|
|
6
|
+
const MobileHeaderRightContainer_1 = require("../DataGrid/MobileHeaderRightContainer");
|
|
7
|
+
const PageEntityViewMobileFrame = ({ header, content, }) => {
|
|
8
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
8
9
|
display: 'flex',
|
|
9
10
|
flex: 1,
|
|
10
11
|
flexDirection: 'column',
|
|
11
12
|
background: react_components_1.tokens.colorNeutralBackground1,
|
|
12
13
|
overflow: 'hidden',
|
|
13
|
-
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
display: 'flex',
|
|
22
|
-
minHeight: 40,
|
|
23
|
-
flexDirection: 'column',
|
|
24
|
-
gap: 4,
|
|
25
|
-
paddingBottom: 8,
|
|
26
|
-
}, children: [commandBar, header] }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
27
|
-
flex: 1,
|
|
28
|
-
display: 'flex',
|
|
29
|
-
flexDirection: 'column',
|
|
30
|
-
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
31
|
-
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
32
|
-
gap: 8,
|
|
14
|
+
}, children: [(0, jsx_runtime_1.jsx)(MobileHeaderRightContainer_1.MobileHeaderRightContainer, {}), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
15
|
+
gap: 4,
|
|
16
|
+
flex: 1,
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flexDirection: 'column',
|
|
19
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
20
|
+
boxShadow: react_components_1.tokens.shadow2,
|
|
21
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
33
22
|
display: 'flex',
|
|
23
|
+
minHeight: 40,
|
|
34
24
|
flexDirection: 'column',
|
|
25
|
+
gap: 4,
|
|
26
|
+
paddingTop: 8,
|
|
27
|
+
paddingBottom: 8,
|
|
28
|
+
}, children: header }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
35
29
|
flex: 1,
|
|
36
|
-
|
|
30
|
+
display: 'flex',
|
|
31
|
+
flexDirection: 'column',
|
|
32
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
33
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
34
|
+
gap: 8,
|
|
35
|
+
display: 'flex',
|
|
36
|
+
flexDirection: 'column',
|
|
37
|
+
flex: 1,
|
|
38
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, display: 'flex' }, children: content }) }) })] })] }));
|
|
37
39
|
};
|
|
38
40
|
exports.PageEntityViewMobileFrame = PageEntityViewMobileFrame;
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ToastNotificationContainer = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
const hooks_1 = require("@headless-adminapp/app/
|
|
6
|
+
const hooks_1 = require("@headless-adminapp/app/hooks");
|
|
7
|
+
const hooks_2 = require("@headless-adminapp/app/toast-notification/hooks");
|
|
7
8
|
const react_1 = require("react");
|
|
8
9
|
const ToastNotificationContainer = () => {
|
|
9
|
-
const items = (0,
|
|
10
|
+
const items = (0, hooks_2.useToastNotificationItems)();
|
|
10
11
|
const toasterId = (0, react_components_1.useId)('toaster');
|
|
11
12
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Toaster, { toasterId: toasterId }), items.map((item) => {
|
|
12
13
|
return (0, jsx_runtime_1.jsx)(Item, { item: item, toasterId: toasterId }, item.id);
|
|
@@ -15,8 +16,9 @@ const ToastNotificationContainer = () => {
|
|
|
15
16
|
exports.ToastNotificationContainer = ToastNotificationContainer;
|
|
16
17
|
const Item = ({ item, toasterId, }) => {
|
|
17
18
|
const { dispatchToast, dismissToast } = (0, react_components_1.useToastController)(toasterId);
|
|
18
|
-
const closeToastNotification = (0,
|
|
19
|
+
const closeToastNotification = (0, hooks_2.useCloseToastNotification)();
|
|
19
20
|
const opened = (0, react_1.useRef)(false);
|
|
21
|
+
const isMobile = (0, hooks_1.useIsMobile)();
|
|
20
22
|
(0, react_1.useEffect)(() => {
|
|
21
23
|
if (!item.isOpen) {
|
|
22
24
|
dismissToast(item.id);
|
|
@@ -31,13 +33,13 @@ const Item = ({ item, toasterId, }) => {
|
|
|
31
33
|
intent: item.type,
|
|
32
34
|
pauseOnHover: true,
|
|
33
35
|
pauseOnWindowBlur: true,
|
|
34
|
-
position: 'top-end',
|
|
36
|
+
position: isMobile ? 'bottom' : 'top-end',
|
|
35
37
|
onStatusChange: (event, data) => {
|
|
36
38
|
if (data.status === 'dismissed') {
|
|
37
39
|
closeToastNotification(item.id);
|
|
38
40
|
}
|
|
39
41
|
},
|
|
40
42
|
});
|
|
41
|
-
}, [dispatchToast, closeToastNotification, item, dismissToast]);
|
|
43
|
+
}, [dispatchToast, closeToastNotification, item, dismissToast, isMobile]);
|
|
42
44
|
return null;
|
|
43
45
|
};
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DialogLogin = DialogLogin;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
const LoginForm_1 = require("./LoginForm");
|
|
7
6
|
const hooks_1 = require("@headless-adminapp/app/hooks");
|
|
7
|
+
const LoginForm_1 = require("./LoginForm");
|
|
8
8
|
function DialogLogin(props) {
|
|
9
9
|
const isMobile = (0, hooks_1.useIsMobile)();
|
|
10
10
|
if (isMobile) {
|
package/components/PageLogin.js
CHANGED
|
@@ -3,11 +3,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PageLogin = PageLogin;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const hooks_1 = require("@headless-adminapp/app/hooks");
|
|
6
7
|
const LoginForm_1 = require("./LoginForm");
|
|
7
8
|
function PageLogin(props) {
|
|
9
|
+
const isMobile = (0, hooks_1.useIsMobile)();
|
|
10
|
+
if (isMobile) {
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
12
|
+
position: 'fixed',
|
|
13
|
+
inset: 0,
|
|
14
|
+
display: 'flex',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
background: react_components_1.tokens.colorNeutralBackground2,
|
|
18
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
19
|
+
position: 'fixed',
|
|
20
|
+
inset: 0,
|
|
21
|
+
padding: 24,
|
|
22
|
+
maxWidth: 360,
|
|
23
|
+
maxHeight: '100vh',
|
|
24
|
+
height: 'fit-content',
|
|
25
|
+
margin: 'auto',
|
|
26
|
+
}, children: (0, jsx_runtime_1.jsx)(LoginForm_1.LoginForm, { onLogin: props.onLogin, logoImageUrl: props.logoImageUrl, afterLoginContent: props.afterLoginContent, beforeLoginContent: props.beforeLoginContent, subtitle: props.subtitle }) }) }));
|
|
27
|
+
}
|
|
8
28
|
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
9
|
-
|
|
10
|
-
|
|
29
|
+
position: 'fixed',
|
|
30
|
+
inset: 0,
|
|
11
31
|
display: 'flex',
|
|
12
32
|
alignItems: 'center',
|
|
13
33
|
justifyContent: 'center',
|
|
@@ -2,10 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FormBody = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
5
6
|
const ScrollView_1 = require("@headless-adminapp/app/components/ScrollView");
|
|
7
|
+
const hooks_1 = require("@headless-adminapp/app/hooks");
|
|
6
8
|
const locale_1 = require("@headless-adminapp/app/locale");
|
|
7
9
|
const FormBody = ({ children }) => {
|
|
8
10
|
const { direction } = (0, locale_1.useLocale)();
|
|
9
|
-
|
|
11
|
+
const isMobile = (0, hooks_1.useIsMobile)();
|
|
12
|
+
if (isMobile) {
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
14
|
+
display: 'flex',
|
|
15
|
+
flexDirection: 'column',
|
|
16
|
+
flex: 1,
|
|
17
|
+
padding: react_components_1.tokens.spacingVerticalM,
|
|
18
|
+
}, children: children }));
|
|
19
|
+
}
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column', flex: 1 }, children: (0, jsx_runtime_1.jsx)(ScrollView_1.ScrollView, { autoHide: true, className: "FormBody_scrollview", rtl: direction === 'rtl', children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
21
|
+
display: 'flex',
|
|
22
|
+
flexDirection: 'column',
|
|
23
|
+
padding: react_components_1.tokens.spacingVerticalM,
|
|
24
|
+
}, children: children }) }) }));
|
|
10
25
|
};
|
|
11
26
|
exports.FormBody = FormBody;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/fluent",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"uuid": "11.0.3",
|
|
53
53
|
"yup": "^1.4.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "70b319f4b807a300e6b01c8d7e8c1768839f9541"
|
|
56
56
|
}
|