drf-react-by-schema 0.28.2 → 0.28.4
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/README.md +11 -0
- package/dist/components/DataGridBySchemaEditable/GeoEditCell.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/GeoEditCell.js +7 -3
- package/dist/components/DataGridBySchemaEditable/GeoThumbCell.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/GeoThumbCell.js +3 -0
- package/dist/components/DialogActions.d.ts.map +1 -1
- package/dist/components/DialogActions.js +8 -3
- package/dist/components/forms/DialogFormBySchema.d.ts.map +1 -1
- package/dist/components/forms/DialogFormBySchema.js +7 -4
- package/dist/components/forms/FormActions.d.ts.map +1 -1
- package/dist/components/forms/FormActions.js +13 -9
- package/dist/components/forms/inputs/MapGeometryPicker.d.ts.map +1 -1
- package/dist/components/forms/inputs/MapGeometryPicker.js +76 -4
- package/dist/components/forms/inputs/leafletMarker.d.ts +12 -0
- package/dist/components/forms/inputs/leafletMarker.d.ts.map +1 -0
- package/dist/components/forms/inputs/leafletMarker.js +52 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/styles/texts.d.ts +48 -0
- package/dist/styles/texts.d.ts.map +1 -0
- package/dist/styles/texts.js +55 -0
- package/dist/styles/theme.d.ts +7 -0
- package/dist/styles/theme.d.ts.map +1 -1
- package/dist/styles/theme.js +2 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,6 +45,17 @@ read-only thumbnail map in the DataGrid.
|
|
|
45
45
|
See the complete table of field types and their widgets (including the geometry
|
|
46
46
|
behaviours — add/move/remove rules, GeoJSON text sync and fallbacks) in
|
|
47
47
|
**[`docs/FIELD_TYPES.md`](docs/FIELD_TYPES.md)**.
|
|
48
|
+
|
|
49
|
+
## Localization & theming
|
|
50
|
+
|
|
51
|
+
User-facing strings (geometry picker, form/dialog action buttons, …) are exposed through
|
|
52
|
+
the **MUI theme** (`theme.texts`), so you can localize every widget in your own `theme.ts`
|
|
53
|
+
— no provider changes. The package ships with sensible defaults and also localizes the
|
|
54
|
+
MUI components it renders (DataGrid, date pickers) to pt-BR.
|
|
55
|
+
|
|
56
|
+
See the full reference (namespaces, precedence, MUI locale setup, custom markers) in
|
|
57
|
+
**[`docs/localization.md`](docs/localization.md)**.
|
|
58
|
+
|
|
48
59
|
## Getting started
|
|
49
60
|
|
|
50
61
|
1. Build the Django model (a guide is available at https://pypi.org/project/drf-react-by-schema/)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeoEditCell.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GeoEditCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GeoEditCell.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GeoEditCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAQxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAKjD,UAAU,gBAAiB,SAAQ,wBAAwB;IACzD,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,EAAE,EACF,KAAK,EACL,GAAG,EACH,KAAK,EACL,QAAQ,EACR,MAAY,GACb,EAAE,gBAAgB,qBA4DlB"}
|
|
@@ -44,9 +44,13 @@ const Button_1 = __importDefault(require("@mui/material/Button"));
|
|
|
44
44
|
const IconButton_1 = __importDefault(require("@mui/material/IconButton"));
|
|
45
45
|
const Modal_1 = __importDefault(require("@mui/material/Modal"));
|
|
46
46
|
const Close_1 = __importDefault(require("@mui/icons-material/Close"));
|
|
47
|
+
const styles_1 = require("@mui/material/styles");
|
|
47
48
|
const utils_1 = require("../../utils");
|
|
48
49
|
const MapGeometryPicker_1 = __importDefault(require("../forms/inputs/MapGeometryPicker"));
|
|
50
|
+
const texts_1 = require("../../styles/texts");
|
|
49
51
|
function GeoEditCell({ id, field, api, value, geometry, height = 360, }) {
|
|
52
|
+
const texts = (0, texts_1.getThemeTexts)((0, styles_1.useTheme)());
|
|
53
|
+
const geometryTexts = texts.geometry;
|
|
50
54
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
51
55
|
const [draft, setDraft] = (0, react_1.useState)((0, utils_1.geometryValueToString)(value));
|
|
52
56
|
const handleOpen = () => {
|
|
@@ -60,7 +64,7 @@ function GeoEditCell({ id, field, api, value, geometry, height = 360, }) {
|
|
|
60
64
|
api.setEditCellValue({ id, field, value: (0, utils_1.parseGeoJSON)(geometry, geoJSON) });
|
|
61
65
|
};
|
|
62
66
|
return (react_1.default.createElement(Box_1.default, { sx: { display: 'flex', alignItems: 'center' } },
|
|
63
|
-
react_1.default.createElement(Button_1.default, { size: "small", variant: "outlined", onClick: handleOpen }, value ?
|
|
67
|
+
react_1.default.createElement(Button_1.default, { size: "small", variant: "outlined", onClick: handleOpen }, value ? geometryTexts.edit : geometryTexts.define),
|
|
64
68
|
react_1.default.createElement(Modal_1.default, { open: open, onClose: () => setOpen(false), sx: { display: 'flex', alignItems: 'center', justifyContent: 'center', p: 2 } },
|
|
65
69
|
react_1.default.createElement(Box_1.default, { sx: {
|
|
66
70
|
width: '100%',
|
|
@@ -74,8 +78,8 @@ function GeoEditCell({ id, field, api, value, geometry, height = 360, }) {
|
|
|
74
78
|
outline: 'none',
|
|
75
79
|
} },
|
|
76
80
|
react_1.default.createElement(Box_1.default, { sx: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 1 } },
|
|
77
|
-
react_1.default.createElement(Typography_1.default, { variant: "h6" },
|
|
78
|
-
react_1.default.createElement(IconButton_1.default, { onClick: () => setOpen(false), "aria-label":
|
|
81
|
+
react_1.default.createElement(Typography_1.default, { variant: "h6" }, geometryTexts.drawSelectTitle),
|
|
82
|
+
react_1.default.createElement(IconButton_1.default, { onClick: () => setOpen(false), "aria-label": geometryTexts.close, size: "small" },
|
|
79
83
|
react_1.default.createElement(Close_1.default, null))),
|
|
80
84
|
react_1.default.createElement(MapGeometryPicker_1.default, { geometry: geometry, value: draft, onChange: handleChange, height: height })))));
|
|
81
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeoThumbCell.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GeoThumbCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GeoThumbCell.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GeoThumbCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAOzC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AA8B/D,UAAU,iBAAiB;IACzB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,QAAQ,EACR,KAAK,EACL,KAAwB,EACxB,MAAyB,GAC1B,EAAE,iBAAiB,qBAqCnB"}
|
|
@@ -41,8 +41,11 @@ const react_1 = __importStar(require("react"));
|
|
|
41
41
|
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
42
42
|
const react_leaflet_1 = require("react-leaflet");
|
|
43
43
|
const leaflet_1 = __importDefault(require("leaflet"));
|
|
44
|
+
const leafletMarker_1 = require("../forms/inputs/leafletMarker");
|
|
44
45
|
const utils_1 = require("../../utils");
|
|
45
46
|
const geoConstants_1 = require("./geoConstants");
|
|
47
|
+
// L.geoJSON point markers use L.Icon.Default; ensure it points at a servable icon.
|
|
48
|
+
(0, leafletMarker_1.applyDefaultLeafletIcon)();
|
|
46
49
|
// Fits the rendered geometry and keeps the thumb static (no pan/zoom).
|
|
47
50
|
function FitGeometry({ data }) {
|
|
48
51
|
const map = (0, react_leaflet_1.useMap)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogActions.d.ts","sourceRoot":"","sources":["../../src/components/DialogActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DialogActions.d.ts","sourceRoot":"","sources":["../../src/components/DialogActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D,UAAU,kBAAkB;IAC1B,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC5C,UAAU,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,SAAS,EACT,UAAU,EACV,SAAS,EACT,UAAU,GACX,EAAE,kBAAkB,qBAepB"}
|
|
@@ -6,10 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.default = DialogActions;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const Button_1 = __importDefault(require("@mui/material/Button"));
|
|
9
|
-
|
|
9
|
+
const styles_1 = require("@mui/material/styles");
|
|
10
|
+
const texts_1 = require("../styles/texts");
|
|
11
|
+
function DialogActions({ setDialog, handleSave, btnCancel, btnConfirm, }) {
|
|
12
|
+
const formTexts = (0, texts_1.getThemeTexts)((0, styles_1.useTheme)()).forms;
|
|
13
|
+
const cancelLabel = btnCancel !== null && btnCancel !== void 0 ? btnCancel : formTexts.dialogCancel;
|
|
14
|
+
const confirmLabel = btnConfirm !== null && btnConfirm !== void 0 ? btnConfirm : formTexts.dialogSave;
|
|
10
15
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
11
16
|
react_1.default.createElement(Button_1.default, { onClick: () => {
|
|
12
17
|
setDialog({ open: false });
|
|
13
|
-
} },
|
|
14
|
-
handleSave && react_1.default.createElement(Button_1.default, { onClick: handleSave },
|
|
18
|
+
} }, cancelLabel),
|
|
19
|
+
handleSave && react_1.default.createElement(Button_1.default, { onClick: handleSave }, confirmLabel)));
|
|
15
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogFormBySchema.d.ts","sourceRoot":"","sources":["../../../src/components/forms/DialogFormBySchema.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAC;AACtD,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"DialogFormBySchema.d.ts","sourceRoot":"","sources":["../../../src/components/forms/DialogFormBySchema.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAC;AACtD,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAMtC,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,IAAI,EACJ,SAAS,EACT,UAAU,EACV,MAAM,EACP,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAI7D,UAAU,uBAAuB,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI;IACvD,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACtB,gBAAgB,EAAE,eAAe,CAAC;IAClC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACvB,eAAe,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,OAAO,GAAG,UAAU,CAAC,CAAC;IAC/D,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC5C,eAAe,EAAE,CACf,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,EAAE,KACnB,OAAO,CAAC,gBAAgB,EAAE,GAAG,UAAU,CAAC,CAAC;IAC9C,YAAY,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IACpC,YAAY,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACzB,YAAY,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CAClD;AAED,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI,EAAE,EAClE,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,SAAS,EACT,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,GACV,EAAE,uBAAuB,CAAC,CAAC,CAAC,qBAwF5B"}
|
|
@@ -52,10 +52,13 @@ const react_hook_form_1 = require("react-hook-form");
|
|
|
52
52
|
const yup_1 = require("@hookform/resolvers/yup");
|
|
53
53
|
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
54
54
|
const Button_1 = __importDefault(require("@mui/material/Button"));
|
|
55
|
-
const styles_1 = require("
|
|
55
|
+
const styles_1 = require("@mui/material/styles");
|
|
56
|
+
const styles_2 = require("../../styles");
|
|
56
57
|
const FormBySchema_1 = __importDefault(require("./FormBySchema"));
|
|
57
58
|
const utils_1 = require("../../utils");
|
|
59
|
+
const texts_1 = require("../../styles/texts");
|
|
58
60
|
function DialogFormBySchema({ schema, validationSchema, initialValues, onEditModelSave, setDialog, getAutoComplete, fieldsLayout, hiddenFields, isCancelDisabled, forceSaveEnabled, optionsAC, }) {
|
|
61
|
+
const formTexts = (0, texts_1.getThemeTexts)((0, styles_1.useTheme)()).forms;
|
|
59
62
|
const { control, handleSubmit, reset, getValues, setValue, setError, formState: { errors, isDirty }, } = (0, react_hook_form_1.useForm)({
|
|
60
63
|
mode: 'onBlur',
|
|
61
64
|
resolver: validationSchema ? (0, yup_1.yupResolver)(validationSchema) : undefined,
|
|
@@ -84,11 +87,11 @@ function DialogFormBySchema({ schema, validationSchema, initialValues, onEditMod
|
|
|
84
87
|
return (react_1.default.createElement(react_1.default.Fragment, null, initialValues && control && (react_1.default.createElement("form", { onSubmit: handleSubmit(handleSubmitWrapper) },
|
|
85
88
|
react_1.default.createElement(Box_1.default, null,
|
|
86
89
|
react_1.default.createElement(FormBySchema_1.default, { control: control, errors: errors, schema: schema, getValues: getValues, setValue: setValue, optionsAC: optionsAC, isolatedGetAutoComplete: getAutoComplete, fieldsLayout: fieldsLayout, hiddenFields: hiddenFields, relatedEditable: false })),
|
|
87
|
-
react_1.default.createElement(Box_1.default, { sx:
|
|
90
|
+
react_1.default.createElement(Box_1.default, { sx: styles_2.Layout.flexRow },
|
|
88
91
|
!isCancelDisabled && (react_1.default.createElement(Button_1.default, { variant: "contained", color: "primary", size: "small", sx: { ml: 1 }, onClick: () => {
|
|
89
92
|
setDialog({
|
|
90
93
|
open: false,
|
|
91
94
|
});
|
|
92
|
-
} },
|
|
93
|
-
react_1.default.createElement(Button_1.default, { variant: "contained", name: "exitOnSave", disabled: !forceSaveEnabled && !isDirty, type: "submit", color: "primary", size: "small" },
|
|
95
|
+
} }, formTexts.dialogCancel)),
|
|
96
|
+
react_1.default.createElement(Button_1.default, { variant: "contained", name: "exitOnSave", disabled: !forceSaveEnabled && !isDirty, type: "submit", color: "primary", size: "small" }, formTexts.dialogSave))))));
|
|
94
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormActions.d.ts","sourceRoot":"","sources":["../../../src/components/forms/FormActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAmB,EAAE,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"FormActions.d.ts","sourceRoot":"","sources":["../../../src/components/forms/FormActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAmB,EAAE,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,EAAE,CAAC;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACtD,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI,EAAE,EAC3D,YAAY,EACZ,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,eAAe,EACf,KAAK,EACL,SAAS,EACT,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,WAAW,GACZ,EAAE,gBAAgB,qBAiHlB"}
|
|
@@ -8,16 +8,20 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
9
9
|
const Button_1 = __importDefault(require("@mui/material/Button"));
|
|
10
10
|
const Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
11
|
-
const styles_1 = require("
|
|
11
|
+
const styles_1 = require("@mui/material/styles");
|
|
12
|
+
const styles_2 = require("../../styles");
|
|
12
13
|
const utils_1 = require("../../utils");
|
|
13
14
|
const _types_1 = require("../../@types");
|
|
14
15
|
const APIWrapperContext_1 = require("../../context/APIWrapperContext");
|
|
16
|
+
const texts_1 = require("../../styles/texts");
|
|
15
17
|
function FormActions({ formDisabled, model, objId, onCancel, onDelete, exit, bottom, saveAndContinue, title, labelSave, labelSaveAndContinue, labelSaveAndCreateNew, labelCancel, labelRemove, }) {
|
|
16
18
|
const { onDeleteModel, isMobile } = (0, APIWrapperContext_1.useAPIWrapper)();
|
|
19
|
+
const texts = (0, texts_1.getThemeTexts)((0, styles_1.useTheme)());
|
|
20
|
+
const formTexts = texts.forms;
|
|
17
21
|
if (isMobile && !bottom) {
|
|
18
22
|
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
19
23
|
}
|
|
20
|
-
const finalSx = Object.assign(Object.assign({},
|
|
24
|
+
const finalSx = Object.assign(Object.assign({}, styles_2.Layout.flexRowGrow), (bottom && !(0, utils_1.isTmpId)(objId)
|
|
21
25
|
? {
|
|
22
26
|
mb: 5,
|
|
23
27
|
pb: 2,
|
|
@@ -40,12 +44,12 @@ function FormActions({ formDisabled, model, objId, onCancel, onDelete, exit, bot
|
|
|
40
44
|
exit(objId);
|
|
41
45
|
};
|
|
42
46
|
return (react_1.default.createElement(Box_1.default, { sx: finalSx },
|
|
43
|
-
bottom ? (react_1.default.createElement(Button_1.default, { variant: "contained", type: "button", color: "error", size: "small", disabled: (0, utils_1.isTmpId)(objId) || !onDeleteModel, onClick: handleDelete }, labelRemove ||
|
|
44
|
-
isMobile ? (react_1.default.createElement(Box_1.default, { sx:
|
|
45
|
-
react_1.default.createElement(Button_1.default, { variant: "contained", name: _types_1.FormSaveActions.EXIT_ON_SAVE, type: "submit", color: "primary", size: "small", sx: { ml: 1 }, disabled: formDisabled }, labelSave ||
|
|
46
|
-
react_1.default.createElement(Button_1.default, { variant: "contained", color: "primary", size: "small", sx: { ml: 1 }, onClick: handleCancel }, labelCancel ||
|
|
47
|
+
bottom ? (react_1.default.createElement(Button_1.default, { variant: "contained", type: "button", color: "error", size: "small", disabled: (0, utils_1.isTmpId)(objId) || !onDeleteModel, onClick: handleDelete }, labelRemove || formTexts.remove)) : title ? (react_1.default.createElement(Typography_1.default, { variant: "h5" }, title)) : (react_1.default.createElement(Box_1.default, null)),
|
|
48
|
+
isMobile ? (react_1.default.createElement(Box_1.default, { sx: styles_2.Layout.flexRow },
|
|
49
|
+
react_1.default.createElement(Button_1.default, { variant: "contained", name: _types_1.FormSaveActions.EXIT_ON_SAVE, type: "submit", color: "primary", size: "small", sx: { ml: 1 }, disabled: formDisabled }, labelSave || formTexts.save))) : (react_1.default.createElement(Box_1.default, { sx: styles_2.Layout.flexRow },
|
|
50
|
+
react_1.default.createElement(Button_1.default, { variant: "contained", color: "primary", size: "small", sx: { ml: 1 }, onClick: handleCancel }, labelCancel || formTexts.cancel),
|
|
47
51
|
!isMobile && saveAndContinue && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
48
|
-
react_1.default.createElement(Button_1.default, { variant: "contained", name: _types_1.FormSaveActions.SAVE_AND_CREATE_NEW, type: "submit", color: "secondary", size: "small", sx: { ml: 1 }, disabled: formDisabled }, labelSaveAndCreateNew ||
|
|
49
|
-
react_1.default.createElement(Button_1.default, { variant: "contained", name: _types_1.FormSaveActions.SAVE_AND_CONTINUE, type: "submit", color: "secondary", size: "small", sx: { ml: 1 }, disabled: formDisabled }, labelSaveAndContinue ||
|
|
50
|
-
react_1.default.createElement(Button_1.default, { variant: "contained", name: _types_1.FormSaveActions.EXIT_ON_SAVE, type: "submit", color: "primary", size: "small", sx: { ml: 1 }, disabled: formDisabled }, labelSave ||
|
|
52
|
+
react_1.default.createElement(Button_1.default, { variant: "contained", name: _types_1.FormSaveActions.SAVE_AND_CREATE_NEW, type: "submit", color: "secondary", size: "small", sx: { ml: 1 }, disabled: formDisabled }, labelSaveAndCreateNew || formTexts.saveAndCreateNew),
|
|
53
|
+
react_1.default.createElement(Button_1.default, { variant: "contained", name: _types_1.FormSaveActions.SAVE_AND_CONTINUE, type: "submit", color: "secondary", size: "small", sx: { ml: 1 }, disabled: formDisabled }, labelSaveAndContinue || formTexts.saveAndContinue))),
|
|
54
|
+
react_1.default.createElement(Button_1.default, { variant: "contained", name: _types_1.FormSaveActions.EXIT_ON_SAVE, type: "submit", color: "primary", size: "small", sx: { ml: 1 }, disabled: formDisabled }, labelSave || formTexts.save)))));
|
|
51
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapGeometryPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/inputs/MapGeometryPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAIjD,OAAO,EAAE,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"MapGeometryPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/inputs/MapGeometryPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAIjD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAY,MAAM,sBAAsB,CAAC;AAGhE,OAAO,0BAA0B,CAAC;AAElC,OAAO,cAAc,CAAC;AACtB,OAAO,oCAAoC,CAAC;AAI5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAMpD,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAgQD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,QAAQ,EACR,KAAK,EACL,KAAK,EACL,QAAQ,EACR,KAAK,EACL,UAAU,EACV,EAAE,EACF,MAAY,GACb,EAAE,sBAAsB,qBAuDxB"}
|
|
@@ -41,13 +41,18 @@ const react_1 = __importStar(require("react"));
|
|
|
41
41
|
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
42
42
|
const TextField_1 = __importDefault(require("@mui/material/TextField"));
|
|
43
43
|
const FormHelperText_1 = __importDefault(require("@mui/material/FormHelperText"));
|
|
44
|
+
const styles_1 = require("@mui/material/styles");
|
|
44
45
|
const react_leaflet_1 = require("react-leaflet");
|
|
45
46
|
const leaflet_1 = __importDefault(require("leaflet"));
|
|
46
47
|
require("leaflet/dist/leaflet.css");
|
|
47
48
|
// leaflet-draw does not export; augments global L with Control.Draw.
|
|
48
49
|
require("leaflet-draw");
|
|
49
50
|
require("leaflet-draw/dist/leaflet.draw.css");
|
|
51
|
+
const leafletMarker_1 = require("./leafletMarker");
|
|
52
|
+
const texts_1 = require("../../../styles/texts");
|
|
50
53
|
const utils_1 = require("../../../utils");
|
|
54
|
+
// Markers need a servable icon; leaflet's stock icons 404 inside an SPA.
|
|
55
|
+
(0, leafletMarker_1.applyDefaultLeafletIcon)();
|
|
51
56
|
// Build the drf-react-by-schema geometry out of leaflet-draw features. Leaflet
|
|
52
57
|
// already parses/produces GeoJSON (L.geoJSON, FeatureGroup.toGeoJSON), so here
|
|
53
58
|
// we only reshape the resulting features into the right geometry type.
|
|
@@ -87,6 +92,70 @@ function layerCounts(featureGroup) {
|
|
|
87
92
|
});
|
|
88
93
|
return { markers, polygons };
|
|
89
94
|
}
|
|
95
|
+
// The geometry picker only enables marker + polygon draw plus edit/remove, so only
|
|
96
|
+
// those leaflet-draw strings are themeable here. Build the subset shown by the UI.
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
|
+
function leafletDrawLocalization(gt) {
|
|
99
|
+
return {
|
|
100
|
+
draw: {
|
|
101
|
+
toolbar: {
|
|
102
|
+
actions: { title: gt.cancelDrawing, text: gt.cancelDrawing },
|
|
103
|
+
finish: { title: gt.finishDrawing, text: gt.finishDrawing },
|
|
104
|
+
undo: { title: gt.undoPoint, text: gt.undoPoint },
|
|
105
|
+
buttons: { marker: gt.drawAMarker, polygon: gt.drawAPolygon },
|
|
106
|
+
},
|
|
107
|
+
handlers: {
|
|
108
|
+
marker: { tooltip: { start: gt.clickToPlaceMarker } },
|
|
109
|
+
polygon: {
|
|
110
|
+
tooltip: {
|
|
111
|
+
start: gt.clickToStartShape,
|
|
112
|
+
cont: gt.clickToContinueShape,
|
|
113
|
+
end: gt.clickToCloseShape,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
edit: {
|
|
119
|
+
toolbar: {
|
|
120
|
+
actions: {
|
|
121
|
+
save: { title: gt.saveChanges, text: gt.saveChanges },
|
|
122
|
+
cancel: { title: gt.cancelEdit, text: gt.cancelEdit },
|
|
123
|
+
clearAll: { title: gt.clearAll, text: gt.clearAll },
|
|
124
|
+
},
|
|
125
|
+
buttons: {
|
|
126
|
+
edit: gt.editLayers,
|
|
127
|
+
editDisabled: gt.editLayersDisabled,
|
|
128
|
+
remove: gt.deleteLayers,
|
|
129
|
+
removeDisabled: gt.deleteLayersDisabled,
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
handlers: {
|
|
133
|
+
edit: { tooltip: { text: gt.dragToEditFeatures, subtext: gt.clickCancelToUndo } },
|
|
134
|
+
remove: { tooltip: { text: gt.clickFeatureToRemove } },
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
// Deep-merge the themed subset over leaflet-draw's global (English) defaults so any
|
|
140
|
+
// string we don't theme keeps a sane value. leaflet-draw reads L.drawLocal at runtime.
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
142
|
+
function deepMerge(target, source) {
|
|
143
|
+
for (const key in source) {
|
|
144
|
+
const sv = source[key];
|
|
145
|
+
const tv = target === null || target === void 0 ? void 0 : target[key];
|
|
146
|
+
if (sv && typeof sv === 'object' && !Array.isArray(sv) && tv && typeof tv === 'object' && !Array.isArray(tv)) {
|
|
147
|
+
target[key] = deepMerge(tv, sv);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
target[key] = sv;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return target;
|
|
154
|
+
}
|
|
155
|
+
function applyLeafletDrawLocalization(gt) {
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
157
|
+
deepMerge(leaflet_1.default.drawLocal, leafletDrawLocalization(gt));
|
|
158
|
+
}
|
|
90
159
|
// Which draw tools each geometry allows.
|
|
91
160
|
const markerEnabledFor = (g) => g === 'point' || g === 'multipoint' || g === 'geometrycollection';
|
|
92
161
|
const polygonEnabledFor = (g) => g === 'polygon' || g === 'multipolygon' || g === 'geometrycollection';
|
|
@@ -98,6 +167,7 @@ const polygonEnabledFor = (g) => g === 'polygon' || g === 'multipolygon' || g ==
|
|
|
98
167
|
// geometrycollection -> many points AND many polygons
|
|
99
168
|
function DrawEditor({ geometry, value, onChange, }) {
|
|
100
169
|
const map = (0, react_leaflet_1.useMap)();
|
|
170
|
+
const texts = (0, texts_1.getThemeTexts)((0, styles_1.useTheme)());
|
|
101
171
|
const featureGroupRef = (0, react_1.useRef)(null);
|
|
102
172
|
const drawControlRef = (0, react_1.useRef)(null);
|
|
103
173
|
const lastEmittedRef = (0, react_1.useRef)('__init__');
|
|
@@ -160,6 +230,7 @@ function DrawEditor({ geometry, value, onChange, }) {
|
|
|
160
230
|
map.fitBounds(bounds, { padding: [40, 40] });
|
|
161
231
|
};
|
|
162
232
|
(0, react_1.useEffect)(() => {
|
|
233
|
+
applyLeafletDrawLocalization(texts.geometry);
|
|
163
234
|
const featureGroup = new leaflet_1.default.FeatureGroup().addTo(map);
|
|
164
235
|
featureGroupRef.current = featureGroup;
|
|
165
236
|
const g = geometryRef.current;
|
|
@@ -224,6 +295,8 @@ function DrawEditor({ geometry, value, onChange, }) {
|
|
|
224
295
|
return null;
|
|
225
296
|
}
|
|
226
297
|
function MapGeometryPicker({ geometry, value, label, onChange, error, helperText, sx, height = 340, }) {
|
|
298
|
+
const texts = (0, texts_1.getThemeTexts)((0, styles_1.useTheme)());
|
|
299
|
+
const geometryTexts = texts.geometry;
|
|
227
300
|
const valueText = value || '';
|
|
228
301
|
// Malformed detection: non-empty text that isn't GeoJSON (or of the wrong
|
|
229
302
|
// geometry type). Invalid input is flagged as an error instead of silently
|
|
@@ -238,12 +311,11 @@ function MapGeometryPicker({ geometry, value, label, onChange, error, helperText
|
|
|
238
311
|
border: (t) => `1px solid ${error ? t.palette.error.main : t.palette.divider}`,
|
|
239
312
|
zIndex: 1 /* keep leaflet controls above MUI overlays */,
|
|
240
313
|
} },
|
|
241
|
-
react_1.default.createElement(react_leaflet_1.MapContainer, { center: [-14.235, -51.9253], zoom: 4, style: { height: '100%', width: '100%' }, zoomControl:
|
|
314
|
+
react_1.default.createElement(react_leaflet_1.MapContainer, { center: [-14.235, -51.9253], zoom: 4, style: { height: '100%', width: '100%' }, zoomControl: false },
|
|
315
|
+
react_1.default.createElement(react_leaflet_1.ZoomControl, { zoomInTitle: geometryTexts.zoomIn, zoomOutTitle: geometryTexts.zoomOut }),
|
|
242
316
|
react_1.default.createElement(react_leaflet_1.TileLayer, { attribution: "\u00A9 OpenStreetMap contributors", url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" }),
|
|
243
317
|
react_1.default.createElement(DrawEditor, { geometry: geometry, value: value, onChange: onChange }))),
|
|
244
|
-
react_1.default.createElement(TextField_1.default, { value: value, onChange: (e) => onChange(e.target.value || null), variant: "outlined", margin: "dense", fullWidth: true, size: "small", label: geometry === 'point' ?
|
|
245
|
-
? 'Dados malformados, corrija o GeoJSON para refletir no mapa.'
|
|
246
|
-
: 'O GeoJSON abaixo é sincronizado com o mapa.' }),
|
|
318
|
+
react_1.default.createElement(TextField_1.default, { value: value, onChange: (e) => onChange(e.target.value || null), variant: "outlined", margin: "dense", fullWidth: true, size: "small", label: geometry === 'point' ? geometryTexts.labelPoint : geometryTexts.labelOther, multiline: geometry !== 'point', minRows: geometry !== 'point' ? 3 : 1, sx: { mt: 1 }, error: malformed, helperText: malformed ? geometryTexts.malformed : geometryTexts.synced }),
|
|
247
319
|
label && react_1.default.createElement(FormHelperText_1.default, { sx: { mt: 0.5 } }, label),
|
|
248
320
|
(helperText || error) && (react_1.default.createElement(FormHelperText_1.default, { error: error, sx: { mt: 0.5 } }, helperText))));
|
|
249
321
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import L from 'leaflet';
|
|
2
|
+
export declare const DEFAULT_MARKER_PIN_SVG: string;
|
|
3
|
+
export declare const DEFAULT_MARKER_SHADOW_SVG: string;
|
|
4
|
+
export declare const DEFAULT_MARKER_ICON_URL: string;
|
|
5
|
+
export declare const DEFAULT_MARKER_SHADOW_URL: string;
|
|
6
|
+
/**
|
|
7
|
+
* Point L.Icon.Default at a servable marker so geometry widgets render points.
|
|
8
|
+
* No args: apply the built-in SVG icon once; skip if any icon is already set.
|
|
9
|
+
* With `userOptions`: always merge (custom marker wins).
|
|
10
|
+
*/
|
|
11
|
+
export declare function applyDefaultLeafletIcon(userOptions?: Partial<L.IconOptions>): void;
|
|
12
|
+
//# sourceMappingURL=leafletMarker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leafletMarker.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/inputs/leafletMarker.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,SAAS,CAAC;AAKxB,eAAO,MAAM,sBAAsB,QAIzB,CAAC;AAEX,eAAO,MAAM,yBAAyB,QAG5B,CAAC;AAIX,eAAO,MAAM,uBAAuB,QAAoC,CAAC;AACzE,eAAO,MAAM,yBAAyB,QAAuC,CAAC;AAgB9E;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,IAAI,CAalF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DEFAULT_MARKER_SHADOW_URL = exports.DEFAULT_MARKER_ICON_URL = exports.DEFAULT_MARKER_SHADOW_SVG = exports.DEFAULT_MARKER_PIN_SVG = void 0;
|
|
7
|
+
exports.applyDefaultLeafletIcon = applyDefaultLeafletIcon;
|
|
8
|
+
const leaflet_1 = __importDefault(require("leaflet"));
|
|
9
|
+
// Leaflet's stock icons are page-relative PNGs that 404 inside an SPA. Use an
|
|
10
|
+
// inline-SVG data-URI default so markers render under any bundler with no assets.
|
|
11
|
+
exports.DEFAULT_MARKER_PIN_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="25" height="41" viewBox="0 0 25 41">' +
|
|
12
|
+
'<path d="M12.5 0C6.7 0 2.1 4.2 2.1 9.4c0 7.7 10.4 31.6 10.4 31.6S22.9 17.1 22.9 9.4C22.9 4.2 18.3 0 12.5 0z" fill="#3388ff" stroke="#ffffff" stroke-width="1.5" stroke-linejoin="round"/>' +
|
|
13
|
+
'<circle cx="12.5" cy="9" r="6.2" fill="#ffffff"/>' +
|
|
14
|
+
'</svg>';
|
|
15
|
+
exports.DEFAULT_MARKER_SHADOW_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="41" height="41" viewBox="0 0 41 41">' +
|
|
16
|
+
'<path d="M20.5 38c-5.4 0-9.7-1-9.9-2.2-.2-1.2 4.1-2.1 9.6-2.1 5.6 0 10.2 1 10 2.2-.2 1.2-4.3 2.1-9.7 2.1z" fill="rgba(0,0,0,0.4)"/>' +
|
|
17
|
+
'</svg>';
|
|
18
|
+
const toDataUri = (svg) => `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
|
|
19
|
+
exports.DEFAULT_MARKER_ICON_URL = toDataUri(exports.DEFAULT_MARKER_PIN_SVG);
|
|
20
|
+
exports.DEFAULT_MARKER_SHADOW_URL = toDataUri(exports.DEFAULT_MARKER_SHADOW_SVG);
|
|
21
|
+
let applied = false;
|
|
22
|
+
const DEFAULT_ICON_OPTIONS = {
|
|
23
|
+
iconUrl: exports.DEFAULT_MARKER_ICON_URL,
|
|
24
|
+
iconRetinaUrl: exports.DEFAULT_MARKER_ICON_URL, // SVG scales; stays crisp on retina
|
|
25
|
+
shadowUrl: exports.DEFAULT_MARKER_SHADOW_URL,
|
|
26
|
+
iconSize: leaflet_1.default.point(25, 41),
|
|
27
|
+
iconAnchor: leaflet_1.default.point(12, 41),
|
|
28
|
+
popupAnchor: leaflet_1.default.point(1, -34),
|
|
29
|
+
tooltipAnchor: leaflet_1.default.point(16, -28),
|
|
30
|
+
shadowSize: leaflet_1.default.point(41, 41),
|
|
31
|
+
shadowAnchor: leaflet_1.default.point(12, 41),
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Point L.Icon.Default at a servable marker so geometry widgets render points.
|
|
35
|
+
* No args: apply the built-in SVG icon once; skip if any icon is already set.
|
|
36
|
+
* With `userOptions`: always merge (custom marker wins).
|
|
37
|
+
*/
|
|
38
|
+
function applyDefaultLeafletIcon(userOptions) {
|
|
39
|
+
if (userOptions) {
|
|
40
|
+
leaflet_1.default.Icon.Default.mergeOptions(userOptions); // explicit custom icon wins
|
|
41
|
+
applied = true;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (applied)
|
|
45
|
+
return;
|
|
46
|
+
if (leaflet_1.default.Icon.Default.prototype.options.iconUrl) {
|
|
47
|
+
applied = true; // consumer already picked their own icon; keep it
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
leaflet_1.default.Icon.Default.mergeOptions(DEFAULT_ICON_OPTIONS);
|
|
51
|
+
applied = true;
|
|
52
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,9 @@ import DesktopDateTimePickerBySchema from './components/forms/inputs/DesktopDate
|
|
|
25
25
|
import EditableAutocompleteFieldBySchema from './components/forms/inputs/EditableAutocompleteFieldBySchema';
|
|
26
26
|
import AutocompleteFieldBySchema from './components/forms/inputs/AutocompleteFieldBySchema';
|
|
27
27
|
import FloatFieldBySchema from './components/forms/inputs/FloatFieldBySchema';
|
|
28
|
+
export { applyDefaultLeafletIcon } from './components/forms/inputs/leafletMarker';
|
|
29
|
+
export { getThemeTexts } from './styles/texts';
|
|
30
|
+
export type { DRFReactBySchemaTexts, GeometryTexts, FormTexts } from './styles/texts';
|
|
28
31
|
import DetailBySchema from './components/details/DetailBySchema';
|
|
29
32
|
import DetailFieldBySchema from './components/details/DetailFieldBySchema';
|
|
30
33
|
export { DRFReactBySchemaProvider, useAPIWrapper, Form, DialogFormBySchema, DataGridBySchemaEditable, GenericModelList, GenericRelatedModelList, DataTotals, DialogActions, FileTypeIcon, SelectEditInputCell, GridDateInput, GridDecimalInput, GridPatternInput, BooleanInputCell, FormWatcher, FormBySchema, FieldBySchema, TextFieldBySchema, BooleanFieldBySchema, DesktopDatePickerBySchema, DesktopDateTimePickerBySchema, EditableAutocompleteFieldBySchema, AutocompleteFieldBySchema, FloatFieldBySchema, DetailBySchema, DetailFieldBySchema, setAuthToken, emptyByType, getChoiceByValue, populateValues, buildGenericYupValidationSchema, errorProps, getFieldErrorsFromResponse, getTmpId, isTmpId, getPatternFormat, clearJWT, hasJWT, slugToCamelCase, AUTH_EXPIRED_EVENT, };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3E,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,+BAA+B,EAC/B,UAAU,EACV,0BAA0B,EAC1B,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,eAAe,EAChB,MAAM,SAAS,CAAC;AAGjB,OAAO,wBAAwB,MAAM,oCAAoC,CAAC;AAG1E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D,OAAO,IAAI,MAAM,yBAAyB,CAAC;AAC3C,OAAO,kBAAkB,MAAM,uCAAuC,CAAC;AAGvE,OAAO,wBAAwB,MAAM,uCAAuC,CAAC;AAC7E,OAAO,gBAAgB,MAAM,+BAA+B,CAAC;AAC7D,OAAO,uBAAuB,MAAM,sCAAsC,CAAC;AAC3E,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,YAAY,MAAM,2BAA2B,CAAC;AAGrD,OAAO,mBAAmB,MAAM,2DAA2D,CAAC;AAC5F,OAAO,aA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yBAAyB,EACzB,6BAA6B,EAC7B,iCAAiC,EACjC,yBAAyB,EACzB,kBAAkB,EAGlB,cAAc,EACd,mBAAmB,EAGnB,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,+BAA+B,EAC/B,UAAU,EACV,0BAA0B,EAC1B,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,kBAAkB,GACnB,CAAC;AAEF,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.AUTH_EXPIRED_EVENT = exports.slugToCamelCase = exports.hasJWT = exports.clearJWT = exports.getPatternFormat = exports.isTmpId = exports.getTmpId = exports.getFieldErrorsFromResponse = exports.errorProps = exports.buildGenericYupValidationSchema = exports.populateValues = exports.getChoiceByValue = exports.emptyByType = exports.setAuthToken = exports.DetailFieldBySchema = exports.DetailBySchema = exports.FloatFieldBySchema = exports.AutocompleteFieldBySchema = exports.EditableAutocompleteFieldBySchema = exports.DesktopDateTimePickerBySchema = exports.DesktopDatePickerBySchema = exports.BooleanFieldBySchema = exports.TextFieldBySchema = exports.FieldBySchema = exports.FormBySchema = exports.FormWatcher = exports.BooleanInputCell = exports.GridPatternInput = exports.GridDecimalInput = exports.GridDateInput = exports.SelectEditInputCell = exports.FileTypeIcon = exports.DialogActions = exports.DataTotals = exports.GenericRelatedModelList = exports.GenericModelList = exports.DataGridBySchemaEditable = exports.DialogFormBySchema = exports.Form = exports.useAPIWrapper = exports.DRFReactBySchemaProvider = void 0;
|
|
20
|
+
exports.AUTH_EXPIRED_EVENT = exports.slugToCamelCase = exports.hasJWT = exports.clearJWT = exports.getPatternFormat = exports.isTmpId = exports.getTmpId = exports.getFieldErrorsFromResponse = exports.errorProps = exports.buildGenericYupValidationSchema = exports.populateValues = exports.getChoiceByValue = exports.emptyByType = exports.setAuthToken = exports.DetailFieldBySchema = exports.DetailBySchema = exports.FloatFieldBySchema = exports.AutocompleteFieldBySchema = exports.EditableAutocompleteFieldBySchema = exports.DesktopDateTimePickerBySchema = exports.DesktopDatePickerBySchema = exports.BooleanFieldBySchema = exports.TextFieldBySchema = exports.FieldBySchema = exports.FormBySchema = exports.FormWatcher = exports.BooleanInputCell = exports.GridPatternInput = exports.GridDecimalInput = exports.GridDateInput = exports.SelectEditInputCell = exports.FileTypeIcon = exports.DialogActions = exports.DataTotals = exports.GenericRelatedModelList = exports.GenericModelList = exports.DataGridBySchemaEditable = exports.DialogFormBySchema = exports.Form = exports.useAPIWrapper = exports.DRFReactBySchemaProvider = exports.getThemeTexts = exports.applyDefaultLeafletIcon = void 0;
|
|
21
21
|
// Methods:
|
|
22
22
|
const api_1 = require("./api");
|
|
23
23
|
Object.defineProperty(exports, "setAuthToken", { enumerable: true, get: function () { return api_1.setAuthToken; } });
|
|
@@ -91,6 +91,10 @@ const AutocompleteFieldBySchema_1 = __importDefault(require("./components/forms/
|
|
|
91
91
|
exports.AutocompleteFieldBySchema = AutocompleteFieldBySchema_1.default;
|
|
92
92
|
const FloatFieldBySchema_1 = __importDefault(require("./components/forms/inputs/FloatFieldBySchema"));
|
|
93
93
|
exports.FloatFieldBySchema = FloatFieldBySchema_1.default;
|
|
94
|
+
var leafletMarker_1 = require("./components/forms/inputs/leafletMarker");
|
|
95
|
+
Object.defineProperty(exports, "applyDefaultLeafletIcon", { enumerable: true, get: function () { return leafletMarker_1.applyDefaultLeafletIcon; } });
|
|
96
|
+
var texts_1 = require("./styles/texts");
|
|
97
|
+
Object.defineProperty(exports, "getThemeTexts", { enumerable: true, get: function () { return texts_1.getThemeTexts; } });
|
|
94
98
|
// DetailComponents
|
|
95
99
|
const DetailBySchema_1 = __importDefault(require("./components/details/DetailBySchema"));
|
|
96
100
|
exports.DetailBySchema = DetailBySchema_1.default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Theme } from '@mui/material/styles';
|
|
2
|
+
export interface GeometryTexts {
|
|
3
|
+
labelPoint: string;
|
|
4
|
+
labelOther: string;
|
|
5
|
+
malformed: string;
|
|
6
|
+
synced: string;
|
|
7
|
+
edit: string;
|
|
8
|
+
define: string;
|
|
9
|
+
drawSelectTitle: string;
|
|
10
|
+
close: string;
|
|
11
|
+
drawAMarker: string;
|
|
12
|
+
drawAPolygon: string;
|
|
13
|
+
cancelDrawing: string;
|
|
14
|
+
finishDrawing: string;
|
|
15
|
+
undoPoint: string;
|
|
16
|
+
editLayers: string;
|
|
17
|
+
editLayersDisabled: string;
|
|
18
|
+
deleteLayers: string;
|
|
19
|
+
deleteLayersDisabled: string;
|
|
20
|
+
saveChanges: string;
|
|
21
|
+
cancelEdit: string;
|
|
22
|
+
clearAll: string;
|
|
23
|
+
clickToPlaceMarker: string;
|
|
24
|
+
clickToStartShape: string;
|
|
25
|
+
clickToContinueShape: string;
|
|
26
|
+
clickToCloseShape: string;
|
|
27
|
+
dragToEditFeatures: string;
|
|
28
|
+
clickCancelToUndo: string;
|
|
29
|
+
clickFeatureToRemove: string;
|
|
30
|
+
zoomIn: string;
|
|
31
|
+
zoomOut: string;
|
|
32
|
+
}
|
|
33
|
+
export interface FormTexts {
|
|
34
|
+
save: string;
|
|
35
|
+
saveAndContinue: string;
|
|
36
|
+
saveAndCreateNew: string;
|
|
37
|
+
cancel: string;
|
|
38
|
+
remove: string;
|
|
39
|
+
dialogCancel: string;
|
|
40
|
+
dialogSave: string;
|
|
41
|
+
}
|
|
42
|
+
export interface DRFReactBySchemaTexts {
|
|
43
|
+
geometry: GeometryTexts;
|
|
44
|
+
forms: FormTexts;
|
|
45
|
+
}
|
|
46
|
+
export declare const DEFAULT_TEXTS: DRFReactBySchemaTexts;
|
|
47
|
+
export declare function getThemeTexts(theme: Theme): DRFReactBySchemaTexts;
|
|
48
|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IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,EAAE,SAAS,CAAC;CAClB;AAGD,eAAO,MAAM,aAAa,EAAE,qBAyC3B,CAAC;AAGF,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,qBAAqB,CAMjE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_TEXTS = void 0;
|
|
4
|
+
exports.getThemeTexts = getThemeTexts;
|
|
5
|
+
// Default widget strings (en). Apps override any namespace via their MUI theme.
|
|
6
|
+
exports.DEFAULT_TEXTS = {
|
|
7
|
+
geometry: {
|
|
8
|
+
labelPoint: 'Coordinates (GeoJSON)',
|
|
9
|
+
labelOther: 'GeoJSON (paste here)',
|
|
10
|
+
malformed: 'Malformed data, fix the GeoJSON to reflect on the map.',
|
|
11
|
+
synced: 'The GeoJSON below is synchronized with the map.',
|
|
12
|
+
edit: 'Edit geometry',
|
|
13
|
+
define: 'Define geometry',
|
|
14
|
+
drawSelectTitle: 'Draw / select geometry',
|
|
15
|
+
close: 'Close',
|
|
16
|
+
drawAMarker: 'Draw a marker',
|
|
17
|
+
drawAPolygon: 'Draw a polygon',
|
|
18
|
+
cancelDrawing: 'Cancel',
|
|
19
|
+
finishDrawing: 'Finish',
|
|
20
|
+
undoPoint: 'Delete last point',
|
|
21
|
+
editLayers: 'Edit layers',
|
|
22
|
+
editLayersDisabled: 'No layers to edit',
|
|
23
|
+
deleteLayers: 'Delete layers',
|
|
24
|
+
deleteLayersDisabled: 'No layers to delete',
|
|
25
|
+
saveChanges: 'Save',
|
|
26
|
+
cancelEdit: 'Cancel',
|
|
27
|
+
clearAll: 'Clear All',
|
|
28
|
+
clickToPlaceMarker: 'Click map to place marker.',
|
|
29
|
+
clickToStartShape: 'Click to start drawing shape.',
|
|
30
|
+
clickToContinueShape: 'Click to continue drawing shape.',
|
|
31
|
+
clickToCloseShape: 'Click first point to close this shape.',
|
|
32
|
+
dragToEditFeatures: 'Drag handles or markers to edit features.',
|
|
33
|
+
clickCancelToUndo: 'Click cancel to undo changes.',
|
|
34
|
+
clickFeatureToRemove: 'Click on a feature to remove.',
|
|
35
|
+
zoomIn: 'Zoom in',
|
|
36
|
+
zoomOut: 'Zoom out',
|
|
37
|
+
},
|
|
38
|
+
forms: {
|
|
39
|
+
save: 'Save',
|
|
40
|
+
saveAndContinue: 'Save and Continue',
|
|
41
|
+
saveAndCreateNew: 'Save and Create New',
|
|
42
|
+
cancel: 'Cancel',
|
|
43
|
+
remove: 'Remove',
|
|
44
|
+
dialogCancel: 'Cancel',
|
|
45
|
+
dialogSave: 'Save',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
// Merge theme.texts over the defaults; theme.texts is absent under a bare ThemeProvider.
|
|
49
|
+
function getThemeTexts(theme) {
|
|
50
|
+
const custom = theme.texts;
|
|
51
|
+
return {
|
|
52
|
+
geometry: Object.assign(Object.assign({}, exports.DEFAULT_TEXTS.geometry), ((custom === null || custom === void 0 ? void 0 : custom.geometry) || {})),
|
|
53
|
+
forms: Object.assign(Object.assign({}, exports.DEFAULT_TEXTS.forms), ((custom === null || custom === void 0 ? void 0 : custom.forms) || {})),
|
|
54
|
+
};
|
|
55
|
+
}
|
package/dist/styles/theme.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DRFReactBySchemaTexts } from './texts';
|
|
1
2
|
declare module '@mui/material/styles' {
|
|
2
3
|
interface Palette {
|
|
3
4
|
avatars: string[];
|
|
@@ -13,6 +14,12 @@ declare module '@mui/material/styles' {
|
|
|
13
14
|
tableColumnHeader: Palette['primary'];
|
|
14
15
|
formCard: Palette['primary'];
|
|
15
16
|
}
|
|
17
|
+
interface Theme {
|
|
18
|
+
texts: DRFReactBySchemaTexts;
|
|
19
|
+
}
|
|
20
|
+
interface ThemeOptions {
|
|
21
|
+
texts?: Partial<DRFReactBySchemaTexts>;
|
|
22
|
+
}
|
|
16
23
|
interface PaletteColor {
|
|
17
24
|
semaphoric?: string;
|
|
18
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/styles/theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/styles/theme.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAiB,MAAM,SAAS,CAAC;AAE/D,OAAO,QAAQ,sBAAsB,CAAC;IAMpC,UAAU,OAAO;QACf,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,YAAY,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACjC,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QAC7B,cAAc,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACnC,eAAe,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACpC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QAC5B,YAAY,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACjC,aAAa,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QAClC,YAAY,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACjC,iBAAiB,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACtC,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;KAC9B;IAED,UAAU,KAAK;QACb,KAAK,EAAE,qBAAqB,CAAC;KAC9B;IACD,UAAU,YAAY;QACpB,KAAK,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;KACxC;IAKD,UAAU,YAAY;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;CASF;AA4GD,QAAA,MAAM,YAAY,sCA2HjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/dist/styles/theme.js
CHANGED
|
@@ -4,6 +4,7 @@ const styles_1 = require("@mui/material/styles");
|
|
|
4
4
|
const locale_1 = require("@mui/material/locale");
|
|
5
5
|
const locales_1 = require("@mui/x-data-grid/locales");
|
|
6
6
|
const locales_2 = require("@mui/x-date-pickers/locales");
|
|
7
|
+
const texts_1 = require("./texts");
|
|
7
8
|
locales_1.ptBR.components.MuiDataGrid.defaultProps.localeText = Object.assign(Object.assign({}, locales_1.ptBR.components.MuiDataGrid.defaultProps.localeText), { toolbarQuickFilterPlaceholder: 'Buscar...', toolbarQuickFilterLabel: 'Buscar', toolbarQuickFilterDeleteIconLabel: 'Limpar busca' });
|
|
8
9
|
const palette = {
|
|
9
10
|
avatars: [
|
|
@@ -105,6 +106,7 @@ const palette = {
|
|
|
105
106
|
};
|
|
106
107
|
const defaultTheme = (0, styles_1.createTheme)({
|
|
107
108
|
palette,
|
|
109
|
+
texts: texts_1.DEFAULT_TEXTS,
|
|
108
110
|
components: {
|
|
109
111
|
MuiButton: {
|
|
110
112
|
styleOverrides: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EACL,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,KAAK,EAEL,eAAe,EACf,YAAY,EAEZ,iBAAiB,EACjB,0BAA0B,EAC1B,IAAI,EACJ,UAAU,EACV,MAAM,EACP,MAAM,WAAW,CAAC;AAEnB,eAAO,MAAM,WAAW,EA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AK,EAAE,MAAM,UAgB3C;AAED,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,eAAe,EAAE,YAwBxE;AAED,wBAAgB,eAAe,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,OAAO,WAetE;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,OAsB3D;AAED,wBAAgB,+BAA+B,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI,EACrE,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,wBAgC9B;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,GAAG,eAAe,EAC/B,kBAAkB,CAAC,EAAE,kBAAkB,EAAE,EACzC,MAAM,CAAC,EAAE,YAAY,EAAE,WA+BxB;AAED,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI,EACpE,KAAK,EAAE,MAAM,GAAG,eAAe,EAC/B,kBAAkB,CAAC,EAAE,kBAAkB,EAAE,EACzC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,WAwBjB;AAOD;;;;GAIG;AAEH,wBAAgB,eAAe,IAAI,GAAG,CAerC;AAED,2EAA2E;AAC3E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAQjE;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAC1B,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,YAAY,GACrB,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,EAAE,GAAG,IAAI,CAaxD"}
|
package/dist/utils/utils.js
CHANGED
|
@@ -266,7 +266,8 @@ function buildGenericYupValidationSchema({ data, schema, many = false, skipField
|
|
|
266
266
|
// For required many-fields the selected items live in an array, and yup's
|
|
267
267
|
// `.required()` still allows `[]`; enforce at least one selection instead.
|
|
268
268
|
if (fieldSchema.type === 'field' && ((_b = fieldSchema.child) === null || _b === void 0 ? void 0 : _b.children)) {
|
|
269
|
-
yupValidator[field] =
|
|
269
|
+
yupValidator[field] = // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
270
|
+
yupValidator[field].min(1, 'Este campo é obrigatório');
|
|
270
271
|
}
|
|
271
272
|
}
|
|
272
273
|
if (fieldSchema.max_length && fieldSchema.type === 'string') {
|
package/package.json
CHANGED