drf-react-by-schema 0.14.6 → 0.15.1
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/dist/components/details/DetailBySchema.d.ts +3 -30
- package/dist/components/details/DetailBySchema.js +23 -11
- package/dist/components/details/DetailFieldBySchema.d.ts +1 -1
- package/dist/components/details/DetailFieldBySchema.js +6 -1
- package/dist/components/forms/FormBySchema.d.ts +5 -9
- package/dist/components/forms/FormBySchema.js +46 -21
- package/dist/components/forms/inputs/BooleanFieldBySchema.js +1 -1
- package/dist/utils.d.ts +47 -5
- package/package.json +1 -1
|
@@ -1,30 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { OptionsACType } from '../../context/APIWrapperContext';
|
|
5
|
-
interface FieldLayout {
|
|
6
|
-
title?: string;
|
|
7
|
-
rows?: (string | string[])[];
|
|
8
|
-
CustomElement?: React.ReactNode;
|
|
9
|
-
}
|
|
10
|
-
interface DetailBySchemaProps {
|
|
11
|
-
values: Item;
|
|
12
|
-
schema: SchemaType;
|
|
13
|
-
editLink?: string;
|
|
14
|
-
editLabel?: string;
|
|
15
|
-
labelKey?: string;
|
|
16
|
-
optionsAC?: OptionsACType;
|
|
17
|
-
setOptionsAC?: (x: OptionsACType) => void;
|
|
18
|
-
decimalScale?: number;
|
|
19
|
-
fieldsLayout?: FieldLayout[];
|
|
20
|
-
sxRow?: SxProps;
|
|
21
|
-
sxRowMultiple?: SxProps;
|
|
22
|
-
sxField?: SxProps;
|
|
23
|
-
sxLabel?: SxProps;
|
|
24
|
-
sxValue?: SxProps;
|
|
25
|
-
sxValueList?: SxProps;
|
|
26
|
-
sxValueListItem?: SxProps;
|
|
27
|
-
sxValueListItemText?: SxProps;
|
|
28
|
-
}
|
|
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;
|
|
30
|
-
export {};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DetailBySchemaProps } from '../../utils';
|
|
3
|
+
export default function DetailBySchema({ values, schema, editLink, editLabel, labelKey, decimalScale, fieldsLayout: fieldsLayoutInitial, fieldsProps, sxRow, sxRowMultiple, sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }: DetailBySchemaProps): JSX.Element;
|
|
@@ -36,11 +36,8 @@ const material_1 = require("@mui/material");
|
|
|
36
36
|
const Stack_1 = __importDefault(require("@mui/material/Stack"));
|
|
37
37
|
const DetailFieldBySchema_1 = __importDefault(require("./DetailFieldBySchema"));
|
|
38
38
|
const styles_1 = require("../../styles");
|
|
39
|
-
|
|
40
|
-
function DetailBySchema({ values, schema, editLink, editLabel, labelKey = 'label', optionsAC, setOptionsAC, decimalScale = 2, fieldsLayout: fieldsLayoutInitial, sxRow, sxRowMultiple, sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }) {
|
|
41
|
-
const { getAutoComplete } = (0, APIWrapperContext_1.useAPIWrapper)();
|
|
39
|
+
function DetailBySchema({ values, schema, editLink, editLabel, labelKey = 'label', decimalScale = 2, fieldsLayout: fieldsLayoutInitial, fieldsProps, sxRow, sxRowMultiple, sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }) {
|
|
42
40
|
const [fieldsLayout, setFieldsLayout] = (0, react_1.useState)([]);
|
|
43
|
-
const [localOptionsAC, setLocalOptionsAC] = (0, react_1.useState)(undefined);
|
|
44
41
|
const getColumns = () => {
|
|
45
42
|
if (fieldsLayoutInitial && fieldsLayoutInitial.length > 0) {
|
|
46
43
|
return fieldsLayoutInitial;
|
|
@@ -66,20 +63,35 @@ function DetailBySchema({ values, schema, editLink, editLabel, labelKey = 'label
|
|
|
66
63
|
}
|
|
67
64
|
return (react_1.default.createElement(react_1.default.Fragment, null, fieldsLayout.map((section, sectionIndex) => {
|
|
68
65
|
return (react_1.default.createElement(Card_1.default, { sx: styles_1.Layout.formCard, key: `section_${sectionIndex}` },
|
|
69
|
-
section.title && react_1.default.createElement(CardHeader_1.default, { title: section.title }
|
|
66
|
+
section.title && (react_1.default.createElement(CardHeader_1.default, { title: section.title, action: sectionIndex === 0 && editLink ? (react_1.default.createElement(Stack_1.default, { direction: "row", justifyContent: "flex-end" },
|
|
67
|
+
react_1.default.createElement(material_1.Button, { href: editLink, variant: "contained" }, editLabel))) : (react_1.default.createElement(react_1.default.Fragment, null)) })),
|
|
70
68
|
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)),
|
|
74
69
|
section.CustomElement && react_1.default.createElement(react_1.default.Fragment, null, section.CustomElement),
|
|
75
70
|
section.rows && (react_1.default.createElement(react_1.default.Fragment, null, section.rows.map((row, rowIndex) => {
|
|
76
71
|
if (typeof row === 'string') {
|
|
77
72
|
const field = row;
|
|
73
|
+
const fieldProps = fieldsProps && fieldsProps.hasOwnProperty(field)
|
|
74
|
+
? fieldsProps[field]
|
|
75
|
+
: {};
|
|
78
76
|
return (react_1.default.createElement(Box_1.default, { key: field, sx: sxRow },
|
|
79
|
-
react_1.default.createElement(DetailFieldBySchema_1.default, { name: field, value: values[field], schema: schema, labelKey: labelKey, decimalScale: decimalScale, sxField: sxField, sxLabel: sxLabel, sxValue: sxValue, sxValueList: sxValueList, sxValueListItem: sxValueListItem, sxValueListItemText: sxValueListItemText })));
|
|
77
|
+
react_1.default.createElement(DetailFieldBySchema_1.default, Object.assign({ name: field, value: values[field], schema: schema, labelKey: labelKey, decimalScale: decimalScale, sxField: sxField, sxLabel: sxLabel, sxValue: sxValue, sxValueList: sxValueList, sxValueListItem: sxValueListItem, sxValueListItemText: sxValueListItemText }, fieldProps))));
|
|
80
78
|
}
|
|
81
|
-
|
|
82
|
-
react_1.default.createElement(
|
|
79
|
+
if (Array.isArray(row)) {
|
|
80
|
+
return (react_1.default.createElement(Box_1.default, { key: `row_${rowIndex}`, sx: sxRowMultiple }, row.map((field, i) => {
|
|
81
|
+
const key = typeof field === 'string'
|
|
82
|
+
? field
|
|
83
|
+
: field.key;
|
|
84
|
+
const fieldProps = fieldsProps &&
|
|
85
|
+
fieldsProps.hasOwnProperty(key)
|
|
86
|
+
? fieldsProps[key]
|
|
87
|
+
: {};
|
|
88
|
+
return (react_1.default.createElement(react_1.default.Fragment, { key: `field_${rowIndex}_${i}` }, typeof field === 'string' ? (react_1.default.createElement(DetailFieldBySchema_1.default, Object.assign({ name: field, value: values[field], schema: schema, labelKey: labelKey, decimalScale: decimalScale, sxField: sxField, sxLabel: sxLabel, sxValue: sxValue, sxValueList: sxValueList, sxValueListItem: sxValueListItem, sxValueListItemText: sxValueListItemText }, fieldProps))) : (react_1.default.createElement(field.CustomElement, Object.assign({ sxField: sxField, sxLabel: sxLabel, sxValue: sxValue, sxValueList: sxValueList, sxValueListItem: sxValueListItem, sxValueListItemText: sxValueListItemText }, fieldProps)))));
|
|
89
|
+
})));
|
|
90
|
+
}
|
|
91
|
+
const fieldProps = fieldsProps && fieldsProps.hasOwnProperty(row.key)
|
|
92
|
+
? fieldsProps[row.key]
|
|
93
|
+
: {};
|
|
94
|
+
return (react_1.default.createElement(row.CustomElement, Object.assign({ sxField: sxField, sxLabel: sxLabel, sxValue: sxValue, sxValueList: sxValueList, sxValueListItem: sxValueListItem, sxValueListItemText: sxValueListItemText }, fieldProps)));
|
|
83
95
|
}))))));
|
|
84
96
|
})));
|
|
85
97
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DetailFieldBySchemaProps } from '../../utils';
|
|
3
|
-
export default function DetailFieldBySchema({ name, value, schema, labelKey,
|
|
3
|
+
export default function DetailFieldBySchema({ name, value, schema, labelKey, optionIdKey, optionLabelKey, sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }: DetailFieldBySchemaProps): JSX.Element;
|
|
@@ -10,7 +10,7 @@ const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
|
10
10
|
const List_1 = __importDefault(require("@mui/material/List"));
|
|
11
11
|
const ListItem_1 = __importDefault(require("@mui/material/ListItem"));
|
|
12
12
|
const ListItemText_1 = __importDefault(require("@mui/material/ListItemText"));
|
|
13
|
-
function DetailFieldBySchema({ name, value, schema, labelKey = 'label',
|
|
13
|
+
function DetailFieldBySchema({ name, value, schema, labelKey = 'label', optionIdKey = 'value', optionLabelKey = 'display_name', sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }) {
|
|
14
14
|
if (!value) {
|
|
15
15
|
return (react_1.default.createElement(Box_1.default, { sx: sxField },
|
|
16
16
|
react_1.default.createElement(Typography_1.default, { variant: "h5", sx: sxLabel }, schema[name].label),
|
|
@@ -57,6 +57,11 @@ function DetailFieldBySchema({ name, value, schema, labelKey = 'label', decimalS
|
|
|
57
57
|
return (react_1.default.createElement(Box_1.default, { sx: sxField },
|
|
58
58
|
react_1.default.createElement(Typography_1.default, { variant: "h5", sx: sxLabel }, schema[name].label),
|
|
59
59
|
react_1.default.createElement(Typography_1.default, { variant: "body2", sx: sxValue }, value.toLocaleString())));
|
|
60
|
+
case 'email':
|
|
61
|
+
return (react_1.default.createElement(Box_1.default, { sx: sxField },
|
|
62
|
+
react_1.default.createElement(Typography_1.default, { variant: "h5", sx: sxLabel }, schema[name].label),
|
|
63
|
+
react_1.default.createElement(Typography_1.default, { variant: "body2", sx: sxValue },
|
|
64
|
+
react_1.default.createElement("a", { href: `mailto: ${value}` }, value))));
|
|
60
65
|
case 'number':
|
|
61
66
|
case 'integer':
|
|
62
67
|
case 'password':
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { UseFormRegister } from 'react-hook-form';
|
|
3
|
-
import { FieldBySchemaProps, Item } from '../../utils';
|
|
3
|
+
import { CommonFieldProps, FieldBySchemaProps, FormFieldLayout, Item } from '../../utils';
|
|
4
4
|
import { OptionsACType } from '../../context/APIWrapperContext';
|
|
5
|
-
interface FieldLayout {
|
|
6
|
-
title?: string;
|
|
7
|
-
rows?: (string | string[])[];
|
|
8
|
-
CustomElement?: React.ReactNode;
|
|
9
|
-
}
|
|
10
5
|
interface FormBySchemaProps extends Omit<FieldBySchemaProps, 'name'> {
|
|
11
|
-
fieldsLayout?:
|
|
6
|
+
fieldsLayout?: FormFieldLayout[];
|
|
12
7
|
hiddenFields?: string[];
|
|
13
8
|
register?: UseFormRegister<Item>;
|
|
14
9
|
setOptionsAC?: (x: OptionsACType) => void;
|
|
15
10
|
forceReload?: boolean;
|
|
16
11
|
isolatedGetAutoComplete?: (model: string) => Promise<false | Item[]>;
|
|
12
|
+
fieldsProps?: Record<string, CommonFieldProps>;
|
|
17
13
|
}
|
|
18
|
-
export default function FormBySchema({ schema, control, errors, register, multiline, setValue, getValues, fieldKey, labelKey, index, optionsAC, setOptionsAC, forceReload, optionsModel, getOptionLabel, renderOption, onEditModel,
|
|
14
|
+
export default function FormBySchema({ schema, control, errors, register, multiline, setValue, getValues, fieldKey, labelKey, index, optionsAC, setOptionsAC, forceReload, optionsModel, getOptionLabel, renderOption, onEditModel, options, isSemaphoric, label, decimalScale, fieldsLayout: fieldsLayoutInitial, fieldsProps, hiddenFields, isolatedGetAutoComplete, }: FormBySchemaProps): JSX.Element;
|
|
19
15
|
export {};
|
|
@@ -31,17 +31,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
35
|
-
var t = {};
|
|
36
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
37
|
-
t[p] = s[p];
|
|
38
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
39
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
40
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
41
|
-
t[p[i]] = s[p[i]];
|
|
42
|
-
}
|
|
43
|
-
return t;
|
|
44
|
-
};
|
|
45
34
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
36
|
};
|
|
@@ -55,11 +44,11 @@ const CircularProgress_1 = __importDefault(require("@mui/material/CircularProgre
|
|
|
55
44
|
const FieldBySchema_1 = __importDefault(require("./FieldBySchema"));
|
|
56
45
|
const styles_1 = require("../../styles");
|
|
57
46
|
const APIWrapperContext_1 = require("../../context/APIWrapperContext");
|
|
58
|
-
function FormBySchema(
|
|
59
|
-
var { schema, control, errors, register, multiline = false, setValue, getValues, fieldKey, labelKey = 'nome', index, optionsAC, setOptionsAC, forceReload, optionsModel, getOptionLabel, renderOption, onEditModel, sx = { mr: 0 }, options, isSemaphoric = false, label, onValueChange, decimalScale = 2, fieldsLayout: fieldsLayoutInitial, hiddenFields = [], isolatedGetAutoComplete } = _a, props = __rest(_a, ["schema", "control", "errors", "register", "multiline", "setValue", "getValues", "fieldKey", "labelKey", "index", "optionsAC", "setOptionsAC", "forceReload", "optionsModel", "getOptionLabel", "renderOption", "onEditModel", "sx", "options", "isSemaphoric", "label", "onValueChange", "decimalScale", "fieldsLayout", "hiddenFields", "isolatedGetAutoComplete"]);
|
|
47
|
+
function FormBySchema({ schema, control, errors, register, multiline = false, setValue, getValues, fieldKey, labelKey = 'nome', index, optionsAC, setOptionsAC, forceReload, optionsModel, getOptionLabel, renderOption, onEditModel, options, isSemaphoric = false, label, decimalScale = 2, fieldsLayout: fieldsLayoutInitial, fieldsProps, hiddenFields = [], isolatedGetAutoComplete, }) {
|
|
60
48
|
const { getAutoComplete } = (0, APIWrapperContext_1.useAPIWrapper)();
|
|
61
49
|
const [fieldsLayout, setFieldsLayout] = (0, react_1.useState)([]);
|
|
62
50
|
const [localOptionsAC, setLocalOptionsAC] = (0, react_1.useState)(undefined);
|
|
51
|
+
const defaultSx = { mr: 0 };
|
|
63
52
|
const getColumns = () => {
|
|
64
53
|
const optionsACModels = [];
|
|
65
54
|
if (fieldsLayoutInitial && fieldsLayoutInitial.length > 0) {
|
|
@@ -76,11 +65,18 @@ function FormBySchema(_a) {
|
|
|
76
65
|
}
|
|
77
66
|
continue;
|
|
78
67
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
if (Array.isArray(row)) {
|
|
69
|
+
for (const field of row) {
|
|
70
|
+
if (typeof field === 'string' &&
|
|
71
|
+
['field', 'nested object'].includes(schema[field].type) &&
|
|
72
|
+
!optionsACModels.includes(field)) {
|
|
73
|
+
optionsACModels.push(field);
|
|
74
|
+
}
|
|
83
75
|
}
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (optionsACModels.includes(row.key)) {
|
|
79
|
+
optionsACModels.push(row.key);
|
|
84
80
|
}
|
|
85
81
|
}
|
|
86
82
|
}
|
|
@@ -150,14 +146,43 @@ function FormBySchema(_a) {
|
|
|
150
146
|
section.rows && (react_1.default.createElement(react_1.default.Fragment, null, section.rows.map((row, rowIndex) => {
|
|
151
147
|
if (typeof row === 'string') {
|
|
152
148
|
const field = row;
|
|
149
|
+
const fieldProps = fieldsProps && fieldsProps.hasOwnProperty(field)
|
|
150
|
+
? fieldsProps[field]
|
|
151
|
+
: {};
|
|
152
|
+
fieldProps.sx = fieldProps.hasOwnProperty('sx')
|
|
153
|
+
? fieldProps.sx
|
|
154
|
+
: defaultSx;
|
|
153
155
|
return (react_1.default.createElement(react_1.default.Fragment, { key: field },
|
|
154
156
|
react_1.default.createElement(FieldBySchema_1.default, Object.assign({ name: field, schema: schema, control: control, errors: errors, multiline: multiline, setValue: setValue, getValues: getValues, fieldKey: fieldKey, labelKey: labelKey, index: index, optionsAC: setOptionsAC
|
|
155
157
|
? optionsAC
|
|
156
|
-
: localOptionsAC, optionsModel: optionsModel, getOptionLabel: getOptionLabel, renderOption: renderOption, onEditModel: onEditModel,
|
|
158
|
+
: localOptionsAC, optionsModel: optionsModel, getOptionLabel: getOptionLabel, renderOption: renderOption, onEditModel: onEditModel, options: options, isSemaphoric: isSemaphoric, label: label, decimalScale: decimalScale }, fieldProps))));
|
|
159
|
+
}
|
|
160
|
+
if (Array.isArray(row)) {
|
|
161
|
+
return (react_1.default.createElement(Box_1.default, { sx: styles_1.Layout.inLineForm, key: `row_${rowIndex}` },
|
|
162
|
+
react_1.default.createElement(react_1.default.Fragment, null, row.map((field, i, j) => {
|
|
163
|
+
const mr = i + 1 === j.length ? 0 : 2;
|
|
164
|
+
const key = typeof field === 'string'
|
|
165
|
+
? field
|
|
166
|
+
: field.key;
|
|
167
|
+
const fieldProps = fieldsProps &&
|
|
168
|
+
fieldsProps.hasOwnProperty(key)
|
|
169
|
+
? fieldsProps[key]
|
|
170
|
+
: {};
|
|
171
|
+
fieldProps.sx =
|
|
172
|
+
fieldProps.hasOwnProperty('sx')
|
|
173
|
+
? Object.assign(Object.assign({}, fieldProps.sx), { mr }) : {
|
|
174
|
+
mr,
|
|
175
|
+
};
|
|
176
|
+
return (react_1.default.createElement(react_1.default.Fragment, { key: `field_${rowIndex}_${i}` }, typeof field === 'string' ? (react_1.default.createElement(FieldBySchema_1.default, Object.assign({ name: field, schema: schema, control: control, errors: errors, multiline: multiline, setValue: setValue, getValues: getValues, fieldKey: fieldKey, labelKey: labelKey, index: index, optionsAC: optionsAC, optionsModel: optionsModel, getOptionLabel: getOptionLabel, renderOption: renderOption, onEditModel: onEditModel, options: options, isSemaphoric: isSemaphoric, label: label, decimalScale: decimalScale }, fieldProps))) : (react_1.default.createElement(field.CustomElement, Object.assign({}, fieldProps)))));
|
|
177
|
+
}))));
|
|
157
178
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
179
|
+
const fieldProps = fieldsProps && fieldsProps.hasOwnProperty(row.key)
|
|
180
|
+
? fieldsProps[row.key]
|
|
181
|
+
: {};
|
|
182
|
+
fieldProps.sx = fieldProps.hasOwnProperty('sx')
|
|
183
|
+
? fieldProps.sx
|
|
184
|
+
: defaultSx;
|
|
185
|
+
return react_1.default.createElement(row.CustomElement, Object.assign({}, fieldProps));
|
|
161
186
|
}))))));
|
|
162
187
|
})));
|
|
163
188
|
}
|
|
@@ -29,6 +29,6 @@ function BooleanFieldBySchema(_a) {
|
|
|
29
29
|
onValueChange(e);
|
|
30
30
|
}
|
|
31
31
|
field.onChange(e);
|
|
32
|
-
} })), label: schema[model].label, required: schema[model].required, sx: sx })) }));
|
|
32
|
+
} })), label: schema[model].label, required: schema[model].required, sx: Object.assign({ width: '100%' }, sx) })) }));
|
|
33
33
|
}
|
|
34
34
|
exports.default = BooleanFieldBySchema;
|
package/dist/utils.d.ts
CHANGED
|
@@ -80,11 +80,8 @@ export interface ItemSchemaColumnsType {
|
|
|
80
80
|
modelOptions: modelOptionsType;
|
|
81
81
|
columns?: GridEnrichedBySchemaColDef[];
|
|
82
82
|
}
|
|
83
|
-
export interface
|
|
84
|
-
|
|
85
|
-
schema: SchemaType;
|
|
86
|
-
control: Control;
|
|
87
|
-
errors: Item;
|
|
83
|
+
export interface CommonFieldProps {
|
|
84
|
+
value?: any;
|
|
88
85
|
multiline?: boolean;
|
|
89
86
|
setValue?: UseFormSetValue<FieldValues>;
|
|
90
87
|
getValues?: UseFormGetValues<FieldValues>;
|
|
@@ -111,6 +108,12 @@ export interface FieldBySchemaProps {
|
|
|
111
108
|
optionLabelKey?: string;
|
|
112
109
|
disabled?: boolean;
|
|
113
110
|
}
|
|
111
|
+
export interface FieldBySchemaProps extends Omit<CommonFieldProps, 'value'> {
|
|
112
|
+
name: string;
|
|
113
|
+
schema: SchemaType;
|
|
114
|
+
control: Control;
|
|
115
|
+
errors: Item;
|
|
116
|
+
}
|
|
114
117
|
export interface DetailFieldBySchemaProps {
|
|
115
118
|
name: string;
|
|
116
119
|
schema: SchemaType;
|
|
@@ -172,4 +175,43 @@ export type OnSelectActions = {
|
|
|
172
175
|
title: string;
|
|
173
176
|
action: OnSelectActionTypes;
|
|
174
177
|
};
|
|
178
|
+
interface CustomFormField {
|
|
179
|
+
key: string;
|
|
180
|
+
CustomElement: (x: CommonFieldProps) => JSX.Element;
|
|
181
|
+
}
|
|
182
|
+
export interface FormFieldLayout {
|
|
183
|
+
title?: string;
|
|
184
|
+
rows?: (string | (string | CustomFormField)[] | CustomFormField)[];
|
|
185
|
+
CustomElement?: React.ReactNode;
|
|
186
|
+
}
|
|
187
|
+
export interface ExtraSxCommonFieldProps {
|
|
188
|
+
sxRow?: SxProps;
|
|
189
|
+
sxRowMultiple?: SxProps;
|
|
190
|
+
sxField?: SxProps;
|
|
191
|
+
sxLabel?: SxProps;
|
|
192
|
+
sxValue?: SxProps;
|
|
193
|
+
sxValueList?: SxProps;
|
|
194
|
+
sxValueListItem?: SxProps;
|
|
195
|
+
sxValueListItemText?: SxProps;
|
|
196
|
+
}
|
|
197
|
+
export type DetailCommonFieldProps = CommonFieldProps & ExtraSxCommonFieldProps;
|
|
198
|
+
interface CustomDetailField {
|
|
199
|
+
key: string;
|
|
200
|
+
CustomElement: (x: DetailCommonFieldProps) => JSX.Element;
|
|
201
|
+
}
|
|
202
|
+
export interface DetailFieldLayout {
|
|
203
|
+
title?: string;
|
|
204
|
+
rows?: (string | (string | CustomDetailField)[] | CustomDetailField)[];
|
|
205
|
+
CustomElement?: React.ReactNode;
|
|
206
|
+
}
|
|
207
|
+
export interface DetailBySchemaProps extends ExtraSxCommonFieldProps {
|
|
208
|
+
values: Item;
|
|
209
|
+
schema: SchemaType;
|
|
210
|
+
editLink?: string;
|
|
211
|
+
editLabel?: string;
|
|
212
|
+
labelKey?: string;
|
|
213
|
+
decimalScale?: number;
|
|
214
|
+
fieldsLayout?: DetailFieldLayout[];
|
|
215
|
+
fieldsProps?: Record<string, DetailCommonFieldProps>;
|
|
216
|
+
}
|
|
175
217
|
export {};
|
package/package.json
CHANGED