@headless-adminapp/fluent 1.4.45 → 1.4.47
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/GridListContainer.js +2 -2
- package/PageEntityForm/CommandContainer.js +4 -3
- package/PageEntityForm/PageEntityForm.d.ts +2 -0
- package/PageEntityForm/PageEntityForm.js +2 -2
- package/PageEntityForm/RecordSetNavigatorContainer.js +12 -10
- package/components/ChoiceBadge.d.ts +1 -1
- package/form/controls/LookupControl.js +1 -1
- package/form/controls/MultiSelectLookupControl.js +1 -1
- package/form/controls/RegardingControl.js +1 -1
- package/package.json +2 -2
- package/App/NavigationContainer.d.ts +0 -1
- package/App/NavigationContainer.js +0 -63
- package/App/utils.d.ts +0 -14
- package/App/utils.js +0 -27
- package/DataGrid/ScrollbarWithMoreDataRequest.d.ts +0 -9
- package/DataGrid/ScrollbarWithMoreDataRequest.js +0 -33
- package/form/controls/DateRangeControl.d.ts +0 -6
- package/form/controls/DateRangeControl.js +0 -49
- package/form/controls/NumberControl.d.ts +0 -4
- package/form/controls/NumberControl.js +0 -15
|
@@ -103,7 +103,7 @@ const GridListContainer = () => {
|
|
|
103
103
|
width: '100%',
|
|
104
104
|
position: 'absolute',
|
|
105
105
|
transform: `translateY(${virtualSize}px)`,
|
|
106
|
-
}, 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: () => {
|
|
106
|
+
}, children: Array.from({ length: 10 }).map((_, index) => view.experience.card.Skeleton ? ((0, jsx_runtime_1.jsx)(view.experience.card.Skeleton, {}, 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: () => {
|
|
107
107
|
setShowContextMenu(false);
|
|
108
108
|
setSelectedIds([]);
|
|
109
109
|
}, actions: contextCommands })] }) }));
|
|
@@ -126,5 +126,5 @@ const Item = ({ onClick, onLongPress, card, record, schema, selected, }) => {
|
|
|
126
126
|
borderRadius: fluent_1.extendedTokens.paperBorderRadius,
|
|
127
127
|
userSelect: 'none',
|
|
128
128
|
WebkitUserSelect: 'none',
|
|
129
|
-
}, ...longPressEvent, onClick: onClick, children: (0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: card, record: record, schema: schema, selected: selected }) }));
|
|
129
|
+
}, ...longPressEvent, onClick: onClick, children: card.Renderer ? ((0, jsx_runtime_1.jsx)(card.Renderer, { record: record, schema: schema, selected: selected })) : ((0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: card, record: record, schema: schema, selected: selected })) }));
|
|
130
130
|
};
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CommandContainer = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_components_1 = require("@fluentui/react-components");
|
|
9
|
+
const dataform_1 = require("@headless-adminapp/app/dataform");
|
|
9
10
|
const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
|
|
10
11
|
const hooks_2 = require("@headless-adminapp/app/hooks");
|
|
11
12
|
const locale_1 = require("@headless-adminapp/app/locale");
|
|
@@ -22,9 +23,9 @@ const CommandContainer = ({ skeleton }) => {
|
|
|
22
23
|
const formCommands = (0, hooks_1.useMainFormCommands)();
|
|
23
24
|
const router = (0, hooks_4.useRouter)();
|
|
24
25
|
const isMobile = (0, hooks_2.useIsMobile)();
|
|
25
|
-
const schema = (0, hooks_1.useDataFormSchema)();
|
|
26
26
|
const [recordSetVisible, setRecordSetVisible] = (0, hooks_3.useRecordSetVisibility)();
|
|
27
27
|
const recordSetContext = (0, mutable_1.useContextSelector)(recordset_1.RecordSetContext, (state) => state);
|
|
28
|
+
const navigatorLogicalName = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.navigatorLogicalName ?? state.schema.logicalName);
|
|
28
29
|
const navigationCommands = (0, react_1.useMemo)(() => {
|
|
29
30
|
return [
|
|
30
31
|
[
|
|
@@ -36,7 +37,7 @@ const CommandContainer = ({ skeleton }) => {
|
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
39
|
],
|
|
39
|
-
...(recordSetContext.logicalName ===
|
|
40
|
+
...(recordSetContext.logicalName === navigatorLogicalName &&
|
|
40
41
|
recordSetContext.ids.length > 0 &&
|
|
41
42
|
!isMobile
|
|
42
43
|
? [
|
|
@@ -58,7 +59,7 @@ const CommandContainer = ({ skeleton }) => {
|
|
|
58
59
|
recordSetContext.logicalName,
|
|
59
60
|
recordSetVisible,
|
|
60
61
|
router,
|
|
61
|
-
|
|
62
|
+
navigatorLogicalName,
|
|
62
63
|
setRecordSetVisible,
|
|
63
64
|
]);
|
|
64
65
|
const extendedCommands = (0, react_1.useMemo)(() => {
|
|
@@ -13,7 +13,7 @@ const PageBroken_1 = require("../components/PageBroken");
|
|
|
13
13
|
const PageLoading_1 = require("../components/PageLoading");
|
|
14
14
|
const PageEntityFormDesktopContainer_1 = require("./PageEntityFormDesktopContainer");
|
|
15
15
|
const RecordSetNavigatorContainer_1 = require("./RecordSetNavigatorContainer");
|
|
16
|
-
const PageEntityForm = ({ logicalName, formId, recordId, }) => {
|
|
16
|
+
const PageEntityForm = ({ logicalName, formId, recordId, navigatorLogicalName, navigatorRecordId, }) => {
|
|
17
17
|
const result = (0, hooks_1.useLoadFormGridPage)(logicalName, formId);
|
|
18
18
|
(0, hooks_2.useMobileHeader)(true);
|
|
19
19
|
if (result.loading) {
|
|
@@ -31,7 +31,7 @@ const PageEntityForm = ({ logicalName, formId, recordId, }) => {
|
|
|
31
31
|
return ((0, jsx_runtime_1.jsx)(PageBroken_1.PageBroken, { Icon: icons_1.Icons.Error, title: "Creating is disabled", message: "Creating records is disabled for this entity." }));
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
return ((0, jsx_runtime_1.jsx)(historystate_1.HistoryStateKeyProvider, { historyKey: 'page-entity-form.' + logicalName, children: (0, jsx_runtime_1.jsx)(recordset_1.RecordSetProvider, { children: (0, jsx_runtime_1.jsx)(PageEntityFormProvider_1.PageEntityFormProvider, { schema: schema, form: form, recordId: recordId, commands: commands, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(historystate_1.HistoryStateKeyProvider, { historyKey: 'page-entity-form.' + logicalName, children: (0, jsx_runtime_1.jsx)(recordset_1.RecordSetProvider, { children: (0, jsx_runtime_1.jsx)(PageEntityFormProvider_1.PageEntityFormProvider, { schema: schema, form: form, navigatorLogicalName: navigatorLogicalName, navigatorRecordId: navigatorRecordId, recordId: recordId, commands: commands, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
35
35
|
display: 'flex',
|
|
36
36
|
flex: 1,
|
|
37
37
|
flexDirection: 'row',
|
|
@@ -4,10 +4,11 @@ exports.RecordSetNavigatorContainer = 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 ScrollView_1 = require("@headless-adminapp/app/components/ScrollView");
|
|
7
|
-
const
|
|
7
|
+
const dataform_1 = require("@headless-adminapp/app/dataform");
|
|
8
8
|
const locale_1 = require("@headless-adminapp/app/locale");
|
|
9
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
9
10
|
const navigation_1 = require("@headless-adminapp/app/navigation");
|
|
10
|
-
const
|
|
11
|
+
const hooks_1 = require("@headless-adminapp/app/recordset/hooks");
|
|
11
12
|
const react_1 = require("react");
|
|
12
13
|
const fluent_1 = require("../components/fluent");
|
|
13
14
|
const RecordCard_1 = require("./RecordCard");
|
|
@@ -26,10 +27,10 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
26
27
|
},
|
|
27
28
|
});
|
|
28
29
|
const RecordSetNavigatorContainer = () => {
|
|
29
|
-
const { data, cardView, schema } = (0,
|
|
30
|
-
const [visible] = (0,
|
|
31
|
-
const
|
|
32
|
-
const
|
|
30
|
+
const { data, cardView, schema } = (0, hooks_1.useRecordSetResult)();
|
|
31
|
+
const [visible] = (0, hooks_1.useRecordSetVisibility)();
|
|
32
|
+
const navigatorRecordId = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.navigatorRecordId ?? state.recordId);
|
|
33
|
+
const navigatorLogicalName = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.navigatorLogicalName ?? state.schema.logicalName);
|
|
33
34
|
const styles = useStyles();
|
|
34
35
|
const openForm = (0, navigation_1.useOpenForm)();
|
|
35
36
|
const { language, direction } = (0, locale_1.useLocale)();
|
|
@@ -39,7 +40,7 @@ const RecordSetNavigatorContainer = () => {
|
|
|
39
40
|
if (!visible) {
|
|
40
41
|
return null;
|
|
41
42
|
}
|
|
42
|
-
if (schema.logicalName !==
|
|
43
|
+
if (schema.logicalName !== navigatorLogicalName) {
|
|
43
44
|
return null;
|
|
44
45
|
}
|
|
45
46
|
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
@@ -59,12 +60,13 @@ const RecordSetNavigatorContainer = () => {
|
|
|
59
60
|
flexDirection: 'column',
|
|
60
61
|
paddingInline: 16,
|
|
61
62
|
paddingBlock: 8,
|
|
62
|
-
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: schema.localizedPluralLabels?.[language] ?? schema?.pluralLabel }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { vertical: false, style: { opacity: 0.2 } }) }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(ScrollView_1.ScrollView, { autoHide: true, rtl: direction === 'rtl', children: data?.map((record) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { role: "button", className: (0, react_components_1.mergeClasses)(styles.item,
|
|
63
|
-
|
|
63
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: schema.localizedPluralLabels?.[language] ?? schema?.pluralLabel }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { vertical: false, style: { opacity: 0.2 } }) }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(ScrollView_1.ScrollView, { autoHide: true, rtl: direction === 'rtl', children: data?.map((record) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { role: "button", className: (0, react_components_1.mergeClasses)(styles.item, navigatorRecordId === record[schema.idAttribute] &&
|
|
64
|
+
styles.selected), onClick: () => {
|
|
65
|
+
void openForm({
|
|
64
66
|
logicalName: schema.logicalName,
|
|
65
67
|
id: record[schema.idAttribute],
|
|
66
68
|
replace: true,
|
|
67
69
|
});
|
|
68
|
-
}, children: (0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: cardView, record: record, schema: schema, selected:
|
|
70
|
+
}, children: cardView?.Renderer ? ((0, jsx_runtime_1.jsx)(cardView.Renderer, { record: record, schema: schema, selected: navigatorRecordId === record[schema.idAttribute] })) : ((0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: cardView, record: record, schema: schema, selected: navigatorRecordId === record[schema.idAttribute] })) }), (0, jsx_runtime_1.jsx)("div", { style: { paddingInline: react_components_1.tokens.spacingHorizontalL }, children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { vertical: false, style: { opacity: 0.2 } }) })] }, record[schema.idAttribute]))) }) })] }) }));
|
|
69
71
|
};
|
|
70
72
|
exports.RecordSetNavigatorContainer = RecordSetNavigatorContainer;
|
|
@@ -4,7 +4,7 @@ interface ChoiceBadgeProps {
|
|
|
4
4
|
value: unknown;
|
|
5
5
|
attribute: ChoiceAttribute<string | number> | ChoicesAttribute<string | number>;
|
|
6
6
|
formattedValue?: string | null;
|
|
7
|
-
size?: 'small' | 'medium';
|
|
7
|
+
size?: 'small' | 'medium' | 'large' | 'extra-large';
|
|
8
8
|
}
|
|
9
9
|
export declare function ChoiceBadge(props: Readonly<ChoiceBadgeProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
10
10
|
export {};
|
|
@@ -130,7 +130,7 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
130
130
|
recentItemStore.addItem((0, useLookupData_1.createLookupRecentKey)(schema.logicalName), _item[schema.idAttribute], _item[schema.idAttribute]);
|
|
131
131
|
}
|
|
132
132
|
handleChange(_item ?? null);
|
|
133
|
-
}, disableAutoFocus: true, onBlur: onBlur, onFocus: onFocus, id: id, autoFocus: autoFocus, autoCapitalize: "none", autoCorrect: "off", spellCheck: false, children: [data?.records.map((item) => ((0, jsx_runtime_1.jsx)(Option_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: {
|
|
133
|
+
}, disableAutoFocus: true, onBlur: onBlur, onFocus: onFocus, id: id, autoFocus: autoFocus, autoCapitalize: "none", autoCorrect: "off", spellCheck: false, children: [data?.records.map((item) => ((0, jsx_runtime_1.jsx)(Option_1.Option, { value: item[schema.idAttribute], className: (0, react_components_1.mergeClasses)(styles.option), text: item[schema.primaryAttribute], children: view?.experience.card ? (view.experience.card.Renderer ? ((0, jsx_runtime_1.jsx)(view.experience.card.Renderer, { record: item, schema: schema, selected: false })) : ((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: {
|
|
134
134
|
paddingInline: react_components_1.tokens.spacingHorizontalL,
|
|
135
135
|
paddingBlock: react_components_1.tokens.spacingVerticalS,
|
|
136
136
|
}, 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)(fluent_1.ToolbarButton, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), onClick: async () => {
|
|
@@ -145,7 +145,7 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
145
145
|
return;
|
|
146
146
|
recentItemStore.addItem((0, useLookupData_1.createLookupRecentKey)(schema.logicalName), _item[schema.idAttribute], _item[schema.idAttribute]);
|
|
147
147
|
handleAdd(_item);
|
|
148
|
-
}, disableAutoFocus: true, onBlur: onBlur, onFocus: onFocus, id: id, autoFocus: autoFocus, children: [data?.records.map((item) => ((0, jsx_runtime_1.jsx)(Option_1.Option, { value: item[schema.idAttribute], className: (0, react_components_1.mergeClasses)(styles.option), text: item[schema.primaryAttribute], children: (0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: view?.experience.card, record: item, schema: schema }) }, item[schema.idAttribute]))), !isLoading && !data?.records.length && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
148
|
+
}, disableAutoFocus: true, onBlur: onBlur, onFocus: onFocus, id: id, autoFocus: autoFocus, children: [data?.records.map((item) => ((0, jsx_runtime_1.jsx)(Option_1.Option, { value: item[schema.idAttribute], className: (0, react_components_1.mergeClasses)(styles.option), text: item[schema.primaryAttribute], children: view?.experience.card.Renderer ? ((0, jsx_runtime_1.jsx)(view.experience.card.Renderer, { record: item, schema: schema })) : ((0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: view?.experience.card, record: item, schema: schema })) }, item[schema.idAttribute]))), !isLoading && !data?.records.length && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
149
149
|
paddingInline: react_components_1.tokens.spacingHorizontalL,
|
|
150
150
|
paddingBlock: react_components_1.tokens.spacingVerticalS,
|
|
151
151
|
}, 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)(fluent_1.ToolbarButton, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), children: lookupStrings.newRecord }) })] }))] }), (0, jsx_runtime_1.jsx)("div", { ref: tagGroupContainerRef, style: {
|
|
@@ -150,7 +150,7 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
150
150
|
return null;
|
|
151
151
|
}
|
|
152
152
|
return ((0, jsx_runtime_1.jsx)(react_components_1.OptionGroup, { label: schema.label, children: data?.records.map((item) => {
|
|
153
|
-
return ((0, jsx_runtime_1.jsx)(Option_1.Option, { value: item[schema.idAttribute], className: (0, react_components_1.mergeClasses)(styles.option), text: item[schema.primaryAttribute], children: view?.card ? ((0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: view.card, record: item, schema: schema })) : item[schema.primaryAttribute] }, item[schema.idAttribute]));
|
|
153
|
+
return ((0, jsx_runtime_1.jsx)(Option_1.Option, { value: item[schema.idAttribute], className: (0, react_components_1.mergeClasses)(styles.option), text: item[schema.primaryAttribute], children: view?.card ? (view.card.Renderer ? ((0, jsx_runtime_1.jsx)(view.card.Renderer, { record: item, schema: schema })) : ((0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: view.card, record: item, schema: schema }))) : item[schema.primaryAttribute] }, item[schema.idAttribute]));
|
|
154
154
|
}) }, schema.logicalName));
|
|
155
155
|
}), !isLoading &&
|
|
156
156
|
result.every((item) => !item.data?.records.length) && ((0, jsx_runtime_1.jsx)("div", { style: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/fluent",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.47",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/lodash": "4.17.20"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "bf25872bd5633ce7bc68f6aedb5356b4890b6bde"
|
|
58
58
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const NavigationContainer: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NavigationContainer = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
const react_nav_preview_1 = require("@fluentui/react-nav-preview");
|
|
7
|
-
const app_1 = require("@headless-adminapp/app/app");
|
|
8
|
-
const locale_1 = require("@headless-adminapp/app/locale");
|
|
9
|
-
const hooks_1 = require("@headless-adminapp/app/route/hooks");
|
|
10
|
-
const icons_1 = require("@headless-adminapp/icons");
|
|
11
|
-
const react_1 = require("react");
|
|
12
|
-
const utils_1 = require("./utils");
|
|
13
|
-
const useStyles = (0, react_components_1.makeStyles)({
|
|
14
|
-
root: {
|
|
15
|
-
overflow: 'hidden',
|
|
16
|
-
display: 'flex',
|
|
17
|
-
flexShrink: 0,
|
|
18
|
-
},
|
|
19
|
-
content: {
|
|
20
|
-
flex: '1',
|
|
21
|
-
padding: '16px',
|
|
22
|
-
display: 'grid',
|
|
23
|
-
justifyContent: 'flex-start',
|
|
24
|
-
alignItems: 'flex-start',
|
|
25
|
-
},
|
|
26
|
-
field: {
|
|
27
|
-
display: 'flex',
|
|
28
|
-
marginTop: '4px',
|
|
29
|
-
marginLeft: '8px',
|
|
30
|
-
flexDirection: 'column',
|
|
31
|
-
gridRowGap: react_components_1.tokens.spacingVerticalS,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
const NavigationContainer = () => {
|
|
35
|
-
const styles = useStyles();
|
|
36
|
-
const { app, schemaMetadataDic } = (0, app_1.useAppContext)();
|
|
37
|
-
const [isOpen] = (0, react_1.useState)(true);
|
|
38
|
-
const [type] = (0, react_1.useState)('inline');
|
|
39
|
-
const router = (0, hooks_1.useRouter)();
|
|
40
|
-
const pathname = (0, hooks_1.usePathname)();
|
|
41
|
-
const selectedPath = pathname;
|
|
42
|
-
const { language } = (0, locale_1.useLocale)();
|
|
43
|
-
const isRouteActive = (0, hooks_1.useIsRouteActive)();
|
|
44
|
-
const routeResolver = (0, hooks_1.useRouteResolver)();
|
|
45
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: styles.root, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavDrawer, { selectedValue: "active", open: isOpen, type: type, children: (0, jsx_runtime_1.jsx)(react_nav_preview_1.NavDrawerBody, { style: { paddingTop: 8 }, children: app.navItems.map((area) => ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: area.groups.map((group) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [!group.hideLabel && ((0, jsx_runtime_1.jsx)(react_nav_preview_1.NavSectionHeader, { children: group.label })), group.items.map((item, index) => {
|
|
46
|
-
var _a;
|
|
47
|
-
const navItem = (0, utils_1.transformNavPageItem)({
|
|
48
|
-
item,
|
|
49
|
-
schemaMetadataDic: schemaMetadataDic,
|
|
50
|
-
language,
|
|
51
|
-
routeResolver,
|
|
52
|
-
});
|
|
53
|
-
const Icon = (_a = navItem.icon) !== null && _a !== void 0 ? _a : icons_1.IconPlaceholder;
|
|
54
|
-
const isActive = isRouteActive(selectedPath, item);
|
|
55
|
-
return ((0, jsx_runtime_1.jsx)(react_nav_preview_1.NavItem, { href: navItem.link, onClick: (event) => {
|
|
56
|
-
event.preventDefault();
|
|
57
|
-
router.push(navItem.link);
|
|
58
|
-
}, icon: (0, jsx_runtime_1.jsx)(Icon, { size: 20, filled: isActive, color: isActive
|
|
59
|
-
? 'var(--colorNeutralForeground2BrandSelected)'
|
|
60
|
-
: undefined }), value: isActive ? 'active' : '', children: navItem.label }, index));
|
|
61
|
-
})] }, group.label))) }, area.label))) }) }) }));
|
|
62
|
-
};
|
|
63
|
-
exports.NavigationContainer = NavigationContainer;
|
package/App/utils.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { InternalRouteResolver } from '@headless-adminapp/app/route/context';
|
|
2
|
-
import { NavPageItem } from '@headless-adminapp/core/experience/app';
|
|
3
|
-
import { SchemaExperienceMetadata } from '@headless-adminapp/core/experience/schema';
|
|
4
|
-
export declare function transformNavPageItem({ item, schemaMetadataDic: schemaMetadataObject, language, routeResolver, }: {
|
|
5
|
-
item: NavPageItem;
|
|
6
|
-
schemaMetadataDic: Record<string, SchemaExperienceMetadata>;
|
|
7
|
-
language: string;
|
|
8
|
-
routeResolver: InternalRouteResolver;
|
|
9
|
-
}): {
|
|
10
|
-
label: string | undefined;
|
|
11
|
-
icon: import("@headless-adminapp/icons").Icon | undefined;
|
|
12
|
-
link: string;
|
|
13
|
-
isExternal: boolean;
|
|
14
|
-
};
|
package/App/utils.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformNavPageItem = transformNavPageItem;
|
|
4
|
-
function transformNavPageItem({ item, schemaMetadataDic: schemaMetadataObject, language, routeResolver, }) {
|
|
5
|
-
var _a, _b, _c, _d;
|
|
6
|
-
let icon = item.icon;
|
|
7
|
-
let label = (_b = (_a = item.localizedLabel) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.label;
|
|
8
|
-
let link = routeResolver(item);
|
|
9
|
-
if (item.type === 'entityview') {
|
|
10
|
-
const metadata = schemaMetadataObject === null || schemaMetadataObject === void 0 ? void 0 : schemaMetadataObject[item.logicalName];
|
|
11
|
-
if (metadata) {
|
|
12
|
-
if (!label) {
|
|
13
|
-
label =
|
|
14
|
-
(_d = (_c = metadata.localizedPluralLabels) === null || _c === void 0 ? void 0 : _c[language]) !== null && _d !== void 0 ? _d : metadata.pluralLabel;
|
|
15
|
-
}
|
|
16
|
-
if (!icon) {
|
|
17
|
-
icon = metadata.icon;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
label,
|
|
23
|
-
icon,
|
|
24
|
-
link,
|
|
25
|
-
isExternal: item.type === 'external',
|
|
26
|
-
};
|
|
27
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
interface ScrollbarWithMoreDataRequest {
|
|
3
|
-
data: any;
|
|
4
|
-
hasMore: boolean;
|
|
5
|
-
onRequestMore: () => void;
|
|
6
|
-
rtl?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const ScrollbarWithMoreDataRequest: FC<PropsWithChildren<ScrollbarWithMoreDataRequest>>;
|
|
9
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ScrollbarWithMoreDataRequest = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const ScrollView_1 = require("@headless-adminapp/app/components/ScrollView");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
function getReaminingSpace(div) {
|
|
8
|
-
return div.scrollHeight - div.scrollTop - div.clientHeight;
|
|
9
|
-
}
|
|
10
|
-
const ScrollbarWithMoreDataRequest = ({ data, onRequestMore, hasMore, children, rtl }) => {
|
|
11
|
-
const divRef = (0, react_1.useRef)(null);
|
|
12
|
-
const onRequestMoreRef = (0, react_1.useRef)(onRequestMore);
|
|
13
|
-
onRequestMoreRef.current = onRequestMore;
|
|
14
|
-
(0, react_1.useEffect)(() => {
|
|
15
|
-
var _a;
|
|
16
|
-
const div = (_a = divRef.current) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
17
|
-
if (!div) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const remainingSpace = getReaminingSpace(div);
|
|
21
|
-
if (remainingSpace <= 0 && hasMore) {
|
|
22
|
-
onRequestMoreRef.current();
|
|
23
|
-
}
|
|
24
|
-
}, [data, hasMore]);
|
|
25
|
-
return ((0, jsx_runtime_1.jsx)(ScrollView_1.ScrollView, { autoHide: true, rtl: rtl, onScroll: (e) => {
|
|
26
|
-
const div = e.target;
|
|
27
|
-
const remainingSpace = getReaminingSpace(div);
|
|
28
|
-
if (remainingSpace <= 0 && hasMore) {
|
|
29
|
-
onRequestMoreRef.current();
|
|
30
|
-
}
|
|
31
|
-
}, children: (0, jsx_runtime_1.jsx)("div", { ref: divRef, children: children }) }));
|
|
32
|
-
};
|
|
33
|
-
exports.ScrollbarWithMoreDataRequest = ScrollbarWithMoreDataRequest;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ControlProps } from './types';
|
|
2
|
-
export interface DateRangeControlProps extends ControlProps<[string | null, string | null]> {
|
|
3
|
-
maxDate?: Date;
|
|
4
|
-
minDate?: Date;
|
|
5
|
-
}
|
|
6
|
-
export declare function DateRangeControl({ value, onChange, id, name, onBlur, onFocus, disabled, maxDate, minDate, readOnly, }: DateRangeControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,49 +0,0 @@
|
|
|
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.DateRangeControl = DateRangeControl;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_datepicker_compat_1 = require("@fluentui/react-datepicker-compat");
|
|
9
|
-
const locale_1 = require("@headless-adminapp/app/locale");
|
|
10
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
11
|
-
const react_1 = require("react");
|
|
12
|
-
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
13
|
-
function DateRangeControl({ value, onChange, id, name, onBlur, onFocus, disabled, maxDate, minDate, readOnly, }) {
|
|
14
|
-
const [from, setFrom] = (0, react_1.useState)(value ? value[0] : null);
|
|
15
|
-
const [to, setTo] = (0, react_1.useState)(value ? value[1] : null);
|
|
16
|
-
const { datePickerStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
17
|
-
const { dateFormats } = (0, locale_1.useLocale)();
|
|
18
|
-
(0, react_1.useEffect)(() => {
|
|
19
|
-
if (value) {
|
|
20
|
-
setFrom(value[0]);
|
|
21
|
-
setTo(value[1]);
|
|
22
|
-
}
|
|
23
|
-
}, [value]);
|
|
24
|
-
const _minDate = minDate
|
|
25
|
-
? new Date(minDate)
|
|
26
|
-
: from
|
|
27
|
-
? new Date(from)
|
|
28
|
-
: undefined;
|
|
29
|
-
const _maxDate = maxDate ? new Date(maxDate) : to ? new Date(to) : undefined;
|
|
30
|
-
const handleChangeFrom = (date) => {
|
|
31
|
-
var _a;
|
|
32
|
-
setFrom(date ? date.toISOString() : null);
|
|
33
|
-
// if (date && to) {
|
|
34
|
-
onChange === null || onChange === void 0 ? void 0 : onChange([(_a = date === null || date === void 0 ? void 0 : date.toISOString()) !== null && _a !== void 0 ? _a : null, to]);
|
|
35
|
-
// }
|
|
36
|
-
};
|
|
37
|
-
const handleChangeTo = (date) => {
|
|
38
|
-
var _a;
|
|
39
|
-
setTo(date ? date.toISOString() : null);
|
|
40
|
-
// if (date && from) {
|
|
41
|
-
onChange === null || onChange === void 0 ? void 0 : onChange([from, (_a = date === null || date === void 0 ? void 0 : date.toISOString()) !== null && _a !== void 0 ? _a : null]);
|
|
42
|
-
// }
|
|
43
|
-
};
|
|
44
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', gap: 8 }, children: [(0, jsx_runtime_1.jsx)(react_datepicker_compat_1.DatePicker, { id: id, name: name, onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), placeholder: "From", appearance: "filled-darker", disabled: disabled, readOnly: readOnly, formatDate: (date) => date ? (0, dayjs_1.default)(date).format(dateFormats.short) : '', value: from ? new Date(from) : null, onSelectDate: (date) => handleChangeFrom(date), strings: datePickerStrings, minDate: minDate, maxDate: _maxDate, style: { flex: 1 }, input: {
|
|
45
|
-
style: { width: '100%' },
|
|
46
|
-
} }), (0, jsx_runtime_1.jsx)(react_datepicker_compat_1.DatePicker, { id: id, name: name, onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), placeholder: "To", appearance: "filled-darker", disabled: disabled, readOnly: readOnly, formatDate: (date) => (date ? (0, dayjs_1.default)(date).format('YYYY-MM-DD') : ''), value: to ? new Date(to) : null, onSelectDate: (date) => handleChangeTo(date), strings: datePickerStrings, minDate: _minDate, maxDate: maxDate, style: { flex: 1 }, input: {
|
|
47
|
-
style: { width: '100%' },
|
|
48
|
-
} })] }));
|
|
49
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ControlProps } from './types';
|
|
2
|
-
export interface NumberControlProps extends ControlProps<number> {
|
|
3
|
-
}
|
|
4
|
-
export declare function NumberControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, }: NumberControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NumberControl = NumberControl;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
function NumberControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, }) {
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "number", placeholder: placeholder, id: id, appearance: "filled-darker", name: name,
|
|
8
|
-
// value={value ?? ''}
|
|
9
|
-
onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value ? Number(e.target.value) : null), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
|
|
10
|
-
// invalid={error}
|
|
11
|
-
// size="sm"
|
|
12
|
-
disabled: disabled, readOnly: readOnly, style: {
|
|
13
|
-
width: '100%',
|
|
14
|
-
} }));
|
|
15
|
-
}
|