@headless-adminapp/fluent 1.4.11 → 1.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App/AppHeaderContianer.js +105 -49
- package/App/QuickActionItem.d.ts +1 -0
- package/App/QuickActionItem.js +7 -3
- package/DataGrid/MobileHeaderRightContainer.d.ts +2 -0
- package/DataGrid/MobileHeaderRightContainer.js +11 -0
- package/DataGrid/TableCell/TableCellBase.d.ts +2 -0
- package/DataGrid/TableCell/TableCellBase.js +2 -2
- package/DataGrid/TableCell/TableCellChoice.d.ts +3 -1
- package/DataGrid/TableCell/TableCellChoice.js +1 -1
- package/DataGrid/TableCell/TableCellLink.d.ts +3 -1
- package/DataGrid/TableCell/TableCellLink.js +2 -2
- package/DataGrid/TableCell/TableCellText.d.ts +3 -1
- package/DataGrid/TableCell/TableCellText.js +2 -2
- package/DataGrid/useTableColumns.d.ts +18 -0
- package/DataGrid/useTableColumns.js +27 -20
- package/Header/MobileHeaderCommandContainer.d.ts +7 -0
- package/Header/MobileHeaderCommandContainer.js +167 -0
- package/Header/MobileHeaderQuickActionButton.d.ts +10 -0
- package/Header/MobileHeaderQuickActionButton.js +36 -0
- package/Insights/Header.js +1 -1
- package/Insights/WidgetTableContainer.d.ts +7 -0
- package/Insights/WidgetTableContainer.js +62 -30
- package/Insights/WidgetTitleBar.d.ts +2 -1
- package/Insights/WidgetTitleBar.js +3 -3
- package/PageEntityForm/CommandContainer.js +3 -3
- package/PageEntityForm/MobileHeaderRightContainer.d.ts +2 -0
- package/PageEntityForm/MobileHeaderRightContainer.js +11 -0
- package/PageEntityForm/MobileHeaderTitleContainer.d.ts +2 -0
- package/PageEntityForm/MobileHeaderTitleContainer.js +38 -0
- package/PageEntityForm/PageEntityForm.js +2 -0
- package/PageEntityForm/PageEntityFormDesktopContainer.js +89 -74
- package/PageEntityForm/TabContainer.d.ts +2 -0
- package/PageEntityForm/TabContainer.js +35 -0
- package/PageEntityView/PageEntityView.js +4 -1
- package/PageEntityView/PageEntityViewMobileContainer.js +1 -2
- package/PageEntityView/PageEntityViewMobileFrame.d.ts +0 -1
- package/PageEntityView/PageEntityViewMobileFrame.js +25 -23
- package/ToastNotificationContainer/index.js +7 -5
- package/components/ChoiceBadge.js +4 -1
- package/components/DialogLogin.js +1 -1
- package/components/PageLogin.js +22 -2
- package/form/layout/FormBody/FormBody.js +16 -1
- package/package.json +2 -2
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileHeaderCommandContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const MobileHeaderRightContent_1 = require("@headless-adminapp/app/header/components/MobileHeaderRightContent");
|
|
7
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const QuickActionItem_1 = require("../App/QuickActionItem");
|
|
10
|
+
const MobileHeaderQuickActionButton_1 = require("./MobileHeaderQuickActionButton");
|
|
11
|
+
const useStyles = (0, react_components_1.makeStyles)({
|
|
12
|
+
dangerMenuItem: {
|
|
13
|
+
color: react_components_1.tokens.colorStatusDangerForeground1,
|
|
14
|
+
'&:hover': {
|
|
15
|
+
backgroundColor: react_components_1.tokens.colorStatusDangerBackground3Hover,
|
|
16
|
+
},
|
|
17
|
+
'&:active': {
|
|
18
|
+
backgroundColor: react_components_1.tokens.colorStatusDangerBackground3Pressed,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
function isQuickAction(command) {
|
|
23
|
+
if (command.type === 'button') {
|
|
24
|
+
return command.isQuickAction ?? false;
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
const MobileHeaderCommandContainer = ({ commands }) => {
|
|
29
|
+
const [showMoreActions, setShowMoreActions] = (0, react_1.useState)(false);
|
|
30
|
+
const quickActions = (0, react_1.useMemo)(() => {
|
|
31
|
+
return commands.flat().filter((command) => isQuickAction(command));
|
|
32
|
+
}, [commands]);
|
|
33
|
+
const moreActions = (0, react_1.useMemo)(() => {
|
|
34
|
+
return commands
|
|
35
|
+
.map((group) => {
|
|
36
|
+
return group.filter((command) => {
|
|
37
|
+
if (isQuickAction(command)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (command.type === 'icon') {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
});
|
|
45
|
+
})
|
|
46
|
+
.filter((group) => group.length > 0);
|
|
47
|
+
}, [commands]);
|
|
48
|
+
return ((0, jsx_runtime_1.jsxs)(MobileHeaderRightContent_1.MobileHeaderRightContent, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
49
|
+
paddingLeft: 8,
|
|
50
|
+
display: 'flex',
|
|
51
|
+
gap: 16,
|
|
52
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', gap: 8 }, children: [quickActions.map((command, index) => {
|
|
53
|
+
if (command.hidden || command.type !== 'button') {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(MobileHeaderQuickActionButton_1.MobileHeaderQuickActionButton, { title: command.text, Icon: command.Icon, onClick: command.onClick }, index));
|
|
57
|
+
}), moreActions.length > 0 && ((0, jsx_runtime_1.jsx)(QuickActionItem_1.QuickActionItem, { Icon: icons_1.Icons.MoreVertical, label: "More Actions", onClick: () => setShowMoreActions(true) }))] }) }), (0, jsx_runtime_1.jsx)(BottomDrawerMenu, { open: showMoreActions, onClose: () => setShowMoreActions(false), actions: moreActions })] }));
|
|
58
|
+
};
|
|
59
|
+
exports.MobileHeaderCommandContainer = MobileHeaderCommandContainer;
|
|
60
|
+
const BottomDrawerMenu = ({ open, onClose, actions, }) => {
|
|
61
|
+
const [subMenuStack, setSubMenuStack] = (0, react_1.useState)([]);
|
|
62
|
+
(0, react_1.useEffect)(() => {
|
|
63
|
+
setSubMenuStack([]);
|
|
64
|
+
}, [open]);
|
|
65
|
+
const pushStack = (items) => {
|
|
66
|
+
setSubMenuStack((prev) => [items, ...prev]);
|
|
67
|
+
};
|
|
68
|
+
const popStack = () => {
|
|
69
|
+
setSubMenuStack((prev) => {
|
|
70
|
+
if (prev.length > 1) {
|
|
71
|
+
return prev.slice(1);
|
|
72
|
+
}
|
|
73
|
+
return [];
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Drawer, { separator: true, open: open, position: "bottom", size: "small", style: {
|
|
77
|
+
borderTopLeftRadius: react_components_1.tokens.borderRadiusXLarge,
|
|
78
|
+
borderTopRightRadius: react_components_1.tokens.borderRadiusXLarge,
|
|
79
|
+
height: 'unset',
|
|
80
|
+
}, onOpenChange: () => { }, children: (0, jsx_runtime_1.jsxs)(react_components_1.DrawerBody, { style: {
|
|
81
|
+
maxHeight: '70vh',
|
|
82
|
+
padding: 0,
|
|
83
|
+
overflowY: 'hidden',
|
|
84
|
+
display: 'flex',
|
|
85
|
+
flexDirection: 'column',
|
|
86
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
87
|
+
paddingInline: react_components_1.tokens.spacingHorizontalM,
|
|
88
|
+
paddingBlock: react_components_1.tokens.spacingVerticalS,
|
|
89
|
+
boxShadow: react_components_1.tokens.shadow2,
|
|
90
|
+
zIndex: 1,
|
|
91
|
+
display: 'flex',
|
|
92
|
+
justifyContent: 'space-between',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
}, children: [subMenuStack.length ? ((0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronLeft, { size: 20 }), appearance: "subtle", onClick: popStack })) : ((0, jsx_runtime_1.jsx)("div", {})), !subMenuStack.length && ((0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Close, { size: 20 }), appearance: "subtle", onClick: onClose }))] }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
95
|
+
overflowY: 'auto',
|
|
96
|
+
overflowX: 'hidden',
|
|
97
|
+
}, children: [!subMenuStack.length && ((0, jsx_runtime_1.jsx)(react_components_1.MenuList, { hasIcons: true, style: { gap: 0 }, children: actions.map((group, groupIndex) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [groupIndex > 0 && ((0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, { style: { opacity: 0.2, margin: '0px 5px' } })), group.map((item, index) => {
|
|
98
|
+
if (item.hidden) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
if (item.type === 'button') {
|
|
102
|
+
return ((0, jsx_runtime_1.jsx)(ButtonItem, { text: item.text, Icon: item.Icon, danger: item.danger, onClick: () => {
|
|
103
|
+
onClose();
|
|
104
|
+
item.onClick?.();
|
|
105
|
+
} }, `${groupIndex}-${index}`));
|
|
106
|
+
}
|
|
107
|
+
if (item.type === 'menu') {
|
|
108
|
+
return ((0, jsx_runtime_1.jsx)(NavigationMenu, { text: item.text, Icon: item.Icon, danger: item.danger, showDivider: item.items.length > 0 && !!item.onClick, showNavigateButton: item.items.length > 0, onNavigate: () => {
|
|
109
|
+
pushStack(item.items);
|
|
110
|
+
}, onClick: () => {
|
|
111
|
+
if (item.onClick) {
|
|
112
|
+
onClose();
|
|
113
|
+
item.onClick();
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
pushStack(item.items);
|
|
117
|
+
}
|
|
118
|
+
} }, `${groupIndex}-${index}`));
|
|
119
|
+
}
|
|
120
|
+
})] }, groupIndex))) })), subMenuStack.length > 0 && ((0, jsx_runtime_1.jsx)(react_components_1.MenuList, { hasIcons: true, style: { gap: 0 }, children: subMenuStack[0].map((group, groupIndex) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [groupIndex > 0 && ((0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, { style: { opacity: 0.2, margin: '0px 5px' } })), group.map((item, index) => {
|
|
121
|
+
if (item.hidden) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
return ((0, jsx_runtime_1.jsx)(NavigationMenu, { text: item.text, Icon: item.Icon, danger: item.danger, showDivider: !!item.items?.length && !!item.onClick, showNavigateButton: !!item.items?.length, onNavigate: () => {
|
|
125
|
+
if (!item.items?.length) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
pushStack(item.items);
|
|
129
|
+
}, onClick: () => {
|
|
130
|
+
if (item.onClick) {
|
|
131
|
+
onClose();
|
|
132
|
+
item.onClick();
|
|
133
|
+
}
|
|
134
|
+
else if (item.items?.length) {
|
|
135
|
+
pushStack(item.items);
|
|
136
|
+
}
|
|
137
|
+
} }, `${groupIndex}-${index}`));
|
|
138
|
+
})] }, groupIndex))) }))] })] }) }));
|
|
139
|
+
};
|
|
140
|
+
const NavigationMenu = ({ Icon, danger, text, onClick, onNavigate, showDivider, showNavigateButton, }) => {
|
|
141
|
+
const styles = useStyles();
|
|
142
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: Icon ? (0, jsx_runtime_1.jsx)(Icon, { size: 20 }) : (0, jsx_runtime_1.jsx)(icons_1.IconPlaceholder, { size: 20 }), className: (0, react_components_1.mergeClasses)(danger && styles.dangerMenuItem), style: {
|
|
143
|
+
maxWidth: 'unset',
|
|
144
|
+
minHeight: 48,
|
|
145
|
+
alignItems: 'center',
|
|
146
|
+
paddingInline: react_components_1.tokens.spacingHorizontalM,
|
|
147
|
+
}, onClick: () => {
|
|
148
|
+
onClick?.();
|
|
149
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
150
|
+
display: 'flex',
|
|
151
|
+
flexDirection: 'row',
|
|
152
|
+
alignItems: 'center',
|
|
153
|
+
gap: 8,
|
|
154
|
+
}, children: [(0, jsx_runtime_1.jsx)("span", { style: { flex: 1 }, children: text }), showNavigateButton && showDivider && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { vertical: true, style: { opacity: 0.5, height: '100%' } }) })), showNavigateButton && ((0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronRight, { size: 20 }), onClick: (e) => {
|
|
155
|
+
e.stopPropagation();
|
|
156
|
+
onNavigate?.();
|
|
157
|
+
}, appearance: "subtle" }))] }) }));
|
|
158
|
+
};
|
|
159
|
+
const ButtonItem = ({ Icon, danger, text, onClick }) => {
|
|
160
|
+
const styles = useStyles();
|
|
161
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: Icon ? (0, jsx_runtime_1.jsx)(Icon, { size: 20 }) : (0, jsx_runtime_1.jsx)(icons_1.IconPlaceholder, { size: 20 }), className: (0, react_components_1.mergeClasses)(danger && styles.dangerMenuItem), style: {
|
|
162
|
+
maxWidth: 'unset',
|
|
163
|
+
minHeight: 48,
|
|
164
|
+
alignItems: 'center',
|
|
165
|
+
paddingInline: react_components_1.tokens.spacingHorizontalM,
|
|
166
|
+
}, onClick: onClick, children: text }));
|
|
167
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Icon } from '@headless-adminapp/icons';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
interface MobileHeaderQuickActionButtonProps {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
title: string;
|
|
6
|
+
Icon: Icon;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const MobileHeaderQuickActionButton: FC<MobileHeaderQuickActionButtonProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileHeaderQuickActionButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const useStyles = (0, react_components_1.makeStyles)({
|
|
7
|
+
root: {
|
|
8
|
+
color: 'inherit !important',
|
|
9
|
+
background: 'rgba(0, 0, 0, 0)',
|
|
10
|
+
transition: 'background 0.3s',
|
|
11
|
+
'&:hover:enabled': {
|
|
12
|
+
color: 'rgba(255, 255, 255, 1)',
|
|
13
|
+
background: 'rgba(0, 0, 0, 0.1)',
|
|
14
|
+
},
|
|
15
|
+
'&:active:enabled': {
|
|
16
|
+
color: 'rgba(255, 255, 255, 1)',
|
|
17
|
+
background: 'rgba(0, 0, 0, 0.2)',
|
|
18
|
+
},
|
|
19
|
+
'&:focus:enabled': {
|
|
20
|
+
color: 'rgba(255, 255, 255, 1)',
|
|
21
|
+
background: 'rgba(0, 0, 0, 0.2)',
|
|
22
|
+
},
|
|
23
|
+
'&:disabled': {
|
|
24
|
+
color: `${react_components_1.tokens.colorNeutralForegroundDisabled} !important`,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
const MobileHeaderQuickActionButton = ({ disabled, title, Icon, onClick }) => {
|
|
29
|
+
const styles = useStyles();
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(Icon, { size: "inherit" }), disabled: disabled, appearance: "transparent", style: {
|
|
31
|
+
position: 'relative',
|
|
32
|
+
fontWeight: react_components_1.tokens.fontWeightRegular,
|
|
33
|
+
minWidth: 'unset',
|
|
34
|
+
}, className: styles.root, onClick: onClick, children: title }));
|
|
35
|
+
};
|
|
36
|
+
exports.MobileHeaderQuickActionButton = MobileHeaderQuickActionButton;
|
package/Insights/Header.js
CHANGED
|
@@ -35,7 +35,7 @@ const Header = () => {
|
|
|
35
35
|
display: 'flex',
|
|
36
36
|
alignItems: 'center',
|
|
37
37
|
gap: react_components_1.tokens.spacingHorizontalM,
|
|
38
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Subtitle2, { style: { color: react_components_1.tokens.colorNeutralForeground1 }, children:
|
|
38
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Subtitle2, { style: { color: react_components_1.tokens.colorNeutralForeground1 }, children: config.title }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground2 }, children: config.subtitle })] }) }) }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
39
39
|
display: 'flex',
|
|
40
40
|
alignItems: 'center',
|
|
41
41
|
gap: react_components_1.tokens.spacingHorizontalS,
|
|
@@ -8,7 +8,14 @@ interface WidgetTableContainerProps {
|
|
|
8
8
|
isPending?: boolean;
|
|
9
9
|
isFetching?: boolean;
|
|
10
10
|
commands?: CommandItemState[][];
|
|
11
|
+
headerRightContent?: React.ReactNode;
|
|
11
12
|
data: any[];
|
|
12
13
|
}
|
|
13
14
|
export declare const WidgetTableContainer: FC<WidgetTableContainerProps>;
|
|
15
|
+
interface WidgetTableProps {
|
|
16
|
+
columns: string[];
|
|
17
|
+
attributes: Record<string, Attribute>;
|
|
18
|
+
data: any[];
|
|
19
|
+
}
|
|
20
|
+
export declare const WidgetTable: FC<WidgetTableProps>;
|
|
14
21
|
export {};
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WidgetTableContainer = void 0;
|
|
3
|
+
exports.WidgetTable = exports.WidgetTableContainer = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const locale_1 = require("@headless-adminapp/app/locale");
|
|
7
|
+
const metadata_1 = require("@headless-adminapp/app/metadata");
|
|
8
|
+
const route_1 = require("@headless-adminapp/app/route");
|
|
7
9
|
const utils_1 = require("@headless-adminapp/app/utils");
|
|
8
10
|
const BodyLoading_1 = require("../components/BodyLoading");
|
|
11
|
+
const TableCell_1 = require("../DataGrid/TableCell");
|
|
12
|
+
const TableCellChoice_1 = require("../DataGrid/TableCell/TableCellChoice");
|
|
13
|
+
const TableCellLink_1 = require("../DataGrid/TableCell/TableCellLink");
|
|
14
|
+
const useTableColumns_1 = require("../DataGrid/useTableColumns");
|
|
9
15
|
const WidgetSection_1 = require("./WidgetSection");
|
|
10
16
|
const WidgetTitleBar_1 = require("./WidgetTitleBar");
|
|
11
17
|
const useStyles = (0, react_components_1.makeStyles)({
|
|
@@ -35,35 +41,61 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
35
41
|
},
|
|
36
42
|
},
|
|
37
43
|
});
|
|
38
|
-
const WidgetTableContainer = ({ title, columns, attributes, isPending, isFetching, commands, data, }) => {
|
|
44
|
+
const WidgetTableContainer = ({ title, columns, attributes, isPending, isFetching, commands, headerRightContent, data, }) => {
|
|
45
|
+
return ((0, jsx_runtime_1.jsxs)(WidgetSection_1.WidgetSection, { children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: title, commands: commands, rightContent: headerRightContent }), (0, jsx_runtime_1.jsxs)("div", { style: { flex: 1, position: 'relative', overflow: 'auto' }, children: [!isPending && ((0, jsx_runtime_1.jsx)(exports.WidgetTable, { columns: columns, attributes: attributes, data: data })), (0, jsx_runtime_1.jsx)(BodyLoading_1.BodyLoading, { loading: isFetching })] })] }));
|
|
46
|
+
};
|
|
47
|
+
exports.WidgetTableContainer = WidgetTableContainer;
|
|
48
|
+
const WidgetTable = ({ columns, attributes, data, }) => {
|
|
39
49
|
const locale = (0, locale_1.useLocale)();
|
|
40
50
|
const styles = useStyles();
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
const router = (0, route_1.useRouter)();
|
|
52
|
+
const routeResolver = (0, route_1.useRouteResolver)();
|
|
53
|
+
const { schemaStore } = (0, metadata_1.useMetadata)();
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)(react_components_1.Table, { className: styles.table, children: [(0, jsx_runtime_1.jsx)(react_components_1.TableHeader, { style: {
|
|
55
|
+
position: 'sticky',
|
|
56
|
+
top: 0,
|
|
57
|
+
background: react_components_1.tokens.colorNeutralBackground3,
|
|
58
|
+
zIndex: 2,
|
|
59
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.TableRow, { style: {
|
|
60
|
+
position: 'sticky',
|
|
61
|
+
top: 0,
|
|
62
|
+
minWidth: 'calc(100% - 16px)',
|
|
63
|
+
}, children: columns.map((column, index) => {
|
|
64
|
+
const attribute = attributes[column];
|
|
65
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.TableHeaderCell, { align: "right", className: attribute?.type === 'money' ? styles.headerAlignRight : '', children: attribute.label }, column + String(index)));
|
|
66
|
+
}) }) }), (0, jsx_runtime_1.jsx)(react_components_1.TableBody, { children: data.map((row, index) => ((0, jsx_runtime_1.jsx)(react_components_1.TableRow, { children: columns.map((column) => {
|
|
67
|
+
const attribute = attributes[column];
|
|
68
|
+
const value = row[column];
|
|
69
|
+
const formattedValue = (0, utils_1.getAttributeFormattedValue)(attribute, value, locale) ?? '';
|
|
70
|
+
switch (attribute?.type) {
|
|
71
|
+
case 'money':
|
|
72
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { style: { textAlign: 'right' }, children: formattedValue }, column));
|
|
73
|
+
case 'lookup':
|
|
74
|
+
return (0, useTableColumns_1.renderLookupAttribute)({
|
|
75
|
+
column: {
|
|
76
|
+
id: column,
|
|
77
|
+
label: attribute.label,
|
|
78
|
+
name: column,
|
|
79
|
+
},
|
|
80
|
+
value,
|
|
81
|
+
attribute,
|
|
82
|
+
router,
|
|
83
|
+
routeResolver,
|
|
84
|
+
schemaStore,
|
|
85
|
+
formattedValue,
|
|
86
|
+
display: 'table-cell',
|
|
87
|
+
});
|
|
88
|
+
case 'choice':
|
|
89
|
+
return ((0, jsx_runtime_1.jsx)(TableCellChoice_1.TableCellChoice, { value: value, attribute: attribute, formattedValue: formattedValue, display: "table-cell" }, column));
|
|
90
|
+
case 'attachment': {
|
|
91
|
+
const url = value?.url;
|
|
92
|
+
if (!url) {
|
|
93
|
+
return (0, jsx_runtime_1.jsx)(TableCell_1.TableCellText, { value: "" }, column);
|
|
94
|
+
}
|
|
95
|
+
return ((0, jsx_runtime_1.jsx)(TableCellLink_1.TableCellLink, { value: formattedValue, href: url, target: "_blank", display: "table-cell" }, column));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return (0, jsx_runtime_1.jsx)(react_components_1.TableCell, { children: formattedValue }, column);
|
|
99
|
+
}) }, index))) })] }));
|
|
68
100
|
};
|
|
69
|
-
exports.
|
|
101
|
+
exports.WidgetTable = WidgetTable;
|
|
@@ -2,6 +2,7 @@ import { CommandItemState } from '@headless-adminapp/app/command';
|
|
|
2
2
|
interface WidgetTitleBarProps {
|
|
3
3
|
title: string;
|
|
4
4
|
commands?: CommandItemState[][];
|
|
5
|
+
rightContent?: React.ReactNode;
|
|
5
6
|
}
|
|
6
|
-
export declare function WidgetTitleBar({ title, commands, }: Readonly<WidgetTitleBarProps>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function WidgetTitleBar({ title, commands, rightContent, }: Readonly<WidgetTitleBarProps>): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -9,13 +9,13 @@ const react_components_1 = require("@fluentui/react-components");
|
|
|
9
9
|
const locale_1 = require("@headless-adminapp/app/locale");
|
|
10
10
|
const CommandBar_1 = __importDefault(require("../CommandBar"));
|
|
11
11
|
const OverflowCommandBar_1 = require("../OverflowCommandBar");
|
|
12
|
-
function WidgetTitleBar({ title, commands, }) {
|
|
12
|
+
function WidgetTitleBar({ title, commands, rightContent, }) {
|
|
13
13
|
const { language } = (0, locale_1.useLocale)();
|
|
14
14
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
15
15
|
display: 'flex',
|
|
16
|
-
|
|
16
|
+
paddingLeft: 16,
|
|
17
17
|
paddingBlock: 8,
|
|
18
18
|
height: 40,
|
|
19
19
|
alignItems: 'center',
|
|
20
|
-
}, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: title }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } }), !!commands && commands[0]?.length > 0 && ((0, jsx_runtime_1.jsx)(
|
|
20
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: title }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } }), rightContent, !!commands && commands[0]?.length > 0 && ((0, jsx_runtime_1.jsx)(CommandBar_1.default.Wrapper, { children: commands[0].map((command, index) => (0, OverflowCommandBar_1.renderCommandItem)(index, command, language)) }))] }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }) })] }));
|
|
21
21
|
}
|
|
@@ -19,7 +19,7 @@ const CommandBar_1 = __importDefault(require("../CommandBar"));
|
|
|
19
19
|
const OverflowCommandBar_1 = require("../OverflowCommandBar");
|
|
20
20
|
const CommandContainer = ({ skeleton }) => {
|
|
21
21
|
const { language } = (0, locale_1.useLocale)();
|
|
22
|
-
const
|
|
22
|
+
const formCommands = (0, hooks_1.useMainFormCommands)();
|
|
23
23
|
const router = (0, hooks_4.useRouter)();
|
|
24
24
|
const isMobile = (0, hooks_2.useIsMobile)();
|
|
25
25
|
const schema = (0, hooks_1.useDataFormSchema)();
|
|
@@ -62,8 +62,8 @@ const CommandContainer = ({ skeleton }) => {
|
|
|
62
62
|
setRecordSetVisible,
|
|
63
63
|
]);
|
|
64
64
|
const extendedCommands = (0, react_1.useMemo)(() => {
|
|
65
|
-
return [...navigationCommands, ...
|
|
66
|
-
}, [
|
|
65
|
+
return [...navigationCommands, ...formCommands];
|
|
66
|
+
}, [formCommands, navigationCommands]);
|
|
67
67
|
if (skeleton) {
|
|
68
68
|
return ((0, jsx_runtime_1.jsxs)(CommandBar_1.default.Wrapper, { overflow: "hidden", children: [navigationCommands.map((group, groupIndex) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [groupIndex > 0 && (0, jsx_runtime_1.jsx)(CommandBar_1.default.Divider, {}), group.map((item, index) => {
|
|
69
69
|
const commandType = item.type;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileHeaderRightContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const dataform_1 = require("@headless-adminapp/app/dataform");
|
|
6
|
+
const MobileHeaderCommandContainer_1 = require("../Header/MobileHeaderCommandContainer");
|
|
7
|
+
const MobileHeaderRightContainer = () => {
|
|
8
|
+
const commands = (0, dataform_1.useMainFormCommands)();
|
|
9
|
+
return (0, jsx_runtime_1.jsx)(MobileHeaderCommandContainer_1.MobileHeaderCommandContainer, { commands: commands });
|
|
10
|
+
};
|
|
11
|
+
exports.MobileHeaderRightContainer = MobileHeaderRightContainer;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileHeaderTitleContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const dataform_1 = require("@headless-adminapp/app/dataform");
|
|
7
|
+
const useFormDataState_1 = require("@headless-adminapp/app/dataform/hooks/useFormDataState");
|
|
8
|
+
const MobileHeaderTitle_1 = require("@headless-adminapp/app/header/components/MobileHeaderTitle");
|
|
9
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
10
|
+
const utils_1 = require("@headless-adminapp/app/locale/utils");
|
|
11
|
+
const MobileHeaderTitleContainer = () => {
|
|
12
|
+
const [recordTitle] = (0, dataform_1.useRecordTitle)();
|
|
13
|
+
const { language } = (0, locale_1.useLocale)();
|
|
14
|
+
const schema = (0, dataform_1.useDataFormSchema)();
|
|
15
|
+
const dataState = (0, useFormDataState_1.useFormDataState)();
|
|
16
|
+
if (dataState.isFetching || dataState.isError) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(MobileHeaderTitle_1.MobileHeaderTitle, { order: 3, title: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'row',
|
|
22
|
+
flex: 1,
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
overflow: 'hidden',
|
|
28
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
29
|
+
display: 'flex',
|
|
30
|
+
gap: react_components_1.tokens.spacingHorizontalXS,
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Subtitle2, { style: {
|
|
33
|
+
textOverflow: 'ellipsis',
|
|
34
|
+
whiteSpace: 'nowrap',
|
|
35
|
+
overflow: 'hidden',
|
|
36
|
+
}, children: recordTitle }) }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { opacity: 0.8 }, children: (0, utils_1.localizedLabel)(language, schema) })] }) }) }));
|
|
37
|
+
};
|
|
38
|
+
exports.MobileHeaderTitleContainer = MobileHeaderTitleContainer;
|
|
@@ -4,6 +4,7 @@ exports.PageEntityForm = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
|
|
7
|
+
const hooks_2 = require("@headless-adminapp/app/header/hooks");
|
|
7
8
|
const historystate_1 = require("@headless-adminapp/app/historystate");
|
|
8
9
|
const PageEntityFormProvider_1 = require("@headless-adminapp/app/providers/PageEntityFormProvider");
|
|
9
10
|
const recordset_1 = require("@headless-adminapp/app/recordset");
|
|
@@ -14,6 +15,7 @@ const PageEntityFormDesktopContainer_1 = require("./PageEntityFormDesktopContain
|
|
|
14
15
|
const RecordSetNavigatorContainer_1 = require("./RecordSetNavigatorContainer");
|
|
15
16
|
const PageEntityForm = ({ logicalName, formId, recordId, }) => {
|
|
16
17
|
const result = (0, hooks_1.useLoadFormGridPage)(logicalName, formId);
|
|
18
|
+
(0, hooks_2.useMobileHeader)(true);
|
|
17
19
|
if (result.loading) {
|
|
18
20
|
return (0, jsx_runtime_1.jsx)(PageLoading_1.PageLoading, {});
|
|
19
21
|
}
|