@headless-adminapp/fluent 1.1.6 → 1.1.8
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/PageCalendar/PageCalendar.js +1 -1
- package/PageEntityForm/SectionContainer.js +2 -2
- package/PageEntityForm/StandardControl.js +2 -2
- package/components/DndProvider.js +1 -1
- package/form/controls/RegardingControl.js +2 -2
- package/form/controls/RichTextControl.js +1 -1
- package/form/controls/TextAreaControl.d.ts +3 -1
- package/form/controls/TextAreaControl.js +33 -8
- package/form/layout/FormSection/FormSection.js +9 -2
- package/form/layout/FormTab/FormTab.js +1 -0
- package/form/layout/FormTab/FormTabColumn.js +1 -0
- package/package.json +2 -2
|
@@ -232,5 +232,5 @@ function PageCalendar(props) {
|
|
|
232
232
|
gap: react_components_1.tokens.spacingVerticalM,
|
|
233
233
|
padding: react_components_1.tokens.spacingHorizontalM,
|
|
234
234
|
background: react_components_1.tokens.colorNeutralBackground2,
|
|
235
|
-
}, children: [(0, jsx_runtime_1.jsx)(Header_1.Header, { filterForm: filterForm, onCreateButtonClick: handleCreateButtonClick }), (0, jsx_runtime_1.jsx)(CalendarSection, { startDate: currentStartDate, endDate: currentEndDate, viewType: viewType, onRangeChange: onRangeChange, events: events ?? [], onEventClick: handleEventClick, onDateSelect: handleDateSelect, loading: loading })] }) }));
|
|
235
|
+
}, children: [(0, jsx_runtime_1.jsx)(Header_1.Header, { filterForm: filterForm, onCreateButtonClick: handleCreateButtonClick }), (0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(CalendarSection, { startDate: currentStartDate, endDate: currentEndDate, viewType: viewType, onRangeChange: onRangeChange, events: events ?? [], onEventClick: handleEventClick, onDateSelect: handleDateSelect, loading: loading }) })] }) }));
|
|
236
236
|
}
|
|
@@ -39,7 +39,7 @@ function SectionContainer({ section }) {
|
|
|
39
39
|
if (hiddenSections[section.name] || visibleControls.length === 0) {
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
42
|
-
return ((0, jsx_runtime_1.jsx)(layout_1.FormSection, { title: (0, utils_2.localizedLabel)(language, section), columnCount: section.columnCount, labelPosition: section.labelPosition, noPadding: section.noPadding, hideLabel: section.hideLabel, children: visibleControls.map((control, index) => {
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(layout_1.FormSection, { title: (0, utils_2.localizedLabel)(language, section), columnCount: section.columnCount, labelPosition: section.labelPosition, noPadding: section.noPadding, hideLabel: section.hideLabel, fullHeight: section.fullHeight, children: visibleControls.map((control, index) => {
|
|
43
43
|
switch (control.type) {
|
|
44
44
|
case 'standard': {
|
|
45
45
|
const attribute = schema.attributes[control.attributeName];
|
|
@@ -94,7 +94,7 @@ function SectionContainer({ section }) {
|
|
|
94
94
|
recordId,
|
|
95
95
|
attributeName: control.attributeName,
|
|
96
96
|
logicalName: schema.logicalName,
|
|
97
|
-
} }) }));
|
|
97
|
+
}, autoHeight: control.autoHeight, maxHeight: control.maxHeight }) }));
|
|
98
98
|
} }, control.attributeName) }, control.attributeName));
|
|
99
99
|
}
|
|
100
100
|
case 'editablegrid': {
|
|
@@ -44,7 +44,7 @@ const StandardControl = (props) => {
|
|
|
44
44
|
// hideLabel,
|
|
45
45
|
hidePlaceholder, readOnly,
|
|
46
46
|
// quickViewControl,
|
|
47
|
-
allowNavigation, allowNewRecord, } = props;
|
|
47
|
+
allowNavigation, allowNewRecord, autoHeight, maxHeight, } = props;
|
|
48
48
|
const isDisabled = readOnly;
|
|
49
49
|
// const label = hideLabel ? undefined : _label ?? attribute.label;
|
|
50
50
|
const placeholder = hidePlaceholder
|
|
@@ -87,7 +87,7 @@ const StandardControl = (props) => {
|
|
|
87
87
|
}
|
|
88
88
|
case 'textarea': {
|
|
89
89
|
const Control = componentStore_1.componentStore.getComponent('Form.TextAreaControl') ?? TextAreaControl_1.TextAreaControl;
|
|
90
|
-
return (0, jsx_runtime_1.jsx)(Control, { ...controlProps });
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)(Control, { ...controlProps, autoHeight: autoHeight, maxHeight: maxHeight }));
|
|
91
91
|
}
|
|
92
92
|
case 'richtext': {
|
|
93
93
|
const Control = componentStore_1.componentStore.getComponent('Form.RichTextControl') ?? RichTextControl_1.RichTextControl;
|
|
@@ -56,7 +56,7 @@ const DndProvider = ({ children }) => {
|
|
|
56
56
|
if (!context) {
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
|
-
return ((0, jsx_runtime_1.jsx)(DndContext.Provider, { value: context, children: (0, jsx_runtime_1.jsx)(DndProviderIntenral, { backend: context.backend, children: children }) }));
|
|
59
|
+
return ((0, jsx_runtime_1.jsx)(DndContext.Provider, { value: context, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(DndProviderIntenral, { backend: context.backend, children: children }) }) }));
|
|
60
60
|
};
|
|
61
61
|
exports.DndProvider = DndProvider;
|
|
62
62
|
function useDndContext() {
|
|
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const app_1 = require("@headless-adminapp/app/app");
|
|
7
7
|
const hooks_1 = require("@headless-adminapp/app/hooks");
|
|
8
|
-
const
|
|
8
|
+
const useMetadata_1 = require("@headless-adminapp/app/metadata/hooks/useMetadata");
|
|
9
9
|
const hooks_2 = require("@headless-adminapp/app/route/hooks");
|
|
10
10
|
const app_2 = require("@headless-adminapp/core/experience/app");
|
|
11
11
|
const icons_1 = require("@headless-adminapp/icons");
|
|
@@ -68,7 +68,7 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
68
68
|
}, [open]);
|
|
69
69
|
const [debouncedSearchText] = (0, hooks_1.useDebouncedValue)(searchText, 500);
|
|
70
70
|
const styles = useStyles();
|
|
71
|
-
const { experienceStore } = (0,
|
|
71
|
+
const { experienceStore } = (0, useMetadata_1.useMetadata)();
|
|
72
72
|
const { isFetching: isConfigFetching, data: configs } = (0, react_query_1.useQuery)({
|
|
73
73
|
queryKey: ['data', 'getLookupViews', entities, undefined],
|
|
74
74
|
queryFn: async () => {
|
|
@@ -28,6 +28,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
28
28
|
const react_1 = require("react");
|
|
29
29
|
const ReactQuill = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('react-quill'))));
|
|
30
30
|
const RichTextControl = ({ value, onChange, id, onBlur, onFocus, disabled, readOnly, }) => {
|
|
31
|
-
return ((0, jsx_runtime_1.jsx)(ReactQuill, { value: value ?? '', onChange: onChange, className: "hdlapp_rte", readOnly: disabled || readOnly, style: { maxHeight: '400px', minHeight: '200px' }, onFocus: onFocus, onBlur: onBlur, id: id }));
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(ReactQuill, { value: value ?? '', onChange: onChange, className: "hdlapp_rte", readOnly: disabled || readOnly, style: { maxHeight: '400px', minHeight: '200px' }, onFocus: onFocus, onBlur: onBlur, id: id }) }));
|
|
32
32
|
};
|
|
33
33
|
exports.RichTextControl = RichTextControl;
|
|
@@ -2,5 +2,7 @@ import { ControlProps } from './types';
|
|
|
2
2
|
export interface TextAreaControlProps extends ControlProps<string> {
|
|
3
3
|
rows?: number;
|
|
4
4
|
textTransform?: 'capitalize' | 'uppercase' | 'lowercase' | 'none';
|
|
5
|
+
autoHeight?: boolean;
|
|
6
|
+
maxHeight?: number;
|
|
5
7
|
}
|
|
6
|
-
export declare function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, readOnly, rows, textTransform, }: TextAreaControlProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, readOnly, rows, textTransform, autoHeight, maxHeight, }: TextAreaControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,14 +3,39 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TextAreaControl = TextAreaControl;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const DEFAULT_MAX_HEIGHT = 260;
|
|
8
|
+
function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, readOnly, rows = 5, textTransform, autoHeight, maxHeight, }) {
|
|
9
|
+
const textAreaRef = (0, react_1.useRef)(null);
|
|
10
|
+
(0, react_1.useEffect)(() => {
|
|
11
|
+
const textarea = textAreaRef.current;
|
|
12
|
+
if (!textarea)
|
|
13
|
+
return;
|
|
14
|
+
if (autoHeight) {
|
|
15
|
+
textarea.style.height = 'auto';
|
|
16
|
+
textarea.style.height = textarea.scrollHeight + 'px';
|
|
17
|
+
textarea.style.maxHeight = maxHeight
|
|
18
|
+
? `${maxHeight}px`
|
|
19
|
+
: textarea.scrollHeight + 'px';
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
textarea.style.height = '';
|
|
23
|
+
textarea.style.maxHeight = maxHeight
|
|
24
|
+
? `${maxHeight}px`
|
|
25
|
+
: `${DEFAULT_MAX_HEIGHT}px`;
|
|
26
|
+
}
|
|
27
|
+
}, [value, autoHeight, maxHeight]);
|
|
28
|
+
const handleInput = (e, data) => {
|
|
29
|
+
let newValue = data.value;
|
|
30
|
+
if (textTransform === 'uppercase') {
|
|
31
|
+
newValue = newValue.toUpperCase();
|
|
32
|
+
}
|
|
33
|
+
else if (textTransform === 'lowercase') {
|
|
34
|
+
newValue = newValue.toLowerCase();
|
|
35
|
+
}
|
|
36
|
+
onChange?.(newValue);
|
|
37
|
+
};
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Textarea, { ref: textAreaRef, placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: value ?? '', onChange: handleInput, onBlur: () => onBlur?.(), onFocus: () => onFocus?.(),
|
|
14
39
|
// error={error}
|
|
15
40
|
readOnly: disabled || readOnly, rows: rows }));
|
|
16
41
|
}
|
|
@@ -11,7 +11,7 @@ const FormSectionLoading_1 = require("./FormSectionLoading");
|
|
|
11
11
|
function determineItemCount(availableWidth, itemWidth, gap, padding) {
|
|
12
12
|
return Math.floor((availableWidth + gap - 2 * padding) / (itemWidth + gap));
|
|
13
13
|
}
|
|
14
|
-
const FormSection = ({ title, children, columnCount, labelPosition, noPadding, hideLabel }) => {
|
|
14
|
+
const FormSection = ({ title, children, columnCount, labelPosition, noPadding, hideLabel, fullHeight, }) => {
|
|
15
15
|
// const columnCount = 2;
|
|
16
16
|
const divRef = (0, react_1.useRef)(null);
|
|
17
17
|
const divSize = (0, hooks_1.useElementSize)(divRef, 100);
|
|
@@ -64,7 +64,14 @@ const FormSection = ({ title, children, columnCount, labelPosition, noPadding, h
|
|
|
64
64
|
boxShadow: react_components_1.tokens.shadow2,
|
|
65
65
|
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
66
66
|
background: react_components_1.tokens.colorNeutralBackground1,
|
|
67
|
-
|
|
67
|
+
display: 'flex',
|
|
68
|
+
flexDirection: 'column',
|
|
69
|
+
flex: fullHeight ? 1 : undefined,
|
|
70
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
71
|
+
display: 'flex',
|
|
72
|
+
flexDirection: 'column',
|
|
73
|
+
flex: fullHeight ? 1 : undefined,
|
|
74
|
+
}, children: [!hideLabel && !!title && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
68
75
|
display: 'flex',
|
|
69
76
|
paddingInline: 16,
|
|
70
77
|
paddingBlock: 8,
|
|
@@ -77,6 +77,7 @@ const FormTabInternal = ({ children, value, fullHeight, columnCount, columnWidth
|
|
|
77
77
|
gridRowGap: 12,
|
|
78
78
|
gridColumnGap: 12,
|
|
79
79
|
gridTemplateColumns: template,
|
|
80
|
+
flex: 1,
|
|
80
81
|
}, children: children }) }));
|
|
81
82
|
};
|
|
82
83
|
exports.FormTab.Column = FormTabColumn_1.FormTabColumn;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/fluent",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"uuid": "11.0.3",
|
|
51
51
|
"yup": "^1.4.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "918b655a582c5c63864e8bbe6999289ec959b917"
|
|
54
54
|
}
|