@headless-adminapp/fluent 1.4.19 → 1.4.20
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/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 +141 -0
- package/DataGrid/CustomFilter/Header.d.ts +6 -0
- package/DataGrid/CustomFilter/Header.js +19 -0
- package/DataGrid/CustomFilter/index.d.ts +1 -0
- package/DataGrid/CustomFilter/index.js +5 -0
- 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/PageEntityView/PageEntityView.js +1 -1
- package/form/controls/useLookupData.js +1 -1
- package/package.json +2 -2
|
@@ -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,141 @@
|
|
|
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 SectionControl_1 = require("../../DataForm/SectionControl");
|
|
13
|
+
const SelectControl_1 = __importDefault(require("../../form/controls/SelectControl"));
|
|
14
|
+
const utils_1 = require("../GridColumnHeader/utils");
|
|
15
|
+
const ColumnFilterItem_1 = require("./ColumnFilterItem");
|
|
16
|
+
const Header_1 = require("./Header");
|
|
17
|
+
const CustomFilter = ({ open, onClose }) => {
|
|
18
|
+
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 }) }));
|
|
19
|
+
};
|
|
20
|
+
exports.CustomFilter = CustomFilter;
|
|
21
|
+
const DrawerContent = ({ onClose }) => {
|
|
22
|
+
const schema = (0, datagrid_1.useDataGridSchema)();
|
|
23
|
+
const [sorting, setSorting] = (0, datagrid_1.useGridSorting)();
|
|
24
|
+
const [columnFilters, , replaceColumnFilters] = (0, datagrid_1.useGridColumnFilter)();
|
|
25
|
+
const [columnFiltersInternal, setColumnFiltersInternal] = (0, react_1.useState)(columnFilters);
|
|
26
|
+
const [sortingInternal, setSortingInternal] = (0, react_1.useState)(sorting);
|
|
27
|
+
(0, react_1.useEffect)(() => {
|
|
28
|
+
setColumnFiltersInternal(columnFilters);
|
|
29
|
+
}, [columnFilters]);
|
|
30
|
+
(0, react_1.useEffect)(() => {
|
|
31
|
+
setSortingInternal(sorting);
|
|
32
|
+
}, [sorting]);
|
|
33
|
+
const attributeOptions = (0, react_1.useMemo)(() => {
|
|
34
|
+
return Object.entries(schema.attributes).map(([key, attribute]) => ({
|
|
35
|
+
value: key,
|
|
36
|
+
label: attribute.label,
|
|
37
|
+
}));
|
|
38
|
+
}, [schema.attributes]);
|
|
39
|
+
const handleAddFilter = (key) => {
|
|
40
|
+
const attribute = schema.attributes[key];
|
|
41
|
+
const defaultOperator = (0, utils_1.getDefaultOperator)(undefined, attribute.type);
|
|
42
|
+
const defaultValues = [];
|
|
43
|
+
setColumnFiltersInternal((prev) => ({
|
|
44
|
+
...prev,
|
|
45
|
+
[key]: {
|
|
46
|
+
operator: defaultOperator,
|
|
47
|
+
value: defaultValues,
|
|
48
|
+
},
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
const isValid = (0, react_1.useMemo)(() => {
|
|
52
|
+
const isSortingValid = sortingInternal.every((x) => x.field && x.order);
|
|
53
|
+
const isColumnFilterValid = Object.entries(columnFiltersInternal).every(([key, condition]) => {
|
|
54
|
+
if (!condition) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
const attribute = schema.attributes[key];
|
|
58
|
+
if (!attribute) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
const selectedOption = constants_1.operatorOptions[attribute.type].find((option) => option.value === condition.operator);
|
|
62
|
+
if (!selectedOption) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
const values = condition.value || [];
|
|
66
|
+
return (values.filter((value) => {
|
|
67
|
+
return value !== null && value !== undefined;
|
|
68
|
+
}).length === selectedOption.controls.length);
|
|
69
|
+
});
|
|
70
|
+
return isColumnFilterValid && isSortingValid;
|
|
71
|
+
}, [columnFiltersInternal, schema, sortingInternal]);
|
|
72
|
+
const handleApply = () => {
|
|
73
|
+
replaceColumnFilters(columnFiltersInternal);
|
|
74
|
+
setSorting(sortingInternal);
|
|
75
|
+
onClose();
|
|
76
|
+
};
|
|
77
|
+
const handleCancel = () => {
|
|
78
|
+
setColumnFiltersInternal(columnFilters);
|
|
79
|
+
setSortingInternal(sorting);
|
|
80
|
+
onClose();
|
|
81
|
+
};
|
|
82
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Header_1.Header, { onClose: handleCancel }), (0, jsx_runtime_1.jsx)(react_components_1.DrawerBody, { style: { padding: react_components_1.tokens.spacingHorizontalM }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
83
|
+
display: 'flex',
|
|
84
|
+
flexDirection: 'column',
|
|
85
|
+
gap: react_components_1.tokens.spacingVerticalM,
|
|
86
|
+
}, 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) => {
|
|
87
|
+
if (!value) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
setSortingInternal((prev) => [
|
|
91
|
+
{
|
|
92
|
+
...prev[0],
|
|
93
|
+
field: value,
|
|
94
|
+
order: prev[0]?.order ?? 'asc',
|
|
95
|
+
},
|
|
96
|
+
]);
|
|
97
|
+
}, 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) => {
|
|
98
|
+
if (!value) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
setSortingInternal((prev) => [
|
|
102
|
+
{
|
|
103
|
+
...prev[0],
|
|
104
|
+
order: value,
|
|
105
|
+
},
|
|
106
|
+
]);
|
|
107
|
+
}, options: [
|
|
108
|
+
{
|
|
109
|
+
label: 'Ascending',
|
|
110
|
+
value: 'asc',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
label: 'Descending',
|
|
114
|
+
value: 'desc',
|
|
115
|
+
},
|
|
116
|
+
] }) }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }), Object.entries(columnFiltersInternal).map(([key, condition]) => {
|
|
117
|
+
const attribute = schema.attributes[key];
|
|
118
|
+
if (!condition) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
return ((0, jsx_runtime_1.jsx)(ColumnFilterItem_1.ColumnFilterItem, { attribute: attribute, condition: condition, onChange: (nextCondition) => {
|
|
122
|
+
setColumnFiltersInternal((prev) => ({
|
|
123
|
+
...prev,
|
|
124
|
+
[key]: nextCondition,
|
|
125
|
+
}));
|
|
126
|
+
}, onRemove: () => {
|
|
127
|
+
setColumnFiltersInternal((prev) => {
|
|
128
|
+
const next = { ...prev };
|
|
129
|
+
delete next[key];
|
|
130
|
+
return next;
|
|
131
|
+
});
|
|
132
|
+
} }, key));
|
|
133
|
+
}), (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) => {
|
|
134
|
+
if (!value)
|
|
135
|
+
return;
|
|
136
|
+
handleAddFilter(value);
|
|
137
|
+
}, options: attributeOptions.filter((x) => !columnFiltersInternal[x.value]) }) })] }) }), (0, jsx_runtime_1.jsxs)(react_components_1.DrawerFooter, { style: {
|
|
138
|
+
padding: react_components_1.tokens.spacingHorizontalM,
|
|
139
|
+
gap: react_components_1.tokens.spacingHorizontalM,
|
|
140
|
+
}, 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" })] })] }));
|
|
141
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Header = 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 Header = ({ onClose }) => {
|
|
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
|
+
alignItems: 'center',
|
|
12
|
+
height: 50,
|
|
13
|
+
minHeight: 50,
|
|
14
|
+
background: react_components_1.tokens.colorNeutralBackground3,
|
|
15
|
+
paddingInline: 8,
|
|
16
|
+
gap: 8,
|
|
17
|
+
}, 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: "Sort and Filter" }) }), (0, jsx_runtime_1.jsx)(QuickActionItem_1.QuickActionItem, { Icon: icons_1.Icons.Close, label: "Close", onClick: onClose })] }) }));
|
|
18
|
+
};
|
|
19
|
+
exports.Header = Header;
|
|
@@ -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; } });
|
|
@@ -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',
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/fluent",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.20",
|
|
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": "be1677e04dcd2ac91082078c0b59f81b0799d469"
|
|
55
55
|
}
|