drf-react-by-schema 0.20.0 → 0.20.2
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/api.d.ts.map +1 -1
- package/dist/api.js +1 -2
- package/dist/components/DataGridBySchemaEditable/DataGridDesktop.d.ts +1 -1
- package/dist/components/DataGridBySchemaEditable/DataGridDesktop.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/DataGridDesktop.js +39 -3
- package/dist/components/DataGridBySchemaEditable/FileInputCell.d.ts +28 -0
- package/dist/components/DataGridBySchemaEditable/FileInputCell.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/FileInputCell.js +114 -0
- package/dist/components/Image.d.ts +10 -0
- package/dist/components/Image.d.ts.map +1 -0
- package/dist/components/Image.js +109 -0
- package/dist/components/details/DetailFieldBySchema.d.ts.map +1 -1
- package/dist/components/details/DetailFieldBySchema.js +3 -1
- package/dist/components/forms/DialogFormBySchema.d.ts +4 -2
- package/dist/components/forms/DialogFormBySchema.d.ts.map +1 -1
- package/dist/components/forms/DialogFormBySchema.js +1 -1
- package/dist/components/forms/FormBySchema.d.ts +1 -1
- package/dist/components/forms/FormBySchema.d.ts.map +1 -1
- package/dist/components/forms/FormBySchema.js +15 -18
- package/dist/context/APIWrapper.d.ts.map +1 -1
- package/dist/context/APIWrapper.js +3 -3
- package/dist/styles/layout.d.ts +21 -114
- package/dist/styles/layout.d.ts.map +1 -1
- package/dist/styles/layout.js +8 -6
- package/package.json +1 -1
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAEL,IAAI,EACJ,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EAErB,EAAE,EAGF,eAAe,EAEf,mBAAmB,EACnB,wBAAwB,EAEzB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,eAMlB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,GAAG,IAAI,SAShD,CAAC;AA2BF,eAAO,MAAM,UAAU,GAAU,gBAAgB,cAAc,GAAG,IAAI,0BAYrE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAU,gBAAgB,cAAc,GAAG,IAAI,iBAmB3E,CAAC;AAEF,eAAO,MAAM,MAAM,GAAU,MAAM,IAAI,EAAE,gBAAgB,cAAc,GAAG,IAAI,iBA+C7E,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAU,oNAkBvC,wBAAwB,2CA2H1B,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,8DAMnC;IACD,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,EAAE,CAAC,EAAE,EAAE,CAAC;IACR,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,2CA8BA,CAAC;AAEF,eAAO,MAAM,YAAY,GAAU,gBAAgB,cAAc,GAAG,IAAI,iBASvE,CAAC"}
|
package/dist/api.js
CHANGED
|
@@ -479,7 +479,6 @@ const prepareDataBySchemaRecursive = ({ data, schema }) => {
|
|
|
479
479
|
};
|
|
480
480
|
const prepareDataBySchema = ({ data, schema }) => {
|
|
481
481
|
const { data: preparedData, requiresMultipart } = prepareDataBySchemaRecursive({ data, schema });
|
|
482
|
-
console.log({ preparedData, formData: (0, utils_1.convertToFormData)(preparedData) });
|
|
483
482
|
return {
|
|
484
483
|
data: requiresMultipart ? (0, utils_1.convertToFormData)(preparedData) : preparedData,
|
|
485
484
|
contentType: requiresMultipart
|
|
@@ -833,7 +832,7 @@ const getGenericModel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ mod
|
|
|
833
832
|
return false;
|
|
834
833
|
}
|
|
835
834
|
let data = {};
|
|
836
|
-
if (id && (!relatedModel || (relatedModel && relatedModelId))) {
|
|
835
|
+
if (!(0, utils_1.isTmpId)(id) && (!relatedModel || (relatedModel && relatedModelId))) {
|
|
837
836
|
const response = yield getData({ path, serverEndPoint });
|
|
838
837
|
if (!('isAxiosError' in response)) {
|
|
839
838
|
data = response;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { JSX } from 'react';
|
|
2
|
-
import { GridRowId, GridRenderCellParams } from '@mui/x-data-grid';
|
|
3
2
|
import * as Yup from 'yup';
|
|
3
|
+
import { GridRowId, GridRenderCellParams } from '@mui/x-data-grid';
|
|
4
4
|
import { SxProps } from '@mui/material';
|
|
5
5
|
import { Item, SchemaType, Id, GridEnrichedBySchemaColDef, PaginationModel, ActionType, OnSelectActions, OptionsAC, FormFieldLayout, CustomAction, LinkComponentType } from '../../@types';
|
|
6
6
|
import { OnEditModelType } from '../../context/APIWrapperContext';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGridDesktop.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/DataGridDesktop.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA+B,GAAG,EAAgB,MAAM,OAAO,CAAC;AAE9E,OAAO,EAML,SAAS,EAET,oBAAoB,EAErB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"DataGridDesktop.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/DataGridDesktop.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA+B,GAAG,EAAgB,MAAM,OAAO,CAAC;AAE9E,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,EAML,SAAS,EAET,oBAAoB,EAErB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAiBxC,OAAO,EACL,IAAI,EACJ,UAAU,EAEV,EAAE,EACF,0BAA0B,EAC1B,eAAe,EACf,UAAU,EACV,eAAe,EAGf,SAAS,EACT,eAAe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,EAAE,EAAE,KAAK,MAAM,IAAI,CAAC;IAC1C,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IACxD,mBAAmB,EAAE,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC;CAC3C;AAED,iBAAS,eAAe,CAAC,EACvB,MAAM,EACN,QAAQ,EACR,WAAW,EACX,QAAY,EACZ,OAAO,EACP,KAAK,EACL,IAAqD,EACrD,UAAmB,EACnB,gBAAgB,EAChB,kBAAwB,EACxB,kBAAuB,EACvB,sBAAsB,EACtB,WAAgB,EAChB,QAAa,EACb,OAAO,EACP,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,UAAkB,EAClB,aAAqB,EACrB,eAAe,EACf,YAAoB,EACpB,oBAA4B,EAC5B,cAAc,EACd,eAA2B,EAC3B,kBAA8B,EAC9B,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,OAAkC,EAClC,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EAAE,iBAAiB,EAE5B,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,mBAAmB,GACpB,EAAE,oBAAoB,eA2+BtB;;AAED,wBAA6D"}
|
|
@@ -48,7 +48,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
48
48
|
const react_1 = __importStar(require("react"));
|
|
49
49
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
50
50
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
51
|
+
const string_mask_1 = __importDefault(require("string-mask"));
|
|
51
52
|
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
53
|
+
const Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
52
54
|
const CircularProgress_1 = __importDefault(require("@mui/material/CircularProgress"));
|
|
53
55
|
const Edit_1 = __importDefault(require("@mui/icons-material/Edit"));
|
|
54
56
|
const Bolt_1 = __importDefault(require("@mui/icons-material/Bolt"));
|
|
@@ -56,20 +58,20 @@ const Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
|
|
|
56
58
|
const Clear_1 = __importDefault(require("@mui/icons-material/Clear"));
|
|
57
59
|
const Check_1 = __importDefault(require("@mui/icons-material/Check"));
|
|
58
60
|
const Undo_1 = __importDefault(require("@mui/icons-material/Undo"));
|
|
59
|
-
const string_mask_1 = __importDefault(require("string-mask"));
|
|
60
61
|
const styles_1 = require("../../styles");
|
|
61
62
|
const api_1 = require("../../api");
|
|
62
63
|
const utils_1 = require("../../utils");
|
|
63
|
-
const DRFReactBySchemaContext_1 = require("../../context/DRFReactBySchemaContext");
|
|
64
64
|
const utils_2 = require("./utils");
|
|
65
|
+
const DRFReactBySchemaContext_1 = require("../../context/DRFReactBySchemaContext");
|
|
66
|
+
const APIWrapperContext_1 = require("../../context/APIWrapperContext");
|
|
65
67
|
const CustomToolbar_1 = require("./CustomToolbar");
|
|
66
68
|
const SelectEditInputCell_1 = require("./SelectEditInputCell");
|
|
67
69
|
const GridDateInput_1 = require("./GridDateInput");
|
|
68
70
|
const GridDecimalInput_1 = require("./GridDecimalInput");
|
|
69
71
|
const GridPatternInput_1 = require("./GridPatternInput");
|
|
70
72
|
const BooleanInputCell_1 = require("./BooleanInputCell");
|
|
73
|
+
const FileInputCell_1 = require("./FileInputCell");
|
|
71
74
|
const FooterToolbar_1 = require("./FooterToolbar");
|
|
72
|
-
const APIWrapperContext_1 = require("../../context/APIWrapperContext");
|
|
73
75
|
function DataGridDesktop({ schema, dataGrid, setDataGrid, rowCount = 0, columns, model, name = Math.floor(Math.random() * 1000000).toString(), indexField = 'nome', addExistingModel, indexFieldMinWidth = 350, indexFieldBasePath = '', indexFieldViewBasePath, stateToLink = {}, minWidth = 80, loading, modelParent, modelParentId, customColumnOperations, customFieldFormLayouts, customLinkDestination, LinkComponent, onProcessRow, onDataChange, onEditModel, isEditable = false, hasBulkSelect = false, onSelectActions, isAutoHeight = false, hideFooterPagination = false, setVisibleRows, paginationModel = undefined, setPaginationModel = undefined, hideFooterComponent, hideToolbarComponent, tableAutoHeight, actions = ['editInline', 'remove'], customActions, hideColumnsButton, hideFilterButton, hideDensityButton, hideExportButton, hideQuickFilterBar, optionsAC: optionsACExternal, emptyItem, handleDeleteClick, setSnackBar, yupValidationSchema, }) {
|
|
74
76
|
const { serverEndPoint } = (0, DRFReactBySchemaContext_1.useDRFReactBySchema)();
|
|
75
77
|
const apiContext = (0, APIWrapperContext_1.useAPIWrapper)();
|
|
@@ -364,6 +366,40 @@ function DataGridDesktop({ schema, dataGrid, setDataGrid, rowCount = 0, columns,
|
|
|
364
366
|
type: 'number',
|
|
365
367
|
});
|
|
366
368
|
break;
|
|
369
|
+
case 'image upload':
|
|
370
|
+
case 'file upload':
|
|
371
|
+
column.filterable = false;
|
|
372
|
+
column.orderable = false;
|
|
373
|
+
const colSchema = schema[col.field];
|
|
374
|
+
const accept = colSchema.allowed_mime_types
|
|
375
|
+
? colSchema.allowed_mime_types.join(', ')
|
|
376
|
+
: colSchema.type === 'image upload'
|
|
377
|
+
? '/image*'
|
|
378
|
+
: '*';
|
|
379
|
+
column.minWidth = 200;
|
|
380
|
+
column.valueFormatter = (params) => {
|
|
381
|
+
var _a;
|
|
382
|
+
return !((_a = params.value) === null || _a === void 0 ? void 0 : _a.name)
|
|
383
|
+
? ''
|
|
384
|
+
: `${params.value.name.split('/').pop()} (${(0, utils_1.formatFileSize)(params.value.size)})`;
|
|
385
|
+
};
|
|
386
|
+
column.renderCell = (params) => {
|
|
387
|
+
var _a, _b;
|
|
388
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, !((_a = params.value) === null || _a === void 0 ? void 0 : _a.name) ? null : ((_b = params.value) === null || _b === void 0 ? void 0 : _b.url) &&
|
|
389
|
+
colSchema.type === 'image upload' ? (react_1.default.createElement("img", { src: `${serverEndPoint === null || serverEndPoint === void 0 ? void 0 : serverEndPoint.url}${params.value.url}`, alt: params.value.name, title: params.value.name, style: {
|
|
390
|
+
width: '100%',
|
|
391
|
+
maxHeight: '100px',
|
|
392
|
+
objectFit: 'cover',
|
|
393
|
+
} })) : (react_1.default.createElement(Typography_1.default, { variant: "body2", sx: { mb: 1 } },
|
|
394
|
+
params.value.name.split('/').pop(),
|
|
395
|
+
" (",
|
|
396
|
+
(0, utils_1.formatFileSize)(params.value.size),
|
|
397
|
+
")"))));
|
|
398
|
+
};
|
|
399
|
+
if (isEditable && !col.disabled) {
|
|
400
|
+
column.renderEditCell = (params) => (react_1.default.createElement(FileInputCell_1.FileInputCell, Object.assign({ accept: accept, fileType: colSchema.type, column: column, required: colSchema.required }, params)));
|
|
401
|
+
}
|
|
402
|
+
break;
|
|
367
403
|
}
|
|
368
404
|
if (indexFieldMinWidth && !column.minWidth) {
|
|
369
405
|
column.minWidth = col.field === indexField ? indexFieldMinWidth : minWidth;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { SxProps } from '@mui/material';
|
|
3
|
+
import { GenericValue, GridEnrichedBySchemaColDef } from '../../@types';
|
|
4
|
+
interface FileInputCellProps {
|
|
5
|
+
field: string;
|
|
6
|
+
id: number | string;
|
|
7
|
+
value?: GenericValue;
|
|
8
|
+
column: GridEnrichedBySchemaColDef;
|
|
9
|
+
accept: string;
|
|
10
|
+
fileType?: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
sx?: SxProps;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*
|
|
17
|
+
* @param {FileInputCellProps} {
|
|
18
|
+
* field,
|
|
19
|
+
* id,
|
|
20
|
+
* value,
|
|
21
|
+
* column,
|
|
22
|
+
* sx = {}
|
|
23
|
+
* }
|
|
24
|
+
* @returns {*} {JSX.Element}
|
|
25
|
+
*/
|
|
26
|
+
export declare function FileInputCell({ field, id, value, column, accept, fileType, required, sx, }: FileInputCellProps): JSX.Element;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=FileInputCell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileInputCell.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/FileInputCell.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAUxC,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAgBxE,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,0BAA0B,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,OAAO,CAAC;CACd;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,EAAE,EACF,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,EAAO,GACR,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAqGlC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FileInputCell = FileInputCell;
|
|
16
|
+
const react_1 = __importDefault(require("react"));
|
|
17
|
+
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
18
|
+
const styles_1 = require("@mui/material/styles");
|
|
19
|
+
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
20
|
+
const Button_1 = __importDefault(require("@mui/material/Button"));
|
|
21
|
+
const FormControl_1 = __importDefault(require("@mui/material/FormControl"));
|
|
22
|
+
const FormControlLabel_1 = __importDefault(require("@mui/material/FormControlLabel"));
|
|
23
|
+
const Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
24
|
+
const CloudUpload_1 = __importDefault(require("@mui/icons-material/CloudUpload"));
|
|
25
|
+
const DRFReactBySchemaContext_1 = require("../../context/DRFReactBySchemaContext");
|
|
26
|
+
const utils_1 = require("../../utils");
|
|
27
|
+
const VisuallyHiddenInput = (0, styles_1.styled)('input')({
|
|
28
|
+
clip: 'rect(0 0 0 0)',
|
|
29
|
+
clipPath: 'inset(50%)',
|
|
30
|
+
height: 1,
|
|
31
|
+
overflow: 'hidden',
|
|
32
|
+
position: 'absolute',
|
|
33
|
+
bottom: 0,
|
|
34
|
+
left: 0,
|
|
35
|
+
whiteSpace: 'nowrap',
|
|
36
|
+
width: 1,
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
*
|
|
41
|
+
* @param {FileInputCellProps} {
|
|
42
|
+
* field,
|
|
43
|
+
* id,
|
|
44
|
+
* value,
|
|
45
|
+
* column,
|
|
46
|
+
* sx = {}
|
|
47
|
+
* }
|
|
48
|
+
* @returns {*} {JSX.Element}
|
|
49
|
+
*/
|
|
50
|
+
function FileInputCell({ field, id, value, column, accept, fileType, required, sx = {}, }) {
|
|
51
|
+
const apiRef = (0, x_data_grid_1.useGridApiContext)();
|
|
52
|
+
const { serverEndPoint } = (0, DRFReactBySchemaContext_1.useDRFReactBySchema)();
|
|
53
|
+
const handleChange = (newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
yield apiRef.current.setEditCellValue({ id, field, value: newValue });
|
|
55
|
+
apiRef.current.stopCellEditMode({ id, field });
|
|
56
|
+
});
|
|
57
|
+
const fileTypeStr = fileType === 'image upload' ? 'imagem' : 'documento';
|
|
58
|
+
return (react_1.default.createElement(FormControl_1.default, { component: "fieldset", sx: { width: '100%' } },
|
|
59
|
+
react_1.default.createElement(FormControlLabel_1.default, { control: react_1.default.createElement(Box_1.default, { sx: Object.assign({ display: 'flex', flexDirection: 'column', alignItems: 'center', width: '100%' }, sx) },
|
|
60
|
+
!(value === null || value === void 0 ? void 0 : value.name) ? null : ((value === null || value === void 0 ? void 0 : value.url) || (value === null || value === void 0 ? void 0 : value.src)) && fileType === 'image upload' ? (react_1.default.createElement("img", { src: value.url ? `${serverEndPoint === null || serverEndPoint === void 0 ? void 0 : serverEndPoint.url}${value.url}` : value.src, alt: value.name, title: value.name, style: {
|
|
61
|
+
width: '100%',
|
|
62
|
+
maxHeight: '100px',
|
|
63
|
+
objectFit: 'cover',
|
|
64
|
+
} })) : (react_1.default.createElement(Typography_1.default, { variant: "body2", sx: { mb: 1 } },
|
|
65
|
+
value.name.split('/').pop(),
|
|
66
|
+
" (",
|
|
67
|
+
(0, utils_1.formatFileSize)(value.size),
|
|
68
|
+
")")),
|
|
69
|
+
react_1.default.createElement(Button_1.default, { component: "label", variant: "outlined", startIcon: react_1.default.createElement(CloudUpload_1.default, null), disabled: column.disabled === true, fullWidth: true, sx: { mt: 1 },
|
|
70
|
+
// color={error ? 'error' : 'primary'}
|
|
71
|
+
color: "primary" },
|
|
72
|
+
value ? `Trocar ${fileTypeStr}` : `Enviar ${fileTypeStr}`,
|
|
73
|
+
react_1.default.createElement(VisuallyHiddenInput, { type: "file", onChange: (e) => {
|
|
74
|
+
var _a;
|
|
75
|
+
const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
76
|
+
if (file) {
|
|
77
|
+
if (file.type.startsWith('image/')) {
|
|
78
|
+
const reader = new FileReader();
|
|
79
|
+
reader.onload = (event) => {
|
|
80
|
+
const src = event.target ? event.target.result : undefined;
|
|
81
|
+
const newValue = {
|
|
82
|
+
name: file.name,
|
|
83
|
+
size: file.size,
|
|
84
|
+
type: file.type,
|
|
85
|
+
src,
|
|
86
|
+
file,
|
|
87
|
+
};
|
|
88
|
+
handleChange(newValue);
|
|
89
|
+
// if (onValueChange) {
|
|
90
|
+
// onValueChange(newValue);
|
|
91
|
+
// }
|
|
92
|
+
};
|
|
93
|
+
reader.readAsDataURL(file);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const newValue = {
|
|
97
|
+
name: file.name,
|
|
98
|
+
size: file.size,
|
|
99
|
+
type: file.type,
|
|
100
|
+
file,
|
|
101
|
+
};
|
|
102
|
+
handleChange(newValue);
|
|
103
|
+
// if (onValueChange) {
|
|
104
|
+
// onValueChange(newValue);
|
|
105
|
+
// }
|
|
106
|
+
}
|
|
107
|
+
}, accept: accept }))), label: '',
|
|
108
|
+
// labelPlacement="top"
|
|
109
|
+
required: required, sx: {
|
|
110
|
+
width: '100%',
|
|
111
|
+
alignItems: 'flex-start',
|
|
112
|
+
marginLeft: 0,
|
|
113
|
+
} })));
|
|
114
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material';
|
|
3
|
+
interface ImageModalProps {
|
|
4
|
+
src: string;
|
|
5
|
+
alt: string;
|
|
6
|
+
sx?: SxProps<Theme>;
|
|
7
|
+
}
|
|
8
|
+
declare const Image: React.FC<ImageModalProps>;
|
|
9
|
+
export default Image;
|
|
10
|
+
//# sourceMappingURL=Image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../src/components/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAOL,OAAO,EACP,KAAK,EACN,MAAM,eAAe,CAAC;AAGvB,UAAU,eAAe;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAED,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA4GpC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const material_1 = require("@mui/material");
|
|
41
|
+
const Expand_1 = __importDefault(require("@mui/icons-material/Expand"));
|
|
42
|
+
const Image = ({ src, alt, sx = {} }) => {
|
|
43
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
44
|
+
const theme = (0, material_1.useTheme)();
|
|
45
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('sm'));
|
|
46
|
+
const handleOpen = () => setOpen(true);
|
|
47
|
+
const handleClose = () => setOpen(false);
|
|
48
|
+
// Styled component for the image container
|
|
49
|
+
const ImageContainer = (0, material_1.styled)(material_1.Box)(() => ({
|
|
50
|
+
position: 'relative',
|
|
51
|
+
display: 'inline-block',
|
|
52
|
+
'&:hover .expand-button': {
|
|
53
|
+
opacity: 1,
|
|
54
|
+
},
|
|
55
|
+
}));
|
|
56
|
+
// Styled component for the expand button
|
|
57
|
+
const ExpandButton = (0, material_1.styled)(material_1.IconButton)(({ theme }) => (Object.assign({ position: 'absolute', bottom: theme.spacing(1), right: theme.spacing(1), backgroundColor: theme.palette.background.paper, opacity: 0.7, transition: 'opacity 0.3s', '&:hover': {
|
|
58
|
+
backgroundColor: theme.palette.background.paper,
|
|
59
|
+
opacity: 1,
|
|
60
|
+
} }, (isMobile && {
|
|
61
|
+
opacity: 1,
|
|
62
|
+
backgroundColor: theme.palette.background.paper + '!important',
|
|
63
|
+
}))));
|
|
64
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
65
|
+
react_1.default.createElement(ImageContainer, { onClick: handleOpen, sx: sx },
|
|
66
|
+
react_1.default.createElement("img", { src: src, alt: alt, style: {
|
|
67
|
+
width: '100%',
|
|
68
|
+
height: 'auto',
|
|
69
|
+
display: 'block',
|
|
70
|
+
cursor: 'pointer',
|
|
71
|
+
borderRadius: theme.shape.borderRadius,
|
|
72
|
+
} }),
|
|
73
|
+
react_1.default.createElement(ExpandButton, { className: "expand-button", "aria-label": "expand image", size: "small", onClick: (e) => {
|
|
74
|
+
e.stopPropagation();
|
|
75
|
+
handleOpen();
|
|
76
|
+
} },
|
|
77
|
+
react_1.default.createElement(Expand_1.default, { fontSize: isMobile ? 'medium' : 'small' }))),
|
|
78
|
+
react_1.default.createElement(material_1.Modal, { open: open, onClose: handleClose, sx: {
|
|
79
|
+
display: 'flex',
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
justifyContent: 'center',
|
|
82
|
+
p: isMobile ? 1 : 2,
|
|
83
|
+
} },
|
|
84
|
+
react_1.default.createElement(material_1.Box, { sx: {
|
|
85
|
+
position: 'relative',
|
|
86
|
+
maxWidth: isMobile ? '100%' : '90vw',
|
|
87
|
+
maxHeight: isMobile ? '100%' : '90vh',
|
|
88
|
+
outline: 'none',
|
|
89
|
+
} },
|
|
90
|
+
react_1.default.createElement("img", { src: src, alt: alt, style: {
|
|
91
|
+
maxWidth: '100%',
|
|
92
|
+
maxHeight: isMobile ? 'calc(100vh - 32px)' : 'calc(90vh - 32px)',
|
|
93
|
+
display: 'block',
|
|
94
|
+
borderRadius: theme.shape.borderRadius,
|
|
95
|
+
} }),
|
|
96
|
+
react_1.default.createElement(material_1.IconButton, { onClick: handleClose, sx: {
|
|
97
|
+
position: 'absolute',
|
|
98
|
+
top: theme.spacing(1),
|
|
99
|
+
right: theme.spacing(1),
|
|
100
|
+
backgroundColor: theme.palette.background.paper,
|
|
101
|
+
opacity: 0.7,
|
|
102
|
+
'&:hover': {
|
|
103
|
+
backgroundColor: theme.palette.background.paper,
|
|
104
|
+
opacity: 1,
|
|
105
|
+
},
|
|
106
|
+
}, size: isMobile ? 'medium' : 'small' },
|
|
107
|
+
react_1.default.createElement(Expand_1.default, { sx: { transform: 'rotate(45deg)' } }))))));
|
|
108
|
+
};
|
|
109
|
+
exports.default = Image;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DetailFieldBySchema.d.ts","sourceRoot":"","sources":["../../../src/components/details/DetailFieldBySchema.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"DetailFieldBySchema.d.ts","sourceRoot":"","sources":["../../../src/components/details/DetailFieldBySchema.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAMxD,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,KAAK,EACL,WAAW,EACX,OAAO,EACP,OAAO,EACP,OAAO,EACP,WAAW,EACX,eAAe,EACf,mBAAmB,GACpB,EAAE,wBAAwB,qBAgI1B"}
|
|
@@ -13,6 +13,8 @@ const ListItemText_1 = __importDefault(require("@mui/material/ListItemText"));
|
|
|
13
13
|
const Button_1 = __importDefault(require("@mui/material/Button"));
|
|
14
14
|
const Download_1 = __importDefault(require("@mui/icons-material/Download"));
|
|
15
15
|
const DRFReactBySchemaContext_1 = require("../../context/DRFReactBySchemaContext");
|
|
16
|
+
const styles_1 = require("../../styles");
|
|
17
|
+
const Image_1 = __importDefault(require("../Image"));
|
|
16
18
|
function DetailFieldBySchema({ value, fieldSchema, sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }) {
|
|
17
19
|
const { serverEndPoint } = (0, DRFReactBySchemaContext_1.useDRFReactBySchema)();
|
|
18
20
|
switch (fieldSchema.type) {
|
|
@@ -51,7 +53,7 @@ function DetailFieldBySchema({ value, fieldSchema, sxField, sxLabel, sxValue, sx
|
|
|
51
53
|
case 'image upload':
|
|
52
54
|
return (react_1.default.createElement(Box_1.default, { sx: sxField },
|
|
53
55
|
react_1.default.createElement(Typography_1.default, { variant: "h5", sx: sxLabel }, value.title),
|
|
54
|
-
react_1.default.createElement(
|
|
56
|
+
react_1.default.createElement(Image_1.default, { sx: styles_1.Layout.detailFieldImg, src: `${serverEndPoint === null || serverEndPoint === void 0 ? void 0 : serverEndPoint.url}${value.value.url}`, alt: value.valueStr }),
|
|
55
57
|
react_1.default.createElement(Typography_1.default, { variant: "body2", sx: sxValue },
|
|
56
58
|
react_1.default.createElement(Button_1.default, { href: `${serverEndPoint === null || serverEndPoint === void 0 ? void 0 : serverEndPoint.url}${value.value.url}`, target: "_blank", variant: "contained", startIcon: react_1.default.createElement(Download_1.default, null) }, value.valueStr))));
|
|
57
59
|
default:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AnyObjectSchema } from 'yup';
|
|
3
|
-
import { FormFieldLayout, Item, SchemaType } from '../../@types';
|
|
3
|
+
import { FormFieldLayout, Item, OptionsAC, SchemaType } from '../../@types';
|
|
4
4
|
import { DialogType } from '../../context/APIWrapperContext';
|
|
5
5
|
interface DialogFormBySchemaProps {
|
|
6
6
|
schema: SchemaType;
|
|
@@ -12,7 +12,9 @@ interface DialogFormBySchemaProps {
|
|
|
12
12
|
fieldsLayout?: FormFieldLayout[];
|
|
13
13
|
isCancelDisabled?: boolean;
|
|
14
14
|
forceSaveEnabled?: boolean;
|
|
15
|
+
optionsAC: OptionsAC | null;
|
|
16
|
+
setOptionsAC: (x: Partial<OptionsAC>) => void;
|
|
15
17
|
}
|
|
16
|
-
export default function DialogFormBySchema({ schema, validationSchema, initialValues, onEditModelSave, setDialog, getAutoComplete, fieldsLayout, isCancelDisabled, forceSaveEnabled, }: DialogFormBySchemaProps): React.JSX.Element;
|
|
18
|
+
export default function DialogFormBySchema({ schema, validationSchema, initialValues, onEditModelSave, setDialog, getAutoComplete, fieldsLayout, isCancelDisabled, forceSaveEnabled, optionsAC, setOptionsAC, }: DialogFormBySchemaProps): React.JSX.Element;
|
|
17
19
|
export {};
|
|
18
20
|
//# sourceMappingURL=DialogFormBySchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogFormBySchema.d.ts","sourceRoot":"","sources":["../../../src/components/forms/DialogFormBySchema.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAKtC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"DialogFormBySchema.d.ts","sourceRoot":"","sources":["../../../src/components/forms/DialogFormBySchema.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAKtC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,UAAU,uBAAuB;IAC/B,MAAM,EAAE,UAAU,CAAC;IACnB,gBAAgB,EAAE,eAAe,CAAC;IAClC,aAAa,EAAE,IAAI,CAAC;IACpB,eAAe,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC5C,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;IAC5D,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;IACjC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;CAC/C;AAED,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,SAAS,EACT,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACT,YAAY,GACb,EAAE,uBAAuB,qBAmEzB"}
|
|
@@ -44,7 +44,7 @@ const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
|
44
44
|
const Button_1 = __importDefault(require("@mui/material/Button"));
|
|
45
45
|
const styles_1 = require("../../styles");
|
|
46
46
|
const FormBySchema_1 = __importDefault(require("./FormBySchema"));
|
|
47
|
-
function DialogFormBySchema({ schema, validationSchema, initialValues, onEditModelSave, setDialog, getAutoComplete, fieldsLayout, isCancelDisabled, forceSaveEnabled, }) {
|
|
47
|
+
function DialogFormBySchema({ schema, validationSchema, initialValues, onEditModelSave, setDialog, getAutoComplete, fieldsLayout, isCancelDisabled, forceSaveEnabled, optionsAC, setOptionsAC, }) {
|
|
48
48
|
const { control, handleSubmit, reset, getValues, setValue, formState: { errors, isDirty }, } = (0, react_hook_form_1.useForm)({
|
|
49
49
|
mode: 'onBlur',
|
|
50
50
|
resolver: (0, yup_1.yupResolver)(validationSchema),
|
|
@@ -13,6 +13,6 @@ interface FormBySchemaProps extends Omit<FieldBySchemaProps, 'name'> {
|
|
|
13
13
|
relatedEditable?: boolean;
|
|
14
14
|
autoFocusField?: string;
|
|
15
15
|
}
|
|
16
|
-
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, customFieldFormLayouts, fieldsProps, hiddenFields, isolatedGetAutoComplete, relatedEditable, autoFocusField, }: FormBySchemaProps): React.JSX.Element;
|
|
16
|
+
export default function FormBySchema({ schema, control, errors, register, multiline, setValue, getValues, fieldKey, labelKey, index, optionsAC, setOptionsAC, forceReload, optionsModel, getOptionLabel, renderOption, onEditModel: customOnEditModel, options, isSemaphoric, label, decimalScale, fieldsLayout: fieldsLayoutInitial, customFieldFormLayouts, fieldsProps, hiddenFields, isolatedGetAutoComplete, relatedEditable, autoFocusField, }: FormBySchemaProps): React.JSX.Element;
|
|
17
17
|
export {};
|
|
18
18
|
//# sourceMappingURL=FormBySchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormBySchema.d.ts","sourceRoot":"","sources":["../../../src/components/forms/FormBySchema.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AASlD,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,IAAI,EACJ,SAAS,EACV,MAAM,cAAc,CAAC;AAGtB,UAAU,iBAAkB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC;IAClE,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;IAC3D,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ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CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IACtC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC/C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAQ,EACR,SAAiB,EACjB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAiB,EACjB,KAAK,EACL,SAAS,EACT,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,WAAW,EAAE,iBAAiB,EAC9B,OAAO,EACP,YAAoB,EACpB,KAAK,EACL,YAAgB,EAEhB,YAAY,EAAE,mBAAmB,EACjC,sBAAsB,EAEtB,WAAW,EACX,YAAiB,EACjB,uBAAuB,EACvB,eAAe,EACf,cAAc,GACf,EAAE,iBAAiB,qBAwQnB"}
|
|
@@ -55,11 +55,10 @@ const CircularProgress_1 = __importDefault(require("@mui/material/CircularProgre
|
|
|
55
55
|
const FieldBySchema_1 = __importDefault(require("./FieldBySchema"));
|
|
56
56
|
const styles_1 = require("../../styles");
|
|
57
57
|
const APIWrapperContext_1 = require("../../context/APIWrapperContext");
|
|
58
|
-
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, customFieldFormLayouts, fieldsProps, hiddenFields = [], isolatedGetAutoComplete, relatedEditable, autoFocusField, }) {
|
|
59
|
-
const { getAutoComplete, onEditModel: defaultOnEditModel } = (0, APIWrapperContext_1.useAPIWrapper)();
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
58
|
+
function FormBySchema({ schema, control, errors, register, multiline = false, setValue, getValues, fieldKey, labelKey = 'nome', index, optionsAC, setOptionsAC, forceReload, optionsModel, getOptionLabel, renderOption, onEditModel: customOnEditModel, options, isSemaphoric = false, label, decimalScale = 2, fieldsLayout: fieldsLayoutInitial, customFieldFormLayouts, fieldsProps, hiddenFields = [], isolatedGetAutoComplete, relatedEditable, autoFocusField, }) {
|
|
59
|
+
const { getAutoComplete: defaulGetAutoComplete, onEditModel: defaultOnEditModel, optionsAC: externalOptionsAC, } = (0, APIWrapperContext_1.useAPIWrapper)();
|
|
60
|
+
const getAutoComplete = isolatedGetAutoComplete || defaulGetAutoComplete;
|
|
61
|
+
const onEditModel = relatedEditable === false ? undefined : customOnEditModel || defaultOnEditModel;
|
|
63
62
|
const [fieldsLayout, setFieldsLayout] = (0, react_1.useState)([]);
|
|
64
63
|
const [localOptionsAC, setLocalOptionsAC] = (0, react_1.useState)(undefined);
|
|
65
64
|
const defaultSx = { mr: 0 };
|
|
@@ -125,7 +124,7 @@ function FormBySchema({ schema, control, errors, register, multiline = false, se
|
|
|
125
124
|
optionsACModels.map((field) => {
|
|
126
125
|
if (!optionsAC || !(field in optionsAC)) {
|
|
127
126
|
fieldsToLoad.push(field);
|
|
128
|
-
promises.push(
|
|
127
|
+
promises.push(getAutoComplete(field));
|
|
129
128
|
}
|
|
130
129
|
});
|
|
131
130
|
const newOptionsAC = {};
|
|
@@ -146,15 +145,15 @@ function FormBySchema({ schema, control, errors, register, multiline = false, se
|
|
|
146
145
|
setFieldsLayout(newFieldsLayout);
|
|
147
146
|
populateOptionsAC(optionsACModels);
|
|
148
147
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
149
|
-
}, []);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}, [forceReload]);
|
|
148
|
+
}, [schema, externalOptionsAC]);
|
|
149
|
+
// useEffect(() => {
|
|
150
|
+
// if (forceReload) {
|
|
151
|
+
// const { newFieldsLayout, optionsACModels } = getColumns();
|
|
152
|
+
// setFieldsLayout(newFieldsLayout);
|
|
153
|
+
// populateOptionsAC(optionsACModels);
|
|
154
|
+
// }
|
|
155
|
+
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
156
|
+
// }, [forceReload]);
|
|
158
157
|
if (fieldsLayout.length === 0 ||
|
|
159
158
|
(setOptionsAC && !optionsAC) ||
|
|
160
159
|
(!setOptionsAC && !localOptionsAC)) {
|
|
@@ -177,9 +176,7 @@ function FormBySchema({ schema, control, errors, register, multiline = false, se
|
|
|
177
176
|
const fieldProps = fieldsProps && field in fieldsProps ? fieldsProps[field] : {};
|
|
178
177
|
fieldProps.sx = 'sx' in fieldProps ? fieldProps.sx : defaultSx;
|
|
179
178
|
return (react_1.default.createElement(react_1.default.Fragment, { key: field },
|
|
180
|
-
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 ? optionsAC : localOptionsAC, optionsModel: optionsModel, getOptionLabel: getOptionLabel, renderOption: renderOption, onEditModel:
|
|
181
|
-
? onEditModel
|
|
182
|
-
: undefined, fieldsLayout: customFieldFormLayouts && field in customFieldFormLayouts
|
|
179
|
+
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 ? optionsAC : localOptionsAC, optionsModel: optionsModel, getOptionLabel: getOptionLabel, renderOption: renderOption, onEditModel: onEditModel, fieldsLayout: customFieldFormLayouts && field in customFieldFormLayouts
|
|
183
180
|
? customFieldFormLayouts[field]
|
|
184
181
|
: undefined, options: options, isSemaphoric: isSemaphoric, label: label, decimalScale: decimalScale, autoFocus: autoFocusField === field || (sectionIndex === 0 && rowIndex === 0) }, fieldProps))));
|
|
185
182
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIWrapper.d.ts","sourceRoot":"","sources":["../../src/context/APIWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAwCvE,OAAO,EAEL,UAAU,EAQV,YAAY,EACb,MAAM,qBAAqB,CAAC;AAG7B,UAAU,eAAe;IACvB,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IAChD,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC5C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AASD,iBAAS,UAAU,CAAC,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"APIWrapper.d.ts","sourceRoot":"","sources":["../../src/context/APIWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAwCvE,OAAO,EAEL,UAAU,EAQV,YAAY,EACb,MAAM,qBAAqB,CAAC;AAG7B,UAAU,eAAe;IACvB,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IAChD,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC5C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AASD,iBAAS,UAAU,CAAC,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,eAAe,qBAmjBvF;;AAED,wBAAsC"}
|
|
@@ -217,9 +217,9 @@ function APIWrapper({ handleLoading, setSnackBar, setDialog, children }) {
|
|
|
217
217
|
const value = getValues(targetKey);
|
|
218
218
|
const newValue = Array.isArray(value)
|
|
219
219
|
? value.map((item) => {
|
|
220
|
-
return item.id ===
|
|
220
|
+
return item.id === response.id ? response : item;
|
|
221
221
|
})
|
|
222
|
-
: Object.assign(
|
|
222
|
+
: Object.assign({}, response);
|
|
223
223
|
setValue(targetKey, newValue);
|
|
224
224
|
populateOptionsAC([model]);
|
|
225
225
|
}
|
|
@@ -279,7 +279,7 @@ function APIWrapper({ handleLoading, setSnackBar, setDialog, children }) {
|
|
|
279
279
|
open: true,
|
|
280
280
|
loading: false,
|
|
281
281
|
title: 'Editar',
|
|
282
|
-
Body: (react_1.default.createElement(DialogFormBySchema_1.default, { schema: result.schema, validationSchema: yupSchema, initialValues: values, setDialog: setDialog, getAutoComplete: localGetAutoComplete, onEditModelSave: onEditModelSave, fieldsLayout: fieldsLayout, isCancelDisabled: true, forceSaveEnabled: true })),
|
|
282
|
+
Body: (react_1.default.createElement(DialogFormBySchema_1.default, { schema: result.schema, validationSchema: yupSchema, initialValues: values, setDialog: setDialog, getAutoComplete: localGetAutoComplete, onEditModelSave: onEditModelSave, fieldsLayout: fieldsLayout, isCancelDisabled: true, forceSaveEnabled: true, optionsAC: optionsAC, setOptionsAC: setOptionsAC })),
|
|
283
283
|
Actions: react_1.default.createElement(react_1.default.Fragment, null),
|
|
284
284
|
isCancelDisabled: true,
|
|
285
285
|
});
|
package/dist/styles/layout.d.ts
CHANGED
|
@@ -1,115 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export declare const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export declare const topBar: {
|
|
23
|
-
width: string;
|
|
24
|
-
pl: number;
|
|
25
|
-
pr: number;
|
|
26
|
-
display: string;
|
|
27
|
-
flexDirection: string;
|
|
28
|
-
justifyContent: string;
|
|
29
|
-
alignItems: string;
|
|
30
|
-
};
|
|
31
|
-
export declare const loadingBox: {
|
|
32
|
-
height: string;
|
|
33
|
-
backgroundColor: string;
|
|
34
|
-
justifyContent: string;
|
|
35
|
-
display: string;
|
|
36
|
-
flexDirection: string;
|
|
37
|
-
alignItems: string;
|
|
38
|
-
};
|
|
39
|
-
export declare const loadingBoxWhite: {
|
|
40
|
-
height: string;
|
|
41
|
-
justifyContent: string;
|
|
42
|
-
display: string;
|
|
43
|
-
flexDirection: string;
|
|
44
|
-
alignItems: string;
|
|
45
|
-
};
|
|
46
|
-
export declare const actionButtons: {
|
|
47
|
-
width: string;
|
|
48
|
-
alignItems: string;
|
|
49
|
-
display: string;
|
|
50
|
-
flexDirection: string;
|
|
51
|
-
justifyContent: string;
|
|
52
|
-
};
|
|
53
|
-
export declare const inLineForm: {
|
|
54
|
-
width: string;
|
|
55
|
-
justifyContent: string;
|
|
56
|
-
display: string;
|
|
57
|
-
flexDirection: string;
|
|
58
|
-
alignItems: string;
|
|
59
|
-
};
|
|
60
|
-
export declare const flexColumn: {
|
|
61
|
-
flexDirection: string;
|
|
62
|
-
display: string;
|
|
63
|
-
justifyContent: string;
|
|
64
|
-
alignItems: string;
|
|
65
|
-
};
|
|
66
|
-
export declare const flexRowGrow: {
|
|
67
|
-
flexGrow: number;
|
|
68
|
-
display: string;
|
|
69
|
-
flexDirection: string;
|
|
70
|
-
justifyContent: string;
|
|
71
|
-
alignItems: string;
|
|
72
|
-
};
|
|
73
|
-
export declare const topBarOverList: {
|
|
74
|
-
mb: number;
|
|
75
|
-
flexGrow: number;
|
|
76
|
-
display: string;
|
|
77
|
-
flexDirection: string;
|
|
78
|
-
justifyContent: string;
|
|
79
|
-
alignItems: string;
|
|
80
|
-
};
|
|
81
|
-
export declare const dataGrid: {
|
|
82
|
-
height: string;
|
|
83
|
-
mt: number;
|
|
84
|
-
};
|
|
85
|
-
export declare const dataGridWithTabs: {
|
|
86
|
-
mt: number;
|
|
87
|
-
height: string;
|
|
88
|
-
};
|
|
89
|
-
export declare const dataGridFixedHeight: {
|
|
90
|
-
height: number;
|
|
91
|
-
mt: number;
|
|
92
|
-
};
|
|
93
|
-
export declare const fullWidthButton: {
|
|
94
|
-
mt: number;
|
|
95
|
-
width: string;
|
|
96
|
-
};
|
|
97
|
-
export declare const formCard: {
|
|
98
|
-
width: string;
|
|
99
|
-
backgroundColor: any;
|
|
100
|
-
mt: number;
|
|
101
|
-
mb: number;
|
|
102
|
-
};
|
|
103
|
-
export declare const formCardContent: {
|
|
104
|
-
maxHeight: number;
|
|
105
|
-
overflow: string;
|
|
106
|
-
};
|
|
107
|
-
export declare const metabaseAppEmbed: {
|
|
108
|
-
height: number;
|
|
109
|
-
};
|
|
110
|
-
export declare const geoPicker: {
|
|
111
|
-
height: number;
|
|
112
|
-
width: string;
|
|
113
|
-
mt: number;
|
|
114
|
-
};
|
|
1
|
+
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
export declare const content: SxProps<Theme>;
|
|
3
|
+
export declare const main: SxProps<Theme>;
|
|
4
|
+
export declare const flexRow: SxProps<Theme>;
|
|
5
|
+
export declare const topBar: SxProps<Theme>;
|
|
6
|
+
export declare const loadingBox: SxProps<Theme>;
|
|
7
|
+
export declare const loadingBoxWhite: SxProps<Theme>;
|
|
8
|
+
export declare const actionButtons: SxProps<Theme>;
|
|
9
|
+
export declare const inLineForm: SxProps<Theme>;
|
|
10
|
+
export declare const flexColumn: SxProps<Theme>;
|
|
11
|
+
export declare const flexRowGrow: SxProps<Theme>;
|
|
12
|
+
export declare const topBarOverList: SxProps<Theme>;
|
|
13
|
+
export declare const dataGrid: SxProps<Theme>;
|
|
14
|
+
export declare const dataGridWithTabs: SxProps<Theme>;
|
|
15
|
+
export declare const dataGridFixedHeight: SxProps<Theme>;
|
|
16
|
+
export declare const fullWidthButton: SxProps<Theme>;
|
|
17
|
+
export declare const formCard: SxProps<Theme>;
|
|
18
|
+
export declare const formCardContent: SxProps<Theme>;
|
|
19
|
+
export declare const metabaseAppEmbed: SxProps<Theme>;
|
|
20
|
+
export declare const geoPicker: SxProps<Theme>;
|
|
21
|
+
export declare const detailFieldImg: SxProps<Theme>;
|
|
115
22
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/styles/layout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/styles/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE/C,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,KAAK,CAMlC,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,OAAO,CAAC,KAAK,CAG/B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,KAAK,CAKlC,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,OAAO,CAAC,KAAK,CAKjC,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,OAAO,CAAC,KAAK,CAKrC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,KAAK,CAI1C,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,KAAK,CAIxC,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,OAAO,CAAC,KAAK,CAIrC,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,OAAO,CAAC,KAAK,CAGrC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,KAAK,CAGtC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,KAAK,CAGzC,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,KAAK,CAGnC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAC,KAAK,CAG3C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,OAAO,CAAC,KAAK,CAG9C,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,KAAK,CAG1C,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,KAAK,CAKnC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,KAAK,CAG1C,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAC,KAAK,CAE3C,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,OAAO,CAAC,KAAK,CAIpC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,KAAK,CAKzC,CAAC"}
|
package/dist/styles/layout.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.geoPicker = exports.metabaseAppEmbed = exports.formCardContent = exports.formCard = exports.fullWidthButton = exports.dataGridFixedHeight = exports.dataGridWithTabs = exports.dataGrid = exports.topBarOverList = exports.flexRowGrow = exports.flexColumn = exports.inLineForm = exports.actionButtons = exports.loadingBoxWhite = exports.loadingBox = exports.topBar = exports.flexRow = exports.main = exports.content = void 0;
|
|
7
|
-
const theme_1 = __importDefault(require("./theme"));
|
|
3
|
+
exports.detailFieldImg = exports.geoPicker = exports.metabaseAppEmbed = exports.formCardContent = exports.formCard = exports.fullWidthButton = exports.dataGridFixedHeight = exports.dataGridWithTabs = exports.dataGrid = exports.topBarOverList = exports.flexRowGrow = exports.flexColumn = exports.inLineForm = exports.actionButtons = exports.loadingBoxWhite = exports.loadingBox = exports.topBar = exports.flexRow = exports.main = exports.content = void 0;
|
|
8
4
|
exports.content = {
|
|
9
5
|
flexGrow: 1,
|
|
10
6
|
pr: 3,
|
|
@@ -39,7 +35,7 @@ exports.fullWidthButton = {
|
|
|
39
35
|
};
|
|
40
36
|
exports.formCard = {
|
|
41
37
|
width: '100%',
|
|
42
|
-
backgroundColor:
|
|
38
|
+
backgroundColor: (theme) => theme.palette.formCard.main,
|
|
43
39
|
mt: 2,
|
|
44
40
|
mb: 2,
|
|
45
41
|
};
|
|
@@ -55,3 +51,9 @@ exports.geoPicker = {
|
|
|
55
51
|
width: '100%',
|
|
56
52
|
mt: 0,
|
|
57
53
|
};
|
|
54
|
+
exports.detailFieldImg = {
|
|
55
|
+
width: '100%',
|
|
56
|
+
maxWidth: 450,
|
|
57
|
+
maxHeight: 300,
|
|
58
|
+
overflow: 'hidden',
|
|
59
|
+
};
|
package/package.json
CHANGED