@headless-adminapp/fluent 0.0.17-alpha.1
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.d.ts +6 -0
- package/App/App.js +12 -0
- package/App/AppHeaderContianer.d.ts +2 -0
- package/App/AppHeaderContianer.js +67 -0
- package/App/AppLogo.d.ts +8 -0
- package/App/AppLogo.js +17 -0
- package/App/AppProvider.d.ts +9 -0
- package/App/AppProvider.js +50 -0
- package/App/AppStringContext.d.ts +16 -0
- package/App/AppStringContext.js +23 -0
- package/App/AppUI.d.ts +2 -0
- package/App/AppUI.js +16 -0
- package/App/NavigationContainer.d.ts +1 -0
- package/App/NavigationContainer.js +63 -0
- package/App/QuickActionItem.d.ts +10 -0
- package/App/QuickActionItem.js +32 -0
- package/App/index.d.ts +1 -0
- package/App/index.js +5 -0
- package/App/utils.d.ts +14 -0
- package/App/utils.js +27 -0
- package/CommandBar/Button.d.ts +11 -0
- package/CommandBar/Button.js +36 -0
- package/CommandBar/Divider.d.ts +2 -0
- package/CommandBar/Divider.js +10 -0
- package/CommandBar/IconButton.d.ts +9 -0
- package/CommandBar/IconButton.js +32 -0
- package/CommandBar/Label.d.ts +7 -0
- package/CommandBar/Label.js +23 -0
- package/CommandBar/MenuButton.d.ts +13 -0
- package/CommandBar/MenuButton.js +43 -0
- package/CommandBar/MenuItem.d.ts +11 -0
- package/CommandBar/MenuItem.js +37 -0
- package/CommandBar/MenuItems.d.ts +6 -0
- package/CommandBar/MenuItems.js +11 -0
- package/CommandBar/MenuList.d.ts +6 -0
- package/CommandBar/MenuList.js +13 -0
- package/CommandBar/Wrapper.d.ts +8 -0
- package/CommandBar/Wrapper.js +24 -0
- package/CommandBar/index.d.ts +9 -0
- package/CommandBar/index.js +17 -0
- package/CommandBar/types.d.ts +0 -0
- package/CommandBar/types.js +1 -0
- package/DataForm/SectionControl.d.ts +10 -0
- package/DataForm/SectionControl.js +8 -0
- package/DataGrid/ActionCell.d.ts +8 -0
- package/DataGrid/ActionCell.js +11 -0
- package/DataGrid/CommandContainer.d.ts +2 -0
- package/DataGrid/CommandContainer.js +11 -0
- package/DataGrid/CustomizeColumns/AddColumns.d.ts +10 -0
- package/DataGrid/CustomizeColumns/AddColumns.js +94 -0
- package/DataGrid/CustomizeColumns/ColumnItem.d.ts +16 -0
- package/DataGrid/CustomizeColumns/ColumnItem.js +86 -0
- package/DataGrid/CustomizeColumns/CustomizeColumns.d.ts +6 -0
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +80 -0
- package/DataGrid/CustomizeColumns/index.d.ts +1 -0
- package/DataGrid/CustomizeColumns/index.js +5 -0
- package/DataGrid/FormSubgridCommandContainer.d.ts +2 -0
- package/DataGrid/FormSubgridCommandContainer.js +24 -0
- package/DataGrid/FormSubgridViewSelector.d.ts +2 -0
- package/DataGrid/FormSubgridViewSelector.js +41 -0
- package/DataGrid/GridColumnHeader/ConditionValueControl.d.ts +9 -0
- package/DataGrid/GridColumnHeader/ConditionValueControl.js +89 -0
- package/DataGrid/GridColumnHeader/FilterForm.d.ts +11 -0
- package/DataGrid/GridColumnHeader/FilterForm.js +55 -0
- package/DataGrid/GridColumnHeader/OperatorSelect.d.ts +9 -0
- package/DataGrid/GridColumnHeader/OperatorSelect.js +21 -0
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.d.ts +22 -0
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +152 -0
- package/DataGrid/GridColumnHeader/index.d.ts +1 -0
- package/DataGrid/GridColumnHeader/index.js +5 -0
- package/DataGrid/GridColumnHeader/utils.d.ts +5 -0
- package/DataGrid/GridColumnHeader/utils.js +18 -0
- package/DataGrid/GridHeaderContainer.d.ts +2 -0
- package/DataGrid/GridHeaderContainer.js +9 -0
- package/DataGrid/GridHeaderDesktop.d.ts +6 -0
- package/DataGrid/GridHeaderDesktop.js +40 -0
- package/DataGrid/GridPaginationContainer.d.ts +2 -0
- package/DataGrid/GridPaginationContainer.js +20 -0
- package/DataGrid/GridTableContainer.d.ts +12 -0
- package/DataGrid/GridTableContainer.js +248 -0
- package/DataGrid/ScrollbarWithMoreDataRequest.d.ts +9 -0
- package/DataGrid/ScrollbarWithMoreDataRequest.js +33 -0
- package/DataGrid/TableCell/TableCellAction.d.ts +8 -0
- package/DataGrid/TableCell/TableCellAction.js +41 -0
- package/DataGrid/TableCell/TableCellBase.d.ts +7 -0
- package/DataGrid/TableCell/TableCellBase.js +9 -0
- package/DataGrid/TableCell/TableCellCheckbox.d.ts +6 -0
- package/DataGrid/TableCell/TableCellCheckbox.js +14 -0
- package/DataGrid/TableCell/TableCellLink.d.ts +8 -0
- package/DataGrid/TableCell/TableCellLink.js +33 -0
- package/DataGrid/TableCell/TableCellText.d.ts +7 -0
- package/DataGrid/TableCell/TableCellText.js +24 -0
- package/DataGrid/TableCell/index.d.ts +4 -0
- package/DataGrid/TableCell/index.js +20 -0
- package/DataGrid/getAttributeFormattedValue.d.ts +16 -0
- package/DataGrid/getAttributeFormattedValue.js +92 -0
- package/DataGrid/index.d.ts +4 -0
- package/DataGrid/index.js +11 -0
- package/DataGrid/useTableColumns.d.ts +10 -0
- package/DataGrid/useTableColumns.js +251 -0
- package/DataGrid/utils.d.ts +2 -0
- package/DataGrid/utils.js +15 -0
- package/DialogContainer/AlertDialog.d.ts +10 -0
- package/DialogContainer/AlertDialog.js +15 -0
- package/DialogContainer/ConfirmDialog.d.ts +12 -0
- package/DialogContainer/ConfirmDialog.js +18 -0
- package/DialogContainer/DialogContainer.d.ts +1 -0
- package/DialogContainer/DialogContainer.js +43 -0
- package/DialogContainer/ErrorDialog.d.ts +10 -0
- package/DialogContainer/ErrorDialog.js +22 -0
- package/DialogContainer/PromptDialog.d.ts +27 -0
- package/DialogContainer/PromptDialog.js +99 -0
- package/DialogContainer/index.d.ts +1 -0
- package/DialogContainer/index.js +5 -0
- package/LICENSE +21 -0
- package/OverflowCommandBar/OverflowCommandBar.d.ts +10 -0
- package/OverflowCommandBar/OverflowCommandBar.js +32 -0
- package/OverflowCommandBar/OverflowMenu.d.ts +4 -0
- package/OverflowCommandBar/OverflowMenu.js +45 -0
- package/OverflowCommandBar/OverflowMenuDivider.d.ts +4 -0
- package/OverflowCommandBar/OverflowMenuDivider.js +14 -0
- package/OverflowCommandBar/index.d.ts +3 -0
- package/OverflowCommandBar/index.js +9 -0
- package/OverflowCommandBar/render.d.ts +2 -0
- package/OverflowCommandBar/render.js +26 -0
- package/OverflowCommandBar/utils.d.ts +4 -0
- package/OverflowCommandBar/utils.js +17 -0
- package/PageEntityForm/CommandContainer.d.ts +2 -0
- package/PageEntityForm/CommandContainer.js +49 -0
- package/PageEntityForm/FormTabRelated.d.ts +6 -0
- package/PageEntityForm/FormTabRelated.js +41 -0
- package/PageEntityForm/PageEntityForm.d.ts +8 -0
- package/PageEntityForm/PageEntityForm.js +30 -0
- package/PageEntityForm/PageEntityFormDesktopContainer.d.ts +2 -0
- package/PageEntityForm/PageEntityFormDesktopContainer.js +120 -0
- package/PageEntityForm/PageEntityFormStringContext.d.ts +8 -0
- package/PageEntityForm/PageEntityFormStringContext.js +15 -0
- package/PageEntityForm/RecordCard.d.ts +10 -0
- package/PageEntityForm/RecordCard.js +134 -0
- package/PageEntityForm/RecordSetNavigatorContainer.d.ts +2 -0
- package/PageEntityForm/RecordSetNavigatorContainer.js +72 -0
- package/PageEntityForm/RelatedViewSelector.d.ts +15 -0
- package/PageEntityForm/RelatedViewSelector.js +78 -0
- package/PageEntityForm/SectionContainer.d.ts +6 -0
- package/PageEntityForm/SectionContainer.js +62 -0
- package/PageEntityForm/StandardControl.d.ts +24 -0
- package/PageEntityForm/StandardControl.js +227 -0
- package/PageEntityForm/SubgridControl.d.ts +13 -0
- package/PageEntityForm/SubgridControl.js +66 -0
- package/PageEntityForm/index.d.ts +1 -0
- package/PageEntityForm/index.js +5 -0
- package/PageEntityView/FormSubgridContainer.d.ts +7 -0
- package/PageEntityView/FormSubgridContainer.js +65 -0
- package/PageEntityView/PageEntityView.d.ts +8 -0
- package/PageEntityView/PageEntityView.js +22 -0
- package/PageEntityView/PageEntityViewDesktopContainer.d.ts +2 -0
- package/PageEntityView/PageEntityViewDesktopContainer.js +14 -0
- package/PageEntityView/PageEntityViewDesktopFrame.d.ts +9 -0
- package/PageEntityView/PageEntityViewDesktopFrame.js +48 -0
- package/PageEntityView/PageEntityViewStringContext.d.ts +23 -0
- package/PageEntityView/PageEntityViewStringContext.js +30 -0
- package/PageEntityView/index.d.ts +1 -0
- package/PageEntityView/index.js +5 -0
- package/ProgressIndicatorContainer/index.d.ts +1 -0
- package/ProgressIndicatorContainer/index.js +30 -0
- package/ToastNotificationContainer/index.d.ts +1 -0
- package/ToastNotificationContainer/index.js +44 -0
- package/components/BodyLoading.d.ts +6 -0
- package/components/BodyLoading.js +19 -0
- package/components/DialogLogin.d.ts +6 -0
- package/components/DialogLogin.js +9 -0
- package/components/LoginForm.d.ts +6 -0
- package/components/LoginForm.js +101 -0
- package/components/PageBroken.d.ts +8 -0
- package/components/PageBroken.js +15 -0
- package/components/PageLoading.d.ts +5 -0
- package/components/PageLoading.js +15 -0
- package/components/PageLogin.d.ts +7 -0
- package/components/PageLogin.js +46 -0
- package/form/FormControl.d.ts +6 -0
- package/form/FormControl.js +95 -0
- package/form/FormControlLoading.d.ts +2 -0
- package/form/FormControlLoading.js +9 -0
- package/form/controls/CurrencyControl.d.ts +4 -0
- package/form/controls/CurrencyControl.js +16 -0
- package/form/controls/DateControl.d.ts +6 -0
- package/form/controls/DateControl.js +21 -0
- package/form/controls/DateRangeControl.d.ts +6 -0
- package/form/controls/DateRangeControl.js +49 -0
- package/form/controls/DateTimeControl.d.ts +6 -0
- package/form/controls/DateTimeControl.js +23 -0
- package/form/controls/EmailControl.d.ts +6 -0
- package/form/controls/EmailControl.js +22 -0
- package/form/controls/LookupControl.d.ts +26 -0
- package/form/controls/LookupControl.js +134 -0
- package/form/controls/MultiSelectControl.d.ts +6 -0
- package/form/controls/MultiSelectControl.js +17 -0
- package/form/controls/MultiSelectLookupControl.d.ts +26 -0
- package/form/controls/MultiSelectLookupControl.js +187 -0
- package/form/controls/NumberControl.d.ts +4 -0
- package/form/controls/NumberControl.js +15 -0
- package/form/controls/PasswordControl.d.ts +6 -0
- package/form/controls/PasswordControl.js +13 -0
- package/form/controls/SelectControl.d.ts +9 -0
- package/form/controls/SelectControl.js +29 -0
- package/form/controls/SwitchControl.d.ts +4 -0
- package/form/controls/SwitchControl.js +6 -0
- package/form/controls/TelephoneControl.d.ts +5 -0
- package/form/controls/TelephoneControl.js +16 -0
- package/form/controls/TextAreaControl.d.ts +6 -0
- package/form/controls/TextAreaControl.js +16 -0
- package/form/controls/TextControl.d.ts +10 -0
- package/form/controls/TextControl.js +24 -0
- package/form/controls/types.d.ts +14 -0
- package/form/controls/types.js +2 -0
- package/form/controls/useLookupData.d.ts +19 -0
- package/form/controls/useLookupData.js +104 -0
- package/form/layout/FormBody/FormBody.d.ts +2 -0
- package/form/layout/FormBody/FormBody.js +11 -0
- package/form/layout/FormBody/index.d.ts +1 -0
- package/form/layout/FormBody/index.js +17 -0
- package/form/layout/FormSection/FormSection.d.ts +16 -0
- package/form/layout/FormSection/FormSection.js +83 -0
- package/form/layout/FormSection/FormSectionColumn.d.ts +6 -0
- package/form/layout/FormSection/FormSectionColumn.js +15 -0
- package/form/layout/FormSection/FormSectionLoading.d.ts +6 -0
- package/form/layout/FormSection/FormSectionLoading.js +7 -0
- package/form/layout/FormSection/index.d.ts +1 -0
- package/form/layout/FormSection/index.js +5 -0
- package/form/layout/FormTab/FormTab.d.ts +13 -0
- package/form/layout/FormTab/FormTab.js +82 -0
- package/form/layout/FormTab/FormTabColumn.d.ts +6 -0
- package/form/layout/FormTab/FormTabColumn.js +15 -0
- package/form/layout/FormTab/index.d.ts +1 -0
- package/form/layout/FormTab/index.js +5 -0
- package/form/layout/TabContext.d.ts +6 -0
- package/form/layout/TabContext.js +5 -0
- package/form/layout/index.d.ts +3 -0
- package/form/layout/index.js +11 -0
- package/form/types.d.ts +74 -0
- package/form/types.js +5 -0
- package/package.json +30 -0
- package/types/index.d.ts +32 -0
- package/types/index.js +2 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MenuItem = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const MenuList_1 = require("./MenuList");
|
|
7
|
+
const useStyles = (0, react_components_1.makeStyles)({
|
|
8
|
+
splitMenuRight: {
|
|
9
|
+
'& .fui-MenuItem__icon': {
|
|
10
|
+
display: 'none',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
danger: {
|
|
14
|
+
'&:hover': {
|
|
15
|
+
color: react_components_1.tokens.colorPaletteRedForeground1,
|
|
16
|
+
background: react_components_1.tokens.colorPaletteRedBackground1,
|
|
17
|
+
'& .fui-MenuItem__icon': {
|
|
18
|
+
color: react_components_1.tokens.colorPaletteRedForeground1,
|
|
19
|
+
},
|
|
20
|
+
'&:active': {
|
|
21
|
+
color: react_components_1.tokens.colorPaletteRedForeground2,
|
|
22
|
+
background: react_components_1.tokens.colorPaletteRedBackground2,
|
|
23
|
+
'& .fui-MenuItem__icon': {
|
|
24
|
+
color: react_components_1.tokens.colorPaletteRedForeground2,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const MenuItem = ({ Icon, text, disabled, danger, onClick, items, }) => {
|
|
31
|
+
const styles = useStyles();
|
|
32
|
+
if (!(items === null || items === void 0 ? void 0 : items.length)) {
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { disabled: disabled, onClick: onClick, icon: (0, jsx_runtime_1.jsx)(Icon, {}), className: (0, react_components_1.mergeClasses)(danger && styles.danger), children: text }));
|
|
34
|
+
}
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(react_components_1.Menu, { hasIcons: true, children: [onClick ? ((0, jsx_runtime_1.jsxs)(react_components_1.MenuSplitGroup, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, {}), className: (0, react_components_1.mergeClasses)(danger && styles.danger), children: text }), (0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { className: (0, react_components_1.mergeClasses)(styles.splitMenuRight) }) })] })) : ((0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, {}), children: text }) })), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(MenuList_1.MenuList, { items: items }) })] }));
|
|
36
|
+
};
|
|
37
|
+
exports.MenuItem = MenuItem;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ArrayGroupWithAtLeastOne } from '@headless-adminapp/core/types';
|
|
2
|
+
import { MenuItemProps } from './MenuItem';
|
|
3
|
+
export interface MenuItemsProps {
|
|
4
|
+
items?: ArrayGroupWithAtLeastOne<MenuItemProps>;
|
|
5
|
+
}
|
|
6
|
+
export declare const MenuItems: React.FC<MenuItemsProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MenuItems = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const MenuItem_1 = require("./MenuItem");
|
|
8
|
+
const MenuItems = ({ 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) => ((0, jsx_runtime_1.jsx)(MenuItem_1.MenuItem, { Icon: item.Icon, onClick: item.onClick, text: item.text, danger: item.danger, disabled: item.disabled, items: item.items }, index)))] }, index))) }));
|
|
10
|
+
};
|
|
11
|
+
exports.MenuItems = MenuItems;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MenuList = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const MenuItems_1 = require("./MenuItems");
|
|
7
|
+
const MenuList = ({ items }) => {
|
|
8
|
+
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: {
|
|
9
|
+
color: react_components_1.tokens.colorNeutralForegroundDisabled,
|
|
10
|
+
fontStyle: 'italic',
|
|
11
|
+
}, children: "No items" })) : ((0, jsx_runtime_1.jsx)(MenuItems_1.MenuItems, { items: items })) }));
|
|
12
|
+
};
|
|
13
|
+
exports.MenuList = MenuList;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ForwardRefComponent } from '@fluentui/react-components';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
export interface CommandBarWrapperProps {
|
|
4
|
+
overflow?: 'hidden' | 'auto';
|
|
5
|
+
className?: string;
|
|
6
|
+
align?: 'start' | 'end';
|
|
7
|
+
}
|
|
8
|
+
export declare const CommandBarWrapper: ForwardRefComponent<PropsWithChildren<CommandBarWrapperProps>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandBarWrapper = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const useStyles = (0, react_components_1.makeStyles)({
|
|
8
|
+
root: {
|
|
9
|
+
flexWrap: 'nowrap',
|
|
10
|
+
minWidth: 0,
|
|
11
|
+
width: '100%',
|
|
12
|
+
},
|
|
13
|
+
overflowHidden: {
|
|
14
|
+
overflow: 'hidden',
|
|
15
|
+
},
|
|
16
|
+
overflowAuto: {
|
|
17
|
+
overflow: 'auto',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
exports.CommandBarWrapper = (0, react_1.forwardRef)(function CommandBarWrapper({ children, overflow, className, align = 'start' }, ref) {
|
|
21
|
+
const styles = useStyles();
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Toolbar, { ref: ref, style: { justifyContent: 'flex-' + align }, className: (0, react_components_1.mergeClasses)(styles.root, overflow === 'hidden' ? styles.overflowHidden : styles.overflowAuto, className), children: children }));
|
|
23
|
+
});
|
|
24
|
+
exports.CommandBarWrapper.displayName = 'CommandBarWrapper';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const CommandBar: {
|
|
2
|
+
Wrapper: import("@fluentui/react-components").ForwardRefComponent<import("react").PropsWithChildren<import("./Wrapper").CommandBarWrapperProps>>;
|
|
3
|
+
Button: import("@fluentui/react-components").ForwardRefComponent<import("./Button").CommandButtonProps>;
|
|
4
|
+
MenuButton: import("@fluentui/react-components").ForwardRefComponent<import("./MenuButton").CommandMenuButtonProps>;
|
|
5
|
+
Divider: import("@fluentui/react-components").ForwardRefComponent<{}>;
|
|
6
|
+
IconButton: import("@fluentui/react-components").ForwardRefComponent<import("./IconButton").CommandIconButtonProps>;
|
|
7
|
+
Label: import("@fluentui/react-components").ForwardRefComponent<import("./Label").CommandLabelProps>;
|
|
8
|
+
};
|
|
9
|
+
export default CommandBar;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Button_1 = require("./Button");
|
|
4
|
+
const Divider_1 = require("./Divider");
|
|
5
|
+
const IconButton_1 = require("./IconButton");
|
|
6
|
+
const Label_1 = require("./Label");
|
|
7
|
+
const MenuButton_1 = require("./MenuButton");
|
|
8
|
+
const Wrapper_1 = require("./Wrapper");
|
|
9
|
+
const CommandBar = {
|
|
10
|
+
Wrapper: Wrapper_1.CommandBarWrapper,
|
|
11
|
+
Button: Button_1.CommandButton,
|
|
12
|
+
MenuButton: MenuButton_1.CommandMenuButton,
|
|
13
|
+
Divider: Divider_1.CommandDivider,
|
|
14
|
+
IconButton: IconButton_1.CommandIconButton,
|
|
15
|
+
Label: Label_1.CommandLabel,
|
|
16
|
+
};
|
|
17
|
+
exports.default = CommandBar;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
interface SectionControlWrapperProps {
|
|
3
|
+
label: string;
|
|
4
|
+
labelPosition?: 'top' | 'left';
|
|
5
|
+
required?: boolean;
|
|
6
|
+
isError?: boolean;
|
|
7
|
+
errorMessage?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function SectionControlWrapper(props: PropsWithChildren<SectionControlWrapperProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SectionControlWrapper = SectionControlWrapper;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
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 }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MenuItemCommandState } from '@headless-adminapp/app/command';
|
|
2
|
+
import { MutableState } from '@headless-adminapp/app/mutable';
|
|
3
|
+
interface ActionCellProps {
|
|
4
|
+
onOpen: () => void;
|
|
5
|
+
mutableState: MutableState<MenuItemCommandState[][]>;
|
|
6
|
+
}
|
|
7
|
+
export declare function ActionCell({ onOpen, mutableState }: ActionCellProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionCell = ActionCell;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
6
|
+
const TableCell_1 = require("../DataGrid/TableCell");
|
|
7
|
+
const OverflowCommandBar_1 = require("../OverflowCommandBar");
|
|
8
|
+
function ActionCell({ onOpen, mutableState }) {
|
|
9
|
+
const transformedCommands = (0, mutable_1.useMutableStateSelector)(mutableState, (state) => state);
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellAction, { onOpen: onOpen, items: transformedCommands.map((item) => (0, OverflowCommandBar_1.transformMenuItems)(item, 'en')) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
6
|
+
const OverflowCommandBar_1 = require("../OverflowCommandBar");
|
|
7
|
+
const CommandContainer = () => {
|
|
8
|
+
const gridCommands = (0, hooks_1.useMainGridCommands)();
|
|
9
|
+
return (0, jsx_runtime_1.jsx)(OverflowCommandBar_1.OverflowCommandBar, { commands: gridCommands });
|
|
10
|
+
};
|
|
11
|
+
exports.CommandContainer = CommandContainer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TransformedViewColumn } from '@headless-adminapp/app/datagrid';
|
|
2
|
+
interface AddColumnsProps {
|
|
3
|
+
onColumnAdd: (column: TransformedViewColumn) => void;
|
|
4
|
+
onColumnRemove: (column: TransformedViewColumn) => void;
|
|
5
|
+
columns: TransformedViewColumn[];
|
|
6
|
+
opened: boolean;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, }: AddColumnsProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddColumns = AddColumns;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const builders_1 = require("@headless-adminapp/app/builders");
|
|
7
|
+
const datagrid_1 = require("@headless-adminapp/app/datagrid");
|
|
8
|
+
const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
9
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
10
|
+
const hooks_2 = require("@headless-adminapp/app/metadata/hooks");
|
|
11
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
12
|
+
const react_1 = require("react");
|
|
13
|
+
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
14
|
+
const PageEntityViewStringContext_1 = require("../../PageEntityView/PageEntityViewStringContext");
|
|
15
|
+
function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, }) {
|
|
16
|
+
var _a;
|
|
17
|
+
const schema = (0, hooks_1.useDataGridSchema)();
|
|
18
|
+
const { schemaStore } = (0, hooks_2.useMetadata)();
|
|
19
|
+
const { language } = (0, locale_1.useLocale)();
|
|
20
|
+
const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
|
|
21
|
+
const appStrings = (0, AppStringContext_1.useAppStrings)();
|
|
22
|
+
const lookupAttributes = Object.entries(schema.attributes)
|
|
23
|
+
.map(([key, attribute]) => ({
|
|
24
|
+
key,
|
|
25
|
+
attribute,
|
|
26
|
+
}))
|
|
27
|
+
.filter(({ attribute }) => attribute.type === 'lookup');
|
|
28
|
+
const columnGroups = Object.assign({ root: {
|
|
29
|
+
label: (0, builders_1.localizedLabel)(language, schema),
|
|
30
|
+
columns: (0, datagrid_1.transformViewColumns)(schema.logicalName, Object.keys(schema.attributes).map((key) => ({
|
|
31
|
+
name: key,
|
|
32
|
+
})), schemaStore, language),
|
|
33
|
+
} }, lookupAttributes.reduce((acc, { key, attribute }) => {
|
|
34
|
+
const lookupSchema = schemaStore.getSchema(attribute.entity);
|
|
35
|
+
const columns = (0, datagrid_1.transformViewColumns)(schema.logicalName, Object.keys(lookupSchema.attributes).map((nestedKey) => ({
|
|
36
|
+
name: key,
|
|
37
|
+
expandedKey: nestedKey,
|
|
38
|
+
})), schemaStore, language);
|
|
39
|
+
acc[key] = {
|
|
40
|
+
label: (0, builders_1.localizedLabel)(language, attribute) +
|
|
41
|
+
' (' +
|
|
42
|
+
(0, builders_1.localizedLabel)(language, lookupSchema) +
|
|
43
|
+
')',
|
|
44
|
+
columns,
|
|
45
|
+
};
|
|
46
|
+
return acc;
|
|
47
|
+
}, {}));
|
|
48
|
+
const tableItems = Object.entries(columnGroups).map(([key, group]) => ({
|
|
49
|
+
key,
|
|
50
|
+
label: group.label,
|
|
51
|
+
}));
|
|
52
|
+
const [selectedGroup, setSelectedGroup] = (0, react_1.useState)('root');
|
|
53
|
+
const selectedGroupItem = tableItems.find((x) => x.key === selectedGroup);
|
|
54
|
+
const availableColumns = columnGroups[selectedGroup].columns;
|
|
55
|
+
const [searchText, setSearchText] = (0, react_1.useState)('');
|
|
56
|
+
const filteredColumns = availableColumns.filter((column) => column.label.toLowerCase().includes(searchText.toLowerCase()));
|
|
57
|
+
const includedColumnsObj = columns.reduce((acc, column) => {
|
|
58
|
+
acc[column.id] = true;
|
|
59
|
+
return acc;
|
|
60
|
+
}, {});
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)(react_components_1.Drawer, { separator: true, open: opened, position: "end", children: [(0, jsx_runtime_1.jsx)(react_components_1.DrawerHeader, { children: (0, jsx_runtime_1.jsx)(react_components_1.DrawerHeaderTitle, { action: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", "aria-label": "Close", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Close, {}), onClick: onClose }), children: strings.addColumns }) }), (0, jsx_runtime_1.jsxs)("div", { style: { width: '100%', display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
62
|
+
display: 'flex',
|
|
63
|
+
flexDirection: 'column-reverse',
|
|
64
|
+
gap: 8,
|
|
65
|
+
marginBottom: react_components_1.tokens.spacingVerticalXS,
|
|
66
|
+
paddingInline: react_components_1.tokens.spacingHorizontalS,
|
|
67
|
+
width: '100%',
|
|
68
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Input, { contentBefore: (0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 16 }), placeholder: appStrings.searchPlaceholder, value: searchText, onChange: (e) => setSearchText(e.target.value) }), (0, jsx_runtime_1.jsx)(react_components_1.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) => {
|
|
69
|
+
setSelectedGroup(data.optionValue);
|
|
70
|
+
}, style: { flex: 1, minWidth: 'unset' }, positioning: {
|
|
71
|
+
align: 'bottom',
|
|
72
|
+
position: 'below',
|
|
73
|
+
}, children: tableItems.map((x) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: x.key, children: x.label }, x.key))) })] }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, {})] }), (0, jsx_runtime_1.jsx)(react_components_1.DrawerBody, { style: { paddingInline: 0 }, children: filteredColumns.map((column) => {
|
|
74
|
+
var _a;
|
|
75
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "transparent", icon: (0, jsx_runtime_1.jsx)(react_components_1.Checkbox, { checked: (_a = includedColumnsObj[column.id]) !== null && _a !== void 0 ? _a : false }), style: {
|
|
76
|
+
fontWeight: react_components_1.tokens.fontSizeBase400,
|
|
77
|
+
width: '100%',
|
|
78
|
+
justifyContent: 'flex-start',
|
|
79
|
+
paddingInline: react_components_1.tokens.spacingHorizontalS,
|
|
80
|
+
}, onClick: () => {
|
|
81
|
+
if (includedColumnsObj[column.id]) {
|
|
82
|
+
onColumnRemove(column);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
onColumnAdd(column);
|
|
86
|
+
}
|
|
87
|
+
}, children: column.label }, column.id));
|
|
88
|
+
}) }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, {}), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
89
|
+
display: 'flex',
|
|
90
|
+
padding: 8,
|
|
91
|
+
gap: 8,
|
|
92
|
+
justifyContent: 'flex-end',
|
|
93
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { onClick: onClose, children: strings.close }) })] })] }));
|
|
94
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TransformedViewColumn } from '@headless-adminapp/app/datagrid';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
export declare const ItemTypes: {
|
|
4
|
+
CARD: string;
|
|
5
|
+
};
|
|
6
|
+
interface CardProps {
|
|
7
|
+
item: TransformedViewColumn;
|
|
8
|
+
index: number;
|
|
9
|
+
moveItem: (dragIndex: number, hoverIndex: number) => void;
|
|
10
|
+
isFirst: boolean;
|
|
11
|
+
isLast: boolean;
|
|
12
|
+
onRemove: () => void;
|
|
13
|
+
stringSet?: any;
|
|
14
|
+
}
|
|
15
|
+
export declare const ColumnItem: FC<CardProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColumnItem = exports.ItemTypes = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_dnd_1 = require("react-dnd");
|
|
9
|
+
exports.ItemTypes = {
|
|
10
|
+
CARD: 'column',
|
|
11
|
+
};
|
|
12
|
+
const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSet = {}, // defaultCustomizeColumnStrings,
|
|
13
|
+
}) => {
|
|
14
|
+
const ref = (0, react_1.useRef)(null);
|
|
15
|
+
const [{ handlerId }, drop] = (0, react_dnd_1.useDrop)({
|
|
16
|
+
accept: exports.ItemTypes.CARD,
|
|
17
|
+
collect(monitor) {
|
|
18
|
+
return {
|
|
19
|
+
handlerId: monitor.getHandlerId(),
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
hover(item, monitor) {
|
|
23
|
+
var _a;
|
|
24
|
+
if (!ref.current) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const dragIndex = item.index;
|
|
28
|
+
const hoverIndex = index;
|
|
29
|
+
// Don't replace items with themselves
|
|
30
|
+
if (dragIndex === hoverIndex) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
// Determine rectangle on screen
|
|
34
|
+
const hoverBoundingRect = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
35
|
+
// Get vertical middle
|
|
36
|
+
const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
|
|
37
|
+
// Determine mouse position
|
|
38
|
+
const clientOffset = monitor.getClientOffset();
|
|
39
|
+
// Get pixels to the top
|
|
40
|
+
const hoverClientY = clientOffset.y - hoverBoundingRect.top;
|
|
41
|
+
// Only perform the move when the mouse has crossed half of the items height
|
|
42
|
+
// When dragging downwards, only move when the cursor is below 50%
|
|
43
|
+
// When dragging upwards, only move when the cursor is above 50%
|
|
44
|
+
// Dragging downwards
|
|
45
|
+
if (dragIndex < hoverIndex && hoverClientY < hoverMiddleY) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
// Dragging upwards
|
|
49
|
+
if (dragIndex > hoverIndex && hoverClientY > hoverMiddleY) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// Time to actually perform the action
|
|
53
|
+
moveItem(dragIndex, hoverIndex);
|
|
54
|
+
// Note: we're mutating the monitor item here!
|
|
55
|
+
// Generally it's better to avoid mutations,
|
|
56
|
+
// but it's good here for the sake of performance
|
|
57
|
+
// to avoid expensive index searches.
|
|
58
|
+
item.index = hoverIndex;
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
const [{ isDragging }, drag] = (0, react_dnd_1.useDrag)({
|
|
62
|
+
type: exports.ItemTypes.CARD,
|
|
63
|
+
item: () => {
|
|
64
|
+
return { id: item.id, index };
|
|
65
|
+
},
|
|
66
|
+
collect: (monitor) => ({
|
|
67
|
+
isDragging: monitor.isDragging(),
|
|
68
|
+
}),
|
|
69
|
+
});
|
|
70
|
+
const opacity = isDragging ? 0 : 1;
|
|
71
|
+
drag(drop(ref));
|
|
72
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: {
|
|
73
|
+
background: react_components_1.tokens.colorNeutralBackground4,
|
|
74
|
+
padding: react_components_1.tokens.spacingHorizontalXS,
|
|
75
|
+
cursor: 'move',
|
|
76
|
+
opacity,
|
|
77
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
78
|
+
display: 'flex',
|
|
79
|
+
flexDirection: 'row',
|
|
80
|
+
}, "data-handler-id": handlerId, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { flex: 1 }, children: item.label }), (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { positioning: "below-start", children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.MoreVertical, {}), appearance: "transparent", size: "small" }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsxs)(react_components_1.MenuList, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Delete, {}), onClick: onRemove, children: stringSet.remove }), !isFirst && ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), onClick: () => {
|
|
81
|
+
moveItem(index, index - 1);
|
|
82
|
+
}, children: stringSet.moveUp })), !isLast && ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), onClick: () => {
|
|
83
|
+
moveItem(index, index + 1);
|
|
84
|
+
}, children: stringSet.moveDown }))] }) })] })] }));
|
|
85
|
+
};
|
|
86
|
+
exports.ColumnItem = ColumnItem;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CustomizeColumns = CustomizeColumns;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
9
|
+
const datagrid_1 = require("@headless-adminapp/app/datagrid");
|
|
10
|
+
const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
11
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
12
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
13
|
+
const immutability_helper_1 = __importDefault(require("immutability-helper"));
|
|
14
|
+
const react_1 = require("react");
|
|
15
|
+
const react_dnd_1 = require("react-dnd");
|
|
16
|
+
const react_dnd_html5_backend_1 = require("react-dnd-html5-backend");
|
|
17
|
+
const PageEntityViewStringContext_1 = require("../../PageEntityView/PageEntityViewStringContext");
|
|
18
|
+
const AddColumns_1 = require("./AddColumns");
|
|
19
|
+
const ColumnItem_1 = require("./ColumnItem");
|
|
20
|
+
function CustomizeColumns({ onClose, opened }) {
|
|
21
|
+
const columns = (0, hooks_1.useGridColumns)();
|
|
22
|
+
const setContextValue = (0, mutable_1.useContextSetValue)(datagrid_1.GridContext);
|
|
23
|
+
const [showAddColumns, setShowAddColumns] = (0, react_1.useState)(false);
|
|
24
|
+
const [items, setItems] = (0, react_1.useState)(columns);
|
|
25
|
+
const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
|
|
26
|
+
const isDirty = (0, react_1.useMemo)(() => {
|
|
27
|
+
return JSON.stringify(items) !== JSON.stringify(columns);
|
|
28
|
+
}, [columns, items]);
|
|
29
|
+
const moveItem = (0, react_1.useCallback)((dragIndex, hoverIndex) => {
|
|
30
|
+
setItems((prevCards) => (0, immutability_helper_1.default)(prevCards, {
|
|
31
|
+
$splice: [
|
|
32
|
+
[dragIndex, 1],
|
|
33
|
+
[hoverIndex, 0, prevCards[dragIndex]],
|
|
34
|
+
],
|
|
35
|
+
}));
|
|
36
|
+
}, []);
|
|
37
|
+
const onColumnAdd = (0, react_1.useCallback)((column) => {
|
|
38
|
+
setItems((prev) => {
|
|
39
|
+
if (prev.some((x) => x.id === column.id)) {
|
|
40
|
+
return prev;
|
|
41
|
+
}
|
|
42
|
+
return [...prev, column];
|
|
43
|
+
});
|
|
44
|
+
}, []);
|
|
45
|
+
const onColumnRemove = (0, react_1.useCallback)((column) => {
|
|
46
|
+
setItems((prev) => prev.filter((x) => x.id !== column.id));
|
|
47
|
+
}, []);
|
|
48
|
+
return ((0, jsx_runtime_1.jsxs)(react_components_1.Drawer, { separator: true, open: opened, position: "end", size: "small", children: [(0, jsx_runtime_1.jsx)(react_components_1.DrawerHeader, { children: (0, jsx_runtime_1.jsx)(react_components_1.DrawerHeaderTitle, { action: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", "aria-label": "Close", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Close, {}), onClick: onClose }), children: strings.editColumns }) }), (0, jsx_runtime_1.jsxs)("div", { style: { width: '100%', display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
49
|
+
display: 'flex',
|
|
50
|
+
gap: 8,
|
|
51
|
+
marginBottom: react_components_1.tokens.spacingVerticalXS,
|
|
52
|
+
paddingInline: react_components_1.tokens.spacingHorizontalS,
|
|
53
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), style: {
|
|
54
|
+
fontWeight: react_components_1.tokens.fontSizeBase400,
|
|
55
|
+
minWidth: 'unset',
|
|
56
|
+
}, onClick: () => setShowAddColumns(true), children: strings.add }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Edit, {}), style: { fontWeight: react_components_1.tokens.fontSizeBase400, minWidth: 'unset' }, disabled: !isDirty, onClick: () => {
|
|
57
|
+
setItems(columns);
|
|
58
|
+
}, children: strings.reset })] }), (0, jsx_runtime_1.jsx)(AddColumns_1.AddColumns, { onColumnAdd: onColumnAdd, onColumnRemove: onColumnRemove, columns: items, opened: showAddColumns, onClose: () => setShowAddColumns(false) }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, {})] }), (0, jsx_runtime_1.jsx)(react_components_1.DrawerBody, { style: { paddingInline: react_components_1.tokens.spacingHorizontalS }, children: (0, jsx_runtime_1.jsx)(react_dnd_1.DndProvider, { backend: react_dnd_html5_backend_1.HTML5Backend, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
59
|
+
display: 'flex',
|
|
60
|
+
flexDirection: 'column',
|
|
61
|
+
width: '100%',
|
|
62
|
+
gap: react_components_1.tokens.spacingVerticalS,
|
|
63
|
+
// padding: tokens.spacingHorizontalS,
|
|
64
|
+
paddingBlock: react_components_1.tokens.spacingVerticalS,
|
|
65
|
+
}, children: items.map((item, index) => ((0, jsx_runtime_1.jsx)(ColumnItem_1.ColumnItem, { index: index, item: item, moveItem: moveItem, isFirst: index === 0, isLast: index === items.length - 1, onRemove: () => {
|
|
66
|
+
setItems((prev) => prev.filter((_, i) => i !== index));
|
|
67
|
+
}, stringSet: strings }, item.id))) }) }) }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, {}), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
68
|
+
display: 'flex',
|
|
69
|
+
padding: 8,
|
|
70
|
+
gap: 8,
|
|
71
|
+
justifyContent: 'flex-end',
|
|
72
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Button, { onClick: () => {
|
|
73
|
+
setContextValue({
|
|
74
|
+
columns: items,
|
|
75
|
+
});
|
|
76
|
+
onClose();
|
|
77
|
+
}, appearance: "primary", children: strings.apply }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { onClick: () => {
|
|
78
|
+
onClose();
|
|
79
|
+
}, children: strings.cancel })] })] })] }));
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CustomizeColumns } from './CustomizeColumns';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomizeColumns = void 0;
|
|
4
|
+
var CustomizeColumns_1 = require("./CustomizeColumns");
|
|
5
|
+
Object.defineProperty(exports, "CustomizeColumns", { enumerable: true, get: function () { return CustomizeColumns_1.CustomizeColumns; } });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormSubgridCommandContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const datagrid_1 = require("@headless-adminapp/app/datagrid");
|
|
6
|
+
const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
7
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
8
|
+
const OverflowCommandBar_1 = require("../OverflowCommandBar");
|
|
9
|
+
const FormSubgridCommandContainer = () => {
|
|
10
|
+
const isSubgrid = (0, mutable_1.useContextSelector)(datagrid_1.GridContext, (state) => state.isSubGrid);
|
|
11
|
+
if (isSubgrid) {
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(InternalSubGridCommandContainer, {});
|
|
13
|
+
}
|
|
14
|
+
return (0, jsx_runtime_1.jsx)(InternalMainGridCommandContainer, {});
|
|
15
|
+
};
|
|
16
|
+
exports.FormSubgridCommandContainer = FormSubgridCommandContainer;
|
|
17
|
+
const InternalMainGridCommandContainer = () => {
|
|
18
|
+
const gridCommands = (0, hooks_1.useMainGridCommands)();
|
|
19
|
+
return (0, jsx_runtime_1.jsx)(OverflowCommandBar_1.OverflowCommandBar, { commands: gridCommands });
|
|
20
|
+
};
|
|
21
|
+
const InternalSubGridCommandContainer = () => {
|
|
22
|
+
const gridCommands = (0, hooks_1.useSubGridCommands)();
|
|
23
|
+
return (0, jsx_runtime_1.jsx)(OverflowCommandBar_1.OverflowCommandBar, { commands: gridCommands });
|
|
24
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormSubgridViewSelector = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const datagrid_1 = require("@headless-adminapp/app/datagrid");
|
|
7
|
+
const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
8
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
9
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
10
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
11
|
+
const FormSubgridViewSelector = () => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const viewLookup = (0, hooks_1.useGridViewLookupData)();
|
|
14
|
+
const selectedView = (0, hooks_1.useSelectedView)();
|
|
15
|
+
const changeView = (0, hooks_1.useChangeView)();
|
|
16
|
+
const { language } = (0, locale_1.useLocale)();
|
|
17
|
+
const allowViewSelection = (0, mutable_1.useContextSelector)(datagrid_1.GridContext, (state) => state.allowViewSelection);
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
paddingBlock: 4,
|
|
21
|
+
paddingInline: 4,
|
|
22
|
+
gap: 16,
|
|
23
|
+
width: '100%',
|
|
24
|
+
display: 'flex',
|
|
25
|
+
height: 40,
|
|
26
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
27
|
+
flex: 1,
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
gap: 16,
|
|
30
|
+
justifyContent: 'space-between',
|
|
31
|
+
display: 'flex',
|
|
32
|
+
}, children: (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: allowViewSelection ? (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronDown, {}) : null, iconPosition: "after", style: {
|
|
33
|
+
paddingInline: 8,
|
|
34
|
+
paddingBlock: 4,
|
|
35
|
+
pointerEvents: allowViewSelection ? 'auto' : 'none',
|
|
36
|
+
}, children: (_b = (_a = selectedView.localizedNames) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : selectedView.name }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: viewLookup.map((view) => {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => changeView(view.id), children: (_b = (_a = view.localizedNames) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : view.name }, view.id));
|
|
39
|
+
}) }) })] }) }) }));
|
|
40
|
+
};
|
|
41
|
+
exports.FormSubgridViewSelector = FormSubgridViewSelector;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Attribute, AttributeType } from '@headless-adminapp/core/attributes';
|
|
2
|
+
interface ConditionValueControlProps {
|
|
3
|
+
attribute: Attribute;
|
|
4
|
+
type: AttributeType;
|
|
5
|
+
value: any;
|
|
6
|
+
onChange?: (value: any) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ConditionValueControl({ attribute, type, value, onChange, }: ConditionValueControlProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|