@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/CommandBar/MenuButton.js
CHANGED
|
@@ -1,43 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const MenuList_1 = require("./MenuList");
|
|
8
|
-
const useStyles = (0, react_components_1.makeStyles)({
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { makeStyles, Menu, MenuButton, MenuPopover, MenuTrigger, mergeClasses, SplitButton, tokens, } from '@fluentui/react-components';
|
|
3
|
+
import { forwardRef, memo } from 'react';
|
|
4
|
+
import { MenuList } from './MenuList';
|
|
5
|
+
const useStyles = makeStyles({
|
|
9
6
|
splitButton: {
|
|
10
7
|
'& > button:first-child': {
|
|
11
|
-
fontWeight:
|
|
12
|
-
borderRightColor:
|
|
8
|
+
fontWeight: tokens.fontWeightRegular,
|
|
9
|
+
borderRightColor: tokens.colorNeutralStroke3,
|
|
13
10
|
},
|
|
14
11
|
},
|
|
15
12
|
menuButton: {
|
|
16
|
-
fontWeight:
|
|
13
|
+
fontWeight: tokens.fontWeightRegular,
|
|
17
14
|
},
|
|
18
15
|
splitButtonDanger: {
|
|
19
16
|
'& > button:first-child:hover': {
|
|
20
|
-
color:
|
|
21
|
-
background:
|
|
17
|
+
color: tokens.colorPaletteRedForeground1,
|
|
18
|
+
background: tokens.colorPaletteRedBackground1,
|
|
22
19
|
'& .fui-Button__icon': {
|
|
23
|
-
color:
|
|
20
|
+
color: tokens.colorPaletteRedForeground1,
|
|
24
21
|
},
|
|
25
22
|
'&:active': {
|
|
26
|
-
color:
|
|
27
|
-
background:
|
|
23
|
+
color: tokens.colorPaletteRedForeground2,
|
|
24
|
+
background: tokens.colorPaletteRedBackground2,
|
|
28
25
|
'& .fui-Button__icon': {
|
|
29
|
-
color:
|
|
26
|
+
color: tokens.colorPaletteRedForeground2,
|
|
30
27
|
},
|
|
31
28
|
},
|
|
32
29
|
},
|
|
33
30
|
},
|
|
34
31
|
});
|
|
35
|
-
|
|
32
|
+
export const CommandMenuButton = memo(forwardRef(function CommandMenuButton({ Icon, items, text, danger, disabled, onClick }, ref) {
|
|
36
33
|
const styles = useStyles();
|
|
37
34
|
return (
|
|
38
35
|
// <div ref={ref}>
|
|
39
|
-
(
|
|
36
|
+
_jsxs(Menu, { hasIcons: true, positioning: "below-end", children: [onClick ? (_jsx(MenuTrigger, { disableButtonEnhancement: true, children: (triggerProps) => (_jsx(SplitButton, { ref: ref, icon: _jsx(Icon, { size: 20 }), appearance: "subtle", className: mergeClasses(styles.splitButton, danger && styles.splitButtonDanger), menuButton: triggerProps, disabled: disabled, children: text })) })) : (_jsx(MenuTrigger, { disableButtonEnhancement: true, children: _jsx(MenuButton, { ref: ref, appearance: "subtle", icon: _jsx(Icon, { size: 20 }), className: mergeClasses(styles.menuButton), children: text }) })), _jsx(MenuPopover, { children: _jsx(MenuList, { items: items }) })] })
|
|
40
37
|
// </div>
|
|
41
38
|
);
|
|
42
39
|
}));
|
|
43
|
-
|
|
40
|
+
CommandMenuButton.displayName = 'CommandMenuButton';
|
package/CommandBar/MenuItem.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const MenuList_1 = require("./MenuList");
|
|
8
|
-
const useStyles = (0, react_components_1.makeStyles)({
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { makeStyles, Menu, MenuItem as InternalMenuItem, MenuPopover, MenuSplitGroup, MenuTrigger, mergeClasses, tokens, } from '@fluentui/react-components';
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { MenuList } from './MenuList';
|
|
5
|
+
const useStyles = makeStyles({
|
|
9
6
|
splitMenuRight: {
|
|
10
7
|
'& .fui-MenuItem__icon': {
|
|
11
8
|
display: 'none',
|
|
@@ -13,26 +10,26 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
13
10
|
},
|
|
14
11
|
danger: {
|
|
15
12
|
'&:hover': {
|
|
16
|
-
color:
|
|
17
|
-
background:
|
|
13
|
+
color: tokens.colorPaletteRedForeground1,
|
|
14
|
+
background: tokens.colorPaletteRedBackground1,
|
|
18
15
|
'& .fui-MenuItem__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-MenuItem__icon': {
|
|
25
|
-
color:
|
|
22
|
+
color: tokens.colorPaletteRedForeground2,
|
|
26
23
|
},
|
|
27
24
|
},
|
|
28
25
|
},
|
|
29
26
|
},
|
|
30
27
|
});
|
|
31
|
-
|
|
28
|
+
export const MenuItem = memo(({ Icon, text, disabled, danger, onClick, items }) => {
|
|
32
29
|
const styles = useStyles();
|
|
33
30
|
if (!(items === null || items === void 0 ? void 0 : items.length)) {
|
|
34
|
-
return ((
|
|
31
|
+
return (_jsx(InternalMenuItem, { disabled: disabled, onClick: onClick, icon: _jsx(Icon, { size: 20 }), className: mergeClasses(danger && styles.danger), children: text }));
|
|
35
32
|
}
|
|
36
|
-
return ((
|
|
33
|
+
return (_jsxs(Menu, { hasIcons: true, children: [onClick ? (_jsxs(MenuSplitGroup, { children: [_jsx(InternalMenuItem, { icon: _jsx(Icon, { size: 20 }), className: mergeClasses(danger && styles.danger), children: text }), _jsx(MenuTrigger, { disableButtonEnhancement: true, children: _jsx(InternalMenuItem, { className: mergeClasses(styles.splitMenuRight) }) })] })) : (_jsx(MenuTrigger, { disableButtonEnhancement: true, children: _jsx(InternalMenuItem, { icon: _jsx(Icon, { size: 20 }), children: text }) })), _jsx(MenuPopover, { children: _jsx(MenuList, { items: items }) })] }));
|
|
37
34
|
});
|
|
38
|
-
|
|
35
|
+
MenuItem.displayName = 'MenuItem';
|
package/CommandBar/MenuItems.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const MenuItem_1 = require("./MenuItem");
|
|
8
|
-
exports.MenuItems = (0, react_1.memo)(({ items }) => {
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: items === null || items === void 0 ? void 0 : items.map((group, index) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [index > 0 && (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, {}), group.map((item, index) => {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { MenuDivider } from '@fluentui/react-components';
|
|
3
|
+
import { Fragment, memo } from 'react';
|
|
4
|
+
import { MenuItem } from './MenuItem';
|
|
5
|
+
export const MenuItems = memo(({ items }) => {
|
|
6
|
+
return (_jsx(Fragment, { children: items === null || items === void 0 ? void 0 : items.map((group, index) => (_jsxs(Fragment, { children: [index > 0 && _jsx(MenuDivider, {}), group.map((item, index) => {
|
|
10
7
|
var _a;
|
|
11
|
-
return ((
|
|
8
|
+
return (_jsx(MenuItem, { Icon: item.Icon, onClick: item.onClick, text: item.text, danger: item.danger, disabled: item.disabled, items: item.items }, ((_a = item.text) !== null && _a !== void 0 ? _a : '') + index));
|
|
12
9
|
})] }, index))) }));
|
|
13
10
|
});
|
|
14
|
-
|
|
11
|
+
MenuItems.displayName = 'MenuItems';
|
package/CommandBar/MenuList.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.MenuList = (0, react_1.memo)(({ items }) => {
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: !(items === null || items === void 0 ? void 0 : items.length) ? ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { style: {
|
|
10
|
-
color: react_components_1.tokens.colorNeutralForegroundDisabled,
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MenuItem, MenuList as InternalMenuList, tokens, } from '@fluentui/react-components';
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { MenuItems } from './MenuItems';
|
|
5
|
+
export const MenuList = memo(({ items }) => {
|
|
6
|
+
return (_jsx(InternalMenuList, { children: !(items === null || items === void 0 ? void 0 : items.length) ? (_jsx(MenuItem, { style: {
|
|
7
|
+
color: tokens.colorNeutralForegroundDisabled,
|
|
11
8
|
fontStyle: 'italic',
|
|
12
|
-
}, children: "No items" })) : ((
|
|
9
|
+
}, children: "No items" })) : (_jsx(MenuItems, { items: items })) }));
|
|
13
10
|
});
|
|
14
|
-
|
|
11
|
+
MenuList.displayName = 'MenuList';
|
package/CommandBar/Wrapper.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, Toolbar, } from '@fluentui/react-components';
|
|
3
|
+
import { forwardRef, memo, } from 'react';
|
|
4
|
+
const useStyles = makeStyles({
|
|
8
5
|
root: {
|
|
9
6
|
flexWrap: 'nowrap',
|
|
10
7
|
minWidth: 0,
|
|
@@ -17,8 +14,8 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
17
14
|
overflow: 'auto',
|
|
18
15
|
},
|
|
19
16
|
});
|
|
20
|
-
|
|
17
|
+
export const CommandBarWrapper = memo(forwardRef(function CommandBarWrapper({ children, overflow, className, align = 'start' }, ref) {
|
|
21
18
|
const styles = useStyles();
|
|
22
|
-
return ((
|
|
19
|
+
return (_jsx(Toolbar, { ref: ref, style: { justifyContent: 'flex-' + align }, className: mergeClasses(styles.root, overflow === 'hidden' ? styles.overflowHidden : styles.overflowAuto, className), children: children }));
|
|
23
20
|
}));
|
|
24
|
-
|
|
21
|
+
CommandBarWrapper.displayName = 'CommandBarWrapper';
|
package/CommandBar/index.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const MenuButton_1 = require("./MenuButton");
|
|
8
|
-
const Wrapper_1 = require("./Wrapper");
|
|
1
|
+
import { CommandButton } from './Button';
|
|
2
|
+
import { CommandDivider } from './Divider';
|
|
3
|
+
import { CommandIconButton } from './IconButton';
|
|
4
|
+
import { CommandLabel } from './Label';
|
|
5
|
+
import { CommandMenuButton } from './MenuButton';
|
|
6
|
+
import { CommandBarWrapper } from './Wrapper';
|
|
9
7
|
const CommandBar = {
|
|
10
|
-
Wrapper:
|
|
11
|
-
Button:
|
|
12
|
-
MenuButton:
|
|
13
|
-
Divider:
|
|
14
|
-
IconButton:
|
|
15
|
-
Label:
|
|
8
|
+
Wrapper: CommandBarWrapper,
|
|
9
|
+
Button: CommandButton,
|
|
10
|
+
MenuButton: CommandMenuButton,
|
|
11
|
+
Divider: CommandDivider,
|
|
12
|
+
IconButton: CommandIconButton,
|
|
13
|
+
Label: CommandLabel,
|
|
16
14
|
};
|
|
17
|
-
|
|
15
|
+
export default CommandBar;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
function SectionControlWrapper(props) {
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.Field, { label: props.label, orientation: props.labelPosition === 'top' ? 'vertical' : 'horizontal', required: props.required, validationState: props.isError ? 'error' : undefined, validationMessage: props.errorMessage, validationMessageIcon: null, children: props.children }));
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Field } from '@fluentui/react-components';
|
|
3
|
+
export function SectionControlWrapper(props) {
|
|
4
|
+
return (_jsx(Field, { label: props.label, orientation: props.labelPosition === 'top' ? 'vertical' : 'horizontal', required: props.required, validationState: props.isError ? 'error' : undefined, validationMessage: props.errorMessage, validationMessageIcon: null, children: props.children }));
|
|
8
5
|
}
|
package/DataGrid/ActionCell.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const transformedCommands = (0, mutable_1.useMutableStateSelector)(mutableState, (state) => state);
|
|
12
|
-
const { language } = (0, locale_1.useLocale)();
|
|
13
|
-
return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellAction, { onOpen: onOpen, items: transformedCommands.map((item) => (0, OverflowCommandBar_1.transformMenuItems)(item, language)) }));
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useLocale } from '@headless-adminapp/app/locale';
|
|
3
|
+
import { useMutableStateSelector, } from '@headless-adminapp/app/mutable';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { TableCellAction } from '../DataGrid/TableCell';
|
|
6
|
+
import { transformMenuItems } from '../OverflowCommandBar';
|
|
7
|
+
export const ActionCell = memo(function ActionCell({ onOpen, mutableState, }) {
|
|
8
|
+
const transformedCommands = useMutableStateSelector(mutableState, (state) => state);
|
|
9
|
+
const { language } = useLocale();
|
|
10
|
+
return (_jsx(TableCellAction, { onOpen: onOpen, items: transformedCommands.map((item) => transformMenuItems(item, language)) }));
|
|
14
11
|
});
|
|
15
|
-
|
|
12
|
+
ActionCell.displayName = 'ActionCell';
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const CommandContainer = () => {
|
|
8
|
-
const gridCommands = (0, hooks_1.useMainGridCommands)();
|
|
9
|
-
return (0, jsx_runtime_1.jsx)(OverflowCommandBar_1.OverflowCommandBar, { commands: gridCommands });
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMainGridCommands } from '@headless-adminapp/app/datagrid/hooks';
|
|
3
|
+
import { OverflowCommandBar } from '../OverflowCommandBar';
|
|
4
|
+
export const CommandContainer = () => {
|
|
5
|
+
const gridCommands = useMainGridCommands();
|
|
6
|
+
return _jsx(OverflowCommandBar, { commands: gridCommands });
|
|
10
7
|
};
|
|
11
|
-
exports.CommandContainer = CommandContainer;
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
14
|
-
const PageEntityViewStringContext_1 = require("../../PageEntityView/PageEntityViewStringContext");
|
|
15
|
-
function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, }) {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Checkbox, Divider, Drawer, DrawerBody, DrawerHeader, DrawerHeaderTitle, Dropdown, Input, Option, tokens, } from '@fluentui/react-components';
|
|
3
|
+
import { transformViewColumns, } from '@headless-adminapp/app/datagrid';
|
|
4
|
+
import { useDataGridSchema } from '@headless-adminapp/app/datagrid/hooks';
|
|
5
|
+
import { useLocale } from '@headless-adminapp/app/locale';
|
|
6
|
+
import { localizedLabel } from '@headless-adminapp/app/locale/utils';
|
|
7
|
+
import { useMetadata } from '@headless-adminapp/app/metadata/hooks';
|
|
8
|
+
import { Icons } from '@headless-adminapp/icons';
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
import { useAppStrings } from '../../App/AppStringContext';
|
|
11
|
+
import { usePageEntityViewStrings } from '../../PageEntityView/PageEntityViewStringContext';
|
|
12
|
+
export function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, }) {
|
|
16
13
|
var _a;
|
|
17
|
-
const schema =
|
|
18
|
-
const { schemaStore } =
|
|
19
|
-
const { language } =
|
|
20
|
-
const strings =
|
|
21
|
-
const appStrings =
|
|
14
|
+
const schema = useDataGridSchema();
|
|
15
|
+
const { schemaStore } = useMetadata();
|
|
16
|
+
const { language } = useLocale();
|
|
17
|
+
const strings = usePageEntityViewStrings();
|
|
18
|
+
const appStrings = useAppStrings();
|
|
22
19
|
const lookupAttributes = Object.entries(schema.attributes)
|
|
23
20
|
.map(([key, attribute]) => ({
|
|
24
21
|
key,
|
|
@@ -26,20 +23,20 @@ function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, })
|
|
|
26
23
|
}))
|
|
27
24
|
.filter(({ attribute }) => attribute.type === 'lookup');
|
|
28
25
|
const columnGroups = Object.assign({ root: {
|
|
29
|
-
label:
|
|
30
|
-
columns:
|
|
26
|
+
label: localizedLabel(language, schema),
|
|
27
|
+
columns: transformViewColumns(schema.logicalName, Object.keys(schema.attributes).map((key) => ({
|
|
31
28
|
name: key,
|
|
32
29
|
})), schemaStore, language),
|
|
33
30
|
} }, lookupAttributes.reduce((acc, { key, attribute }) => {
|
|
34
31
|
const lookupSchema = schemaStore.getSchema(attribute.entity);
|
|
35
|
-
const columns =
|
|
32
|
+
const columns = transformViewColumns(schema.logicalName, Object.keys(lookupSchema.attributes).map((nestedKey) => ({
|
|
36
33
|
name: key,
|
|
37
34
|
expandedKey: nestedKey,
|
|
38
35
|
})), schemaStore, language);
|
|
39
36
|
acc[key] = {
|
|
40
|
-
label:
|
|
37
|
+
label: localizedLabel(language, attribute) +
|
|
41
38
|
' (' +
|
|
42
|
-
|
|
39
|
+
localizedLabel(language, lookupSchema) +
|
|
43
40
|
')',
|
|
44
41
|
columns,
|
|
45
42
|
};
|
|
@@ -49,33 +46,33 @@ function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, })
|
|
|
49
46
|
key,
|
|
50
47
|
label: group.label,
|
|
51
48
|
}));
|
|
52
|
-
const [selectedGroup, setSelectedGroup] =
|
|
49
|
+
const [selectedGroup, setSelectedGroup] = useState('root');
|
|
53
50
|
const selectedGroupItem = tableItems.find((x) => x.key === selectedGroup);
|
|
54
51
|
const availableColumns = columnGroups[selectedGroup].columns;
|
|
55
|
-
const [searchText, setSearchText] =
|
|
52
|
+
const [searchText, setSearchText] = useState('');
|
|
56
53
|
const filteredColumns = availableColumns.filter((column) => column.label.toLowerCase().includes(searchText.toLowerCase()));
|
|
57
54
|
const includedColumnsObj = columns.reduce((acc, column) => {
|
|
58
55
|
acc[column.id] = true;
|
|
59
56
|
return acc;
|
|
60
57
|
}, {});
|
|
61
|
-
return ((
|
|
58
|
+
return (_jsxs(Drawer, { separator: true, open: opened, position: "end", children: [_jsx(DrawerHeader, { children: _jsx(DrawerHeaderTitle, { action: _jsx(Button, { appearance: "subtle", "aria-label": "Close", icon: _jsx(Icons.Close, {}), onClick: onClose }), children: strings.addColumns }) }), _jsxs("div", { style: { width: '100%', display: 'flex', flexDirection: 'column' }, children: [_jsxs("div", { style: {
|
|
62
59
|
display: 'flex',
|
|
63
60
|
flexDirection: 'column-reverse',
|
|
64
61
|
gap: 8,
|
|
65
|
-
marginBottom:
|
|
66
|
-
paddingInline:
|
|
67
|
-
}, children: [(
|
|
62
|
+
marginBottom: tokens.spacingVerticalXS,
|
|
63
|
+
paddingInline: tokens.spacingHorizontalS,
|
|
64
|
+
}, children: [_jsx(Input, { contentBefore: _jsx(Icons.Search, { size: 16 }), placeholder: appStrings.searchPlaceholder, value: searchText, onChange: (e) => setSearchText(e.target.value) }), _jsx(Dropdown, { value: (_a = selectedGroupItem === null || selectedGroupItem === void 0 ? void 0 : selectedGroupItem.label) !== null && _a !== void 0 ? _a : '', selectedOptions: selectedGroupItem ? [String(selectedGroupItem.key)] : [], onOptionSelect: (event, data) => {
|
|
68
65
|
setSelectedGroup(data.optionValue);
|
|
69
66
|
}, style: { flex: 1, minWidth: 'unset' }, positioning: {
|
|
70
67
|
align: 'bottom',
|
|
71
68
|
position: 'below',
|
|
72
|
-
}, children: tableItems.map((x) => ((
|
|
69
|
+
}, children: tableItems.map((x) => (_jsx(Option, { value: x.key, children: x.label }, x.key))) })] }), _jsx(Divider, {})] }), _jsx(DrawerBody, { style: { paddingInline: 0 }, children: filteredColumns.map((column) => {
|
|
73
70
|
var _a;
|
|
74
|
-
return ((
|
|
75
|
-
fontWeight:
|
|
71
|
+
return (_jsx(Button, { appearance: "transparent", icon: _jsx(Checkbox, { checked: (_a = includedColumnsObj[column.id]) !== null && _a !== void 0 ? _a : false }), style: {
|
|
72
|
+
fontWeight: tokens.fontSizeBase400,
|
|
76
73
|
width: '100%',
|
|
77
74
|
justifyContent: 'flex-start',
|
|
78
|
-
paddingInline:
|
|
75
|
+
paddingInline: tokens.spacingHorizontalS,
|
|
79
76
|
}, onClick: () => {
|
|
80
77
|
if (includedColumnsObj[column.id]) {
|
|
81
78
|
onColumnRemove(column);
|
|
@@ -84,10 +81,10 @@ function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, })
|
|
|
84
81
|
onColumnAdd(column);
|
|
85
82
|
}
|
|
86
83
|
}, children: column.label }, column.id));
|
|
87
|
-
}) }), (
|
|
84
|
+
}) }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: [_jsx(Divider, {}), _jsx("div", { style: {
|
|
88
85
|
display: 'flex',
|
|
89
86
|
padding: 8,
|
|
90
87
|
gap: 8,
|
|
91
88
|
justifyContent: 'flex-end',
|
|
92
|
-
}, children: (
|
|
89
|
+
}, children: _jsx(Button, { onClick: onClose, children: strings.close }) })] })] }));
|
|
93
90
|
}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const react_dnd_1 = require("react-dnd");
|
|
9
|
-
exports.ItemTypes = {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Body1, Button, Menu, MenuItem, MenuList, MenuPopover, MenuTrigger, tokens, } from '@fluentui/react-components';
|
|
3
|
+
import { Icons } from '@headless-adminapp/icons';
|
|
4
|
+
import { useRef } from 'react';
|
|
5
|
+
import { useDrag, useDrop } from 'react-dnd';
|
|
6
|
+
export const ItemTypes = {
|
|
10
7
|
CARD: 'column',
|
|
11
8
|
};
|
|
12
|
-
const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSet = {}, // defaultCustomizeColumnStrings,
|
|
9
|
+
export const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSet = {}, // defaultCustomizeColumnStrings,
|
|
13
10
|
}) => {
|
|
14
|
-
const ref =
|
|
15
|
-
const [{ handlerId }, drop] =
|
|
16
|
-
accept:
|
|
11
|
+
const ref = useRef(null);
|
|
12
|
+
const [{ handlerId }, drop] = useDrop({
|
|
13
|
+
accept: ItemTypes.CARD,
|
|
17
14
|
collect(monitor) {
|
|
18
15
|
return {
|
|
19
16
|
handlerId: monitor.getHandlerId(),
|
|
@@ -58,8 +55,8 @@ const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSe
|
|
|
58
55
|
item.index = hoverIndex;
|
|
59
56
|
},
|
|
60
57
|
});
|
|
61
|
-
const [{ isDragging }, drag] =
|
|
62
|
-
type:
|
|
58
|
+
const [{ isDragging }, drag] = useDrag({
|
|
59
|
+
type: ItemTypes.CARD,
|
|
63
60
|
item: () => {
|
|
64
61
|
return { id: item.id, index };
|
|
65
62
|
},
|
|
@@ -69,20 +66,19 @@ const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSe
|
|
|
69
66
|
});
|
|
70
67
|
const opacity = isDragging ? 0 : 1;
|
|
71
68
|
drag(drop(ref));
|
|
72
|
-
return ((
|
|
73
|
-
background:
|
|
74
|
-
paddingBlock:
|
|
75
|
-
paddingLeft:
|
|
69
|
+
return (_jsxs("div", { ref: ref, style: {
|
|
70
|
+
background: tokens.colorNeutralBackground4,
|
|
71
|
+
paddingBlock: tokens.spacingVerticalXS,
|
|
72
|
+
paddingLeft: tokens.spacingHorizontalS,
|
|
76
73
|
cursor: 'move',
|
|
77
74
|
opacity,
|
|
78
|
-
borderRadius:
|
|
75
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
79
76
|
display: 'flex',
|
|
80
77
|
flexDirection: 'row',
|
|
81
78
|
alignItems: 'center',
|
|
82
|
-
}, "data-handler-id": handlerId, children: [(
|
|
79
|
+
}, "data-handler-id": handlerId, children: [_jsx(Body1, { style: { flex: 1 }, children: item.label }), _jsxs(Menu, { positioning: "below-start", children: [_jsx(MenuTrigger, { children: _jsx(Button, { icon: _jsx(Icons.MoreVertical, {}), appearance: "transparent", size: "small" }) }), _jsx(MenuPopover, { children: _jsxs(MenuList, { children: [_jsx(MenuItem, { icon: _jsx(Icons.Delete, {}), onClick: onRemove, children: stringSet.remove }), !isFirst && (_jsx(MenuItem, { icon: _jsx(Icons.Add, {}), onClick: () => {
|
|
83
80
|
moveItem(index, index - 1);
|
|
84
|
-
}, children: stringSet.moveUp })), !isLast && ((
|
|
81
|
+
}, children: stringSet.moveUp })), !isLast && (_jsx(MenuItem, { icon: _jsx(Icons.Add, {}), onClick: () => {
|
|
85
82
|
moveItem(index, index + 1);
|
|
86
83
|
}, children: stringSet.moveDown }))] }) })] })] }));
|
|
87
84
|
};
|
|
88
|
-
exports.ColumnItem = ColumnItem;
|