react-admin-base-bootstrap 0.8.14 → 0.8.16
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/lib/esm/Components/BootstrapDataTable.d.ts +7 -7
- package/lib/esm/Components/BootstrapDataTable.js +7 -4
- package/lib/esm/Components/BootstrapModal.d.ts +2 -1
- package/lib/esm/Components/BootstrapOptions.d.ts +4 -2
- package/lib/esm/Components/BootstrapOptions.js +5 -3
- package/lib/esm/Components/BootstrapPagination.d.ts +2 -1
- package/lib/esm/Components/CRUD.d.ts +3 -3
- package/lib/esm/Components/CRUD.js +9 -3
- package/lib/esm/Components/CheckBox.d.ts +1 -1
- package/lib/esm/Components/DefaultValidatorOptions.d.ts +1 -1
- package/lib/esm/Components/DragAndDropArrow.d.ts +2 -1
- package/lib/esm/Components/EntityEditor.d.ts +1 -1
- package/lib/esm/Components/ErrorBoundary.d.ts +1 -1
- package/lib/esm/Components/ExcelExportButton.d.ts +2 -1
- package/lib/esm/Components/ExternalLoginButton.d.ts +2 -1
- package/lib/esm/Components/FilePickerCore.d.ts +2 -2
- package/lib/esm/Components/GoToTop.d.ts +1 -1
- package/lib/esm/Components/ImagePicker.d.ts +2 -1
- package/lib/esm/Components/LanguageProvider.d.ts +2 -2
- package/lib/esm/Components/LoadingButton.d.ts +2 -1
- package/lib/esm/Components/MultiFilePicker.d.ts +1 -1
- package/lib/esm/Components/PasswordInput.d.ts +2 -1
- package/lib/esm/Components/SingleFilePicker.d.ts +1 -1
- package/lib/esm/Components/StepList.d.ts +2 -2
- package/lib/esm/Components/ThemeProvider.d.ts +2 -1
- package/lib/esm/Components/TitleOrTranslate.d.ts +2 -1
- package/lib/esm/Components/Validator.d.ts +4 -3
- package/lib/esm/i18n/de.json +2 -1
- package/lib/esm/i18n/en.json +2 -1
- package/lib/esm/i18n/tr.json +2 -1
- package/package.json +13 -13
- package/src/Components/BootstrapDataTable.tsx +19 -9
- package/src/Components/BootstrapOptions.tsx +7 -3
- package/src/Components/CRUD.tsx +9 -7
- package/src/i18n/de.json +2 -1
- package/src/i18n/en.json +2 -1
- package/src/i18n/tr.json +2 -1
- package/tsconfig.json +0 -1
|
@@ -8,10 +8,10 @@ type ActionsProp = {
|
|
|
8
8
|
rowSpan?: number | undefined;
|
|
9
9
|
children?: React.ReactNode;
|
|
10
10
|
};
|
|
11
|
-
export declare function Actions({ edit, del, rowSpan, children }: ActionsProp): JSX.Element;
|
|
12
|
-
export declare function IdColumn(): JSX.Element;
|
|
13
|
-
export declare function ActionsColumn(): JSX.Element;
|
|
14
|
-
export declare function Column(props: any): JSX.Element;
|
|
11
|
+
export declare function Actions({ edit, del, rowSpan, children }: ActionsProp): React.JSX.Element;
|
|
12
|
+
export declare function IdColumn(): React.JSX.Element;
|
|
13
|
+
export declare function ActionsColumn(): React.JSX.Element;
|
|
14
|
+
export declare function Column(props: any): React.JSX.Element;
|
|
15
15
|
export interface BootstrapTableProps {
|
|
16
16
|
url: string;
|
|
17
17
|
bordered?: boolean;
|
|
@@ -25,7 +25,7 @@ export interface BootstrapTableProps {
|
|
|
25
25
|
interface RowRendererProps<Row = any> {
|
|
26
26
|
render: (row: Row) => React.ReactNode;
|
|
27
27
|
}
|
|
28
|
-
export declare function RowRenderer<Row = any>({ render }: RowRendererProps<Row>): JSX.Element;
|
|
29
|
-
export declare function CustomRenderer<Row = any>({ render }: RowRendererProps<Row>): JSX.Element;
|
|
30
|
-
export default function BootstrapTable({ url, bordered, noStrip, defaultParams, add, children, innerRef, body }: BootstrapTableProps): JSX.Element;
|
|
28
|
+
export declare function RowRenderer<Row = any>({ render }: RowRendererProps<Row>): React.JSX.Element;
|
|
29
|
+
export declare function CustomRenderer<Row = any>({ render }: RowRendererProps<Row>): React.JSX.Element;
|
|
30
|
+
export default function BootstrapTable({ url, bordered, noStrip, defaultParams, add, children, innerRef, body }: BootstrapTableProps): React.JSX.Element;
|
|
31
31
|
export {};
|
|
@@ -93,7 +93,7 @@ export function CustomRenderer({ render }) {
|
|
|
93
93
|
export default function BootstrapTable({ url, bordered, noStrip, defaultParams, add, children, innerRef, body }) {
|
|
94
94
|
const state = useState(Object.assign({ sort: 'id' }, defaultParams));
|
|
95
95
|
const [params, setParams] = state;
|
|
96
|
-
const [page, lastPage, setPage, data, itemPerPage, setItemPerPage, update] = useDataTable(url, params, body);
|
|
96
|
+
const [page, lastPage, setPage, data, itemPerPage, setItemPerPage, update, count] = useDataTable(url, params, body);
|
|
97
97
|
const intl = useIntl();
|
|
98
98
|
const [api] = useAuth();
|
|
99
99
|
const ref = useRef(defaultParams);
|
|
@@ -151,7 +151,10 @@ export default function BootstrapTable({ url, bordered, noStrip, defaultParams,
|
|
|
151
151
|
React.createElement(FormattedMessage, { id: "NO_DATA_IS_AVAILABLE" })) : React.createElement(Table, { hover: true, bordered: bordered, striped: !noStrip, responsive: true, size: "md", className: "mb-0 dataTable" },
|
|
152
152
|
children[0],
|
|
153
153
|
children[1].type === "tbody" ? React.createElement("tbody", null, data && data.map(children[1].props.children)) : children[1]),
|
|
154
|
-
lastPage > 1 && React.createElement(CardFooter, null,
|
|
155
|
-
React.createElement("
|
|
156
|
-
React.createElement(
|
|
154
|
+
(lastPage > 1 || count > 0) && React.createElement(CardFooter, null,
|
|
155
|
+
React.createElement(Row, { className: "justify-content-between" },
|
|
156
|
+
React.createElement(Col, null, lastPage > 1 && React.createElement("nav", null,
|
|
157
|
+
React.createElement(BootstrapPagination, { currentPage: page, pageCount: lastPage, onPageChange: index => setPage(index) }))),
|
|
158
|
+
count > 0 && React.createElement(Col, { className: "col-auto align-self-center" },
|
|
159
|
+
React.createElement(FormattedMessage, { id: "RECORDS", values: { count } })))))))));
|
|
157
160
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
2
|
import BootstrapOptions from "./BootstrapOptions";
|
|
3
3
|
interface BootstrapOptions {
|
|
4
4
|
noCloseModal: boolean;
|
|
5
|
+
noCloseOnSave: boolean;
|
|
6
|
+
onlySaveOnDirty: boolean;
|
|
5
7
|
}
|
|
6
8
|
interface BootstrapOptionsProviderProps extends BootstrapOptions {
|
|
7
9
|
children: ReactNode;
|
|
8
10
|
}
|
|
9
11
|
export declare function useBootstrapOptions(): BootstrapOptions;
|
|
10
|
-
export default function BootstrapOptionsProvider({ children, noCloseModal }: BootstrapOptionsProviderProps): JSX.Element;
|
|
12
|
+
export default function BootstrapOptionsProvider({ children, noCloseModal, noCloseOnSave, onlySaveOnDirty }: BootstrapOptionsProviderProps): React.JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React, { createContext, useContext, useMemo } from "react";
|
|
2
2
|
const BootstrapOptionsContext = createContext({
|
|
3
|
-
noCloseModal: false
|
|
3
|
+
noCloseModal: false,
|
|
4
|
+
noCloseOnSave: false,
|
|
5
|
+
onlySaveOnDirty: false
|
|
4
6
|
});
|
|
5
7
|
export function useBootstrapOptions() {
|
|
6
8
|
return useContext(BootstrapOptionsContext);
|
|
7
9
|
}
|
|
8
|
-
export default function BootstrapOptionsProvider({ children, noCloseModal }) {
|
|
9
|
-
const options = useMemo(() => ({ noCloseModal }), [noCloseModal]);
|
|
10
|
+
export default function BootstrapOptionsProvider({ children, noCloseModal, noCloseOnSave, onlySaveOnDirty }) {
|
|
11
|
+
const options = useMemo(() => ({ noCloseModal, noCloseOnSave, onlySaveOnDirty }), [noCloseModal, noCloseOnSave]);
|
|
10
12
|
return React.createElement(BootstrapOptionsContext.Provider, { value: options }, children);
|
|
11
13
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
type BootstrapPaginationProps = {
|
|
2
3
|
className?: string;
|
|
3
4
|
currentPage: number;
|
|
4
5
|
pageCount: number;
|
|
5
6
|
onPageChange: (page: number) => void;
|
|
6
7
|
};
|
|
7
|
-
export default function BootstrapPagination({ className, currentPage, pageCount, onPageChange }: BootstrapPaginationProps): JSX.Element | null;
|
|
8
|
+
export default function BootstrapPagination({ className, currentPage, pageCount, onPageChange }: BootstrapPaginationProps): React.JSX.Element | null;
|
|
8
9
|
export {};
|
|
@@ -9,18 +9,18 @@ type ModalEntityEditorParams = {
|
|
|
9
9
|
disabled?: Boolean;
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
};
|
|
12
|
-
export declare function ModalEntityEditor({ entity, title, size, url, onReload, disabled, children }: ModalEntityEditorParams): JSX.Element;
|
|
12
|
+
export declare function ModalEntityEditor({ entity, title, size, url, onReload, disabled, children }: ModalEntityEditorParams): React.JSX.Element;
|
|
13
13
|
type CrudActionProps = {
|
|
14
14
|
id: any;
|
|
15
15
|
edit?: Boolean;
|
|
16
16
|
del: string;
|
|
17
17
|
children?: React.ReactNode;
|
|
18
18
|
};
|
|
19
|
-
export declare function CRUDActions({ id, edit, del, children }: CrudActionProps): JSX.Element;
|
|
19
|
+
export declare function CRUDActions({ id, edit, del, children }: CrudActionProps): React.JSX.Element;
|
|
20
20
|
interface CRUDProps extends BootstrapTableProps {
|
|
21
21
|
apiUrl?: string;
|
|
22
22
|
Component: any;
|
|
23
23
|
noAdd?: boolean;
|
|
24
24
|
}
|
|
25
|
-
export default function CRUD(props: CRUDProps): JSX.Element;
|
|
25
|
+
export default function CRUD(props: CRUDProps): React.JSX.Element;
|
|
26
26
|
export {};
|
|
@@ -26,8 +26,10 @@ import { Alert, Button, Col, Form, ModalFooter, ModalHeader, Row } from "reactst
|
|
|
26
26
|
import LoadingButton from '../Components/LoadingButton';
|
|
27
27
|
import BootstrapDataTable, { Actions } from './BootstrapDataTable';
|
|
28
28
|
import BootstrapModal from './BootstrapModal';
|
|
29
|
+
import { useBootstrapOptions } from "./BootstrapOptions";
|
|
29
30
|
export function ModalEntityEditor({ entity, title, size, url, onReload, disabled, children }) {
|
|
30
|
-
const [, , save, loading] = entity;
|
|
31
|
+
const [, , save, loading, dirty] = entity;
|
|
32
|
+
const bsOptions = useBootstrapOptions();
|
|
31
33
|
const [open, setOpen] = useState(true);
|
|
32
34
|
const [saved, setSaved] = useState(false);
|
|
33
35
|
const [error, setError] = useState(false);
|
|
@@ -59,7 +61,7 @@ export function ModalEntityEditor({ entity, title, size, url, onReload, disabled
|
|
|
59
61
|
});
|
|
60
62
|
}, [save, saved, error, onReload, url]);
|
|
61
63
|
return React.createElement(React.Fragment, null,
|
|
62
|
-
(saved || !open) && url && React.createElement(Navigate, { to: url, replace: true }),
|
|
64
|
+
((!bsOptions.noCloseOnSave && saved) || !open) && url && React.createElement(Navigate, { to: url, replace: true }),
|
|
63
65
|
React.createElement(BootstrapModal, { isOpen: true, size: size, toggle: () => url ? setOpen(false) : onReload(null), fade: false },
|
|
64
66
|
title && React.createElement(ModalHeader, { toggle: () => url ? setOpen(false) : onReload(null) },
|
|
65
67
|
React.createElement("b", null, title)),
|
|
@@ -68,9 +70,13 @@ export function ModalEntityEditor({ entity, title, size, url, onReload, disabled
|
|
|
68
70
|
React.createElement("fieldset", { disabled: !!loading || !!disabled }, children),
|
|
69
71
|
React.createElement(ModalFooter, null,
|
|
70
72
|
error && React.createElement(Alert, { color: "danger", toggle: () => setError(null), style: { display: 'block', width: '100%' } }, error),
|
|
73
|
+
bsOptions.noCloseOnSave && !dirty && saved && React.createElement(Alert, { color: "success", style: { display: 'block', width: '100%' } },
|
|
74
|
+
React.createElement("i", { className: "fas fa-check-circle" }),
|
|
75
|
+
" ",
|
|
76
|
+
React.createElement(FormattedMessage, { id: "ENTITY.SAVED" })),
|
|
71
77
|
React.createElement(Row, { className: "w-100" },
|
|
72
78
|
React.createElement(Col, null,
|
|
73
|
-
React.createElement(LoadingButton, { block: true, loading: loading, type: "submit", color: "primary" },
|
|
79
|
+
React.createElement(LoadingButton, { block: true, loading: loading, disabled: bsOptions.onlySaveOnDirty && !dirty, type: "submit", color: "primary" },
|
|
74
80
|
React.createElement("i", { className: "fas fa-save" }),
|
|
75
81
|
' ',
|
|
76
82
|
React.createElement(FormattedMessage, { id: "ENTITY.SAVE" }))),
|
|
@@ -2,5 +2,5 @@ import React from "react";
|
|
|
2
2
|
type DefaultValidatorOptionsProps = {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
};
|
|
5
|
-
export default function DefaultValidatorOptions({ children }: DefaultValidatorOptionsProps): JSX.Element;
|
|
5
|
+
export default function DefaultValidatorOptions({ children }: DefaultValidatorOptionsProps): React.JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -7,5 +7,5 @@ type EntityEditorParams = {
|
|
|
7
7
|
disabled?: Boolean;
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
};
|
|
10
|
-
export default function EntityEditor({ entity, disabled, children, onSave, saveButtonClassName, saveButtonText }: EntityEditorParams): JSX.Element;
|
|
10
|
+
export default function EntityEditor({ entity, disabled, children, onSave, saveButtonClassName, saveButtonText }: EntityEditorParams): React.JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -10,5 +10,5 @@ export default class ErrorBoundary extends React.Component<{
|
|
|
10
10
|
hasError: boolean;
|
|
11
11
|
error: any;
|
|
12
12
|
};
|
|
13
|
-
render(): string | number | boolean | JSX.Element | React.
|
|
13
|
+
render(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
14
14
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
export default function ExcelExportButton({ name, header, params, size, map, extra }: {
|
|
2
3
|
name: any;
|
|
3
4
|
header: any;
|
|
@@ -5,4 +6,4 @@ export default function ExcelExportButton({ name, header, params, size, map, ext
|
|
|
5
6
|
size: any;
|
|
6
7
|
map: any;
|
|
7
8
|
extra: any;
|
|
8
|
-
}): JSX.Element;
|
|
9
|
+
}): React.JSX.Element;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
type ExternalLoginButtonProps = {
|
|
2
3
|
id: string;
|
|
3
4
|
icon?: string;
|
|
4
5
|
name: string;
|
|
5
6
|
url: string;
|
|
6
7
|
};
|
|
7
|
-
export default function ExternalLoginButton({ id, icon, name, url }: ExternalLoginButtonProps): JSX.Element;
|
|
8
|
+
export default function ExternalLoginButton({ id, icon, name, url }: ExternalLoginButtonProps): React.JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -5,7 +5,7 @@ type RelativeProps = {
|
|
|
5
5
|
export declare function Relative({ children }: RelativeProps): React.FunctionComponentElement<any> | null;
|
|
6
6
|
export declare function Preview({ value }: {
|
|
7
7
|
value: any;
|
|
8
|
-
}): JSX.Element | null;
|
|
8
|
+
}): React.JSX.Element | null;
|
|
9
9
|
export default function FilePickerCore({ disabled, index, move, className, accepts, value, onNotify, children, transform }: {
|
|
10
10
|
disabled?: any;
|
|
11
11
|
index?: number;
|
|
@@ -16,5 +16,5 @@ export default function FilePickerCore({ disabled, index, move, className, accep
|
|
|
16
16
|
onNotify?: any;
|
|
17
17
|
children?: any;
|
|
18
18
|
transform?: any;
|
|
19
|
-
}): JSX.Element | null;
|
|
19
|
+
}): React.JSX.Element | null;
|
|
20
20
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { SingleFilePickerProps } from './SingleFilePicker';
|
|
2
3
|
interface ImagePickerProps extends SingleFilePickerProps {
|
|
3
4
|
width: number;
|
|
@@ -5,5 +6,5 @@ interface ImagePickerProps extends SingleFilePickerProps {
|
|
|
5
6
|
type: string;
|
|
6
7
|
exact?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export default function ImagePicker(props: ImagePickerProps): JSX.Element;
|
|
9
|
+
export default function ImagePicker(props: ImagePickerProps): React.JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -6,6 +6,6 @@ type LanguageProviderProps = {
|
|
|
6
6
|
loader?: (language: any) => any;
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
};
|
|
9
|
-
export default function LanguageProvider({ defaultLanguage, languages, loader, children }: LanguageProviderProps): JSX.Element | null;
|
|
10
|
-
export declare function LanguageSwitcher(): JSX.Element | null;
|
|
9
|
+
export default function LanguageProvider({ defaultLanguage, languages, loader, children }: LanguageProviderProps): React.JSX.Element | null;
|
|
10
|
+
export declare function LanguageSwitcher(): React.JSX.Element | null;
|
|
11
11
|
export {};
|
|
@@ -8,5 +8,5 @@ type MultiFilePickerProps = {
|
|
|
8
8
|
noMove?: boolean;
|
|
9
9
|
children?: (value: any) => React.ReactNode;
|
|
10
10
|
};
|
|
11
|
-
export default function MultiFilePicker({ disabled, className, noMove, accepts, value, onChange, children }: MultiFilePickerProps): JSX.Element;
|
|
11
|
+
export default function MultiFilePicker({ disabled, className, noMove, accepts, value, onChange, children }: MultiFilePickerProps): React.JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
interface PasswordInputParams {
|
|
2
3
|
value?: string;
|
|
3
4
|
onChange: (str: string) => any;
|
|
@@ -7,5 +8,5 @@ interface PasswordInputParams {
|
|
|
7
8
|
required?: boolean;
|
|
8
9
|
placeholder?: string;
|
|
9
10
|
}
|
|
10
|
-
export default function PasswordInput({ value, onChange, className, disabled, icon, required, placeholder }: PasswordInputParams): JSX.Element;
|
|
11
|
+
export default function PasswordInput({ value, onChange, className, disabled, icon, required, placeholder }: PasswordInputParams): React.JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -8,4 +8,4 @@ export interface SingleFilePickerProps {
|
|
|
8
8
|
children?: (value: any) => React.ReactNode;
|
|
9
9
|
transform?: any;
|
|
10
10
|
}
|
|
11
|
-
export default function SingleFilePicker({ disabled, className, accepts, value, onChange, transform, children }: SingleFilePickerProps): JSX.Element;
|
|
11
|
+
export default function SingleFilePicker({ disabled, className, accepts, value, onChange, transform, children }: SingleFilePickerProps): React.JSX.Element;
|
|
@@ -4,11 +4,11 @@ type StepListProps = {
|
|
|
4
4
|
setActive: (active: number) => {};
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
};
|
|
7
|
-
export default function StepList({ active, setActive, children }: StepListProps): JSX.Element;
|
|
7
|
+
export default function StepList({ active, setActive, children }: StepListProps): React.JSX.Element;
|
|
8
8
|
type StepItemProps = {
|
|
9
9
|
title?: string;
|
|
10
10
|
translate?: string;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
};
|
|
13
|
-
export declare function StepItem({ title, translate, disabled }: StepItemProps): JSX.Element;
|
|
13
|
+
export declare function StepItem({ title, translate, disabled }: StepItemProps): React.JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
export declare function useTheme(): any;
|
|
2
3
|
export declare function useAllThemes(): any;
|
|
3
4
|
export default function ThemeProvider({ themes, defaultTheme, children }: {
|
|
4
5
|
themes: any;
|
|
5
6
|
defaultTheme: any;
|
|
6
7
|
children: any;
|
|
7
|
-
}): JSX.Element;
|
|
8
|
+
}): React.JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
export interface TitleOrTranslateProps {
|
|
2
3
|
title?: string;
|
|
3
4
|
translate?: string;
|
|
4
5
|
values?: Record<string, any>;
|
|
5
6
|
}
|
|
6
|
-
export default function TitleOrTranslate({ title, translate, values }: TitleOrTranslateProps): JSX.Element;
|
|
7
|
+
export default function TitleOrTranslate({ title, translate, values }: TitleOrTranslateProps): React.JSX.Element;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
type ValidatorProps = {
|
|
2
3
|
name: string;
|
|
3
4
|
type: any;
|
|
4
5
|
children: JSX.Element;
|
|
5
6
|
};
|
|
6
|
-
export declare function Validator({ name, type, children }: ValidatorProps): JSX.Element;
|
|
7
|
+
export declare function Validator({ name, type, children }: ValidatorProps): React.JSX.Element;
|
|
7
8
|
type ValueValidatorProps = {
|
|
8
9
|
name: string;
|
|
9
10
|
type: any;
|
|
10
11
|
value: any;
|
|
11
12
|
children: any;
|
|
12
13
|
};
|
|
13
|
-
export declare function ValueValidator({ name, value, type, children }: ValueValidatorProps): JSX.Element;
|
|
14
|
-
export declare function ValidationErrors(): JSX.Element | null;
|
|
14
|
+
export declare function ValueValidator({ name, value, type, children }: ValueValidatorProps): React.JSX.Element;
|
|
15
|
+
export declare function ValidationErrors(): React.JSX.Element | null;
|
|
15
16
|
export {};
|
package/lib/esm/i18n/de.json
CHANGED
|
@@ -37,5 +37,6 @@
|
|
|
37
37
|
"ACTIONS.DELETE.TEXT": "Diese Aktion ist nicht umkehrbar!",
|
|
38
38
|
"ACTIONS.DELETE.CONFIRM": "Ja, löschen!",
|
|
39
39
|
"PLEASE_WAIT": "Warten Sie mal.",
|
|
40
|
-
"AUTHORIZATION_CODE": "Zugangscode"
|
|
40
|
+
"AUTHORIZATION_CODE": "Zugangscode",
|
|
41
|
+
"RECORDS": "{count, plural, =0 {kein eintrag} one {# datensatz} other {# datensätze}}"
|
|
41
42
|
}
|
package/lib/esm/i18n/en.json
CHANGED
|
@@ -39,5 +39,6 @@
|
|
|
39
39
|
"ACTIONS.DELETE.TEXT": "You won't be able to revert this!",
|
|
40
40
|
"ACTIONS.DELETE.CONFIRM": "Yes, delete it!",
|
|
41
41
|
"PLEASE_WAIT": "Please wait.",
|
|
42
|
-
"AUTHORIZATION_CODE": "Authorization Code"
|
|
42
|
+
"AUTHORIZATION_CODE": "Authorization Code",
|
|
43
|
+
"RECORDS": "{count, plural, =0 {no records} one {# record} other {# records}}"
|
|
43
44
|
}
|
package/lib/esm/i18n/tr.json
CHANGED
|
@@ -38,5 +38,6 @@
|
|
|
38
38
|
"ACTIONS.DELETE.TEXT": "Bu işlem geri alınamaz!",
|
|
39
39
|
"ACTIONS.DELETE.CONFIRM": "Evet, sil!",
|
|
40
40
|
"PLEASE_WAIT": "Lütfen bekleyiniz.",
|
|
41
|
-
"AUTHORIZATION_CODE": "Yetki Kodu"
|
|
41
|
+
"AUTHORIZATION_CODE": "Yetki Kodu",
|
|
42
|
+
"RECORDS": "{count, plural, =0 {Kayıt yok} one {# kayıt} other {# kayıt}}"
|
|
42
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-admin-base-bootstrap",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -28,31 +28,31 @@
|
|
|
28
28
|
"react": "^18.2.0",
|
|
29
29
|
"react-dom": "^18.2.0",
|
|
30
30
|
"react-intl": "^6.2.10",
|
|
31
|
-
"react-router-dom": "^6.
|
|
31
|
+
"react-router-dom": "^6.13.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@emotion/react": "^11.
|
|
35
|
-
"@fortawesome/fontawesome-free": "^6.
|
|
36
|
-
"bootstrap": "^5.
|
|
34
|
+
"@emotion/react": "^11.11.1",
|
|
35
|
+
"@fortawesome/fontawesome-free": "^6.4.0",
|
|
36
|
+
"bootstrap": "^5.3.0",
|
|
37
37
|
"file-dialog": "^0.0.8",
|
|
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.
|
|
41
|
+
"react-admin-base": "^0.8.10",
|
|
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",
|
|
45
45
|
"react-responsive": "^9.0.2",
|
|
46
|
-
"react-select": "^5.7.
|
|
47
|
-
"reactstrap": "^9.
|
|
46
|
+
"react-select": "^5.7.3",
|
|
47
|
+
"reactstrap": "^9.2.0",
|
|
48
48
|
"rewire": "^6.0.0",
|
|
49
|
-
"sweetalert2": "^11.7.
|
|
49
|
+
"sweetalert2": "^11.7.12"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@types/react": "^18.
|
|
52
|
+
"@types/react": "^18.2.12",
|
|
53
53
|
"cross-env": "^7.0.3",
|
|
54
|
-
"nodemon": "^2.0.
|
|
55
|
-
"react-intl": "^6.
|
|
56
|
-
"typescript": "^
|
|
54
|
+
"nodemon": "^2.0.22",
|
|
55
|
+
"react-intl": "^6.4.4",
|
|
56
|
+
"typescript": "^5.1.3"
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -126,7 +126,7 @@ export function CustomRenderer<Row = any>({render}: RowRendererProps<Row>) {
|
|
|
126
126
|
export default function BootstrapTable({url, bordered, noStrip, defaultParams, add, children, innerRef, body}: BootstrapTableProps) {
|
|
127
127
|
const state = useState({sort: 'id', ...defaultParams});
|
|
128
128
|
const [params, setParams] = state;
|
|
129
|
-
const [page, lastPage, setPage, data, itemPerPage, setItemPerPage, update] = useDataTable(url, params, body);
|
|
129
|
+
const [page, lastPage, setPage, data, itemPerPage, setItemPerPage, update, count] = useDataTable(url, params, body);
|
|
130
130
|
const intl = useIntl();
|
|
131
131
|
const [ api ] = useAuth();
|
|
132
132
|
|
|
@@ -196,14 +196,24 @@ export default function BootstrapTable({url, bordered, noStrip, defaultParams, a
|
|
|
196
196
|
{data && data.map(children[1].props.children)}
|
|
197
197
|
</tbody> : children[1]}
|
|
198
198
|
</Table>}
|
|
199
|
-
{ lastPage > 1 && <CardFooter>
|
|
200
|
-
<
|
|
201
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
199
|
+
{ (lastPage > 1 || count > 0) && <CardFooter>
|
|
200
|
+
<Row className="justify-content-between">
|
|
201
|
+
<Col>
|
|
202
|
+
{ lastPage > 1 && <nav>
|
|
203
|
+
<BootstrapPagination
|
|
204
|
+
currentPage={page}
|
|
205
|
+
pageCount={lastPage}
|
|
206
|
+
onPageChange={index => setPage(index)}
|
|
207
|
+
/>
|
|
208
|
+
</nav> }
|
|
209
|
+
</Col>
|
|
210
|
+
{ count > 0 && <Col className="col-auto align-self-center">
|
|
211
|
+
<FormattedMessage
|
|
212
|
+
id="RECORDS"
|
|
213
|
+
values={{ count }}
|
|
214
|
+
/>
|
|
215
|
+
</Col> }
|
|
216
|
+
</Row>
|
|
207
217
|
</CardFooter> }
|
|
208
218
|
</RowDatasContext.Provider>
|
|
209
219
|
</RefreshScope>
|
|
@@ -3,6 +3,8 @@ import BootstrapOptions from "./BootstrapOptions";
|
|
|
3
3
|
|
|
4
4
|
interface BootstrapOptions {
|
|
5
5
|
noCloseModal: boolean;
|
|
6
|
+
noCloseOnSave: boolean;
|
|
7
|
+
onlySaveOnDirty: boolean;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
interface BootstrapOptionsProviderProps extends BootstrapOptions {
|
|
@@ -10,15 +12,17 @@ interface BootstrapOptionsProviderProps extends BootstrapOptions {
|
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
const BootstrapOptionsContext = createContext<BootstrapOptions>({
|
|
13
|
-
noCloseModal: false
|
|
15
|
+
noCloseModal: false,
|
|
16
|
+
noCloseOnSave: false,
|
|
17
|
+
onlySaveOnDirty: false
|
|
14
18
|
});
|
|
15
19
|
|
|
16
20
|
export function useBootstrapOptions() {
|
|
17
21
|
return useContext(BootstrapOptionsContext);
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
export default function BootstrapOptionsProvider({children,noCloseModal}: BootstrapOptionsProviderProps) {
|
|
21
|
-
const options = useMemo(() => ({noCloseModal}), [noCloseModal]);
|
|
24
|
+
export default function BootstrapOptionsProvider({children,noCloseModal,noCloseOnSave, onlySaveOnDirty}: BootstrapOptionsProviderProps) {
|
|
25
|
+
const options = useMemo(() => ({noCloseModal,noCloseOnSave,onlySaveOnDirty}), [noCloseModal, noCloseOnSave]);
|
|
22
26
|
return <BootstrapOptionsContext.Provider value={options}>
|
|
23
27
|
{ children }
|
|
24
28
|
</BootstrapOptionsContext.Provider>;
|
package/src/Components/CRUD.tsx
CHANGED
|
@@ -19,7 +19,8 @@ type ModalEntityEditorParams = {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export function ModalEntityEditor({ entity, title, size, url, onReload, disabled, children } : ModalEntityEditorParams) {
|
|
22
|
-
const [ , , save, loading ] = entity;
|
|
22
|
+
const [ , , save, loading, dirty ] = entity;
|
|
23
|
+
const bsOptions = useBootstrapOptions();
|
|
23
24
|
|
|
24
25
|
const [ open, setOpen ] = useState(true);
|
|
25
26
|
const [ saved, setSaved ] = useState(false);
|
|
@@ -58,10 +59,10 @@ export function ModalEntityEditor({ entity, title, size, url, onReload, disabled
|
|
|
58
59
|
}, [save, saved, error, onReload, url]);
|
|
59
60
|
|
|
60
61
|
return <>
|
|
61
|
-
{ (saved || !open) && url && <Navigate to={url} replace />}
|
|
62
|
+
{ ((!bsOptions.noCloseOnSave && saved) || !open) && url && <Navigate to={url} replace />}
|
|
62
63
|
<BootstrapModal isOpen size={size} toggle={() => url ? setOpen(false) : onReload(null)} fade={false}>
|
|
63
64
|
{ title && <ModalHeader toggle={() => url ? setOpen(false) : onReload(null)}>
|
|
64
|
-
|
|
65
|
+
<b>{ title }</b>
|
|
65
66
|
</ModalHeader> }
|
|
66
67
|
<ValidatorProvider>
|
|
67
68
|
<Form onSubmit={onSubmit} disabled={!!loading || disabled}>
|
|
@@ -69,12 +70,13 @@ export function ModalEntityEditor({ entity, title, size, url, onReload, disabled
|
|
|
69
70
|
{ children }
|
|
70
71
|
</fieldset>
|
|
71
72
|
<ModalFooter>
|
|
72
|
-
|
|
73
|
+
{ error && <Alert color="danger" toggle={() => setError(null)} style={{ display: 'block', width: '100%' }}>{ error }</Alert>}
|
|
74
|
+
{ bsOptions.noCloseOnSave && !dirty && saved && <Alert color="success" style={{ display: 'block', width: '100%' }}><i className="fas fa-check-circle" /> <FormattedMessage id="ENTITY.SAVED" /></Alert>}
|
|
73
75
|
<Row className="w-100">
|
|
74
76
|
<Col>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
<LoadingButton block loading={loading} disabled={bsOptions.onlySaveOnDirty && !dirty} type="submit" color="primary">
|
|
78
|
+
<i className="fas fa-save" />{' '}<FormattedMessage id="ENTITY.SAVE" />
|
|
79
|
+
</LoadingButton>
|
|
78
80
|
</Col>
|
|
79
81
|
<Col>
|
|
80
82
|
<Button block outline color="danger" onClick={(e) => { e.preventDefault(); (url ? setOpen(false) : onReload(null)); }}>
|
package/src/i18n/de.json
CHANGED
|
@@ -37,5 +37,6 @@
|
|
|
37
37
|
"ACTIONS.DELETE.TEXT": "Diese Aktion ist nicht umkehrbar!",
|
|
38
38
|
"ACTIONS.DELETE.CONFIRM": "Ja, löschen!",
|
|
39
39
|
"PLEASE_WAIT": "Warten Sie mal.",
|
|
40
|
-
"AUTHORIZATION_CODE": "Zugangscode"
|
|
40
|
+
"AUTHORIZATION_CODE": "Zugangscode",
|
|
41
|
+
"RECORDS": "{count, plural, =0 {kein eintrag} one {# datensatz} other {# datensätze}}"
|
|
41
42
|
}
|
package/src/i18n/en.json
CHANGED
|
@@ -39,5 +39,6 @@
|
|
|
39
39
|
"ACTIONS.DELETE.TEXT": "You won't be able to revert this!",
|
|
40
40
|
"ACTIONS.DELETE.CONFIRM": "Yes, delete it!",
|
|
41
41
|
"PLEASE_WAIT": "Please wait.",
|
|
42
|
-
"AUTHORIZATION_CODE": "Authorization Code"
|
|
42
|
+
"AUTHORIZATION_CODE": "Authorization Code",
|
|
43
|
+
"RECORDS": "{count, plural, =0 {no records} one {# record} other {# records}}"
|
|
43
44
|
}
|
package/src/i18n/tr.json
CHANGED
|
@@ -38,5 +38,6 @@
|
|
|
38
38
|
"ACTIONS.DELETE.TEXT": "Bu işlem geri alınamaz!",
|
|
39
39
|
"ACTIONS.DELETE.CONFIRM": "Evet, sil!",
|
|
40
40
|
"PLEASE_WAIT": "Lütfen bekleyiniz.",
|
|
41
|
-
"AUTHORIZATION_CODE": "Yetki Kodu"
|
|
41
|
+
"AUTHORIZATION_CODE": "Yetki Kodu",
|
|
42
|
+
"RECORDS": "{count, plural, =0 {Kayıt yok} one {# kayıt} other {# kayıt}}"
|
|
42
43
|
}
|