@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
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.PageEntityViewStringContext = exports.defaultPageEntityViewStrings = void 0;
|
|
4
|
-
exports.usePageEntityViewStrings = usePageEntityViewStrings;
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
exports.defaultPageEntityViewStrings = {
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const defaultPageEntityViewStrings = {
|
|
7
3
|
add: 'Add',
|
|
8
4
|
addColumns: 'Add columns',
|
|
9
5
|
apply: 'Apply',
|
|
@@ -24,8 +20,8 @@ exports.defaultPageEntityViewStrings = {
|
|
|
24
20
|
filterBy: 'Filter by',
|
|
25
21
|
noRecordsFound: "We didn't find anything to show here",
|
|
26
22
|
};
|
|
27
|
-
|
|
28
|
-
function usePageEntityViewStrings() {
|
|
29
|
-
const context =
|
|
23
|
+
export const PageEntityViewStringContext = createContext(defaultPageEntityViewStrings);
|
|
24
|
+
export function usePageEntityViewStrings() {
|
|
25
|
+
const context = useContext(PageEntityViewStringContext);
|
|
30
26
|
return context;
|
|
31
27
|
}
|
package/PageEntityView/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PageEntityView = void 0;
|
|
4
|
-
var PageEntityView_1 = require("./PageEntityView");
|
|
5
|
-
Object.defineProperty(exports, "PageEntityView", { enumerable: true, get: function () { return PageEntityView_1.PageEntityView; } });
|
|
1
|
+
export { PageEntityView } from './PageEntityView';
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const InsightsProvider_1 = require("@headless-adminapp/app/insights/InsightsProvider");
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const InsightsContainer_1 = require("../Insights/InsightsContainer");
|
|
9
|
-
function createInsightLookup(insights) {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { InsightsProvider } from '@headless-adminapp/app/insights/InsightsProvider';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { InsightsContainer } from '../Insights/InsightsContainer';
|
|
5
|
+
export function createInsightLookup(insights) {
|
|
10
6
|
return insights.map((insight) => ({
|
|
11
7
|
id: insight.id,
|
|
12
8
|
title: insight.title,
|
|
13
9
|
subtitle: insight.subtitle,
|
|
14
10
|
}));
|
|
15
11
|
}
|
|
16
|
-
function PageInsights({ insightId, insights, onChangeInsight, }) {
|
|
17
|
-
const insightExpereince =
|
|
12
|
+
export function PageInsights({ insightId, insights, onChangeInsight, }) {
|
|
13
|
+
const insightExpereince = useMemo(() => {
|
|
18
14
|
return insights.find((insight) => insight.id === insightId);
|
|
19
15
|
}, [insightId, insights]);
|
|
20
|
-
const insightLookups =
|
|
16
|
+
const insightLookups = useMemo(() => createInsightLookup(insights), [insights]);
|
|
21
17
|
if (!insightExpereince) {
|
|
22
18
|
return null;
|
|
23
19
|
}
|
|
24
|
-
return ((
|
|
20
|
+
return (_jsx(InsightsProvider, { experience: insightExpereince, insightLookup: insightLookups, onInsightSelect: onChangeInsight, children: _jsx(InsightsContainer, {}) }));
|
|
25
21
|
}
|
package/PageInsights/index.js
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createInsightLookup = exports.PageInsights = void 0;
|
|
4
|
-
var PageInsights_1 = require("./PageInsights");
|
|
5
|
-
Object.defineProperty(exports, "PageInsights", { enumerable: true, get: function () { return PageInsights_1.PageInsights; } });
|
|
6
|
-
Object.defineProperty(exports, "createInsightLookup", { enumerable: true, get: function () { return PageInsights_1.createInsightLookup; } });
|
|
1
|
+
export { PageInsights, createInsightLookup } from './PageInsights';
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const ProgressIndicatorContainer = () => {
|
|
8
|
-
const state = (0, hooks_1.useProgressIndicator)();
|
|
9
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [state.overlayVisible && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Body1, Dialog, DialogBody, DialogContent, DialogSurface, Spinner, tokens, } from '@fluentui/react-components';
|
|
3
|
+
import { useProgressIndicator } from '@headless-adminapp/app/progress-indicator/hooks';
|
|
4
|
+
export const ProgressIndicatorContainer = () => {
|
|
5
|
+
const state = useProgressIndicator();
|
|
6
|
+
return (_jsxs(_Fragment, { children: [state.overlayVisible && (_jsx("div", { style: {
|
|
10
7
|
position: 'fixed',
|
|
11
8
|
top: 0,
|
|
12
9
|
bottom: 0,
|
|
13
10
|
left: 0,
|
|
14
11
|
right: 0,
|
|
15
12
|
zIndex: 1000,
|
|
16
|
-
} })), (
|
|
13
|
+
} })), _jsx(Dialog, { open: state.visible, onOpenChange: () => {
|
|
17
14
|
// do nothing
|
|
18
|
-
}, children: (
|
|
15
|
+
}, children: _jsx(DialogSurface, { style: { maxWidth: 320 }, children: _jsx(DialogBody, { children: _jsxs(DialogContent, { children: [_jsx(Spinner, {}), !!state.message && (_jsx(Body1, { style: {
|
|
19
16
|
textAlign: 'center',
|
|
20
17
|
display: 'flex',
|
|
21
18
|
alignItems: 'center',
|
|
22
19
|
justifyContent: 'center',
|
|
23
|
-
marginTop:
|
|
24
|
-
}, children: state.message })), (
|
|
20
|
+
marginTop: tokens.spacingVerticalL,
|
|
21
|
+
}, children: state.message })), _jsx("button", { style: {
|
|
25
22
|
position: 'absolute',
|
|
26
23
|
opacity: 0,
|
|
27
24
|
pointerEvents: 'none',
|
|
28
25
|
} })] }) }) }) })] }));
|
|
29
26
|
};
|
|
30
|
-
exports.ProgressIndicatorContainer = ProgressIndicatorContainer;
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const toasterId = (0, react_components_1.useId)('toaster');
|
|
11
|
-
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
|
-
return (0, jsx_runtime_1.jsx)(Item, { item: item, toasterId: toasterId }, item.id);
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Link, Toast, ToastBody, Toaster, ToastFooter, ToastTitle, useId, useToastController, } from '@fluentui/react-components';
|
|
3
|
+
import { useCloseToastNotification, useToastNotificationItems, } from '@headless-adminapp/app/toast-notification/hooks';
|
|
4
|
+
import { useEffect, useRef } from 'react';
|
|
5
|
+
export const ToastNotificationContainer = () => {
|
|
6
|
+
const items = useToastNotificationItems();
|
|
7
|
+
const toasterId = useId('toaster');
|
|
8
|
+
return (_jsxs(_Fragment, { children: [_jsx(Toaster, { toasterId: toasterId }), items.map((item) => {
|
|
9
|
+
return _jsx(Item, { item: item, toasterId: toasterId }, item.id);
|
|
13
10
|
})] }));
|
|
14
11
|
};
|
|
15
|
-
exports.ToastNotificationContainer = ToastNotificationContainer;
|
|
16
12
|
const Item = ({ item, toasterId, }) => {
|
|
17
|
-
const { dispatchToast, dismissToast } =
|
|
18
|
-
const closeToastNotification =
|
|
19
|
-
const opened =
|
|
20
|
-
|
|
13
|
+
const { dispatchToast, dismissToast } = useToastController(toasterId);
|
|
14
|
+
const closeToastNotification = useCloseToastNotification();
|
|
15
|
+
const opened = useRef(false);
|
|
16
|
+
useEffect(() => {
|
|
21
17
|
var _a;
|
|
22
18
|
if (!item.isOpen) {
|
|
23
19
|
dismissToast(item.id);
|
|
@@ -27,7 +23,7 @@ const Item = ({ item, toasterId, }) => {
|
|
|
27
23
|
return;
|
|
28
24
|
}
|
|
29
25
|
opened.current = true;
|
|
30
|
-
dispatchToast((
|
|
26
|
+
dispatchToast(_jsxs(Toast, { children: [_jsx(ToastTitle, { children: item.title }), _jsx(ToastBody, { children: item.text }), !!((_a = item.actions) === null || _a === void 0 ? void 0 : _a.length) && (_jsx(ToastFooter, { children: item.actions.map((action, index) => (_jsx(Link, { onClick: action.onClick, children: action.text }, index))) }))] }), {
|
|
31
27
|
timeout: 2000,
|
|
32
28
|
intent: item.type,
|
|
33
29
|
pauseOnHover: true,
|
package/componentStore.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.componentStore = void 0;
|
|
4
|
-
const store_1 = require("@headless-adminapp/app/store");
|
|
5
|
-
exports.componentStore = new store_1.ComponentStore();
|
|
1
|
+
import { ComponentStore } from '@headless-adminapp/app/store';
|
|
2
|
+
export const componentStore = new ComponentStore();
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
const BodyLoading = ({ loading }) => {
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Spinner, tokens } from '@fluentui/react-components';
|
|
3
|
+
export const BodyLoading = ({ loading }) => {
|
|
7
4
|
if (!loading) {
|
|
8
5
|
return null;
|
|
9
6
|
}
|
|
10
|
-
return ((
|
|
7
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { style: {
|
|
11
8
|
position: 'absolute',
|
|
12
9
|
inset: 0,
|
|
13
|
-
backgroundColor:
|
|
10
|
+
backgroundColor: tokens.colorNeutralBackground1,
|
|
14
11
|
opacity: 0.7,
|
|
15
|
-
} }), (
|
|
12
|
+
} }), _jsx("div", { style: {
|
|
16
13
|
position: 'absolute',
|
|
17
14
|
inset: 0,
|
|
18
15
|
display: 'flex',
|
|
19
16
|
alignItems: 'center',
|
|
20
17
|
justifyContent: 'center',
|
|
21
|
-
}, children: (
|
|
18
|
+
}, children: _jsx(Spinner, { size: "small" }) })] }));
|
|
22
19
|
};
|
|
23
|
-
exports.BodyLoading = BodyLoading;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const LoginForm_1 = require("./LoginForm");
|
|
7
|
-
function DialogLogin(props) {
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.Dialog, { open: true, onOpenChange: () => { }, modalType: "non-modal", children: (0, jsx_runtime_1.jsx)(react_components_1.DialogSurface, { style: { maxWidth: 360 }, children: (0, jsx_runtime_1.jsx)(react_components_1.DialogBody, { children: (0, jsx_runtime_1.jsx)(react_components_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(LoginForm_1.LoginForm, { onLogin: props.onLogin, logoImageUrl: props.logoImageUrl }) }) }) }) }));
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog, DialogBody, DialogContent, DialogSurface, } from '@fluentui/react-components';
|
|
3
|
+
import { LoginForm } from './LoginForm';
|
|
4
|
+
export function DialogLogin(props) {
|
|
5
|
+
return (_jsx(Dialog, { open: true, onOpenChange: () => { }, modalType: "non-modal", children: _jsx(DialogSurface, { style: { maxWidth: 360 }, children: _jsx(DialogBody, { children: _jsx(DialogContent, { children: _jsx(LoginForm, { onLogin: props.onLogin, logoImageUrl: props.logoImageUrl }) }) }) }) }));
|
|
9
6
|
}
|
package/components/LoginForm.js
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -31,16 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
8
|
});
|
|
33
9
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const PasswordControl_1 = require("../form/controls/PasswordControl");
|
|
43
|
-
const TextControl_1 = require("../form/controls/TextControl");
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Button, MessageBar, MessageBarBody, Spinner, Subtitle1, } from '@fluentui/react-components';
|
|
12
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
13
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
14
|
+
import * as yup from 'yup';
|
|
15
|
+
import { SectionControlWrapper } from '../DataForm/SectionControl';
|
|
16
|
+
import { PasswordControl } from '../form/controls/PasswordControl';
|
|
17
|
+
import { TextControl } from '../form/controls/TextControl';
|
|
44
18
|
const validationSchema = yup
|
|
45
19
|
.object()
|
|
46
20
|
.shape({
|
|
@@ -51,10 +25,10 @@ const initialValues = {
|
|
|
51
25
|
username: '',
|
|
52
26
|
password: '',
|
|
53
27
|
};
|
|
54
|
-
function LoginForm(props) {
|
|
55
|
-
const form =
|
|
28
|
+
export function LoginForm(props) {
|
|
29
|
+
const form = useForm({
|
|
56
30
|
defaultValues: initialValues,
|
|
57
|
-
resolver:
|
|
31
|
+
resolver: yupResolver(validationSchema),
|
|
58
32
|
});
|
|
59
33
|
const handleOnSubmit = (values) => __awaiter(this, void 0, void 0, function* () {
|
|
60
34
|
var _a, _b;
|
|
@@ -69,33 +43,33 @@ function LoginForm(props) {
|
|
|
69
43
|
});
|
|
70
44
|
}
|
|
71
45
|
});
|
|
72
|
-
return ((
|
|
46
|
+
return (_jsx("form", { onSubmit: form.handleSubmit(handleOnSubmit), children: _jsxs("div", { style: {
|
|
73
47
|
display: 'flex',
|
|
74
48
|
flexDirection: 'column',
|
|
75
49
|
alignItems: 'stretch',
|
|
76
50
|
justifyContent: 'flex-start',
|
|
77
51
|
gap: 16,
|
|
78
|
-
}, children: [(
|
|
52
|
+
}, children: [_jsx("div", { style: {
|
|
79
53
|
width: 80,
|
|
80
54
|
height: 80,
|
|
81
|
-
}, children: !!props.logoImageUrl && ((
|
|
55
|
+
}, children: !!props.logoImageUrl && (_jsx("img", { src: props.logoImageUrl, style: {
|
|
82
56
|
width: 80,
|
|
83
57
|
height: 80,
|
|
84
58
|
aspectRatio: 'auto 80 / 80',
|
|
85
|
-
}, alt: "logo" })) }), (
|
|
59
|
+
}, alt: "logo" })) }), _jsx(Subtitle1, { children: "Log in to your account" }), _jsxs("div", { style: {
|
|
86
60
|
display: 'flex',
|
|
87
61
|
flexDirection: 'column',
|
|
88
62
|
alignItems: 'stretch',
|
|
89
63
|
justifyContent: 'flex-start',
|
|
90
64
|
gap: 16,
|
|
91
|
-
}, children: [(
|
|
65
|
+
}, children: [_jsx(Controller, { control: form.control, name: "username", render: ({ field, fieldState, formState }) => {
|
|
92
66
|
var _a, _b, _c;
|
|
93
|
-
return ((
|
|
94
|
-
} }), (
|
|
67
|
+
return (_jsx(SectionControlWrapper, { label: "Username", labelPosition: "top", required: true, isError: !!((_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message) && formState.isSubmitted, errorMessage: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, children: _jsx(TextControl, { placeholder: "Username", appearance: "outline", name: field.name, value: field.value, onChange: field.onChange, onBlur: field.onBlur, autoCapitalize: "none", autoCorrect: "off", error: !!((_c = fieldState.error) === null || _c === void 0 ? void 0 : _c.message) && formState.isSubmitted }) }));
|
|
68
|
+
} }), _jsx(Controller, { control: form.control, name: "password", render: ({ field, fieldState, formState }) => {
|
|
95
69
|
var _a, _b, _c;
|
|
96
|
-
return ((
|
|
97
|
-
} }), !!form.formState.errors.root && ((
|
|
70
|
+
return (_jsx(SectionControlWrapper, { label: "Password", labelPosition: "top", required: true, isError: !!((_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message) && formState.isSubmitted, errorMessage: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, children: _jsx(PasswordControl, { placeholder: "Password", name: field.name, appearance: "outline", error: !!((_c = fieldState.error) === null || _c === void 0 ? void 0 : _c.message) && formState.isSubmitted, value: field.value, onChange: field.onChange, onBlur: field.onBlur }) }));
|
|
71
|
+
} }), !!form.formState.errors.root && (_jsx(MessageBar, { intent: "error", children: _jsx(MessageBarBody, { children: form.formState.errors.root.message }) })), _jsxs(Button, { appearance: "primary", type: "submit", style: {
|
|
98
72
|
marginTop: 8,
|
|
99
73
|
pointerEvents: form.formState.isSubmitting ? 'none' : 'auto',
|
|
100
|
-
}, children: [form.formState.isSubmitting && ((
|
|
74
|
+
}, children: [form.formState.isSubmitting && (_jsx(Spinner, { size: "extra-tiny", appearance: "inverted", style: { marginRight: 4 } })), "Login"] })] }), _jsx("div", { style: { height: 80 } })] }) }));
|
|
101
75
|
}
|
package/components/PageBroken.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
function PageBroken({ title, message, Icon }) {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Body1, Button, Title2 } from '@fluentui/react-components';
|
|
3
|
+
export function PageBroken({ title, message, Icon }) {
|
|
4
|
+
return (_jsxs("div", { style: {
|
|
8
5
|
display: 'flex',
|
|
9
6
|
flex: 1,
|
|
10
7
|
flexDirection: 'column',
|
|
11
8
|
alignItems: 'center',
|
|
12
9
|
justifyContent: 'center',
|
|
13
10
|
gap: 16,
|
|
14
|
-
}, children: [!!Icon && (
|
|
11
|
+
}, children: [!!Icon && _jsx(Icon, { size: 64 }), _jsx(Title2, { children: title }), !!message && _jsx(Body1, { children: message }), _jsx(Button, { onClick: () => window.history.back(), children: "Go back" })] }));
|
|
15
12
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
function PageLoading({ message }) {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Body1, Spinner } from '@fluentui/react-components';
|
|
3
|
+
export function PageLoading({ message }) {
|
|
4
|
+
return (_jsxs("div", { style: {
|
|
8
5
|
display: 'flex',
|
|
9
6
|
flex: 1,
|
|
10
7
|
flexDirection: 'column',
|
|
11
8
|
gap: 16,
|
|
12
9
|
alignItems: 'center',
|
|
13
10
|
justifyContent: 'center',
|
|
14
|
-
}, children: [(
|
|
11
|
+
}, children: [_jsx(Spinner, {}), !!message && _jsx(Body1, { children: message })] }));
|
|
15
12
|
}
|
package/components/PageLogin.js
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const LoginForm_1 = require("./LoginForm");
|
|
7
|
-
function PageLogin(props) {
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { tokens } from '@fluentui/react-components';
|
|
3
|
+
import { LoginForm } from './LoginForm';
|
|
4
|
+
export function PageLogin(props) {
|
|
5
|
+
return (_jsx("div", { style: {
|
|
9
6
|
height: '100vh',
|
|
10
7
|
width: '100vw',
|
|
11
8
|
display: 'flex',
|
|
12
9
|
alignItems: 'center',
|
|
13
10
|
justifyContent: 'center',
|
|
14
|
-
background:
|
|
15
|
-
}, children: (
|
|
16
|
-
boxShadow:
|
|
11
|
+
background: tokens.colorNeutralBackground2,
|
|
12
|
+
}, children: _jsx("div", { style: {
|
|
13
|
+
boxShadow: tokens.shadow4,
|
|
17
14
|
maxWidth: 992,
|
|
18
15
|
width: '100%',
|
|
19
16
|
overflow: 'hidden',
|
|
20
|
-
borderRadius:
|
|
21
|
-
background:
|
|
22
|
-
}, children: (
|
|
17
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
18
|
+
background: tokens.colorNeutralBackground1,
|
|
19
|
+
}, children: _jsxs("div", { style: { display: 'flex', minHeight: 'calc(-200px + 100vh)' }, children: [_jsx("div", { style: {
|
|
23
20
|
display: 'flex',
|
|
24
21
|
flexDirection: 'column',
|
|
25
22
|
gap: 16,
|
|
26
23
|
flex: 1,
|
|
27
24
|
alignItems: 'center',
|
|
28
25
|
justifyContent: 'center',
|
|
29
|
-
}, children: (
|
|
26
|
+
}, children: _jsx("div", { style: {
|
|
30
27
|
display: 'flex',
|
|
31
28
|
flexDirection: 'column',
|
|
32
29
|
alignItems: 'stretch',
|
|
33
30
|
justifyContent: 'flex-start',
|
|
34
31
|
gap: 16,
|
|
35
32
|
minWidth: 300,
|
|
36
|
-
}, children: (
|
|
33
|
+
}, children: _jsx(LoginForm, { logoImageUrl: props.logoImageUrl, onLogin: props.onLogin }) }) }), _jsx("div", { style: {
|
|
37
34
|
display: 'flex',
|
|
38
35
|
flexDirection: 'column',
|
|
39
36
|
gap: 16,
|
|
@@ -41,5 +38,5 @@ function PageLogin(props) {
|
|
|
41
38
|
alignItems: 'stretch',
|
|
42
39
|
justifyContent: 'center',
|
|
43
40
|
overflow: 'hidden',
|
|
44
|
-
}, children: (
|
|
41
|
+
}, children: _jsx("img", { src: props.illustrationImageUrl, alt: "Login", style: { width: '100%', height: '100%', objectFit: 'contain' } }) })] }) }) }));
|
|
45
42
|
}
|
package/form/FormControl.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,29 +9,25 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
9
|
}
|
|
11
10
|
return t;
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const TelephoneControl_1 = require("./controls/TelephoneControl");
|
|
33
|
-
const TextAreaControl_1 = require("./controls/TextAreaControl");
|
|
34
|
-
const TextControl_1 = require("./controls/TextControl");
|
|
35
|
-
const FormControlLoading_1 = require("./FormControlLoading");
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Label } from '@fluentui/react-components';
|
|
14
|
+
import { useCallback, useMemo } from 'react';
|
|
15
|
+
import { v4 as uuid } from 'uuid';
|
|
16
|
+
import { CurrencyControl } from './controls/CurrencyControl';
|
|
17
|
+
import { DateControl } from './controls/DateControl';
|
|
18
|
+
import { DateTimeControl } from './controls/DateTimeControl';
|
|
19
|
+
import { DecimalControl } from './controls/DecimalControl';
|
|
20
|
+
import { EmailControl } from './controls/EmailControl';
|
|
21
|
+
import { LookupControl } from './controls/LookupControl';
|
|
22
|
+
import MultiSelectControl from './controls/MultiSelectControl';
|
|
23
|
+
import { MultiSelectLookupControl } from './controls/MultiSelectLookupControl';
|
|
24
|
+
import { PasswordControl } from './controls/PasswordControl';
|
|
25
|
+
import SelectControl from './controls/SelectControl';
|
|
26
|
+
import { SwitchControl } from './controls/SwitchControl';
|
|
27
|
+
import { TelephoneControl } from './controls/TelephoneControl';
|
|
28
|
+
import { TextAreaControl } from './controls/TextAreaControl';
|
|
29
|
+
import { TextControl } from './controls/TextControl';
|
|
30
|
+
import { FormControlLoading } from './FormControlLoading';
|
|
36
31
|
function Control(props) {
|
|
37
32
|
const { type, label: _label, value, onChange } = props, rest = __rest(props, ["type", "label", "value", "onChange"]);
|
|
38
33
|
switch (type) {
|
|
@@ -43,42 +38,42 @@ function Control(props) {
|
|
|
43
38
|
disabled: props.disabled,
|
|
44
39
|
});
|
|
45
40
|
case 'text':
|
|
46
|
-
return ((
|
|
41
|
+
return (_jsx(TextControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
47
42
|
case 'textarea':
|
|
48
|
-
return ((
|
|
43
|
+
return (_jsx(TextAreaControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
49
44
|
case 'telephone':
|
|
50
|
-
return ((
|
|
45
|
+
return (_jsx(TelephoneControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
51
46
|
case 'email':
|
|
52
|
-
return ((
|
|
47
|
+
return (_jsx(EmailControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
53
48
|
case 'password':
|
|
54
|
-
return ((
|
|
49
|
+
return (_jsx(PasswordControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
55
50
|
case 'number':
|
|
56
|
-
return ((
|
|
51
|
+
return (_jsx(DecimalControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
57
52
|
case 'currency':
|
|
58
|
-
return ((
|
|
53
|
+
return (_jsx(CurrencyControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
59
54
|
case 'date':
|
|
60
|
-
return ((
|
|
55
|
+
return (_jsx(DateControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
61
56
|
case 'datetime':
|
|
62
|
-
return ((
|
|
57
|
+
return (_jsx(DateTimeControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
63
58
|
case 'select':
|
|
64
|
-
return ((
|
|
59
|
+
return (_jsx(SelectControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
65
60
|
case 'multi-select':
|
|
66
|
-
return ((
|
|
61
|
+
return (_jsx(MultiSelectControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
67
62
|
case 'lookup':
|
|
68
|
-
return ((
|
|
63
|
+
return (_jsx(LookupControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
69
64
|
case 'lookups':
|
|
70
|
-
return ((
|
|
65
|
+
return (_jsx(MultiSelectLookupControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
71
66
|
case 'switch':
|
|
72
|
-
return ((
|
|
67
|
+
return (_jsx(SwitchControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
73
68
|
default:
|
|
74
|
-
return (
|
|
69
|
+
return _jsx("div", {});
|
|
75
70
|
}
|
|
76
71
|
}
|
|
77
72
|
function FormControl(props) {
|
|
78
73
|
const { label, id, onChange } = props;
|
|
79
|
-
const _id =
|
|
80
|
-
const noop =
|
|
81
|
-
return ((
|
|
74
|
+
const _id = useMemo(() => id !== null && id !== void 0 ? id : uuid(), [id]);
|
|
75
|
+
const noop = useCallback(() => { }, []);
|
|
76
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx(Label, { style: { width: 160, marginTop: 4 }, children: label }), _jsx("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: _jsx(Control, Object.assign({ id: _id, onChange: onChange || noop }, props)) })] }));
|
|
82
77
|
}
|
|
83
|
-
FormControl.Loading =
|
|
84
|
-
|
|
78
|
+
FormControl.Loading = FormControlLoading;
|
|
79
|
+
export default FormControl;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
const FormControlLoading = () => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', gap: 6, marginTop: 2 }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Skeleton, { style: { width: 100, height: 20 } }), (0, jsx_runtime_1.jsx)(react_components_1.Skeleton, { style: { height: 32 } })] }));
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Skeleton } from '@fluentui/react-components';
|
|
3
|
+
export const FormControlLoading = () => {
|
|
4
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 6, marginTop: 2 }, children: [_jsx(Skeleton, { style: { width: 100, height: 20 } }), _jsx(Skeleton, { style: { height: 32 } })] }));
|
|
8
5
|
};
|
|
9
|
-
exports.FormControlLoading = FormControlLoading;
|