drf-react-by-schema 0.12.1 → 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.
|
@@ -238,7 +238,7 @@ const DataGridBySchemaEditable = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
238
238
|
column.valueFormatter = (params) => {
|
|
239
239
|
return !params.value ? '' : params.value.label;
|
|
240
240
|
};
|
|
241
|
-
column.filterable = false;
|
|
241
|
+
// column.filterable = false;
|
|
242
242
|
column.sortComparator = (v1, v2, param1, param2) => {
|
|
243
243
|
return (0, x_data_grid_1.gridStringOrNumberComparator)(v1.label, v2.label, param1, param2);
|
|
244
244
|
};
|
|
@@ -42,6 +42,7 @@ const CardHeader_1 = __importDefault(require("@mui/material/CardHeader"));
|
|
|
42
42
|
const CardContent_1 = __importDefault(require("@mui/material/CardContent"));
|
|
43
43
|
const DataGridBySchemaEditable_1 = __importDefault(require("./DataGridBySchemaEditable"));
|
|
44
44
|
const DataTotals_1 = __importDefault(require("./DataTotals"));
|
|
45
|
+
const DataTotalsServer_1 = __importDefault(require("./DataTotalsServer"));
|
|
45
46
|
const APIWrapperContext_1 = require("../context/APIWrapperContext");
|
|
46
47
|
const utils_1 = require("../utils");
|
|
47
48
|
const api_1 = require("../api");
|
|
@@ -55,7 +56,7 @@ const ContentTable = ({ data, relatedModel, model, id, indexField, indexFieldBas
|
|
|
55
56
|
: typeof data.rowCount !== undefined
|
|
56
57
|
? data.rowCount
|
|
57
58
|
: 0 }))),
|
|
58
|
-
react_1.default.createElement(DataTotals_1.default, { data: data.data, sumRows: sumRows, visibleRows: visibleRows })));
|
|
59
|
+
paginationMode === 'client' ? (react_1.default.createElement(DataTotals_1.default, { data: data.data, sumRows: sumRows, visibleRows: visibleRows })) : (react_1.default.createElement(DataTotalsServer_1.default, { sumRows: sumRows, totals: data.sumRowsTotals }))));
|
|
59
60
|
function GenericRelatedModelList({ model, id, relatedModel, columnFields, hiddenFields, creatableFields, disabledFields, usuaria = null, minWidthFields, indexField, indexFieldBasePath, indexFieldViewBasePath, addExistingModel, label, onProcessRow, customColumnOperations, isEditable = true, hasBulkSelect = false, sumRows, isAutoHeight = false, isInBatches = true, noCardWrapper = false, paginationMode = 'client', defaultFilter, queryParams, hideFooterComponent, hideToolbarComponent, tableAutoHeight, actions, optionsAC, }) {
|
|
60
61
|
const [data, setData] = (0, react_1.useState)(false);
|
|
61
62
|
const [visibleRows, setVisibleRows] = (0, react_1.useState)([]);
|
|
@@ -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