@headless-adminapp/fluent 0.0.17-alpha.52 → 0.0.17-alpha.53
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/App.js +7 -11
- package/App/AppHeaderContianer.js +38 -42
- package/App/AppLogo.js +8 -12
- package/App/AppStringContext.js +9 -13
- package/App/AppUI.js +11 -15
- package/App/LayoutProvider.js +11 -15
- package/App/NavigationContainer.js +25 -29
- package/App/QuickActionItem.js +5 -9
- package/App/index.js +1 -5
- package/App/utils.js +1 -4
- package/CommandBar/Button.js +14 -17
- package/CommandBar/Divider.js +6 -9
- package/CommandBar/IconButton.js +13 -16
- package/CommandBar/Label.js +8 -11
- package/CommandBar/MenuButton.js +17 -20
- package/CommandBar/MenuItem.js +15 -18
- package/CommandBar/MenuItems.js +8 -11
- package/CommandBar/MenuList.js +9 -12
- package/CommandBar/Wrapper.js +7 -10
- package/CommandBar/index.js +13 -15
- package/DataForm/SectionControl.js +4 -7
- package/DataGrid/ActionCell.js +11 -14
- package/DataGrid/CommandContainer.js +6 -10
- package/DataGrid/CustomizeColumns/AddColumns.js +34 -37
- package/DataGrid/CustomizeColumns/ColumnItem.js +19 -23
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +36 -42
- package/DataGrid/CustomizeColumns/index.js +1 -5
- package/DataGrid/FormSubgridCommandContainer.js +13 -17
- package/DataGrid/FormSubgridViewSelector.js +18 -22
- package/DataGrid/GridColumnHeader/ConditionValueControl.js +14 -20
- package/DataGrid/GridColumnHeader/FilterForm.js +23 -27
- package/DataGrid/GridColumnHeader/OperatorSelect.js +13 -19
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +28 -32
- package/DataGrid/GridColumnHeader/index.js +1 -5
- package/DataGrid/GridColumnHeader/utils.js +2 -6
- package/DataGrid/GridHeaderContainer.js +4 -8
- package/DataGrid/GridHeaderDesktop.js +26 -30
- package/DataGrid/GridHeaderMobile.js +17 -21
- package/DataGrid/GridListContainer.js +39 -43
- package/DataGrid/GridPaginationContainer.js +12 -16
- package/DataGrid/GridTableContainer.js +74 -78
- package/DataGrid/TableCell/TableCellAction.js +11 -15
- package/DataGrid/TableCell/TableCellBase.js +4 -8
- package/DataGrid/TableCell/TableCellCheckbox.js +7 -10
- package/DataGrid/TableCell/TableCellChoice.js +11 -14
- package/DataGrid/TableCell/TableCellLink.d.ts +1 -1
- package/DataGrid/TableCell/TableCellLink.js +13 -12
- package/DataGrid/TableCell/TableCellText.js +7 -10
- package/DataGrid/TableCell/index.js +4 -20
- package/DataGrid/index.js +4 -11
- package/DataGrid/types.js +1 -2
- package/DataGrid/useTableColumns.js +139 -90
- package/DataGrid/utils.js +1 -5
- package/DialogContainer/AlertDialog.js +5 -8
- package/DialogContainer/ConfirmDialog.js +6 -9
- package/DialogContainer/DialogContainer.js +14 -18
- package/DialogContainer/ErrorDialog.js +9 -12
- package/DialogContainer/PromptDialog.js +30 -57
- package/DialogContainer/index.js +1 -5
- package/Insights/CommandBarContainer.js +11 -14
- package/Insights/FilterBarContainer.js +17 -20
- package/Insights/Grid.js +9 -13
- package/Insights/InsightsContainer.js +19 -22
- package/Insights/WidgetChartContainer.js +30 -34
- package/Insights/WidgetDataGridContainer.js +32 -35
- package/Insights/WidgetTableContainer.js +24 -28
- package/Insights/WidgetTileContainer.js +12 -16
- package/Insights/WidgetTitleBar.js +9 -15
- package/Insights/Widgets.js +25 -28
- package/Insights/charts/AreaChart.js +12 -15
- package/Insights/charts/BarChart.js +12 -15
- package/Insights/charts/ComposedChart.js +12 -15
- package/Insights/charts/CustomTooltipContent.js +8 -12
- package/Insights/charts/GaugeChart.js +3 -6
- package/Insights/charts/LineChart.js +12 -15
- package/Insights/charts/OhlcChart.js +36 -41
- package/Insights/charts/PieChart.js +23 -26
- package/Insights/charts/RadarChart.js +16 -19
- package/Insights/charts/ScatterChart.js +23 -26
- package/Insights/charts/constants.js +1 -4
- package/Insights/charts/formatters.js +17 -29
- package/Insights/charts/index.js +1 -2
- package/Insights/charts/renderers.js +25 -36
- package/Insights/hooks/useQueriesData.js +19 -25
- package/Insights/hooks/useWidgetDetail.js +13 -16
- package/OverflowCommandBar/OverflowCommandBar.js +12 -19
- package/OverflowCommandBar/OverflowMenu.js +16 -20
- package/OverflowCommandBar/OverflowMenuDivider.js +6 -10
- package/OverflowCommandBar/index.js +3 -9
- package/OverflowCommandBar/render.js +9 -15
- package/OverflowCommandBar/utils.js +1 -4
- package/PageBoard/BoardColumn.js +5 -8
- package/PageBoard/BoardColumnCard.js +12 -15
- package/PageBoard/BoardColumnUI.js +34 -38
- package/PageBoard/BoardingColumnCardLoading.js +10 -13
- package/PageBoard/Header.js +16 -20
- package/PageBoard/PageBoard.d.ts +1 -1
- package/PageBoard/PageBoard.js +26 -29
- package/PageBoard/index.js +1 -5
- package/PageEntityForm/CommandContainer.js +21 -25
- package/PageEntityForm/FormTabRelated.js +17 -20
- package/PageEntityForm/PageEntityForm.js +16 -20
- package/PageEntityForm/PageEntityFormDesktopContainer.js +68 -72
- package/PageEntityForm/PageEntityFormStringContext.js +5 -9
- package/PageEntityForm/ProcessFlow.js +21 -24
- package/PageEntityForm/RecordCard.js +21 -24
- package/PageEntityForm/RecordCardLoading.js +10 -13
- package/PageEntityForm/RecordSetNavigatorContainer.js +30 -34
- package/PageEntityForm/RelatedViewSelector.js +28 -31
- package/PageEntityForm/SectionContainer.js +25 -28
- package/PageEntityForm/StandardControl.d.ts +3 -3
- package/PageEntityForm/StandardControl.js +74 -81
- package/PageEntityForm/SubgridControl.js +20 -23
- package/PageEntityForm/index.js +1 -5
- package/PageEntityView/FormSubgridContainer.js +22 -26
- package/PageEntityView/PageEntityView.js +15 -19
- package/PageEntityView/PageEntityViewDesktopContainer.js +9 -13
- package/PageEntityView/PageEntityViewDesktopFrame.js +17 -21
- package/PageEntityView/PageEntityViewMobileContainer.js +9 -13
- package/PageEntityView/PageEntityViewStringContext.js +5 -9
- package/PageEntityView/index.js +1 -5
- package/PageInsights/PageInsights.js +9 -13
- package/PageInsights/index.js +1 -6
- package/ProgressIndicatorContainer/index.js +10 -14
- package/ToastNotificationContainer/index.js +14 -18
- package/componentStore.js +2 -5
- package/components/BodyLoading.js +7 -11
- package/components/DialogLogin.js +5 -8
- package/components/LoginForm.js +21 -47
- package/components/PageBroken.js +5 -8
- package/components/PageLoading.js +5 -8
- package/components/PageLogin.js +14 -17
- package/form/FormControl.js +39 -44
- package/form/FormControlLoading.js +4 -8
- package/form/controls/AttachmentControl.js +56 -60
- package/form/controls/AttachmentsControl.js +15 -19
- package/form/controls/CurrencyControl.js +10 -13
- package/form/controls/DateControl.js +18 -24
- package/form/controls/DateRangeControl.js +14 -20
- package/form/controls/DateTimeControl.js +39 -45
- package/form/controls/DecimalControl.js +8 -11
- package/form/controls/DurationControl.js +11 -15
- package/form/controls/EmailControl.js +7 -10
- package/form/controls/IntegerControl.js +4 -7
- package/form/controls/LookupControl.d.ts +1 -0
- package/form/controls/LookupControl.js +75 -38
- package/form/controls/MultiSelectControl.js +8 -11
- package/form/controls/MultiSelectLookupControl.js +40 -43
- package/form/controls/PasswordControl.js +8 -11
- package/form/controls/RichTextControl.js +5 -32
- package/form/controls/SelectControl.js +8 -11
- package/form/controls/SwitchControl.js +4 -7
- package/form/controls/TelephoneControl.js +7 -10
- package/form/controls/TextAreaControl.js +4 -7
- package/form/controls/TextControl.js +5 -8
- package/form/controls/UrlControl.js +7 -10
- package/form/controls/types.js +1 -2
- package/form/controls/useLookupData.js +14 -18
- package/form/layout/FormBody/FormBody.js +6 -10
- package/form/layout/FormBody/index.js +1 -17
- package/form/layout/FormSection/FormSection.js +18 -22
- package/form/layout/FormSection/FormSectionColumn.js +3 -7
- package/form/layout/FormSection/FormSectionLoading.js +1 -5
- package/form/layout/FormSection/index.js +1 -5
- package/form/layout/FormTab/FormTab.js +16 -20
- package/form/layout/FormTab/FormTabColumn.js +5 -9
- package/form/layout/FormTab/index.js +1 -5
- package/form/layout/TabContext.js +2 -5
- package/form/layout/index.js +3 -9
- package/form/types.js +1 -2
- package/package.json +3 -2
- package/types/index.js +1 -2
- package/utils/avatar.d.ts +2 -0
- package/utils/avatar.js +42 -0
package/App/App.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const AppUI_1 = require("./AppUI");
|
|
9
|
-
const App = ({ appId, children }) => {
|
|
10
|
-
return ((0, jsx_runtime_1.jsx)(app_1.AppProvider, { appId: appId, loadingComponent: (0, jsx_runtime_1.jsx)(BodyLoading_1.BodyLoading, { loading: true }), notFoundComponent: (0, jsx_runtime_1.jsx)(PageBroken_1.PageBroken, { title: "App not found" }), children: (0, jsx_runtime_1.jsx)(AppUI_1.AppUI, { children: children }) }));
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AppProvider } from '@headless-adminapp/app/app';
|
|
3
|
+
import { BodyLoading } from '../components/BodyLoading';
|
|
4
|
+
import { PageBroken } from '../components/PageBroken';
|
|
5
|
+
import { AppUI } from './AppUI';
|
|
6
|
+
export const App = ({ appId, children }) => {
|
|
7
|
+
return (_jsx(AppProvider, { appId: appId, loadingComponent: _jsx(BodyLoading, { loading: true }), notFoundComponent: _jsx(PageBroken, { title: "App not found" }), children: _jsx(AppUI, { children: children }) }));
|
|
11
8
|
};
|
|
12
|
-
exports.App = App;
|
|
@@ -1,73 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const { language } = (0, locale_1.useLocale)();
|
|
24
|
-
const isMobile = (0, hooks_2.useIsMobile)();
|
|
25
|
-
const initials = (0, react_1.useMemo)(() => {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar, Caption1, Caption1Strong, MenuDivider, MenuItem, MenuList, Popover, PopoverSurface, PopoverTrigger, Subtitle2, tokens, } from '@fluentui/react-components';
|
|
3
|
+
import { Hamburger } from '@fluentui/react-nav-preview';
|
|
4
|
+
import { useAppContext } from '@headless-adminapp/app/app';
|
|
5
|
+
import { useAuthSession, useLogout } from '@headless-adminapp/app/auth/hooks';
|
|
6
|
+
import { useIsSkipAuthCheck } from '@headless-adminapp/app/auth/hooks/useIsSkipAuthCheck';
|
|
7
|
+
import { useIsMobile, useItemsWithKey } from '@headless-adminapp/app/hooks';
|
|
8
|
+
import { useLocale } from '@headless-adminapp/app/locale';
|
|
9
|
+
import { Icons } from '@headless-adminapp/icons';
|
|
10
|
+
import { useMemo } from 'react';
|
|
11
|
+
import { AppLogo } from './AppLogo';
|
|
12
|
+
import { useAppStrings } from './AppStringContext';
|
|
13
|
+
import { QuickActionItem } from './QuickActionItem';
|
|
14
|
+
export const AppHeaderContainer = ({ onNavToggle, }) => {
|
|
15
|
+
const { app } = useAppContext();
|
|
16
|
+
const authSession = useAuthSession();
|
|
17
|
+
const isSkipAuthCheck = useIsSkipAuthCheck();
|
|
18
|
+
const logout = useLogout();
|
|
19
|
+
const strings = useAppStrings();
|
|
20
|
+
const { language } = useLocale();
|
|
21
|
+
const isMobile = useIsMobile();
|
|
22
|
+
const initials = useMemo(() => {
|
|
26
23
|
return authSession === null || authSession === void 0 ? void 0 : authSession.fullName.split(' ').map((item) => item[0]).slice(0, 2).join('');
|
|
27
24
|
}, [authSession === null || authSession === void 0 ? void 0 : authSession.fullName]);
|
|
28
|
-
const quickActionItems =
|
|
29
|
-
const accountMenuItems =
|
|
30
|
-
return ((
|
|
25
|
+
const quickActionItems = useItemsWithKey(app.quickActionItems);
|
|
26
|
+
const accountMenuItems = useItemsWithKey(app.accountMenuItems);
|
|
27
|
+
return (_jsxs("div", { style: {
|
|
31
28
|
display: 'flex',
|
|
32
29
|
alignItems: 'center',
|
|
33
30
|
height: 50,
|
|
34
31
|
minHeight: 50,
|
|
35
|
-
background:
|
|
32
|
+
background: tokens.colorBrandBackground,
|
|
36
33
|
paddingInline: 8,
|
|
37
34
|
gap: 8,
|
|
38
|
-
}, children: [(
|
|
35
|
+
}, children: [_jsxs("div", { style: { display: 'flex', flex: 1, alignItems: 'center', gap: 8 }, children: [isMobile && (_jsx("div", { role: "button", style: {
|
|
39
36
|
cursor: 'pointer',
|
|
40
|
-
}, onClick: onNavToggle, children: (
|
|
37
|
+
}, onClick: onNavToggle, children: _jsx(Hamburger, { style: { color: 'white' } }) })), _jsxs("div", { style: {
|
|
41
38
|
display: 'flex',
|
|
42
39
|
alignItems: 'center',
|
|
43
40
|
cursor: 'pointer',
|
|
44
41
|
color: 'white',
|
|
45
|
-
}, children: [(
|
|
42
|
+
}, children: [_jsx("div", { style: { display: 'flex', paddingLeft: 4, paddingRight: 6 }, children: _jsx(AppLogo, { logo: app.logo, title: app.title }) }), _jsx(Subtitle2, { style: { paddingLeft: 4 }, children: app.title })] })] }), _jsxs("div", { style: {
|
|
46
43
|
paddingLeft: 8,
|
|
47
44
|
display: 'flex',
|
|
48
45
|
gap: 16,
|
|
49
|
-
}, children: [(
|
|
46
|
+
}, children: [_jsx("div", { style: { display: 'flex', gap: 8 }, children: quickActionItems === null || quickActionItems === void 0 ? void 0 : quickActionItems.map((item) => {
|
|
50
47
|
var _a, _b;
|
|
51
|
-
return ((
|
|
52
|
-
}) }), (!isSkipAuthCheck || !!(accountMenuItems === null || accountMenuItems === void 0 ? void 0 : accountMenuItems.length)) && ((
|
|
48
|
+
return (_jsx(QuickActionItem, { Icon: item.icon, label: (_b = (_a = item.localizedLabel) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.label, onClick: () => { var _a; return (_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item); }, link: item.link }, item.__key));
|
|
49
|
+
}) }), (!isSkipAuthCheck || !!(accountMenuItems === null || accountMenuItems === void 0 ? void 0 : accountMenuItems.length)) && (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { disableButtonEnhancement: true, children: _jsx(Avatar, { initials: initials, color: "neutral", style: { cursor: 'pointer' }, image: {
|
|
53
50
|
src: authSession === null || authSession === void 0 ? void 0 : authSession.profilePicture,
|
|
54
|
-
} }) }), (
|
|
51
|
+
} }) }), _jsxs(PopoverSurface, { tabIndex: -1, style: { padding: 0 }, children: [!isSkipAuthCheck && (_jsxs("div", { style: {
|
|
55
52
|
display: 'flex',
|
|
56
53
|
gap: 8,
|
|
57
54
|
padding: 8,
|
|
58
55
|
overflow: 'hidden',
|
|
59
56
|
width: 200,
|
|
60
|
-
}, children: [(
|
|
57
|
+
}, children: [_jsx("div", { children: _jsx(Avatar, { initials: initials, color: "neutral", image: {
|
|
61
58
|
src: authSession === null || authSession === void 0 ? void 0 : authSession.profilePicture,
|
|
62
|
-
} }) }), (
|
|
59
|
+
} }) }), _jsxs("div", { style: {
|
|
63
60
|
display: 'flex',
|
|
64
61
|
flexDirection: 'column',
|
|
65
62
|
overflow: 'hidden',
|
|
66
63
|
flex: 1,
|
|
67
|
-
}, children: [(
|
|
64
|
+
}, children: [_jsx(Caption1Strong, { children: authSession === null || authSession === void 0 ? void 0 : authSession.fullName }), _jsx(Caption1, { style: { textOverflow: 'ellipsis', overflow: 'hidden' }, children: authSession === null || authSession === void 0 ? void 0 : authSession.email })] })] })), !isSkipAuthCheck && _jsx(MenuDivider, { style: { marginInline: 0 } }), _jsxs(MenuList, { style: { width: 200, marginBottom: 4 }, children: [accountMenuItems === null || accountMenuItems === void 0 ? void 0 : accountMenuItems.map((item) => {
|
|
68
65
|
var _a, _b;
|
|
69
66
|
const Icon = item.icon;
|
|
70
|
-
return ((
|
|
71
|
-
}), !isSkipAuthCheck && ((
|
|
67
|
+
return (_jsx(MenuItem, { icon: _jsx(Icon, { size: "inherit" }), onClick: () => { var _a; return (_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item); }, children: (_b = (_a = item.localizedLabel) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.label }, item.__key));
|
|
68
|
+
}), !isSkipAuthCheck && (_jsx(MenuItem, { icon: _jsx(Icons.SignOut, {}), onClick: () => logout(), children: strings.logout }))] })] })] }))] })] }));
|
|
72
69
|
};
|
|
73
|
-
exports.AppHeaderContainer = AppHeaderContainer;
|
package/App/AppLogo.js
CHANGED
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const icons_1 = require("@headless-adminapp/icons");
|
|
6
|
-
const AppLogo = ({ logo, title }) => {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { IconPlaceholder } from '@headless-adminapp/icons';
|
|
3
|
+
export const AppLogo = ({ logo, title }) => {
|
|
7
4
|
var _a;
|
|
8
5
|
if (logo.Icon) {
|
|
9
|
-
const Icon = (_a = logo.Icon) !== null && _a !== void 0 ? _a :
|
|
10
|
-
return ((
|
|
6
|
+
const Icon = (_a = logo.Icon) !== null && _a !== void 0 ? _a : IconPlaceholder;
|
|
7
|
+
return (_jsx("div", { style: {
|
|
11
8
|
display: 'flex',
|
|
12
9
|
alignItems: 'center',
|
|
13
10
|
justifyContent: 'center',
|
|
14
11
|
width: 32,
|
|
15
12
|
height: 32,
|
|
16
|
-
}, children: (
|
|
13
|
+
}, children: _jsx(Icon, { size: 24 }) }));
|
|
17
14
|
}
|
|
18
15
|
if (logo.image) {
|
|
19
|
-
return ((
|
|
16
|
+
return (_jsx("div", { style: {
|
|
20
17
|
display: 'flex',
|
|
21
18
|
alignItems: 'center',
|
|
22
19
|
justifyContent: 'center',
|
|
23
20
|
width: 32,
|
|
24
21
|
height: 32,
|
|
25
|
-
}, children: (
|
|
22
|
+
}, children: _jsx("img", { src: logo.image, alt: title, style: { width: 32, height: 32 } }) }));
|
|
26
23
|
}
|
|
27
24
|
return null;
|
|
28
25
|
};
|
|
29
|
-
exports.AppLogo = AppLogo;
|
package/App/AppStringContext.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
exports.defaultAppStrings = {
|
|
9
|
-
datePickerStrings: react_datepicker_compat_1.defaultDatePickerStrings,
|
|
10
|
-
operatorStrings: column_filter_1.defaultOperatorStrings,
|
|
1
|
+
import { defaultDatePickerStrings, } from '@fluentui/react-datepicker-compat';
|
|
2
|
+
import { defaultOperatorStrings, } from '@headless-adminapp/app/datagrid/column-filter';
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
export const defaultAppStrings = {
|
|
5
|
+
datePickerStrings: defaultDatePickerStrings,
|
|
6
|
+
operatorStrings: defaultOperatorStrings,
|
|
11
7
|
loockupStrings: {
|
|
12
8
|
newRecord: 'New Record',
|
|
13
9
|
noRecordsFound: 'No records found',
|
|
@@ -16,8 +12,8 @@ exports.defaultAppStrings = {
|
|
|
16
12
|
error: 'Error',
|
|
17
13
|
searchPlaceholder: 'Search...',
|
|
18
14
|
};
|
|
19
|
-
|
|
20
|
-
function useAppStrings() {
|
|
21
|
-
const context =
|
|
15
|
+
export const AppStringContext = createContext(defaultAppStrings);
|
|
16
|
+
export function useAppStrings() {
|
|
17
|
+
const context = useContext(AppStringContext);
|
|
22
18
|
return context;
|
|
23
19
|
}
|
package/App/AppUI.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
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)(() => {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useIsMobile } from '@headless-adminapp/app/hooks';
|
|
3
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { AppHeaderContainer } from './AppHeaderContianer';
|
|
5
|
+
import { NavigationContainer } from './NavigationContainer';
|
|
6
|
+
export const AppUI = ({ children }) => {
|
|
7
|
+
const isMobile = useIsMobile();
|
|
8
|
+
const [isNavOpen, setIsNavOpen] = useState(!isMobile);
|
|
9
|
+
const navType = useMemo(() => (isMobile ? 'overlay' : 'inline'), [isMobile]);
|
|
10
|
+
useEffect(() => {
|
|
14
11
|
setIsNavOpen(!isMobile);
|
|
15
12
|
}, [isMobile]);
|
|
16
|
-
return ((
|
|
13
|
+
return (_jsxs("main", { style: { display: 'flex', flexDirection: 'column', height: '100vh' }, children: [_jsx(AppHeaderContainer, { onNavToggle: () => setIsNavOpen(!isNavOpen) }), _jsxs("div", { style: { display: 'flex', flex: 1, overflow: 'hidden' }, children: [_jsx(NavigationContainer, { open: isNavOpen, type: navType, onOpenChange: (open) => setIsNavOpen(open) }), _jsx("div", { style: {
|
|
17
14
|
display: 'flex',
|
|
18
15
|
flexDirection: 'column',
|
|
19
16
|
flex: 1,
|
|
@@ -21,4 +18,3 @@ const AppUI = ({ children }) => {
|
|
|
21
18
|
overflow: 'hidden',
|
|
22
19
|
}, children: children })] })] }));
|
|
23
20
|
};
|
|
24
|
-
exports.AppUI = AppUI;
|
package/App/LayoutProvider.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
2
|
var t = {};
|
|
4
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -10,20 +9,17 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
9
|
}
|
|
11
10
|
return t;
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const ToastNotificationContainer_1 = require("../ToastNotificationContainer");
|
|
21
|
-
const LayoutProvider = (_a) => {
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { FluentProvider, webLightTheme, } from '@fluentui/react-components';
|
|
14
|
+
import { LayoutProvider as LayoutProviderInternal, } from '@headless-adminapp/app/app/LayoutProvider';
|
|
15
|
+
import { DialogContainer } from '../DialogContainer';
|
|
16
|
+
import { ProgressIndicatorContainer } from '../ProgressIndicatorContainer';
|
|
17
|
+
import { ToastNotificationContainer } from '../ToastNotificationContainer';
|
|
18
|
+
export const LayoutProvider = (_a) => {
|
|
22
19
|
var { children, theme } = _a, rest = __rest(_a, ["children", "theme"]);
|
|
23
|
-
return ((
|
|
24
|
-
DialogContainer
|
|
25
|
-
ProgressIndicatorContainer
|
|
26
|
-
ToastNotificationContainer
|
|
20
|
+
return (_jsx(FluentProvider, { theme: theme !== null && theme !== void 0 ? theme : webLightTheme, children: _jsx(LayoutProviderInternal, Object.assign({}, rest, { containers: {
|
|
21
|
+
DialogContainer,
|
|
22
|
+
ProgressIndicatorContainer,
|
|
23
|
+
ToastNotificationContainer,
|
|
27
24
|
}, children: children })) }));
|
|
28
25
|
};
|
|
29
|
-
exports.LayoutProvider = LayoutProvider;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const react_1 = require("react");
|
|
12
|
-
const utils_1 = require("./utils");
|
|
13
|
-
const useStyles = (0, react_components_1.makeStyles)({
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { makeStyles, tokens } from '@fluentui/react-components';
|
|
3
|
+
import { NavDrawer, NavDrawerBody, NavItem, NavSectionHeader, } from '@fluentui/react-nav-preview';
|
|
4
|
+
import { useAppContext } from '@headless-adminapp/app/app';
|
|
5
|
+
import { useLocale } from '@headless-adminapp/app/locale';
|
|
6
|
+
import { useIsRouteActive, usePathname, useRouter, useRouteResolver, } from '@headless-adminapp/app/route/hooks';
|
|
7
|
+
import { IconPlaceholder, Icons } from '@headless-adminapp/icons';
|
|
8
|
+
import { Fragment } from 'react';
|
|
9
|
+
import { transformNavPageItem } from './utils';
|
|
10
|
+
const useStyles = makeStyles({
|
|
14
11
|
root: {
|
|
15
12
|
overflow: 'hidden',
|
|
16
13
|
display: 'flex',
|
|
@@ -28,40 +25,39 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
28
25
|
marginTop: '4px',
|
|
29
26
|
marginLeft: '8px',
|
|
30
27
|
flexDirection: 'column',
|
|
31
|
-
gridRowGap:
|
|
28
|
+
gridRowGap: tokens.spacingVerticalS,
|
|
32
29
|
},
|
|
33
30
|
});
|
|
34
|
-
const NavigationContainer = ({ open, type, onOpenChange, }) => {
|
|
31
|
+
export const NavigationContainer = ({ open, type, onOpenChange, }) => {
|
|
35
32
|
const styles = useStyles();
|
|
36
|
-
const { app } =
|
|
37
|
-
return ((
|
|
33
|
+
const { app } = useAppContext();
|
|
34
|
+
return (_jsx("div", { className: styles.root, children: _jsx(NavDrawer, { selectedValue: "active", open: open, type: type, onOpenChange: (value, data) => onOpenChange(data.open), children: _jsx(NavDrawerBody, { style: { paddingTop: 8 }, children: app.navItems.map((area) => (_jsx(Fragment, { children: area.groups.map((group) => (_jsxs(Fragment, { children: [!group.hideLabel && (_jsx(NavSectionHeader, { children: group.label })), group.items.map((item, index) => {
|
|
38
35
|
var _a;
|
|
39
|
-
return ((
|
|
36
|
+
return (_jsx(Test, { item: item, drawerType: type, onOpenChange: onOpenChange }, ((_a = item.label) !== null && _a !== void 0 ? _a : '') + String(index)));
|
|
40
37
|
})] }, group.label))) }, area.label))) }) }) }));
|
|
41
38
|
};
|
|
42
|
-
exports.NavigationContainer = NavigationContainer;
|
|
43
39
|
const Test = ({ item, onOpenChange, drawerType }) => {
|
|
44
40
|
var _a, _b;
|
|
45
|
-
const { schemaMetadataDic } =
|
|
46
|
-
const router =
|
|
47
|
-
const pathname =
|
|
41
|
+
const { schemaMetadataDic } = useAppContext();
|
|
42
|
+
const router = useRouter();
|
|
43
|
+
const pathname = usePathname();
|
|
48
44
|
const selectedPath = pathname;
|
|
49
|
-
const { language } =
|
|
50
|
-
const isRouteActive =
|
|
51
|
-
const routeResolver =
|
|
52
|
-
const navItem =
|
|
45
|
+
const { language } = useLocale();
|
|
46
|
+
const isRouteActive = useIsRouteActive();
|
|
47
|
+
const routeResolver = useRouteResolver();
|
|
48
|
+
const navItem = transformNavPageItem({
|
|
53
49
|
item,
|
|
54
50
|
schemaMetadataDic: schemaMetadataDic,
|
|
55
51
|
language,
|
|
56
52
|
routeResolver,
|
|
57
53
|
});
|
|
58
|
-
const Icon = (_b = (_a = navItem.icon) !== null && _a !== void 0 ? _a :
|
|
54
|
+
const Icon = (_b = (_a = navItem.icon) !== null && _a !== void 0 ? _a : Icons.Entity) !== null && _b !== void 0 ? _b : IconPlaceholder;
|
|
59
55
|
const isActive = isRouteActive(selectedPath, item);
|
|
60
|
-
return ((
|
|
56
|
+
return (_jsx(NavItem, { href: navItem.link, onClick: (event) => {
|
|
61
57
|
if (drawerType === 'overlay') {
|
|
62
58
|
onOpenChange(false);
|
|
63
59
|
}
|
|
64
60
|
event.preventDefault();
|
|
65
61
|
router.push(navItem.link);
|
|
66
|
-
}, icon: (
|
|
62
|
+
}, icon: _jsx(Icon, { size: 20, filled: isActive, color: isActive ? 'var(--colorNeutralForeground2BrandSelected)' : undefined }), value: isActive ? 'active' : '', children: navItem.label }));
|
|
67
63
|
};
|
package/App/QuickActionItem.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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)({
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button, makeStyles } from '@fluentui/react-components';
|
|
3
|
+
const useStyles = makeStyles({
|
|
7
4
|
root: {
|
|
8
5
|
color: 'rgba(255, 255, 255, 1) !important',
|
|
9
6
|
background: 'rgba(0, 0, 0, 0)',
|
|
@@ -22,11 +19,10 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
22
19
|
},
|
|
23
20
|
},
|
|
24
21
|
});
|
|
25
|
-
const QuickActionItem = ({ label, Icon, onClick, link, }) => {
|
|
22
|
+
export const QuickActionItem = ({ label, Icon, onClick, link, }) => {
|
|
26
23
|
const styles = useStyles();
|
|
27
|
-
return ((
|
|
24
|
+
return (_jsx(Button, { icon: _jsx(Icon, { size: "inherit" }), appearance: "transparent", as: "a", href: link, title: label, className: styles.root, onClick: (event) => {
|
|
28
25
|
event.preventDefault();
|
|
29
26
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
30
27
|
} }));
|
|
31
28
|
};
|
|
32
|
-
exports.QuickActionItem = QuickActionItem;
|
package/App/index.js
CHANGED
package/App/utils.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformNavPageItem = transformNavPageItem;
|
|
4
|
-
function transformNavPageItem({ item, schemaMetadataDic: schemaMetadataObject, language, routeResolver, }) {
|
|
1
|
+
export function transformNavPageItem({ item, schemaMetadataDic: schemaMetadataObject, language, routeResolver, }) {
|
|
5
2
|
var _a, _b, _c, _d;
|
|
6
3
|
let icon = item.icon;
|
|
7
4
|
let label = (_b = (_a = item.localizedLabel) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.label;
|
package/CommandBar/Button.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const useStyles = (0, react_components_1.makeStyles)({
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { makeStyles, mergeClasses, tokens, ToolbarButton, } from '@fluentui/react-components';
|
|
3
|
+
import { forwardRef, memo } from 'react';
|
|
4
|
+
const useStyles = makeStyles({
|
|
8
5
|
root: {
|
|
9
6
|
fontWeight: 'normal',
|
|
10
7
|
minWidth: 'unset',
|
|
@@ -13,24 +10,24 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
13
10
|
},
|
|
14
11
|
danger: {
|
|
15
12
|
'&:hover:not(:disabled)': {
|
|
16
|
-
color:
|
|
17
|
-
background:
|
|
13
|
+
color: tokens.colorPaletteRedForeground1,
|
|
14
|
+
background: tokens.colorPaletteRedBackground1,
|
|
18
15
|
'& .fui-Button__icon': {
|
|
19
|
-
color:
|
|
16
|
+
color: tokens.colorPaletteRedForeground1,
|
|
20
17
|
},
|
|
21
18
|
'&:active': {
|
|
22
|
-
color:
|
|
23
|
-
background:
|
|
19
|
+
color: tokens.colorPaletteRedForeground2,
|
|
20
|
+
background: tokens.colorPaletteRedBackground2,
|
|
24
21
|
'& .fui-Button__icon': {
|
|
25
|
-
color:
|
|
22
|
+
color: tokens.colorPaletteRedForeground2,
|
|
26
23
|
},
|
|
27
24
|
},
|
|
28
25
|
},
|
|
29
26
|
},
|
|
30
27
|
});
|
|
31
|
-
const ToolbarButtonInternal =
|
|
32
|
-
|
|
28
|
+
const ToolbarButtonInternal = ToolbarButton;
|
|
29
|
+
export const CommandButton = memo(forwardRef(function CommandButton({ Icon, text, danger, onClick, disabled, iconPosition = 'before' }, ref) {
|
|
33
30
|
const styles = useStyles();
|
|
34
|
-
return ((
|
|
31
|
+
return (_jsx(ToolbarButtonInternal, { ref: ref, type: "button", icon: !!Icon ? _jsx(Icon, { size: 20 }) : undefined, iconPosition: iconPosition, disabled: disabled, onClick: onClick, className: mergeClasses(styles.root, danger && styles.danger), children: text }));
|
|
35
32
|
}));
|
|
36
|
-
|
|
33
|
+
CommandButton.displayName = 'CommandButton';
|
package/CommandBar/Divider.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
exports.CommandDivider = (0, react_1.memo)((0, react_1.forwardRef)(function CommandDivider(_, ref) {
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.ToolbarDivider, { ref: ref, style: { paddingInline: react_components_1.tokens.spacingHorizontalXS } }));
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { tokens, ToolbarDivider, } from '@fluentui/react-components';
|
|
3
|
+
import { forwardRef, memo } from 'react';
|
|
4
|
+
export const CommandDivider = memo(forwardRef(function CommandDivider(_, ref) {
|
|
5
|
+
return (_jsx(ToolbarDivider, { ref: ref, style: { paddingInline: tokens.spacingHorizontalXS } }));
|
|
9
6
|
}));
|
|
10
|
-
|
|
7
|
+
CommandDivider.displayName = 'CommandDivider';
|
package/CommandBar/IconButton.js
CHANGED
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const useStyles = (0, react_components_1.makeStyles)({
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { makeStyles, mergeClasses, tokens, ToolbarButton, } from '@fluentui/react-components';
|
|
3
|
+
import { forwardRef, memo } from 'react';
|
|
4
|
+
const useStyles = makeStyles({
|
|
8
5
|
root: {
|
|
9
6
|
flexShrink: 0,
|
|
10
7
|
},
|
|
11
8
|
danger: {
|
|
12
9
|
'&:hover': {
|
|
13
|
-
color:
|
|
14
|
-
background:
|
|
10
|
+
color: tokens.colorPaletteRedForeground1,
|
|
11
|
+
background: tokens.colorPaletteRedBackground1,
|
|
15
12
|
'& .fui-Button__icon': {
|
|
16
|
-
color:
|
|
13
|
+
color: tokens.colorPaletteRedForeground1,
|
|
17
14
|
},
|
|
18
15
|
'&:active': {
|
|
19
|
-
color:
|
|
20
|
-
background:
|
|
16
|
+
color: tokens.colorPaletteRedForeground2,
|
|
17
|
+
background: tokens.colorPaletteRedBackground2,
|
|
21
18
|
'& .fui-Button__icon': {
|
|
22
|
-
color:
|
|
19
|
+
color: tokens.colorPaletteRedForeground2,
|
|
23
20
|
},
|
|
24
21
|
},
|
|
25
22
|
},
|
|
26
23
|
},
|
|
27
24
|
});
|
|
28
|
-
|
|
25
|
+
export const CommandIconButton = memo(forwardRef(function CommandIconButton({ Icon, disabled, onClick, danger }, ref) {
|
|
29
26
|
const styles = useStyles();
|
|
30
|
-
return ((
|
|
27
|
+
return (_jsx(ToolbarButton, { ref: ref, icon: _jsx(Icon, { size: 20 }), disabled: disabled, onClick: onClick, className: mergeClasses(styles.root, danger && styles.danger) }));
|
|
31
28
|
}));
|
|
32
|
-
|
|
29
|
+
CommandIconButton.displayName = 'CommandIconButton';
|
package/CommandBar/Label.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const useStyles = (0, react_components_1.makeStyles)({
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { makeStyles, mergeClasses, tokens, ToolbarButton, } from '@fluentui/react-components';
|
|
3
|
+
import { forwardRef, memo } from 'react';
|
|
4
|
+
const useStyles = makeStyles({
|
|
8
5
|
root: {
|
|
9
6
|
fontWeight: 'normal',
|
|
10
7
|
minWidth: 'unset',
|
|
@@ -12,12 +9,12 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
12
9
|
flexShrink: 0,
|
|
13
10
|
cursor: 'default !important',
|
|
14
11
|
'&:hover:active': {
|
|
15
|
-
backgroundColor:
|
|
12
|
+
backgroundColor: tokens.colorNeutralBackground2Hover,
|
|
16
13
|
},
|
|
17
14
|
},
|
|
18
15
|
});
|
|
19
|
-
|
|
16
|
+
export const CommandLabel = memo(forwardRef(function CommandLabel({ Icon, text }, ref) {
|
|
20
17
|
const styles = useStyles();
|
|
21
|
-
return ((
|
|
18
|
+
return (_jsx(ToolbarButton, { ref: ref, type: "button", icon: !!Icon ? _jsx(Icon, { size: 20 }) : undefined, className: mergeClasses(styles.root), children: text }));
|
|
22
19
|
}));
|
|
23
|
-
|
|
20
|
+
CommandLabel.displayName = 'CommandLabel';
|