react-admin-base-bootstrap 0.8.21 → 0.8.23

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/bun.lockb CHANGED
Binary file
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  };
21
21
  import React, { useCallback, useContext, useRef, useState } from 'react';
22
22
  import { ValidatorProvider } from "react-admin-base";
23
- import { FormattedMessage } from 'react-intl';
23
+ import { FormattedMessage, useIntl } from 'react-intl';
24
24
  import { Navigate, Routes, useParams, Route } from 'react-router-dom';
25
25
  import { Alert, Button, Col, Form, ModalFooter, ModalHeader, Row } from "reactstrap";
26
26
  import LoadingButton from '../Components/LoadingButton';
@@ -60,11 +60,27 @@ export function ModalEntityEditor({ entity, title, size, url, onReload, disabled
60
60
  }
61
61
  });
62
62
  }, [save, saved, error, onReload, url]);
63
+ const check = bsOptions.noCloseOnSave && dirty;
64
+ const intl = useIntl();
65
+ const checkConfirmText = intl.formatMessage({ id: 'CANCEL_ENTITY_SAVE' });
66
+ const onClose = useCallback(function () {
67
+ if (check) {
68
+ const ok = confirm(checkConfirmText);
69
+ if (!ok)
70
+ return;
71
+ }
72
+ if (url) {
73
+ setOpen(false);
74
+ }
75
+ else {
76
+ onReload(null);
77
+ }
78
+ }, [setOpen, onReload, url, check, checkConfirmText]);
63
79
  return React.createElement(React.Fragment, null,
64
80
  ((!bsOptions.noCloseOnSave && saved) || !open) && url && React.createElement(Navigate, { to: url, replace: true }),
65
81
  bsOptions.noCloseOnSave && saved && open && url && React.createElement(Navigate, { to: url + "/" + data.id + "/edit", replace: true }),
66
- React.createElement(BootstrapModal, { isOpen: true, size: size, toggle: () => url ? setOpen(false) : onReload(null), fade: false },
67
- title && React.createElement(ModalHeader, { toggle: () => url ? setOpen(false) : onReload(null) },
82
+ React.createElement(BootstrapModal, { isOpen: true, size: size, toggle: onClose, fade: false },
83
+ title && React.createElement(ModalHeader, { toggle: onClose },
68
84
  React.createElement("b", null, title)),
69
85
  React.createElement(ValidatorProvider, null,
70
86
  React.createElement(Form, { onSubmit: onSubmit, disabled: !!loading || disabled },
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
- export default function ExcelExportButton({ name, header, params, size, map, extra }: {
2
+ export default function ExcelExportButton({ name, header, params, size, transform, map, extra }: {
3
3
  name: any;
4
4
  header: any;
5
5
  params: any;
6
6
  size: any;
7
+ transform: any;
7
8
  map: any;
8
9
  extra: any;
9
10
  }): React.JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { useExporter } from 'react-admin-base';
3
3
  import { Button, Col } from "reactstrap";
4
- export default function ExcelExportButton({ name, header, params, size, map, extra }) {
5
- const [handleExport, loading] = useExporter(header, params, map, extra);
4
+ export default function ExcelExportButton({ name, header, params, size, transform, map, extra }) {
5
+ const [handleExport, loading] = useExporter(header, params, map, extra, transform);
6
6
  return React.createElement(Col, null,
7
7
  React.createElement(Button, { className: "w-100 d-block", type: "button", size: size, color: "success", outline: true, disabled: !!loading, onClick: () => handleExport(name) }, loading ? React.createElement("i", { className: "fas fa-spin fa-spinner" }) : React.createElement("i", { className: "fas fa-file-excel" })));
8
8
  }
@@ -38,5 +38,6 @@
38
38
  "ACTIONS.DELETE.CONFIRM": "Ja, löschen!",
39
39
  "PLEASE_WAIT": "Warten Sie mal.",
40
40
  "AUTHORIZATION_CODE": "Zugangscode",
41
- "RECORDS": "{count, plural, =0 {kein eintrag} one {# datensatz} other {# datensätze}}"
41
+ "RECORDS": "{count, plural, =0 {kein eintrag} one {# datensatz} other {# datensätze}}",
42
+ "CANCEL_ENTITY_SAVE": "Es sind noch nicht gespeicherte Änderungen vorhanden. Möchten Sie den Vorgang wirklich abbrechen?"
42
43
  }
@@ -40,5 +40,6 @@
40
40
  "ACTIONS.DELETE.CONFIRM": "Yes, delete it!",
41
41
  "PLEASE_WAIT": "Please wait.",
42
42
  "AUTHORIZATION_CODE": "Authorization Code",
43
- "RECORDS": "{count, plural, =0 {no records} one {# record} other {# records}}"
43
+ "RECORDS": "{count, plural, =0 {no records} one {# record} other {# records}}",
44
+ "CANCEL_ENTITY_SAVE": "There are unsaved changes, are you sure to cancel?"
44
45
  }
@@ -39,5 +39,6 @@
39
39
  "ACTIONS.DELETE.CONFIRM": "Evet, sil!",
40
40
  "PLEASE_WAIT": "Lütfen bekleyiniz.",
41
41
  "AUTHORIZATION_CODE": "Yetki Kodu",
42
- "RECORDS": "{count, plural, =0 {Kayıt yok} one {# kayıt} other {# kayıt}}"
42
+ "RECORDS": "{count, plural, =0 {Kayıt yok} one {# kayıt} other {# kayıt}}",
43
+ "CANCEL_ENTITY_SAVE": "Kaydedilmemiş değişiklikler var, iptal etmek istediğinizden emin misiniz?"
43
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-admin-base-bootstrap",
3
- "version": "0.8.21",
3
+ "version": "0.8.23",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -38,7 +38,7 @@
38
38
  "modal-cropper": "^1.2.3",
39
39
  "nprogress": "^0.2.0",
40
40
  "prettysize": "^2.0.0",
41
- "react-admin-base": "^0.8.10",
41
+ "react-admin-base": "^0.8.12",
42
42
  "react-dnd": "^16.0.1",
43
43
  "react-dnd-html5-backend": "^16.0.1",
44
44
  "react-password-strength-bar": "^0.4.1",
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useContext, useRef, useState } from 'react';
2
2
  import { ValidatorProvider } from "react-admin-base";
3
- import { FormattedMessage } from 'react-intl';
3
+ import { FormattedMessage, useIntl } from 'react-intl';
4
4
  import { Navigate, Routes, useParams, Route } from 'react-router-dom';
5
5
  import { Alert, Button, Col, Form, Modal, ModalFooter, ModalHeader, Row } from "reactstrap";
6
6
  import LoadingButton from '../Components/LoadingButton';
@@ -58,11 +58,28 @@ export function ModalEntityEditor({ entity, title, size, url, onReload, disabled
58
58
  }
59
59
  }, [save, saved, error, onReload, url]);
60
60
 
61
+ const check = bsOptions.noCloseOnSave && dirty;
62
+ const intl = useIntl();
63
+ const checkConfirmText = intl.formatMessage({ id: 'CANCEL_ENTITY_SAVE' });
64
+ const onClose = useCallback(function() {
65
+ if (check) {
66
+ const ok = confirm(checkConfirmText);
67
+ if (!ok)
68
+ return ;
69
+ }
70
+
71
+ if (url) {
72
+ setOpen(false);
73
+ } else {
74
+ onReload(null);
75
+ }
76
+ }, [ setOpen, onReload, url, check, checkConfirmText ]);
77
+
61
78
  return <>
62
79
  { ((!bsOptions.noCloseOnSave && saved) || !open) && url && <Navigate to={url} replace />}
63
80
  { bsOptions.noCloseOnSave && saved && open && url && <Navigate to={url + "/" + data.id + "/edit"} replace />}
64
- <BootstrapModal isOpen size={size} toggle={() => url ? setOpen(false) : onReload(null)} fade={false}>
65
- { title && <ModalHeader toggle={() => url ? setOpen(false) : onReload(null)}>
81
+ <BootstrapModal isOpen size={size} toggle={onClose} fade={false}>
82
+ { title && <ModalHeader toggle={onClose}>
66
83
  <b>{ title }</b>
67
84
  </ModalHeader> }
68
85
  <ValidatorProvider>
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import {useExporter} from 'react-admin-base';
3
3
  import {Button, Col} from "reactstrap";
4
4
 
5
- export default function ExcelExportButton({name, header, params, size, map, extra}) {
6
- const [ handleExport, loading ] = useExporter(header, params, map, extra);
5
+ export default function ExcelExportButton({name, header, params, size, transform, map, extra}) {
6
+ const [ handleExport, loading ] = useExporter(header, params, map, extra, transform);
7
7
 
8
8
  return <Col>
9
9
  <Button className="w-100 d-block" type="button" size={size} color="success" outline disabled={!!loading} onClick={() => handleExport(name)}>
package/src/i18n/de.json CHANGED
@@ -38,5 +38,6 @@
38
38
  "ACTIONS.DELETE.CONFIRM": "Ja, löschen!",
39
39
  "PLEASE_WAIT": "Warten Sie mal.",
40
40
  "AUTHORIZATION_CODE": "Zugangscode",
41
- "RECORDS": "{count, plural, =0 {kein eintrag} one {# datensatz} other {# datensätze}}"
41
+ "RECORDS": "{count, plural, =0 {kein eintrag} one {# datensatz} other {# datensätze}}",
42
+ "CANCEL_ENTITY_SAVE": "Es sind noch nicht gespeicherte Änderungen vorhanden. Möchten Sie den Vorgang wirklich abbrechen?"
42
43
  }
package/src/i18n/en.json CHANGED
@@ -40,5 +40,6 @@
40
40
  "ACTIONS.DELETE.CONFIRM": "Yes, delete it!",
41
41
  "PLEASE_WAIT": "Please wait.",
42
42
  "AUTHORIZATION_CODE": "Authorization Code",
43
- "RECORDS": "{count, plural, =0 {no records} one {# record} other {# records}}"
43
+ "RECORDS": "{count, plural, =0 {no records} one {# record} other {# records}}",
44
+ "CANCEL_ENTITY_SAVE": "There are unsaved changes, are you sure to cancel?"
44
45
  }
package/src/i18n/tr.json CHANGED
@@ -39,5 +39,6 @@
39
39
  "ACTIONS.DELETE.CONFIRM": "Evet, sil!",
40
40
  "PLEASE_WAIT": "Lütfen bekleyiniz.",
41
41
  "AUTHORIZATION_CODE": "Yetki Kodu",
42
- "RECORDS": "{count, plural, =0 {Kayıt yok} one {# kayıt} other {# kayıt}}"
42
+ "RECORDS": "{count, plural, =0 {Kayıt yok} one {# kayıt} other {# kayıt}}",
43
+ "CANCEL_ENTITY_SAVE": "Kaydedilmemiş değişiklikler var, iptal etmek istediğinizden emin misiniz?"
43
44
  }