drf-react-by-schema 0.12.2 → 0.12.3
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.
|
@@ -10,6 +10,8 @@ interface FieldLayout {
|
|
|
10
10
|
interface DetailBySchemaProps {
|
|
11
11
|
values: Item;
|
|
12
12
|
schema: SchemaType;
|
|
13
|
+
editLink?: string;
|
|
14
|
+
editLabel?: string;
|
|
13
15
|
labelKey?: string;
|
|
14
16
|
optionsAC?: OptionsACType;
|
|
15
17
|
setOptionsAC?: (x: OptionsACType) => void;
|
|
@@ -24,5 +26,5 @@ interface DetailBySchemaProps {
|
|
|
24
26
|
sxValueListItem?: SxProps;
|
|
25
27
|
sxValueListItemText?: SxProps;
|
|
26
28
|
}
|
|
27
|
-
export default function DetailBySchema({ values, schema, labelKey, optionsAC, setOptionsAC, decimalScale, fieldsLayout: fieldsLayoutInitial, sxRow, sxRowMultiple, sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }: DetailBySchemaProps): JSX.Element;
|
|
29
|
+
export default function DetailBySchema({ values, schema, editLink, editLabel, labelKey, optionsAC, setOptionsAC, decimalScale, fieldsLayout: fieldsLayoutInitial, sxRow, sxRowMultiple, sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }: DetailBySchemaProps): JSX.Element;
|
|
28
30
|
export {};
|
|
@@ -32,10 +32,12 @@ const Card_1 = __importDefault(require("@mui/material/Card"));
|
|
|
32
32
|
const CardHeader_1 = __importDefault(require("@mui/material/CardHeader"));
|
|
33
33
|
const CardContent_1 = __importDefault(require("@mui/material/CardContent"));
|
|
34
34
|
const CircularProgress_1 = __importDefault(require("@mui/material/CircularProgress"));
|
|
35
|
+
const material_1 = require("@mui/material");
|
|
36
|
+
const Stack_1 = __importDefault(require("@mui/material/Stack"));
|
|
35
37
|
const DetailFieldBySchema_1 = __importDefault(require("./DetailFieldBySchema"));
|
|
36
38
|
const styles_1 = require("../../styles");
|
|
37
39
|
const APIWrapperContext_1 = require("../../context/APIWrapperContext");
|
|
38
|
-
function DetailBySchema({ values, schema, labelKey = 'label', optionsAC, setOptionsAC, decimalScale = 2, fieldsLayout: fieldsLayoutInitial, sxRow, sxRowMultiple, sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }) {
|
|
40
|
+
function DetailBySchema({ values, schema, editLink, editLabel, labelKey = 'label', optionsAC, setOptionsAC, decimalScale = 2, fieldsLayout: fieldsLayoutInitial, sxRow, sxRowMultiple, sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }) {
|
|
39
41
|
const { getAutoComplete } = (0, APIWrapperContext_1.useAPIWrapper)();
|
|
40
42
|
const [fieldsLayout, setFieldsLayout] = (0, react_1.useState)([]);
|
|
41
43
|
const [localOptionsAC, setLocalOptionsAC] = (0, react_1.useState)(undefined);
|
|
@@ -66,6 +68,9 @@ function DetailBySchema({ values, schema, labelKey = 'label', optionsAC, setOpti
|
|
|
66
68
|
return (react_1.default.createElement(Card_1.default, { sx: styles_1.Layout.formCard, key: `section_${sectionIndex}` },
|
|
67
69
|
section.title && react_1.default.createElement(CardHeader_1.default, { title: section.title }),
|
|
68
70
|
react_1.default.createElement(CardContent_1.default, null,
|
|
71
|
+
editLink &&
|
|
72
|
+
react_1.default.createElement(Stack_1.default, { direction: "row", justifyContent: "flex-end" },
|
|
73
|
+
react_1.default.createElement(material_1.Button, { href: editLink, variant: "contained" }, editLabel)),
|
|
69
74
|
section.CustomElement && react_1.default.createElement(react_1.default.Fragment, null, section.CustomElement),
|
|
70
75
|
section.rows && (react_1.default.createElement(react_1.default.Fragment, null, section.rows.map((row, rowIndex) => {
|
|
71
76
|
if (typeof row === 'string') {
|
package/package.json
CHANGED