@headless-adminapp/fluent 1.4.19 → 1.4.21
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 +4 -4
- package/App/Navigation/NavigationContainer.js +28 -19
- package/App/QuickActionItem.js +1 -1
- package/DataGrid/CustomFilter/ColumnFilterItem.d.ts +11 -0
- package/DataGrid/CustomFilter/ColumnFilterItem.js +47 -0
- package/DataGrid/CustomFilter/CustomFilter.d.ts +7 -0
- package/DataGrid/CustomFilter/CustomFilter.js +139 -0
- package/DataGrid/CustomFilter/index.d.ts +1 -0
- package/DataGrid/CustomFilter/index.js +5 -0
- package/DataGrid/CustomizeColumns/AddColumns.js +15 -18
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +21 -30
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +1 -1
- package/DataGrid/GridColumnHeader/utils.js +3 -0
- package/DataGrid/GridHeaderMobile.js +7 -7
- package/DataGrid/GridListContainer.js +4 -1
- package/DataGrid/MobileHeaderTitleContainer.d.ts +2 -0
- package/DataGrid/MobileHeaderTitleContainer.js +45 -0
- package/Header/MobileHeaderCommandContainer.js +5 -1
- package/PageEntityForm/CommandContainer.js +2 -2
- package/PageEntityForm/EditableGridControl/CardUi.js +1 -1
- package/PageEntityView/PageEntityView.js +1 -1
- package/components/DrawerFooter.d.ts +6 -0
- package/components/DrawerFooter.js +14 -0
- package/components/DrawerHeader.d.ts +10 -0
- package/components/DrawerHeader.js +22 -0
- package/form/controls/LookupControl.js +4 -4
- package/form/controls/useLookupData.js +1 -1
- package/package.json +2 -2
|
@@ -40,8 +40,8 @@ const NavBackButton = () => {
|
|
|
40
40
|
color: 'inherit',
|
|
41
41
|
width: !isMobile ? 44 : undefined,
|
|
42
42
|
maxWidth: !isMobile ? 44 : undefined,
|
|
43
|
-
}, icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ArrowLeft, {}), onClick: () => {
|
|
44
|
-
router.back();
|
|
43
|
+
}, icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ArrowLeft, {}), onClick: async () => {
|
|
44
|
+
await router.back();
|
|
45
45
|
} }));
|
|
46
46
|
};
|
|
47
47
|
const NavTitle = () => {
|
|
@@ -98,12 +98,12 @@ const NavActions = () => {
|
|
|
98
98
|
flex: 1,
|
|
99
99
|
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Caption1Strong, { children: authSession?.fullName }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { textOverflow: 'ellipsis', overflow: 'hidden' }, children: authSession?.email })] })] })), !isSkipAuthCheck && (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, { style: { marginInline: 0 } }), (0, jsx_runtime_1.jsxs)(react_components_1.MenuList, { style: { width: 200, marginBottom: 4 }, children: [accountMenuItems?.map((item) => {
|
|
100
100
|
const Icon = item.icon;
|
|
101
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, { size: "inherit" }), onClick: () => {
|
|
101
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(Icon, { size: "inherit" }), onClick: async () => {
|
|
102
102
|
if (item.onClick) {
|
|
103
103
|
item.onClick();
|
|
104
104
|
}
|
|
105
105
|
else if (item.link) {
|
|
106
|
-
router.push(basePath + item.link);
|
|
106
|
+
await router.push(basePath + item.link);
|
|
107
107
|
}
|
|
108
108
|
}, children: item.localizedLabel?.[language] ?? item.label }, item.__key));
|
|
109
109
|
}), !isSkipAuthCheck && ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.SignOut, {}), onClick: () => logout(), children: strings.logout }))] })] })] }))] }));
|
|
@@ -4,8 +4,9 @@ exports.NavigationContainer = 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 app_1 = require("@headless-adminapp/app/app");
|
|
7
|
+
const hooks_1 = require("@headless-adminapp/app/hooks");
|
|
7
8
|
const locale_1 = require("@headless-adminapp/app/locale");
|
|
8
|
-
const
|
|
9
|
+
const hooks_2 = require("@headless-adminapp/app/route/hooks");
|
|
9
10
|
const app_2 = require("@headless-adminapp/core/experience/app");
|
|
10
11
|
const react_1 = require("react");
|
|
11
12
|
const NavCategoryItemComponent_1 = require("./NavCategoryItemComponent");
|
|
@@ -26,11 +27,12 @@ const NavigationContainer = ({ open, type, onOpenChange, isMini, }) => {
|
|
|
26
27
|
const styles = useStyles();
|
|
27
28
|
const { appExperience: app } = (0, app_1.useAppContext)();
|
|
28
29
|
const { schemaMetadataDic } = (0, app_1.useAppContext)();
|
|
29
|
-
const
|
|
30
|
-
const
|
|
30
|
+
const isMobile = (0, hooks_1.useIsMobile)();
|
|
31
|
+
const router = (0, hooks_2.useRouter)();
|
|
32
|
+
const pathname = (0, hooks_2.usePathname)();
|
|
31
33
|
const { language } = (0, locale_1.useLocale)();
|
|
32
|
-
const isRouteActive = (0,
|
|
33
|
-
const routeResolver = (0,
|
|
34
|
+
const isRouteActive = (0, hooks_2.useIsRouteActive)();
|
|
35
|
+
const routeResolver = (0, hooks_2.useRouteResolver)();
|
|
34
36
|
const sections = (0, react_1.useMemo)(() => (0, utils_1.transformNavSections)({
|
|
35
37
|
navItems: app.navItems,
|
|
36
38
|
schemaMetadataDic,
|
|
@@ -46,7 +48,7 @@ const NavigationContainer = ({ open, type, onOpenChange, isMini, }) => {
|
|
|
46
48
|
isRouteActive,
|
|
47
49
|
pathname,
|
|
48
50
|
]);
|
|
49
|
-
const handleNavigation = (item) => {
|
|
51
|
+
const handleNavigation = async (item) => {
|
|
50
52
|
if (type === 'overlay') {
|
|
51
53
|
onOpenChange(false);
|
|
52
54
|
}
|
|
@@ -54,22 +56,29 @@ const NavigationContainer = ({ open, type, onOpenChange, isMini, }) => {
|
|
|
54
56
|
window.open(item.link, '_blank');
|
|
55
57
|
}
|
|
56
58
|
else {
|
|
57
|
-
router.push(item.link);
|
|
59
|
+
await router.push(item.link);
|
|
58
60
|
}
|
|
59
61
|
};
|
|
60
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: styles.root, children: (0, jsx_runtime_1.
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: styles.root, children: (0, jsx_runtime_1.jsxs)(react_components_1.NavDrawer, { selectedValue: "active", selectedCategoryValue: "active", defaultOpenCategories: ['active'], open: open || isMini, type: type, onOpenChange: (_value, data) => onOpenChange(data.open), onNavItemSelect: () => {
|
|
61
63
|
// do nothing
|
|
62
|
-
}, style: { width: isMini ? 60 : undefined }, children: (0, jsx_runtime_1.jsx)(react_components_1.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
}, style: { width: isMini ? 60 : undefined }, children: [isMobile && ((0, jsx_runtime_1.jsx)(react_components_1.NavDrawerHeader, { style: { padding: 0 }, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
65
|
+
display: 'flex',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
height: 50,
|
|
68
|
+
minHeight: 50,
|
|
69
|
+
paddingInline: 12,
|
|
70
|
+
gap: 8,
|
|
71
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Hamburger, { onClick: () => onOpenChange(false) }) }) })), (0, jsx_runtime_1.jsx)(react_components_1.NavDrawerBody, { style: {
|
|
72
|
+
paddingTop: 8,
|
|
73
|
+
}, children: sections.map((section, index) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [!section.hideLabel && !isMini && ((0, jsx_runtime_1.jsx)(react_components_1.NavSectionHeader, { children: section.label })), isMini && index > 0 && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.5 } }) })), section.items.map((item) => {
|
|
74
|
+
if (item.type === app_2.PageType.Category) {
|
|
75
|
+
const isActive = item.items.some((subItem) => subItem.active);
|
|
76
|
+
if (isMini) {
|
|
77
|
+
return ((0, jsx_runtime_1.jsx)(NavMiniCategoryMenu_1.NavMiniCategoryMenu, { isActive: isActive, item: item, onSelect: handleNavigation }, item.key));
|
|
78
|
+
}
|
|
79
|
+
return ((0, jsx_runtime_1.jsxs)(react_components_1.NavCategory, { value: isActive ? 'active' : '', children: [(0, jsx_runtime_1.jsx)(NavCategoryItemComponent_1.NavCategoryItemComponent, { item: item, isActive: isActive }), (0, jsx_runtime_1.jsx)(react_components_1.NavSubItemGroup, { children: item.items.map((subItem) => ((0, jsx_runtime_1.jsx)(NavSubItemComponent_1.NavSubItemComponent, { item: subItem, onClick: handleNavigation }, subItem.key))) })] }, item.key));
|
|
69
80
|
}
|
|
70
|
-
return ((0, jsx_runtime_1.
|
|
71
|
-
}
|
|
72
|
-
return ((0, jsx_runtime_1.jsx)(NavItemComponent_1.NavItemComponent, { item: item, onClick: handleNavigation, isMini: isMini }, item.key));
|
|
73
|
-
})] }, section.label))) }) }) }));
|
|
81
|
+
return ((0, jsx_runtime_1.jsx)(NavItemComponent_1.NavItemComponent, { item: item, onClick: handleNavigation, isMini: isMini }, item.key));
|
|
82
|
+
})] }, section.label))) })] }) }));
|
|
74
83
|
};
|
|
75
84
|
exports.NavigationContainer = NavigationContainer;
|
package/App/QuickActionItem.js
CHANGED
|
@@ -32,7 +32,7 @@ const QuickActionItem = ({ label, Icon, onClick, link, badgeCount, badgeColor =
|
|
|
32
32
|
position: 'relative',
|
|
33
33
|
fontWeight: react_components_1.tokens.fontWeightRegular,
|
|
34
34
|
minWidth: 'unset',
|
|
35
|
-
}, as: "a", href: fullLink, title: label, className: styles.root, onClick: (event) => {
|
|
35
|
+
}, as: "a", href: fullLink, title: label, "aria-label": label, className: styles.root, onClick: (event) => {
|
|
36
36
|
event.preventDefault();
|
|
37
37
|
if (fullLink) {
|
|
38
38
|
router.push(fullLink);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Attribute } from '@headless-adminapp/core/attributes';
|
|
2
|
+
import { ColumnCondition } from '@headless-adminapp/core/experience/view';
|
|
3
|
+
import { FC } from 'react';
|
|
4
|
+
interface ColumnFilterItemProps {
|
|
5
|
+
attribute: Attribute;
|
|
6
|
+
condition: ColumnCondition;
|
|
7
|
+
onChange?: (condition: ColumnCondition) => void;
|
|
8
|
+
onRemove?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const ColumnFilterItem: FC<ColumnFilterItemProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColumnFilterItem = 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 icons_1 = require("@headless-adminapp/icons");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
10
|
+
const TextControl_1 = require("../../form/controls/TextControl");
|
|
11
|
+
const ConditionValueControl_1 = require("../GridColumnHeader/ConditionValueControl");
|
|
12
|
+
const OperatorSelect_1 = require("../GridColumnHeader/OperatorSelect");
|
|
13
|
+
const ColumnFilterItem = ({ condition, attribute, onChange, onRemove, }) => {
|
|
14
|
+
const { operatorStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
15
|
+
const operatorOptions = (0, react_1.useMemo)(() => {
|
|
16
|
+
return (0, datagrid_1.getLocalizedOperatorOptions)(operatorStrings);
|
|
17
|
+
}, [operatorStrings]);
|
|
18
|
+
const selectedOption = (0, react_1.useMemo)(() => {
|
|
19
|
+
return operatorOptions[attribute.type].find((option) => option.value === condition.operator);
|
|
20
|
+
}, [condition.operator, attribute.type, operatorOptions]);
|
|
21
|
+
const handleChangeOperator = (operator) => {
|
|
22
|
+
onChange?.({
|
|
23
|
+
...condition,
|
|
24
|
+
operator,
|
|
25
|
+
value: [],
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const handleChangeValue = (value, index) => {
|
|
29
|
+
const next = [...condition.value];
|
|
30
|
+
next[index] = value;
|
|
31
|
+
onChange?.({
|
|
32
|
+
...condition,
|
|
33
|
+
value: next,
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
37
|
+
display: 'flex',
|
|
38
|
+
flexDirection: 'column',
|
|
39
|
+
gap: react_components_1.tokens.spacingVerticalM,
|
|
40
|
+
border: `1px solid ${react_components_1.tokens.colorNeutralStroke3}`,
|
|
41
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
42
|
+
padding: react_components_1.tokens.spacingVerticalM,
|
|
43
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', gap: react_components_1.tokens.spacingHorizontalS }, children: [(0, jsx_runtime_1.jsx)(TextControl_1.TextControl, { readOnly: true, value: attribute.label }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { style: { alignSelf: 'flex-start' }, icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Delete, { size: 20 }), appearance: "subtle", onClick: onRemove })] }), (0, jsx_runtime_1.jsx)(OperatorSelect_1.OperatorSelect, { attribute: attribute, onChange: (value) => handleChangeOperator(value), value: condition.operator }), selectedOption?.controls.map((x, i) => ((0, jsx_runtime_1.jsx)(ConditionValueControl_1.ConditionValueControl, { type: x, attribute: attribute, value: condition.value[i] ?? null, onChange: (value) => {
|
|
44
|
+
handleChangeValue(value, i);
|
|
45
|
+
} }, x + String(i))))] }));
|
|
46
|
+
};
|
|
47
|
+
exports.ColumnFilterItem = ColumnFilterItem;
|
|
@@ -0,0 +1,139 @@
|
|
|
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.CustomFilter = void 0;
|
|
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 constants_1 = require("@headless-adminapp/app/datagrid/column-filter/constants");
|
|
11
|
+
const react_1 = require("react");
|
|
12
|
+
const DrawerFooter_1 = require("../../components/DrawerFooter");
|
|
13
|
+
const DrawerHeader_1 = require("../../components/DrawerHeader");
|
|
14
|
+
const SectionControl_1 = require("../../DataForm/SectionControl");
|
|
15
|
+
const SelectControl_1 = __importDefault(require("../../form/controls/SelectControl"));
|
|
16
|
+
const utils_1 = require("../GridColumnHeader/utils");
|
|
17
|
+
const ColumnFilterItem_1 = require("./ColumnFilterItem");
|
|
18
|
+
const CustomFilter = ({ open, onClose }) => {
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Drawer, { open: open, position: "end", size: "small", style: { borderLeftWidth: 0 }, children: (0, jsx_runtime_1.jsx)(DrawerContent, { onClose: onClose }) }));
|
|
20
|
+
};
|
|
21
|
+
exports.CustomFilter = CustomFilter;
|
|
22
|
+
const DrawerContent = ({ onClose }) => {
|
|
23
|
+
const schema = (0, datagrid_1.useDataGridSchema)();
|
|
24
|
+
const [sorting, setSorting] = (0, datagrid_1.useGridSorting)();
|
|
25
|
+
const [columnFilters, , replaceColumnFilters] = (0, datagrid_1.useGridColumnFilter)();
|
|
26
|
+
const [columnFiltersInternal, setColumnFiltersInternal] = (0, react_1.useState)(columnFilters);
|
|
27
|
+
const [sortingInternal, setSortingInternal] = (0, react_1.useState)(sorting);
|
|
28
|
+
(0, react_1.useEffect)(() => {
|
|
29
|
+
setColumnFiltersInternal(columnFilters);
|
|
30
|
+
}, [columnFilters]);
|
|
31
|
+
(0, react_1.useEffect)(() => {
|
|
32
|
+
setSortingInternal(sorting);
|
|
33
|
+
}, [sorting]);
|
|
34
|
+
const attributeOptions = (0, react_1.useMemo)(() => {
|
|
35
|
+
return Object.entries(schema.attributes).map(([key, attribute]) => ({
|
|
36
|
+
value: key,
|
|
37
|
+
label: attribute.label,
|
|
38
|
+
}));
|
|
39
|
+
}, [schema.attributes]);
|
|
40
|
+
const handleAddFilter = (key) => {
|
|
41
|
+
const attribute = schema.attributes[key];
|
|
42
|
+
const defaultOperator = (0, utils_1.getDefaultOperator)(undefined, attribute.type);
|
|
43
|
+
const defaultValues = [];
|
|
44
|
+
setColumnFiltersInternal((prev) => ({
|
|
45
|
+
...prev,
|
|
46
|
+
[key]: {
|
|
47
|
+
operator: defaultOperator,
|
|
48
|
+
value: defaultValues,
|
|
49
|
+
},
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
const isValid = (0, react_1.useMemo)(() => {
|
|
53
|
+
const isSortingValid = sortingInternal.every((x) => x.field && x.order);
|
|
54
|
+
const isColumnFilterValid = Object.entries(columnFiltersInternal).every(([key, condition]) => {
|
|
55
|
+
if (!condition) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
const attribute = schema.attributes[key];
|
|
59
|
+
if (!attribute) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
const selectedOption = constants_1.operatorOptions[attribute.type].find((option) => option.value === condition.operator);
|
|
63
|
+
if (!selectedOption) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
const values = condition.value || [];
|
|
67
|
+
return (values.filter((value) => {
|
|
68
|
+
return value !== null && value !== undefined;
|
|
69
|
+
}).length === selectedOption.controls.length);
|
|
70
|
+
});
|
|
71
|
+
return isColumnFilterValid && isSortingValid;
|
|
72
|
+
}, [columnFiltersInternal, schema, sortingInternal]);
|
|
73
|
+
const handleApply = () => {
|
|
74
|
+
replaceColumnFilters(columnFiltersInternal);
|
|
75
|
+
setSorting(sortingInternal);
|
|
76
|
+
onClose();
|
|
77
|
+
};
|
|
78
|
+
const handleCancel = () => {
|
|
79
|
+
setColumnFiltersInternal(columnFilters);
|
|
80
|
+
setSortingInternal(sorting);
|
|
81
|
+
onClose();
|
|
82
|
+
};
|
|
83
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(DrawerHeader_1.DrawerHeader, { title: "Sort and Filter", onClose: handleCancel, showCloseButton: true }), (0, jsx_runtime_1.jsx)(react_components_1.DrawerBody, { style: { padding: react_components_1.tokens.spacingHorizontalM }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
84
|
+
display: 'flex',
|
|
85
|
+
flexDirection: 'column',
|
|
86
|
+
gap: react_components_1.tokens.spacingVerticalM,
|
|
87
|
+
}, children: [(0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: "Sort by", labelPosition: "top", children: (0, jsx_runtime_1.jsx)(SelectControl_1.default, { value: sortingInternal[0]?.field ?? null, onChange: (value) => {
|
|
88
|
+
if (!value) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
setSortingInternal((prev) => [
|
|
92
|
+
{
|
|
93
|
+
...prev[0],
|
|
94
|
+
field: value,
|
|
95
|
+
order: prev[0]?.order ?? 'asc',
|
|
96
|
+
},
|
|
97
|
+
]);
|
|
98
|
+
}, options: attributeOptions }) }), (0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: "Sort order", labelPosition: "top", children: (0, jsx_runtime_1.jsx)(SelectControl_1.default, { value: sortingInternal[0]?.order ?? null, onChange: (value) => {
|
|
99
|
+
if (!value) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
setSortingInternal((prev) => [
|
|
103
|
+
{
|
|
104
|
+
...prev[0],
|
|
105
|
+
order: value,
|
|
106
|
+
},
|
|
107
|
+
]);
|
|
108
|
+
}, options: [
|
|
109
|
+
{
|
|
110
|
+
label: 'Ascending',
|
|
111
|
+
value: 'asc',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
label: 'Descending',
|
|
115
|
+
value: 'desc',
|
|
116
|
+
},
|
|
117
|
+
] }) }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }), Object.entries(columnFiltersInternal).map(([key, condition]) => {
|
|
118
|
+
const attribute = schema.attributes[key];
|
|
119
|
+
if (!condition) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
return ((0, jsx_runtime_1.jsx)(ColumnFilterItem_1.ColumnFilterItem, { attribute: attribute, condition: condition, onChange: (nextCondition) => {
|
|
123
|
+
setColumnFiltersInternal((prev) => ({
|
|
124
|
+
...prev,
|
|
125
|
+
[key]: nextCondition,
|
|
126
|
+
}));
|
|
127
|
+
}, onRemove: () => {
|
|
128
|
+
setColumnFiltersInternal((prev) => {
|
|
129
|
+
const next = { ...prev };
|
|
130
|
+
delete next[key];
|
|
131
|
+
return next;
|
|
132
|
+
});
|
|
133
|
+
} }, key));
|
|
134
|
+
}), (0, jsx_runtime_1.jsx)("div", { style: { alignSelf: 'flex-start' }, children: (0, jsx_runtime_1.jsx)(SelectControl_1.default, { value: null, placeholder: "Add filter on", onChange: (value) => {
|
|
135
|
+
if (!value)
|
|
136
|
+
return;
|
|
137
|
+
handleAddFilter(value);
|
|
138
|
+
}, options: attributeOptions.filter((x) => !columnFiltersInternal[x.value]) }) })] }) }), (0, jsx_runtime_1.jsxs)(DrawerFooter_1.DrawerFooter, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "primary", disabled: !isValid, onClick: handleApply, children: "Apply" }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { onClick: handleCancel, children: "Cancel" })] })] }));
|
|
139
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CustomFilter } from './CustomFilter';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomFilter = void 0;
|
|
4
|
+
var CustomFilter_1 = require("./CustomFilter");
|
|
5
|
+
Object.defineProperty(exports, "CustomFilter", { enumerable: true, get: function () { return CustomFilter_1.CustomFilter; } });
|
|
@@ -11,6 +11,8 @@ const hooks_2 = require("@headless-adminapp/app/metadata/hooks");
|
|
|
11
11
|
const icons_1 = require("@headless-adminapp/icons");
|
|
12
12
|
const react_1 = require("react");
|
|
13
13
|
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
14
|
+
const DrawerFooter_1 = require("../../components/DrawerFooter");
|
|
15
|
+
const DrawerHeader_1 = require("../../components/DrawerHeader");
|
|
14
16
|
const PageEntityViewStringContext_1 = require("../../PageEntityView/PageEntityViewStringContext");
|
|
15
17
|
function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, }) {
|
|
16
18
|
const schema = (0, hooks_1.useDataGridSchema)();
|
|
@@ -60,18 +62,18 @@ function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, })
|
|
|
60
62
|
acc[column.id] = true;
|
|
61
63
|
return acc;
|
|
62
64
|
}, {});
|
|
63
|
-
return ((0, jsx_runtime_1.jsxs)(react_components_1.Drawer, { separator: true, open: opened, position: "end", children: [(0, jsx_runtime_1.jsx)(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
return ((0, jsx_runtime_1.jsxs)(react_components_1.Drawer, { separator: true, open: opened, position: "end", children: [(0, jsx_runtime_1.jsx)(DrawerHeader_1.DrawerHeader, { title: strings.addColumns, showCloseButton: true, onClose: onClose, bottomContent: (0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
66
|
+
display: 'flex',
|
|
67
|
+
flexDirection: 'column-reverse',
|
|
68
|
+
gap: 8,
|
|
69
|
+
marginBlock: react_components_1.tokens.spacingVerticalS,
|
|
70
|
+
paddingInline: react_components_1.tokens.spacingHorizontalS,
|
|
71
|
+
}, 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: selectedGroupItem?.label ?? '', selectedOptions: selectedGroupItem ? [String(selectedGroupItem.key)] : [], onOptionSelect: (event, data) => {
|
|
72
|
+
setSelectedGroup(data.optionValue);
|
|
73
|
+
}, style: { flex: 1, minWidth: 'unset' }, positioning: {
|
|
74
|
+
align: 'bottom',
|
|
75
|
+
position: 'below',
|
|
76
|
+
}, 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) => ((0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "transparent", icon: (0, jsx_runtime_1.jsx)(react_components_1.Checkbox, { checked: includedColumnsObj[column.id] ?? false }), style: {
|
|
75
77
|
fontWeight: react_components_1.tokens.fontSizeBase400,
|
|
76
78
|
width: '100%',
|
|
77
79
|
justifyContent: 'flex-start',
|
|
@@ -83,10 +85,5 @@ function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, })
|
|
|
83
85
|
else {
|
|
84
86
|
onColumnAdd(column);
|
|
85
87
|
}
|
|
86
|
-
}, children: column.label }, column.id))) }), (0, jsx_runtime_1.
|
|
87
|
-
display: 'flex',
|
|
88
|
-
padding: 8,
|
|
89
|
-
gap: 8,
|
|
90
|
-
justifyContent: 'flex-end',
|
|
91
|
-
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { onClick: onClose, children: strings.close }) })] })] }));
|
|
88
|
+
}, children: column.label }, column.id))) }), (0, jsx_runtime_1.jsx)(DrawerFooter_1.DrawerFooter, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { onClick: onClose, children: strings.close }) })] }));
|
|
92
89
|
}
|
|
@@ -12,7 +12,11 @@ const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
|
12
12
|
const icons_1 = require("@headless-adminapp/icons");
|
|
13
13
|
const immutability_helper_1 = __importDefault(require("immutability-helper"));
|
|
14
14
|
const react_1 = require("react");
|
|
15
|
+
const Button_1 = require("../../CommandBar/Button");
|
|
16
|
+
const Wrapper_1 = require("../../CommandBar/Wrapper");
|
|
15
17
|
const DndProvider_1 = require("../../components/DndProvider");
|
|
18
|
+
const DrawerFooter_1 = require("../../components/DrawerFooter");
|
|
19
|
+
const DrawerHeader_1 = require("../../components/DrawerHeader");
|
|
16
20
|
const PageEntityViewStringContext_1 = require("../../PageEntityView/PageEntityViewStringContext");
|
|
17
21
|
const AddColumns_1 = require("./AddColumns");
|
|
18
22
|
const ColumnItem_1 = require("./ColumnItem");
|
|
@@ -44,34 +48,21 @@ function CustomizeColumns({ onClose, opened }) {
|
|
|
44
48
|
const onColumnRemove = (0, react_1.useCallback)((column) => {
|
|
45
49
|
setItems((prev) => prev.filter((x) => x.id !== column.id));
|
|
46
50
|
}, []);
|
|
47
|
-
return ((0, jsx_runtime_1.jsxs)(react_components_1.Drawer, { separator: true, open: opened, position: "end", size: "small", children: [(0, jsx_runtime_1.jsx)(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}, 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: () => onColumnRemove(item), 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: {
|
|
65
|
-
display: 'flex',
|
|
66
|
-
padding: 8,
|
|
67
|
-
gap: 8,
|
|
68
|
-
justifyContent: 'flex-end',
|
|
69
|
-
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Button, { onClick: () => {
|
|
70
|
-
setContextValue({
|
|
71
|
-
columns: items,
|
|
72
|
-
});
|
|
73
|
-
onClose();
|
|
74
|
-
}, appearance: "primary", children: strings.apply }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { onClick: () => {
|
|
75
|
-
onClose();
|
|
76
|
-
}, children: strings.cancel })] })] })] }));
|
|
51
|
+
return ((0, jsx_runtime_1.jsxs)(react_components_1.Drawer, { separator: true, open: opened, position: "end", size: "small", children: [(0, jsx_runtime_1.jsx)(DrawerHeader_1.DrawerHeader, { title: strings.editColumns, showCloseButton: true, onClose: onClose }), (0, jsx_runtime_1.jsxs)(react_components_1.DrawerBody, { style: { paddingInline: react_components_1.tokens.spacingHorizontalM }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { marginInline: -8, marginTop: 8 }, children: [(0, jsx_runtime_1.jsxs)(Wrapper_1.CommandBarWrapper, { children: [(0, jsx_runtime_1.jsx)(Button_1.CommandButton, { Icon: icons_1.Icons.Add, text: strings.add, onClick: () => setShowAddColumns(true) }), (0, jsx_runtime_1.jsx)(Button_1.CommandButton, { Icon: icons_1.Icons.Edit, text: strings.reset, disabled: !isDirty, onClick: () => {
|
|
52
|
+
setItems(columns);
|
|
53
|
+
} })] }), (0, jsx_runtime_1.jsx)(AddColumns_1.AddColumns, { onColumnAdd: onColumnAdd, onColumnRemove: onColumnRemove, columns: items, opened: showAddColumns, onClose: () => setShowAddColumns(false) })] }), (0, jsx_runtime_1.jsx)(DndProvider_1.DndProvider, { children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
54
|
+
display: 'flex',
|
|
55
|
+
flexDirection: 'column',
|
|
56
|
+
width: '100%',
|
|
57
|
+
gap: react_components_1.tokens.spacingVerticalS,
|
|
58
|
+
// padding: tokens.spacingHorizontalS,
|
|
59
|
+
paddingBlock: react_components_1.tokens.spacingVerticalS,
|
|
60
|
+
}, 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: () => onColumnRemove(item), stringSet: strings }, item.id))) }) })] }), (0, jsx_runtime_1.jsxs)(DrawerFooter_1.DrawerFooter, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Button, { onClick: () => {
|
|
61
|
+
setContextValue({
|
|
62
|
+
columns: items,
|
|
63
|
+
});
|
|
64
|
+
onClose();
|
|
65
|
+
}, appearance: "primary", children: strings.apply }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { onClick: () => {
|
|
66
|
+
onClose();
|
|
67
|
+
}, children: strings.cancel })] })] }));
|
|
77
68
|
}
|
|
@@ -81,7 +81,7 @@ const TableHeaderFilterCell = ({ children, sortDirection, onChangeSortDirection,
|
|
|
81
81
|
default:
|
|
82
82
|
return 'left';
|
|
83
83
|
}
|
|
84
|
-
}, [attribute]);
|
|
84
|
+
}, [attribute, column.name, schema.primaryAttribute]);
|
|
85
85
|
const styles = useStyles();
|
|
86
86
|
const isResizingRef = (0, react_1.useRef)(false);
|
|
87
87
|
const [columnFilters, setColumnFilters] = (0, hooks_1.useGridColumnFilter)();
|
|
@@ -12,6 +12,9 @@ function getDefaultOperator(operator, attributeType) {
|
|
|
12
12
|
if (attributeType === 'choice' || attributeType === 'lookup') {
|
|
13
13
|
return 'in';
|
|
14
14
|
}
|
|
15
|
+
if (attributeType === 'string') {
|
|
16
|
+
return 'like';
|
|
17
|
+
}
|
|
15
18
|
return 'eq';
|
|
16
19
|
}
|
|
17
20
|
function getDefaultValues(operator, value, _attributeType) {
|
|
@@ -4,26 +4,26 @@ exports.GridHeaderMobile = 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/datagrid/hooks");
|
|
7
|
-
const locale_1 = require("@headless-adminapp/app/locale");
|
|
8
7
|
const icons_1 = require("@headless-adminapp/icons");
|
|
8
|
+
const react_1 = require("react");
|
|
9
9
|
const AppStringContext_1 = require("../App/AppStringContext");
|
|
10
|
+
const CustomFilter_1 = require("./CustomFilter");
|
|
11
|
+
const MobileHeaderTitleContainer_1 = require("./MobileHeaderTitleContainer");
|
|
10
12
|
const GridHeaderMobile = () => {
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const changeView = (0, hooks_1.useChangeView)();
|
|
13
|
+
const [columnFilters] = (0, hooks_1.useGridColumnFilter)();
|
|
14
|
+
const [showCustomFilters, setShowCustomFilters] = (0, react_1.useState)(false);
|
|
14
15
|
const [searchText, setSearchText] = (0, hooks_1.useSearchText)();
|
|
15
|
-
const { language } = (0, locale_1.useLocale)();
|
|
16
16
|
const appStrings = (0, AppStringContext_1.useAppStrings)();
|
|
17
17
|
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
18
18
|
alignItems: 'center',
|
|
19
19
|
paddingInline: 8,
|
|
20
20
|
gap: 8,
|
|
21
21
|
display: 'flex',
|
|
22
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { alignItems: 'center', display: 'flex', gap: 16, flex: 1 }, 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), style: { flex: 1 } }) }), (0, jsx_runtime_1.
|
|
22
|
+
}, children: [(0, jsx_runtime_1.jsx)(MobileHeaderTitleContainer_1.MobileHeaderTitleContainer, {}), (0, jsx_runtime_1.jsx)("div", { style: { alignItems: 'center', display: 'flex', gap: 16, flex: 1 }, 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), style: { flex: 1 } }) }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
23
23
|
alignItems: 'center',
|
|
24
24
|
gap: 16,
|
|
25
25
|
justifyContent: 'space-between',
|
|
26
26
|
display: 'flex',
|
|
27
|
-
}, children: (0, jsx_runtime_1.
|
|
27
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", style: { position: 'relative' }, icon: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(icons_1.Icons.Filter, {}), Object.keys(columnFilters).length > 0 && ((0, jsx_runtime_1.jsx)(react_components_1.Badge, { style: { position: 'absolute', top: 0, right: 0 }, color: "danger", size: "tiny" }))] }), iconPosition: "after", onClick: () => setShowCustomFilters(true) }), (0, jsx_runtime_1.jsx)(CustomFilter_1.CustomFilter, { open: showCustomFilters, onClose: () => setShowCustomFilters(false) })] })] }));
|
|
28
28
|
};
|
|
29
29
|
exports.GridHeaderMobile = GridHeaderMobile;
|
|
@@ -98,7 +98,10 @@ const GridListContainer = () => {
|
|
|
98
98
|
width: '100%',
|
|
99
99
|
position: 'absolute',
|
|
100
100
|
transform: `translateY(${virtualSize}px)`,
|
|
101
|
-
}, children: Array.from({ length: 10 }).map((_, index) => ((0, jsx_runtime_1.jsx)(RecordCardLoading_1.RecordCardLoading, { cardView: view.experience.card }, index))) }))] }) }), (0, jsx_runtime_1.jsx)("div", { style: { height: 'env(safe-area-inset-bottom)' } }), (0, jsx_runtime_1.jsx)(MobileHeaderCommandContainer_1.BottomDrawerMenu, { open: showContextMenu, onClose: () =>
|
|
101
|
+
}, children: Array.from({ length: 10 }).map((_, index) => ((0, jsx_runtime_1.jsx)(RecordCardLoading_1.RecordCardLoading, { cardView: view.experience.card }, index))) }))] }) }), (0, jsx_runtime_1.jsx)("div", { style: { height: 'env(safe-area-inset-bottom)' } }), (0, jsx_runtime_1.jsx)(MobileHeaderCommandContainer_1.BottomDrawerMenu, { open: showContextMenu, onClose: () => {
|
|
102
|
+
setShowContextMenu(false);
|
|
103
|
+
setSelectedIds([]);
|
|
104
|
+
}, actions: contextCommands })] }) }));
|
|
102
105
|
};
|
|
103
106
|
exports.GridListContainer = GridListContainer;
|
|
104
107
|
const Item = ({ onClick, onLongPress, card, record, schema, selected, }) => {
|
|
@@ -0,0 +1,45 @@
|
|
|
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 hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
7
|
+
const MobileHeaderTitle_1 = require("@headless-adminapp/app/header/components/MobileHeaderTitle");
|
|
8
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
9
|
+
const metadata_1 = require("@headless-adminapp/app/metadata");
|
|
10
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
11
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
12
|
+
const MobileHeaderTitleContainer = () => {
|
|
13
|
+
const { language } = (0, locale_1.useLocale)();
|
|
14
|
+
const viewLookup = (0, hooks_1.useGridViewLookupData)();
|
|
15
|
+
const selectedView = (0, hooks_1.useSelectedView)();
|
|
16
|
+
const changeView = (0, hooks_1.useChangeView)();
|
|
17
|
+
const schema = (0, hooks_1.useDataGridSchema)();
|
|
18
|
+
const { experienceStore } = (0, metadata_1.useMetadata)();
|
|
19
|
+
const { data: defaultViewId, isPending } = (0, react_query_1.useQuery)({
|
|
20
|
+
queryKey: ['experience-schema-default-view-id', schema.logicalName],
|
|
21
|
+
queryFn: () => experienceStore.getDefaultViewId(schema.logicalName),
|
|
22
|
+
});
|
|
23
|
+
if (viewLookup.length < 2) {
|
|
24
|
+
if (isPending || selectedView.id === defaultViewId) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(MobileHeaderTitle_1.MobileHeaderTitle, { order: 3, title: (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { hasIcons: true, children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: {
|
|
29
|
+
style: { color: 'inherit' },
|
|
30
|
+
children: (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronDown, {}),
|
|
31
|
+
}, iconPosition: "after", style: {
|
|
32
|
+
fontSize: react_components_1.tokens.fontSizeBase400,
|
|
33
|
+
fontWeight: react_components_1.tokens.fontWeightSemibold,
|
|
34
|
+
lineHeight: react_components_1.tokens.lineHeightBase400,
|
|
35
|
+
color: 'inherit',
|
|
36
|
+
backgroundColor: 'transparent',
|
|
37
|
+
paddingInline: 0,
|
|
38
|
+
justifyContent: 'flex-start',
|
|
39
|
+
}, children: (0, jsx_runtime_1.jsx)("span", { style: {
|
|
40
|
+
textOverflow: 'ellipsis',
|
|
41
|
+
whiteSpace: 'nowrap',
|
|
42
|
+
overflow: 'hidden',
|
|
43
|
+
}, children: selectedView.localizedNames?.[language] ?? 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) => ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => changeView(view.id), icon: selectedView.id === view.id ? ((0, jsx_runtime_1.jsx)(icons_1.Icons.Checkmark, {})) : undefined, children: view.localizedNames?.[language] ?? view.name }, view.id))) }) })] }) }));
|
|
44
|
+
};
|
|
45
|
+
exports.MobileHeaderTitleContainer = MobileHeaderTitleContainer;
|
|
@@ -77,7 +77,11 @@ const BottomDrawerMenu = ({ open, onClose, actions, }) => {
|
|
|
77
77
|
borderTopLeftRadius: react_components_1.tokens.borderRadiusXLarge,
|
|
78
78
|
borderTopRightRadius: react_components_1.tokens.borderRadiusXLarge,
|
|
79
79
|
height: 'unset',
|
|
80
|
-
}, onOpenChange: () => {
|
|
80
|
+
}, onOpenChange: () => {
|
|
81
|
+
if (!subMenuStack.length) {
|
|
82
|
+
onClose();
|
|
83
|
+
}
|
|
84
|
+
}, children: (0, jsx_runtime_1.jsxs)(react_components_1.DrawerBody, { style: {
|
|
81
85
|
maxHeight: '70vh',
|
|
82
86
|
padding: 0,
|
|
83
87
|
overflowY: 'hidden',
|
|
@@ -61,7 +61,7 @@ const CardUi = ({ schema, control, formControl, onAddRow, onRemoveRow, rows, ali
|
|
|
61
61
|
}, children: (0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { name: `${alias}.${index}.${attributeName}`, control: formControl, render: ({ field, fieldState, formState }) => {
|
|
62
62
|
const isError = (fieldState.isTouched || formState.isSubmitted) &&
|
|
63
63
|
!!fieldState.error?.message;
|
|
64
|
-
return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: attribute.label, labelPosition: "top", isError: isError, children: (0, jsx_runtime_1.jsx)(StandardControl_1.StandardControl, { attribute: attribute, name: attributeName, value: field.value ?? null, readOnly: isControlReadonly, onChange: (value) => {
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: attribute.label, labelPosition: "top", isError: isError, required: attribute.required, children: (0, jsx_runtime_1.jsx)(StandardControl_1.StandardControl, { attribute: attribute, name: attributeName, value: field.value ?? null, readOnly: isControlReadonly, onChange: (value) => {
|
|
65
65
|
const previousValue = field.value;
|
|
66
66
|
field.onChange(value);
|
|
67
67
|
eventManager.emit(constants_1.EVENT_KEY_ON_FIELD_CHANGE, field.name, value, previousValue);
|
|
@@ -34,6 +34,6 @@ const PageEntityView = ({ logicalName, viewId, onChangeView, useV2, }) => {
|
|
|
34
34
|
else {
|
|
35
35
|
content = (0, jsx_runtime_1.jsx)(PageEntityViewDesktopContainer_1.PageEntityViewDesktopContainerV2, {});
|
|
36
36
|
}
|
|
37
|
-
return ((0, jsx_runtime_1.jsx)(historystate_1.HistoryStateKeyProvider, { historyKey: 'page-entity-view.' + logicalName, children: (0, jsx_runtime_1.jsxs)(PageEntityViewProvider_1.PageEntityViewProvider, { schema: schema, view: view, availableViews: viewLookup, commands: commands, onChangeView: onChangeView, children: [(0, jsx_runtime_1.jsx)(MobileHeaderTitle_1.MobileHeaderTitle, { title: schema.
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(historystate_1.HistoryStateKeyProvider, { historyKey: 'page-entity-view.' + logicalName, children: (0, jsx_runtime_1.jsxs)(PageEntityViewProvider_1.PageEntityViewProvider, { schema: schema, view: view, availableViews: viewLookup, commands: commands, onChangeView: onChangeView, children: [(0, jsx_runtime_1.jsx)(MobileHeaderTitle_1.MobileHeaderTitle, { title: schema.pluralLabel, order: 2 }), content] }) }));
|
|
38
38
|
};
|
|
39
39
|
exports.PageEntityView = PageEntityView;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DrawerFooter = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const DrawerFooter = ({ children, justify, }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.DrawerFooter, { style: {
|
|
8
|
+
padding: react_components_1.tokens.spacingHorizontalM,
|
|
9
|
+
gap: react_components_1.tokens.spacingHorizontalM,
|
|
10
|
+
background: react_components_1.tokens.colorNeutralBackground2,
|
|
11
|
+
justifyContent: justify,
|
|
12
|
+
}, children: children }));
|
|
13
|
+
};
|
|
14
|
+
exports.DrawerFooter = DrawerFooter;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface DrawerHeaderProps {
|
|
3
|
+
title: string;
|
|
4
|
+
onClose?: () => void;
|
|
5
|
+
showCloseButton: boolean;
|
|
6
|
+
rightContent?: React.ReactNode;
|
|
7
|
+
bottomContent?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const DrawerHeader: FC<DrawerHeaderProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DrawerHeader = 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 QuickActionItem_1 = require("../App/QuickActionItem");
|
|
8
|
+
const DrawerHeader = ({ title, onClose, showCloseButton, rightContent, bottomContent, }) => {
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.DrawerHeader, { style: { padding: 0 }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
height: 50,
|
|
16
|
+
minHeight: 50,
|
|
17
|
+
background: react_components_1.tokens.colorNeutralBackground3,
|
|
18
|
+
paddingInline: 8,
|
|
19
|
+
gap: 8,
|
|
20
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, alignItems: 'center', gap: 8 }, children: (0, jsx_runtime_1.jsx)(react_components_1.Subtitle2, { style: { paddingLeft: 4 }, children: title }) }), rightContent, showCloseButton && ((0, jsx_runtime_1.jsx)(QuickActionItem_1.QuickActionItem, { Icon: icons_1.Icons.Close, label: "Close", onClick: onClose }))] }), bottomContent] }) }));
|
|
21
|
+
};
|
|
22
|
+
exports.DrawerHeader = DrawerHeader;
|
|
@@ -55,13 +55,13 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
55
55
|
id: value.id,
|
|
56
56
|
});
|
|
57
57
|
}, [allowNavigation, routeResolver, schema.logicalName, value]);
|
|
58
|
-
const handleOpenRecord = (0, react_1.useCallback)((event) => {
|
|
58
|
+
const handleOpenRecord = (0, react_1.useCallback)(async (event) => {
|
|
59
59
|
event.preventDefault();
|
|
60
60
|
event.stopPropagation();
|
|
61
61
|
if (!path) {
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
router.push(path);
|
|
64
|
+
await router.push(path);
|
|
65
65
|
}, [path, router]);
|
|
66
66
|
(0, react_1.useEffect)(() => {
|
|
67
67
|
if (open)
|
|
@@ -118,8 +118,8 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
118
118
|
}, disableAutoFocus: true, onBlur: onBlur, onFocus: onFocus, id: id, autoFocus: autoFocus, children: [data?.records.map((item) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: item[schema.idAttribute], className: (0, react_components_1.mergeClasses)(styles.option), text: item[schema.primaryAttribute], children: view?.experience.card ? ((0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: view.experience.card, record: item, schema: schema })) : item[schema.primaryAttribute] }, item[schema.idAttribute]))), !isLoading && !data?.records.length && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
119
119
|
paddingInline: react_components_1.tokens.spacingHorizontalL,
|
|
120
120
|
paddingBlock: react_components_1.tokens.spacingVerticalS,
|
|
121
|
-
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Body1, { children: lookupStrings.noRecordsFound }) })), allowNewRecord && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, {}), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: react_components_1.tokens.spacingVerticalXXS }, children: (0, jsx_runtime_1.jsx)(react_components_1.ToolbarButton, { style: { fontWeight: 'normal' }, icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), onClick: () => {
|
|
122
|
-
router.push(routeResolver({
|
|
121
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Body1, { children: lookupStrings.noRecordsFound }) })), allowNewRecord && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, {}), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: react_components_1.tokens.spacingVerticalXXS }, children: (0, jsx_runtime_1.jsx)(react_components_1.ToolbarButton, { style: { fontWeight: 'normal' }, icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), onClick: async () => {
|
|
122
|
+
await router.push(routeResolver({
|
|
123
123
|
logicalName: schema.logicalName,
|
|
124
124
|
type: app_2.PageType.EntityForm,
|
|
125
125
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/fluent",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"uuid": "11.0.3",
|
|
52
52
|
"yup": "^1.4.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "2a993d2eb239ff24ffd73df81aba26240aaf1b2f"
|
|
55
55
|
}
|