@headless-adminapp/fluent 1.4.32 → 1.4.38
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/DataForm/SectionControl.d.ts +1 -0
- package/DataForm/SectionControl.js +10 -1
- package/DataGrid/GridListContainer.js +5 -1
- package/DataGrid/GridTableContainer.js +7 -2
- package/PageEntityForm/RecordCard.js +1 -1
- package/PageEntityForm/SectionContainer.js +6 -4
- package/PageEntityForm/SubgridControl.d.ts +3 -0
- package/PageEntityForm/SubgridControl.js +2 -2
- package/PageEntityView/FormSubgridContainer.d.ts +1 -0
- package/PageEntityView/FormSubgridContainer.js +14 -14
- package/form/layout/FormSection/FormSection.js +1 -1
- package/package.json +2 -2
|
@@ -6,6 +6,7 @@ interface SectionControlWrapperProps {
|
|
|
6
6
|
required?: boolean;
|
|
7
7
|
isError?: boolean;
|
|
8
8
|
errorMessage?: string;
|
|
9
|
+
grow?: boolean;
|
|
9
10
|
}
|
|
10
11
|
export declare function SectionControlWrapper(props: PropsWithChildren<SectionControlWrapperProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -4,5 +4,14 @@ exports.SectionControlWrapper = SectionControlWrapper;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
function SectionControlWrapper(props) {
|
|
7
|
-
|
|
7
|
+
const gridTemplateRows = !props.grow
|
|
8
|
+
? undefined
|
|
9
|
+
: props.labelPosition === 'top' && !props.labelHidden
|
|
10
|
+
? 'auto 1fr auto auto'
|
|
11
|
+
: '1fr auto auto auto';
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Field, { label: props.labelHidden ? undefined : props.label, orientation: props.labelPosition === 'top' ? 'vertical' : 'horizontal', required: props.labelHidden ? undefined : props.required, validationState: props.isError ? 'error' : undefined, validationMessage: props.errorMessage, validationMessageIcon: null, style: {
|
|
13
|
+
paddingLeft: props.labelHidden ? 0 : undefined,
|
|
14
|
+
gridTemplateRows,
|
|
15
|
+
flexGrow: props.grow ? 1 : undefined,
|
|
16
|
+
}, children: props.children }));
|
|
8
17
|
}
|
|
@@ -55,8 +55,12 @@ const GridListContainer = () => {
|
|
|
55
55
|
const virtualSize = virtualizer.getTotalSize();
|
|
56
56
|
const openFormInternal = (0, navigation_1.useOpenForm)();
|
|
57
57
|
const openRecord = (0, react_1.useCallback)(async (id) => {
|
|
58
|
+
const record = dataRef.current?.records.find((r) => r[schema.idAttribute] === id);
|
|
59
|
+
if (!record) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
58
62
|
await openFormInternal({
|
|
59
|
-
logicalName: schema.logicalName,
|
|
63
|
+
logicalName: record.$entity || schema.logicalName,
|
|
60
64
|
id,
|
|
61
65
|
recordSetIds: dataRef.current?.records.map((x) => x[schema.idAttribute]) ?? [],
|
|
62
66
|
});
|
|
@@ -110,11 +110,16 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
110
110
|
const tableWrapperRef = (0, react_1.useRef)(null);
|
|
111
111
|
const openFormInternal = (0, navigation_1.useOpenForm)();
|
|
112
112
|
const openRecord = (0, react_1.useCallback)((id) => {
|
|
113
|
+
const record = dataRef.current?.records.find((r) => r[schema.idAttribute] === id);
|
|
114
|
+
if (!record) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const logicalName = record.$entity || schema.logicalName;
|
|
113
118
|
openFormInternal({
|
|
114
|
-
logicalName:
|
|
119
|
+
logicalName: logicalName,
|
|
115
120
|
id,
|
|
116
121
|
recordSetIds: dataRef.current?.records.map((x) => x[schema.idAttribute]),
|
|
117
|
-
});
|
|
122
|
+
}).catch(console.error);
|
|
118
123
|
}, [openFormInternal, schema.idAttribute, schema.logicalName]);
|
|
119
124
|
const { direction } = (0, locale_1.useLocale)();
|
|
120
125
|
const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
|
|
@@ -93,7 +93,7 @@ function RecordCard({ schema, cardView, record, selected, }) {
|
|
|
93
93
|
}
|
|
94
94
|
function SecondaryColumnContent({ record: _record, column, schema, locale, }) {
|
|
95
95
|
const value = _record[column.name];
|
|
96
|
-
if (!value) {
|
|
96
|
+
if (!value && value !== 0) {
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
99
99
|
const attribute = schema.attributes[column.name];
|
|
@@ -80,6 +80,8 @@ function SectionContainer({ section, skeleton, }) {
|
|
|
80
80
|
gridColumn: control.span
|
|
81
81
|
? `var(--section-item-span-${control.span})`
|
|
82
82
|
: undefined,
|
|
83
|
+
display: control.fullHeight ? 'flex' : undefined,
|
|
84
|
+
flexDirection: control.fullHeight ? 'column' : undefined,
|
|
83
85
|
}, children: (0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: formInstance.control, name: control.attributeName, render: ({ field, fieldState, formState }) => {
|
|
84
86
|
const isError = (fieldState.isTouched || formState.isSubmitted) &&
|
|
85
87
|
!!fieldState.error?.message;
|
|
@@ -91,7 +93,7 @@ function SectionContainer({ section, skeleton, }) {
|
|
|
91
93
|
control.label ??
|
|
92
94
|
attribute.label;
|
|
93
95
|
const labelHidden = control.labelHidden;
|
|
94
|
-
return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: label, labelHidden: labelHidden, labelPosition: isMobile ? 'top' : section.labelPosition, required: required, isError: isError, errorMessage: errorMessage, children: (0, jsx_runtime_1.jsx)(Control, { attribute: attribute, name: control.attributeName, value: field.value, onChange: (value) => {
|
|
96
|
+
return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: label, labelHidden: labelHidden, labelPosition: isMobile ? 'top' : section.labelPosition, required: required, isError: isError, errorMessage: errorMessage, grow: control.fullHeight, children: (0, jsx_runtime_1.jsx)(Control, { attribute: attribute, name: control.attributeName, value: field.value, onChange: (value) => {
|
|
95
97
|
const previousValue = field.value;
|
|
96
98
|
field.onChange(value);
|
|
97
99
|
eventManager.emit(constants_1.EVENT_KEY_ON_FIELD_CHANGE, control.attributeName, value, previousValue);
|
|
@@ -100,7 +102,7 @@ function SectionContainer({ section, skeleton, }) {
|
|
|
100
102
|
recordId,
|
|
101
103
|
attributeName: control.attributeName,
|
|
102
104
|
logicalName: schema.logicalName,
|
|
103
|
-
}, autoHeight: control.autoHeight, maxHeight: control.maxHeight, skeleton: skeleton, required: required }) }));
|
|
105
|
+
}, autoHeight: control.autoHeight, maxHeight: control.maxHeight, fullHeight: control.fullHeight, skeleton: skeleton, required: required }) }));
|
|
104
106
|
} }, control.attributeName) }, control.attributeName));
|
|
105
107
|
}
|
|
106
108
|
case 'editablegrid': {
|
|
@@ -126,13 +128,13 @@ function SectionContainer({ section, skeleton, }) {
|
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
const key = control.key ?? `${control.logicalName}-${index}`;
|
|
129
|
-
return ((0, jsx_runtime_1.jsx)(historystate_1.HistoryStateKeyProvider, { historyKey: `subgrid.${key}`, nested: true, children: (0, jsx_runtime_1.jsx)(SubgridControl_1.SubgridControl, { logicalName: control.logicalName, allowViewSelection: control.allowViewSelection, viewId: control.viewId, availableViewIds: control.availableViewIds, ContainerComponent: ContainerComponent, associated: !control.associatedAttribute
|
|
131
|
+
return ((0, jsx_runtime_1.jsx)(historystate_1.HistoryStateKeyProvider, { historyKey: `subgrid.${key}`, nested: true, children: (0, jsx_runtime_1.jsx)(SubgridControl_1.SubgridControl, { logicalName: control.logicalName, allowViewSelection: control.allowViewSelection, viewId: control.viewId, availableViewIds: control.availableViewIds, ContainerComponent: ContainerComponent, hideSelector: control.labelHidden, associated: !control.associatedAttribute
|
|
130
132
|
? false
|
|
131
133
|
: {
|
|
132
134
|
logicalName: schema.logicalName,
|
|
133
135
|
id: recordId,
|
|
134
136
|
refAttributeName: control.associatedAttribute,
|
|
135
|
-
} }, key)
|
|
137
|
+
}, view: control.view }) }, key));
|
|
136
138
|
}
|
|
137
139
|
case 'component': {
|
|
138
140
|
const Component = control.component === 'string'
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { ViewExperience } from '@headless-adminapp/core/experience/view';
|
|
1
2
|
interface SubgridControlProps {
|
|
2
3
|
logicalName: string;
|
|
3
4
|
allowViewSelection?: boolean;
|
|
4
5
|
viewId?: string;
|
|
6
|
+
view?: ViewExperience<any>;
|
|
5
7
|
availableViewIds?: string[];
|
|
8
|
+
hideSelector?: boolean;
|
|
6
9
|
associated: false | {
|
|
7
10
|
logicalName: string;
|
|
8
11
|
id: string;
|
|
@@ -11,7 +11,7 @@ const FormSubgridNotAvailableContainer_1 = require("../PageEntityView/FormSubgri
|
|
|
11
11
|
function SubgridControl(props) {
|
|
12
12
|
const schema = (0, hooks_1.useSchema)(props.logicalName);
|
|
13
13
|
const [viewId, setViewId] = (0, react_1.useState)(props.viewId);
|
|
14
|
-
const { view, isLoadingView } = (0, hooks_1.useExperienceView)(props.logicalName, viewId, !!props.associated, props.availableViewIds);
|
|
14
|
+
const { view, isLoadingView } = (0, hooks_1.useExperienceView)(props.logicalName, viewId, !!props.associated, props.availableViewIds, props.view);
|
|
15
15
|
const { viewLookup } = (0, hooks_1.useExperienceViewLookup)(props.logicalName, !!props.associated, props.availableViewIds);
|
|
16
16
|
const { commands } = (0, hooks_1.useExperienceViewCommands)(props.logicalName);
|
|
17
17
|
const { commands: subgridCommands } = (0, hooks_1.useExperienceViewSubgridCommands)(props.logicalName);
|
|
@@ -64,5 +64,5 @@ function SubgridControl(props) {
|
|
|
64
64
|
}
|
|
65
65
|
const ContainerComponent = props.ContainerComponent ?? FormSubgridContainer_1.FormSubgridContainer;
|
|
66
66
|
const disabled = !!props.associated && !props.associated.id;
|
|
67
|
-
return ((0, jsx_runtime_1.jsx)(DataGridProvider_1.DataGridProvider, { schema: schema, view: view, views: viewLookup, onChangeView: setViewId, commands: (props.associated ? subgridCommands : commands), isSubGrid: !!props.associated, associated: props.associated, extraFilter: extraFilter, allowViewSelection: props.allowViewSelection ?? false, disabled: disabled, children: disabled ? (0, jsx_runtime_1.jsx)(FormSubgridNotAvailableContainer_1.FormSubgridNotAvailableContainer, {}) : (0, jsx_runtime_1.jsx)(ContainerComponent, {}) }));
|
|
67
|
+
return ((0, jsx_runtime_1.jsx)(DataGridProvider_1.DataGridProvider, { schema: schema, view: view, views: viewLookup, onChangeView: setViewId, commands: (props.associated ? subgridCommands : commands), isSubGrid: !!props.associated, associated: props.associated, extraFilter: extraFilter, allowViewSelection: props.allowViewSelection ?? false, disabled: disabled, children: disabled ? ((0, jsx_runtime_1.jsx)(FormSubgridNotAvailableContainer_1.FormSubgridNotAvailableContainer, {})) : ((0, jsx_runtime_1.jsx)(ContainerComponent, { hideSelector: props.hideSelector })) }));
|
|
68
68
|
}
|
|
@@ -23,7 +23,7 @@ const FormSubgridContainer = (props) => {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
exports.FormSubgridContainer = FormSubgridContainer;
|
|
26
|
-
const FormSubgridDesktopContainer = ({ hideCommandBar, hideSearch, }) => {
|
|
26
|
+
const FormSubgridDesktopContainer = ({ hideSelector, hideCommandBar, hideSearch, }) => {
|
|
27
27
|
const appStrings = (0, AppStringContext_1.useAppStrings)();
|
|
28
28
|
const [searchText, setSearchText] = (0, hooks_1.useSearchText)();
|
|
29
29
|
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
@@ -40,12 +40,12 @@ const FormSubgridDesktopContainer = ({ hideCommandBar, hideSearch, }) => {
|
|
|
40
40
|
display: 'flex',
|
|
41
41
|
flexDirection: 'column',
|
|
42
42
|
// overflow: 'hidden',
|
|
43
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
}, children: [!hideSelector && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
44
|
+
display: 'flex',
|
|
45
|
+
flexDirection: 'row',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
height: 40,
|
|
48
|
+
}, children: (0, jsx_runtime_1.jsx)(FormSubgridViewSelector_1.FormSubgridViewSelector, {}) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }) })] })), (!hideCommandBar || !hideSearch) && ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
49
49
|
display: 'flex',
|
|
50
50
|
flexDirection: 'row',
|
|
51
51
|
gap: 10,
|
|
@@ -79,7 +79,7 @@ const FormSubgridDesktopContainer = ({ hideCommandBar, hideSearch, }) => {
|
|
|
79
79
|
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.5 } }), (0, jsx_runtime_1.jsx)(GridPaginationContainer_1.GridPaginationContainer, {})] })] })] }) }));
|
|
80
80
|
};
|
|
81
81
|
exports.FormSubgridDesktopContainer = FormSubgridDesktopContainer;
|
|
82
|
-
const FormSubgridMobileContainer = ({ hideCommandBar, hideSearch, }) => {
|
|
82
|
+
const FormSubgridMobileContainer = ({ hideSelector, hideCommandBar, hideSearch, }) => {
|
|
83
83
|
const appStrings = (0, AppStringContext_1.useAppStrings)();
|
|
84
84
|
const [searchText, setSearchText] = (0, hooks_1.useSearchText)();
|
|
85
85
|
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
@@ -92,12 +92,12 @@ const FormSubgridMobileContainer = ({ hideCommandBar, hideSearch, }) => {
|
|
|
92
92
|
flex: 1,
|
|
93
93
|
display: 'flex',
|
|
94
94
|
flexDirection: 'column',
|
|
95
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
}, children: [!hideSelector && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
96
|
+
display: 'flex',
|
|
97
|
+
flexDirection: 'row',
|
|
98
|
+
alignItems: 'center',
|
|
99
|
+
height: 40,
|
|
100
|
+
}, children: (0, jsx_runtime_1.jsx)(FormSubgridViewSelector_1.FormSubgridViewSelector, {}) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }) })] })), (!hideCommandBar || !hideSearch) && ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
101
101
|
display: 'flex',
|
|
102
102
|
flexDirection: 'row',
|
|
103
103
|
gap: 10,
|
|
@@ -77,7 +77,7 @@ const FormSection = ({ title, children, columnCount, labelPosition, noPadding, h
|
|
|
77
77
|
paddingBlock: 8,
|
|
78
78
|
height: 40,
|
|
79
79
|
alignItems: 'center',
|
|
80
|
-
}, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: title }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } })] }) }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } })] })), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
80
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: title }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } })] }) }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2, flexGrow: 0 } })] })), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
81
81
|
flex: 1,
|
|
82
82
|
display: 'flex',
|
|
83
83
|
flexDirection: 'column',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/fluent",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.38",
|
|
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": "f94f402ec1cbba0d94b6122d48dce471eba433e1"
|
|
58
58
|
}
|