@headless-adminapp/fluent 0.0.17-alpha.52 → 0.0.17-alpha.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App/App.js +7 -11
- package/App/AppHeaderContianer.js +38 -42
- package/App/AppLogo.js +8 -12
- package/App/AppStringContext.js +9 -13
- package/App/AppUI.js +11 -15
- package/App/LayoutProvider.js +11 -15
- package/App/NavigationContainer.js +25 -29
- package/App/QuickActionItem.js +5 -9
- package/App/index.js +1 -5
- package/App/utils.js +1 -4
- package/CommandBar/Button.js +14 -17
- package/CommandBar/Divider.js +6 -9
- package/CommandBar/IconButton.js +13 -16
- package/CommandBar/Label.js +8 -11
- package/CommandBar/MenuButton.js +17 -20
- package/CommandBar/MenuItem.js +15 -18
- package/CommandBar/MenuItems.js +8 -11
- package/CommandBar/MenuList.js +9 -12
- package/CommandBar/Wrapper.js +7 -10
- package/CommandBar/index.js +13 -15
- package/DataForm/SectionControl.js +4 -7
- package/DataGrid/ActionCell.js +11 -14
- package/DataGrid/CommandContainer.js +6 -10
- package/DataGrid/CustomizeColumns/AddColumns.js +34 -37
- package/DataGrid/CustomizeColumns/ColumnItem.js +19 -23
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +36 -42
- package/DataGrid/CustomizeColumns/index.js +1 -5
- package/DataGrid/FormSubgridCommandContainer.js +13 -17
- package/DataGrid/FormSubgridViewSelector.js +18 -22
- package/DataGrid/GridColumnHeader/ConditionValueControl.js +14 -20
- package/DataGrid/GridColumnHeader/FilterForm.js +23 -27
- package/DataGrid/GridColumnHeader/OperatorSelect.js +13 -19
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +28 -32
- package/DataGrid/GridColumnHeader/index.js +1 -5
- package/DataGrid/GridColumnHeader/utils.js +2 -6
- package/DataGrid/GridHeaderContainer.js +4 -8
- package/DataGrid/GridHeaderDesktop.js +26 -30
- package/DataGrid/GridHeaderMobile.js +17 -21
- package/DataGrid/GridListContainer.js +39 -43
- package/DataGrid/GridPaginationContainer.js +12 -16
- package/DataGrid/GridTableContainer.js +74 -78
- package/DataGrid/TableCell/TableCellAction.js +11 -15
- package/DataGrid/TableCell/TableCellBase.js +4 -8
- package/DataGrid/TableCell/TableCellCheckbox.js +7 -10
- package/DataGrid/TableCell/TableCellChoice.js +11 -14
- package/DataGrid/TableCell/TableCellLink.d.ts +1 -1
- package/DataGrid/TableCell/TableCellLink.js +13 -12
- package/DataGrid/TableCell/TableCellText.js +7 -10
- package/DataGrid/TableCell/index.js +4 -20
- package/DataGrid/index.js +4 -11
- package/DataGrid/types.js +1 -2
- package/DataGrid/useTableColumns.js +139 -90
- package/DataGrid/utils.js +1 -5
- package/DialogContainer/AlertDialog.js +5 -8
- package/DialogContainer/ConfirmDialog.js +6 -9
- package/DialogContainer/DialogContainer.js +14 -18
- package/DialogContainer/ErrorDialog.js +9 -12
- package/DialogContainer/PromptDialog.js +30 -57
- package/DialogContainer/index.js +1 -5
- package/Insights/CommandBarContainer.js +11 -14
- package/Insights/FilterBarContainer.js +17 -20
- package/Insights/Grid.js +9 -13
- package/Insights/InsightsContainer.js +19 -22
- package/Insights/WidgetChartContainer.js +30 -34
- package/Insights/WidgetDataGridContainer.js +32 -35
- package/Insights/WidgetTableContainer.js +24 -28
- package/Insights/WidgetTileContainer.js +12 -16
- package/Insights/WidgetTitleBar.js +9 -15
- package/Insights/Widgets.js +25 -28
- package/Insights/charts/AreaChart.js +12 -15
- package/Insights/charts/BarChart.js +12 -15
- package/Insights/charts/ComposedChart.js +12 -15
- package/Insights/charts/CustomTooltipContent.js +8 -12
- package/Insights/charts/GaugeChart.js +3 -6
- package/Insights/charts/LineChart.js +12 -15
- package/Insights/charts/OhlcChart.js +36 -41
- package/Insights/charts/PieChart.js +23 -26
- package/Insights/charts/RadarChart.js +16 -19
- package/Insights/charts/ScatterChart.js +23 -26
- package/Insights/charts/constants.js +1 -4
- package/Insights/charts/formatters.js +17 -29
- package/Insights/charts/index.js +1 -2
- package/Insights/charts/renderers.js +25 -36
- package/Insights/hooks/useQueriesData.js +19 -25
- package/Insights/hooks/useWidgetDetail.js +13 -16
- package/OverflowCommandBar/OverflowCommandBar.js +12 -19
- package/OverflowCommandBar/OverflowMenu.js +16 -20
- package/OverflowCommandBar/OverflowMenuDivider.js +6 -10
- package/OverflowCommandBar/index.js +3 -9
- package/OverflowCommandBar/render.js +9 -15
- package/OverflowCommandBar/utils.js +1 -4
- package/PageBoard/BoardColumn.js +5 -8
- package/PageBoard/BoardColumnCard.js +12 -15
- package/PageBoard/BoardColumnUI.js +34 -38
- package/PageBoard/BoardingColumnCardLoading.js +10 -13
- package/PageBoard/Header.js +16 -20
- package/PageBoard/PageBoard.d.ts +1 -1
- package/PageBoard/PageBoard.js +26 -29
- package/PageBoard/index.js +1 -5
- package/PageEntityForm/CommandContainer.js +21 -25
- package/PageEntityForm/FormTabRelated.js +17 -20
- package/PageEntityForm/PageEntityForm.js +16 -20
- package/PageEntityForm/PageEntityFormDesktopContainer.js +68 -72
- package/PageEntityForm/PageEntityFormStringContext.js +5 -9
- package/PageEntityForm/ProcessFlow.js +21 -24
- package/PageEntityForm/RecordCard.js +21 -24
- package/PageEntityForm/RecordCardLoading.js +10 -13
- package/PageEntityForm/RecordSetNavigatorContainer.js +30 -34
- package/PageEntityForm/RelatedViewSelector.js +28 -31
- package/PageEntityForm/SectionContainer.js +25 -28
- package/PageEntityForm/StandardControl.d.ts +3 -3
- package/PageEntityForm/StandardControl.js +74 -81
- package/PageEntityForm/SubgridControl.js +20 -23
- package/PageEntityForm/index.js +1 -5
- package/PageEntityView/FormSubgridContainer.js +22 -26
- package/PageEntityView/PageEntityView.js +15 -19
- package/PageEntityView/PageEntityViewDesktopContainer.js +9 -13
- package/PageEntityView/PageEntityViewDesktopFrame.js +17 -21
- package/PageEntityView/PageEntityViewMobileContainer.js +9 -13
- package/PageEntityView/PageEntityViewStringContext.js +5 -9
- package/PageEntityView/index.js +1 -5
- package/PageInsights/PageInsights.js +9 -13
- package/PageInsights/index.js +1 -6
- package/ProgressIndicatorContainer/index.js +10 -14
- package/ToastNotificationContainer/index.js +14 -18
- package/componentStore.js +2 -5
- package/components/BodyLoading.js +7 -11
- package/components/DialogLogin.js +5 -8
- package/components/LoginForm.js +21 -47
- package/components/PageBroken.js +5 -8
- package/components/PageLoading.js +5 -8
- package/components/PageLogin.js +14 -17
- package/form/FormControl.js +39 -44
- package/form/FormControlLoading.js +4 -8
- package/form/controls/AttachmentControl.js +56 -60
- package/form/controls/AttachmentsControl.js +15 -19
- package/form/controls/CurrencyControl.js +10 -13
- package/form/controls/DateControl.js +18 -24
- package/form/controls/DateRangeControl.js +14 -20
- package/form/controls/DateTimeControl.js +39 -45
- package/form/controls/DecimalControl.js +8 -11
- package/form/controls/DurationControl.js +11 -15
- package/form/controls/EmailControl.js +7 -10
- package/form/controls/IntegerControl.js +4 -7
- package/form/controls/LookupControl.d.ts +1 -0
- package/form/controls/LookupControl.js +75 -38
- package/form/controls/MultiSelectControl.js +8 -11
- package/form/controls/MultiSelectLookupControl.js +40 -43
- package/form/controls/PasswordControl.js +8 -11
- package/form/controls/RichTextControl.js +5 -32
- package/form/controls/SelectControl.js +8 -11
- package/form/controls/SwitchControl.js +4 -7
- package/form/controls/TelephoneControl.js +7 -10
- package/form/controls/TextAreaControl.js +4 -7
- package/form/controls/TextControl.js +5 -8
- package/form/controls/UrlControl.js +7 -10
- package/form/controls/types.js +1 -2
- package/form/controls/useLookupData.js +14 -18
- package/form/layout/FormBody/FormBody.js +6 -10
- package/form/layout/FormBody/index.js +1 -17
- package/form/layout/FormSection/FormSection.js +18 -22
- package/form/layout/FormSection/FormSectionColumn.js +3 -7
- package/form/layout/FormSection/FormSectionLoading.js +1 -5
- package/form/layout/FormSection/index.js +1 -5
- package/form/layout/FormTab/FormTab.js +16 -20
- package/form/layout/FormTab/FormTabColumn.js +5 -9
- package/form/layout/FormTab/index.js +1 -5
- package/form/layout/TabContext.js +2 -5
- package/form/layout/index.js +3 -9
- package/form/types.js +1 -2
- package/package.json +3 -2
- package/types/index.js +1 -2
- package/utils/avatar.d.ts +2 -0
- package/utils/avatar.js +42 -0
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const utils_1 = require("@headless-adminapp/app/utils");
|
|
7
|
-
const color_1 = require("@headless-adminapp/app/utils/color");
|
|
8
|
-
const useStyles = (0, react_components_1.makeStyles)({
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar, Body1, Body1Strong, Caption1, makeStyles, mergeClasses, Tag, tokens, } from '@fluentui/react-components';
|
|
3
|
+
import { getAttributeFormattedValue } from '@headless-adminapp/app/utils';
|
|
4
|
+
import { isColorDark } from '@headless-adminapp/app/utils/color';
|
|
5
|
+
const useStyles = makeStyles({
|
|
9
6
|
root: {
|
|
10
7
|
width: '100%',
|
|
11
8
|
display: 'flex',
|
|
12
9
|
flexDirection: 'row',
|
|
13
|
-
paddingInline:
|
|
14
|
-
paddingBlock:
|
|
15
|
-
gap:
|
|
10
|
+
paddingInline: tokens.spacingHorizontalL,
|
|
11
|
+
paddingBlock: tokens.spacingVerticalS,
|
|
12
|
+
gap: tokens.spacingHorizontalS,
|
|
16
13
|
// cursor: 'pointer',
|
|
17
14
|
// '&:hover': {
|
|
18
15
|
// background: tokens.colorNeutralBackground1Hover,
|
|
@@ -29,7 +26,7 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
29
26
|
function createIntial(name) {
|
|
30
27
|
return name === null || name === void 0 ? void 0 : name.split(' ').map((x) => x[0]).slice(0, 2).join('').toUpperCase();
|
|
31
28
|
}
|
|
32
|
-
function RecordCard({ schema, cardView, record, selected, }) {
|
|
29
|
+
export function RecordCard({ schema, cardView, record, selected, }) {
|
|
33
30
|
var _a, _b, _c;
|
|
34
31
|
const styles = useStyles();
|
|
35
32
|
const _record = record;
|
|
@@ -47,13 +44,13 @@ function RecordCard({ schema, cardView, record, selected, }) {
|
|
|
47
44
|
avatarSrc = _record[cardView.avatarColumn];
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
|
-
return ((
|
|
47
|
+
return (_jsxs("div", { className: mergeClasses(styles.root, selected && styles.selected), children: [cardView.showAvatar && (_jsx(Avatar, { initials: initials, color: "neutral", style: { cursor: 'pointer' }, image: {
|
|
51
48
|
src: avatarSrc,
|
|
52
|
-
} })), (
|
|
49
|
+
} })), _jsxs("div", { style: {
|
|
53
50
|
display: 'flex',
|
|
54
51
|
flexDirection: 'column',
|
|
55
52
|
flex: 1,
|
|
56
|
-
}, children: [(
|
|
53
|
+
}, children: [_jsx(Body1, { style: { wordBreak: 'break-all' }, children: _record[cardView.primaryColumn] }), (_b = cardView.secondaryColumns) === null || _b === void 0 ? void 0 : _b.map((column) => (_jsx(SecondaryColumnContent, { record: _record, column: column, schema: schema }, column.name)))] }), !!((_c = cardView.rightColumn) === null || _c === void 0 ? void 0 : _c.length) && (_jsx("div", { style: {
|
|
57
54
|
display: 'flex',
|
|
58
55
|
flexDirection: 'column',
|
|
59
56
|
alignItems: 'flex-end',
|
|
@@ -69,7 +66,7 @@ function RecordCard({ schema, cardView, record, selected, }) {
|
|
|
69
66
|
if (!choice) {
|
|
70
67
|
return null;
|
|
71
68
|
}
|
|
72
|
-
return ((
|
|
69
|
+
return (_jsx(Tag, { size: "extra-small", appearance: "filled", style: {
|
|
73
70
|
background: choice.color,
|
|
74
71
|
color: 'white',
|
|
75
72
|
height: 16,
|
|
@@ -80,9 +77,9 @@ function RecordCard({ schema, cardView, record, selected, }) {
|
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
79
|
if (column.variant === 'strong') {
|
|
83
|
-
return ((
|
|
80
|
+
return (_jsx(Body1Strong, { children: getAttributeFormattedValue(value, attribute) }, column.name));
|
|
84
81
|
}
|
|
85
|
-
return ((
|
|
82
|
+
return (_jsx(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: getAttributeFormattedValue(value, attribute) }, column.name));
|
|
86
83
|
}) }))] }));
|
|
87
84
|
}
|
|
88
85
|
function SecondaryColumnContent({ record: _record, column, schema, }) {
|
|
@@ -100,21 +97,21 @@ function SecondaryColumnContent({ record: _record, column, schema, }) {
|
|
|
100
97
|
}
|
|
101
98
|
if (column.variant === 'choice') {
|
|
102
99
|
if (attribute.type === 'choice') {
|
|
103
|
-
return (
|
|
100
|
+
return _jsx(ChoiceTag, { attribute: attribute, value: value });
|
|
104
101
|
}
|
|
105
102
|
if (attribute.type === 'choices') {
|
|
106
103
|
const choices = attribute.options.filter((option) => value.includes(option.value));
|
|
107
104
|
if (!choices.length) {
|
|
108
105
|
return null;
|
|
109
106
|
}
|
|
110
|
-
return ((
|
|
107
|
+
return (_jsx("div", { style: {
|
|
111
108
|
display: 'flex',
|
|
112
109
|
flexDirection: 'row',
|
|
113
110
|
gap: 4,
|
|
114
|
-
}, children: choices.map((choice) => ((
|
|
111
|
+
}, children: choices.map((choice) => (_jsx(ChoiceTag, { attribute: attribute, value: choice.value }, choice.value))) }, column.name));
|
|
115
112
|
}
|
|
116
113
|
}
|
|
117
|
-
return ((
|
|
114
|
+
return (_jsxs(Caption1, { style: { color: tokens.colorNeutralForeground4 }, children: [!!label && `${label}: `, getAttributeFormattedValue(attribute, value)] }, column.name));
|
|
118
115
|
}
|
|
119
116
|
const ChoiceTag = ({ attribute, value, }) => {
|
|
120
117
|
const choice = attribute.options.find((option) => option.value === value);
|
|
@@ -124,9 +121,9 @@ const ChoiceTag = ({ attribute, value, }) => {
|
|
|
124
121
|
const bgColor = choice.color;
|
|
125
122
|
let color;
|
|
126
123
|
if (bgColor) {
|
|
127
|
-
color =
|
|
124
|
+
color = isColorDark(bgColor) ? '#FFFFFF' : '#000000';
|
|
128
125
|
}
|
|
129
|
-
return ((
|
|
126
|
+
return (_jsx(Tag, { size: "extra-small", appearance: "filled", style: {
|
|
130
127
|
background: bgColor,
|
|
131
128
|
color: color,
|
|
132
129
|
height: 16,
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
const useStyles = (0, react_components_1.makeStyles)({
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar, makeStyles, mergeClasses, SkeletonItem, tokens, } from '@fluentui/react-components';
|
|
3
|
+
const useStyles = makeStyles({
|
|
7
4
|
root: {
|
|
8
5
|
width: '100%',
|
|
9
6
|
display: 'flex',
|
|
10
7
|
flexDirection: 'row',
|
|
11
|
-
paddingInline:
|
|
12
|
-
paddingBlock:
|
|
13
|
-
gap:
|
|
8
|
+
paddingInline: tokens.spacingHorizontalL,
|
|
9
|
+
paddingBlock: tokens.spacingVerticalS,
|
|
10
|
+
gap: tokens.spacingHorizontalS,
|
|
14
11
|
},
|
|
15
12
|
});
|
|
16
|
-
function RecordCardLoading({ cardView }) {
|
|
13
|
+
export function RecordCardLoading({ cardView }) {
|
|
17
14
|
var _a;
|
|
18
15
|
const styles = useStyles();
|
|
19
|
-
return ((
|
|
16
|
+
return (_jsxs("div", { className: mergeClasses(styles.root), children: [cardView.showAvatar && (_jsx(Avatar, { color: "neutral", style: { cursor: 'pointer' } })), _jsxs("div", { style: {
|
|
20
17
|
display: 'flex',
|
|
21
18
|
flexDirection: 'column',
|
|
22
19
|
flex: 1,
|
|
23
|
-
gap:
|
|
24
|
-
}, children: [(
|
|
20
|
+
gap: tokens.spacingVerticalXXS,
|
|
21
|
+
}, children: [_jsx("div", { style: { paddingBlock: 2 }, children: _jsx(SkeletonItem, { size: 16, style: { height: 16 } }) }), (_a = cardView.secondaryColumns) === null || _a === void 0 ? void 0 : _a.map((_, index) => (_jsx("div", { style: { paddingBlock: 2 }, children: _jsx(SkeletonItem, { size: 16, style: { width: 160, height: 12 } }) }, index)))] })] }));
|
|
25
22
|
}
|
|
@@ -1,61 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const react_1 = require("react");
|
|
12
|
-
const RecordCard_1 = require("./RecordCard");
|
|
13
|
-
const useStyles = (0, react_components_1.makeStyles)({
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Body1Strong, Divider, makeStyles, mergeClasses, tokens, } from '@fluentui/react-components';
|
|
3
|
+
import { ScrollView } from '@headless-adminapp/app/components/ScrollView';
|
|
4
|
+
import { useRecordId } from '@headless-adminapp/app/dataform/hooks';
|
|
5
|
+
import { useLocale } from '@headless-adminapp/app/locale';
|
|
6
|
+
import { useOpenForm } from '@headless-adminapp/app/navigation';
|
|
7
|
+
import { useRecordSetResult, useRecordSetVisibility, } from '@headless-adminapp/app/recordset/hooks';
|
|
8
|
+
import { Fragment } from 'react';
|
|
9
|
+
import { RecordCard } from './RecordCard';
|
|
10
|
+
const useStyles = makeStyles({
|
|
14
11
|
item: {
|
|
15
12
|
cursor: 'pointer',
|
|
16
13
|
'&:hover': {
|
|
17
|
-
background:
|
|
14
|
+
background: tokens.colorNeutralBackground1Hover,
|
|
18
15
|
},
|
|
19
16
|
'&:active': {
|
|
20
|
-
background:
|
|
17
|
+
background: tokens.colorNeutralBackground1Pressed,
|
|
21
18
|
},
|
|
22
19
|
},
|
|
23
20
|
selected: {
|
|
24
|
-
background:
|
|
21
|
+
background: tokens.colorNeutralBackground1Selected,
|
|
25
22
|
},
|
|
26
23
|
});
|
|
27
|
-
const RecordSetNavigatorContainer = () => {
|
|
24
|
+
export const RecordSetNavigatorContainer = () => {
|
|
28
25
|
var _a, _b;
|
|
29
|
-
const { data, cardView, schema } =
|
|
30
|
-
const [visible] =
|
|
31
|
-
const recordId =
|
|
26
|
+
const { data, cardView, schema } = useRecordSetResult();
|
|
27
|
+
const [visible] = useRecordSetVisibility();
|
|
28
|
+
const recordId = useRecordId();
|
|
32
29
|
const styles = useStyles();
|
|
33
|
-
const openForm =
|
|
34
|
-
const { language, direction } =
|
|
30
|
+
const openForm = useOpenForm();
|
|
31
|
+
const { language, direction } = useLocale();
|
|
35
32
|
if (!schema) {
|
|
36
33
|
return null;
|
|
37
34
|
}
|
|
38
35
|
if (!visible) {
|
|
39
36
|
return null;
|
|
40
37
|
}
|
|
41
|
-
return ((
|
|
42
|
-
[direction === 'rtl' ? 'paddingRight' : 'paddingLeft']:
|
|
43
|
-
paddingBlock:
|
|
38
|
+
return (_jsx("div", { style: {
|
|
39
|
+
[direction === 'rtl' ? 'paddingRight' : 'paddingLeft']: tokens.spacingVerticalM,
|
|
40
|
+
paddingBlock: tokens.spacingVerticalM,
|
|
44
41
|
display: 'flex',
|
|
45
42
|
// display: 'none',
|
|
46
|
-
}, children: (
|
|
47
|
-
boxShadow:
|
|
48
|
-
borderRadius:
|
|
49
|
-
background:
|
|
43
|
+
}, children: _jsxs("div", { style: {
|
|
44
|
+
boxShadow: tokens.shadow2,
|
|
45
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
46
|
+
background: tokens.colorNeutralBackground1,
|
|
50
47
|
display: 'flex',
|
|
51
48
|
minWidth: 320,
|
|
52
49
|
flexDirection: 'column',
|
|
53
|
-
}, children: [(
|
|
50
|
+
}, children: [_jsx("div", { style: {
|
|
54
51
|
display: 'flex',
|
|
55
52
|
flexDirection: 'column',
|
|
56
53
|
paddingInline: 16,
|
|
57
54
|
paddingBlock: 8,
|
|
58
|
-
}, children: (
|
|
55
|
+
}, children: _jsx(Body1Strong, { children: (_b = (_a = schema.localizedPluralLabels) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : schema === null || schema === void 0 ? void 0 : schema.pluralLabel }) }), _jsx("div", { children: _jsx(Divider, { vertical: false, style: { opacity: 0.2 } }) }), _jsx("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: _jsx(ScrollView, { autoHide: true, rtl: direction === 'rtl', children: data === null || data === void 0 ? void 0 : data.map((record) => (_jsxs(Fragment, { children: [_jsx("div", { role: "button", className: mergeClasses(styles.item, recordId ===
|
|
59
56
|
record[schema.idAttribute] &&
|
|
60
57
|
styles.selected), onClick: () => {
|
|
61
58
|
openForm({
|
|
@@ -63,7 +60,6 @@ const RecordSetNavigatorContainer = () => {
|
|
|
63
60
|
id: record[schema.idAttribute],
|
|
64
61
|
replace: true,
|
|
65
62
|
});
|
|
66
|
-
}, children: (
|
|
67
|
-
record[schema.idAttribute] }) }), (
|
|
63
|
+
}, children: _jsx(RecordCard, { cardView: cardView, record: record, schema: schema, selected: recordId ===
|
|
64
|
+
record[schema.idAttribute] }) }), _jsx("div", { style: { paddingInline: tokens.spacingHorizontalL }, children: _jsx(Divider, { vertical: false, style: { opacity: 0.2 } }) })] }, record[schema.idAttribute]))) }) })] }) }));
|
|
68
65
|
};
|
|
69
|
-
exports.RecordSetNavigatorContainer = RecordSetNavigatorContainer;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const icons_1 = require("@headless-adminapp/icons");
|
|
11
|
-
const react_1 = require("react");
|
|
12
|
-
const PageEntityFormStringContext_1 = require("./PageEntityFormStringContext");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Menu, MenuItem, MenuList, MenuPopover, MenuTrigger, tokens, } from '@fluentui/react-components';
|
|
3
|
+
import { useDataFormSchema, useSelectedForm, } from '@headless-adminapp/app/dataform/hooks';
|
|
4
|
+
import { useLocale } from '@headless-adminapp/app/locale';
|
|
5
|
+
import { useMetadata } from '@headless-adminapp/app/metadata/hooks';
|
|
6
|
+
import { isLookupAttribute } from '@headless-adminapp/core/attributes/utils';
|
|
7
|
+
import { Icons } from '@headless-adminapp/icons';
|
|
8
|
+
import { useMemo } from 'react';
|
|
9
|
+
import { usePageEntityFormStrings } from './PageEntityFormStringContext';
|
|
13
10
|
function getRelatedItems(currentSchema, schemas, relatedItems) {
|
|
14
11
|
if (relatedItems === null) {
|
|
15
12
|
return [];
|
|
@@ -25,7 +22,7 @@ function getRelatedItems(currentSchema, schemas, relatedItems) {
|
|
|
25
22
|
throw new Error(`Attribute not found: ${item.logicalName}.${item.attributeName}`);
|
|
26
23
|
}
|
|
27
24
|
const attribute = schema.attributes[item.attributeName];
|
|
28
|
-
if (!
|
|
25
|
+
if (!isLookupAttribute(attribute)) {
|
|
29
26
|
throw new Error(`Attribute is not a lookup: ${item.logicalName}.${item.attributeName}`);
|
|
30
27
|
}
|
|
31
28
|
if (attribute.entity !== currentSchema.logicalName) {
|
|
@@ -44,7 +41,7 @@ function getRelatedItems(currentSchema, schemas, relatedItems) {
|
|
|
44
41
|
.map((s) => {
|
|
45
42
|
return Object.entries(s.attributes)
|
|
46
43
|
.map(([key, attribute]) => {
|
|
47
|
-
if (!
|
|
44
|
+
if (!isLookupAttribute(attribute)) {
|
|
48
45
|
return null;
|
|
49
46
|
}
|
|
50
47
|
if (attribute.entity !== currentSchema.logicalName) {
|
|
@@ -72,24 +69,24 @@ function getRelatedItems(currentSchema, schemas, relatedItems) {
|
|
|
72
69
|
})
|
|
73
70
|
.flat();
|
|
74
71
|
}
|
|
75
|
-
function RelatedViewSelector(props) {
|
|
76
|
-
const schema =
|
|
77
|
-
const formConfig =
|
|
78
|
-
const { schemas } =
|
|
79
|
-
const strings =
|
|
80
|
-
const { language } =
|
|
81
|
-
const data =
|
|
72
|
+
export function RelatedViewSelector(props) {
|
|
73
|
+
const schema = useDataFormSchema();
|
|
74
|
+
const formConfig = useSelectedForm();
|
|
75
|
+
const { schemas } = useMetadata();
|
|
76
|
+
const strings = usePageEntityFormStrings();
|
|
77
|
+
const { language } = useLocale();
|
|
78
|
+
const data = useMemo(() => getRelatedItems(schema, schemas, formConfig.experience.relatedItems), [formConfig.experience.relatedItems, schema, schemas]);
|
|
82
79
|
if (!data.length) {
|
|
83
80
|
return null;
|
|
84
81
|
}
|
|
85
|
-
return ((
|
|
82
|
+
return (_jsxs(Menu, { children: [_jsx(MenuTrigger, { children: _jsxs("button", { style: {
|
|
86
83
|
border: 'none',
|
|
87
84
|
overflow: 'hidden',
|
|
88
|
-
borderRadius:
|
|
89
|
-
padding: `${
|
|
90
|
-
fontFamily:
|
|
91
|
-
lineHeight:
|
|
92
|
-
backgroundColor:
|
|
85
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
86
|
+
padding: `${tokens.spacingVerticalM} ${tokens.spacingHorizontalMNudge}`,
|
|
87
|
+
fontFamily: tokens.fontFamilyBase,
|
|
88
|
+
lineHeight: tokens.lineHeightBase300,
|
|
89
|
+
backgroundColor: tokens.colorTransparentBackground,
|
|
93
90
|
alignItems: 'center',
|
|
94
91
|
position: 'relative',
|
|
95
92
|
display: 'flex',
|
|
@@ -98,10 +95,10 @@ function RelatedViewSelector(props) {
|
|
|
98
95
|
cursor: 'pointer',
|
|
99
96
|
outlineStyle: 'none',
|
|
100
97
|
textTransform: 'none',
|
|
101
|
-
columnGap:
|
|
102
|
-
color:
|
|
103
|
-
}, children: [strings.related, (
|
|
98
|
+
columnGap: tokens.spacingHorizontalSNudge,
|
|
99
|
+
color: tokens.colorNeutralForeground2,
|
|
100
|
+
}, children: [strings.related, _jsx(Icons.ChevronDown, { size: 16 })] }) }), _jsx(MenuPopover, { children: _jsx(MenuList, { children: data.map((item) => {
|
|
104
101
|
var _a, _b;
|
|
105
|
-
return ((
|
|
102
|
+
return (_jsx(MenuItem, { onClick: () => props.onSelect(item), children: (_b = (_a = item.localizedPluralLabels) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.pluralLabel }, item.key));
|
|
106
103
|
}) }) })] }));
|
|
107
104
|
}
|
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const readonly = (0, hooks_1.useFormIsReadonly)();
|
|
19
|
-
const { language } = (0, locale_1.useLocale)();
|
|
20
|
-
return ((0, jsx_runtime_1.jsx)(layout_1.FormSection, { title: (0, utils_1.localizedLabel)(language, section), columnCount: section.columnCount, labelPosition: section.labelPosition, noPadding: section.noPadding, hideLabel: section.hideLabel, children: section.controls.map((control, index) => {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useDataFormSchema, useFormInstance, useFormIsReadonly, useRecordId, } from '@headless-adminapp/app/dataform/hooks';
|
|
3
|
+
import { useLocale } from '@headless-adminapp/app/locale';
|
|
4
|
+
import { localizedLabel } from '@headless-adminapp/app/locale/utils';
|
|
5
|
+
import { Controller } from 'react-hook-form';
|
|
6
|
+
import { componentStore } from '../componentStore';
|
|
7
|
+
import { SectionControlWrapper } from '../DataForm/SectionControl';
|
|
8
|
+
import { FormSection } from '../form/layout';
|
|
9
|
+
import { StandardControl } from './StandardControl';
|
|
10
|
+
import { SubgridControl } from './SubgridControl';
|
|
11
|
+
export function SectionContainer({ section }) {
|
|
12
|
+
const schema = useDataFormSchema();
|
|
13
|
+
const formInstance = useFormInstance();
|
|
14
|
+
const recordId = useRecordId();
|
|
15
|
+
const readonly = useFormIsReadonly();
|
|
16
|
+
const { language } = useLocale();
|
|
17
|
+
return (_jsx(FormSection, { title: localizedLabel(language, section), columnCount: section.columnCount, labelPosition: section.labelPosition, noPadding: section.noPadding, hideLabel: section.hideLabel, children: section.controls.map((control, index) => {
|
|
21
18
|
var _a;
|
|
22
19
|
switch (control.type) {
|
|
23
20
|
case 'standard': {
|
|
24
21
|
const attribute = schema.attributes[control.attributeName];
|
|
25
|
-
let Control =
|
|
22
|
+
let Control = StandardControl;
|
|
26
23
|
if (control.component) {
|
|
27
|
-
const OverrideControl =
|
|
24
|
+
const OverrideControl = componentStore.getComponent(control.component);
|
|
28
25
|
if (OverrideControl) {
|
|
29
26
|
Control = OverrideControl;
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
return ((
|
|
29
|
+
return (_jsx("div", { style: {
|
|
33
30
|
gridColumn: control.span
|
|
34
31
|
? `var(--section-item-span-${control.span})`
|
|
35
32
|
: undefined,
|
|
36
|
-
}, children: (
|
|
33
|
+
}, children: _jsx(Controller, { control: formInstance.control, name: control.attributeName, render: ({ field, fieldState, formState }) => {
|
|
37
34
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
38
35
|
const isError = (fieldState.isTouched || formState.isSubmitted) &&
|
|
39
36
|
!!((_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message);
|
|
@@ -41,7 +38,7 @@ function SectionContainer({ section }) {
|
|
|
41
38
|
? (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message
|
|
42
39
|
: '';
|
|
43
40
|
const label = (_g = (_f = (_d = (_c = control.localizedLabels) === null || _c === void 0 ? void 0 : _c[language]) !== null && _d !== void 0 ? _d : (_e = attribute.localizedLabels) === null || _e === void 0 ? void 0 : _e[language]) !== null && _f !== void 0 ? _f : control.label) !== null && _g !== void 0 ? _g : attribute.label;
|
|
44
|
-
return ((
|
|
41
|
+
return (_jsx(SectionControlWrapper, { label: label, labelPosition: section.labelPosition, required: attribute.required, isError: isError, errorMessage: errorMessage, children: _jsx(Control, { attribute: attribute, name: control.attributeName, value: field.value, onChange: field.onChange, onBlur: field.onBlur, errorMessage: errorMessage, isError: isError, disabled: readonly, label: label, placeholder: label, allowNavigation: true, allowNewRecord: true, fileServiceContext: {
|
|
45
42
|
type: 'entity-form',
|
|
46
43
|
recordId,
|
|
47
44
|
attributeName: control.attributeName,
|
|
@@ -57,9 +54,9 @@ function SectionContainer({ section }) {
|
|
|
57
54
|
case 'subgrid':
|
|
58
55
|
let ContainerComponent = null;
|
|
59
56
|
if (control.component) {
|
|
60
|
-
ContainerComponent =
|
|
57
|
+
ContainerComponent = componentStore.getComponent(control.component);
|
|
61
58
|
}
|
|
62
|
-
return ((
|
|
59
|
+
return (_jsx(SubgridControl, { logicalName: control.logicalName, allowViewSelection: control.allowViewSelection, viewId: control.viewId, availableViewIds: control.availableViewIds, ContainerComponent: ContainerComponent, associated: !control.associatedAttribute
|
|
63
60
|
? false
|
|
64
61
|
: {
|
|
65
62
|
logicalName: schema.logicalName,
|
|
@@ -67,7 +64,7 @@ function SectionContainer({ section }) {
|
|
|
67
64
|
refAttributeName: control.associatedAttribute,
|
|
68
65
|
} }, index));
|
|
69
66
|
case 'spacer':
|
|
70
|
-
return ((
|
|
67
|
+
return (_jsx("div", { style: {
|
|
71
68
|
gridColumn: control.span
|
|
72
69
|
? `var(--section-item-span-${control.span})`
|
|
73
70
|
: undefined,
|
|
@@ -3,13 +3,13 @@ import { FC } from 'react';
|
|
|
3
3
|
export interface StandardControlProps {
|
|
4
4
|
attribute: Attribute;
|
|
5
5
|
label?: string;
|
|
6
|
-
isError
|
|
7
|
-
errorMessage
|
|
6
|
+
isError?: boolean;
|
|
7
|
+
errorMessage?: string;
|
|
8
8
|
name: string;
|
|
9
9
|
value: any;
|
|
10
10
|
placeholder?: string;
|
|
11
11
|
onChange: (value: any) => void;
|
|
12
|
-
onBlur
|
|
12
|
+
onBlur?: () => void;
|
|
13
13
|
fileServiceContext?: Record<string, unknown>;
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
borderOnFocusOnly?: boolean;
|