react-admin-base-bootstrap 0.8.4 → 0.8.6
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/assets/main.css +37 -0
- package/lib/esm/Components/BootstrapDataTable.d.ts +1 -1
- package/lib/esm/Components/BootstrapModal.d.ts +2 -0
- package/lib/esm/Components/BootstrapModal.js +7 -0
- package/lib/esm/Components/BootstrapOptions.d.ts +11 -0
- package/lib/esm/Components/BootstrapOptions.js +11 -0
- package/lib/esm/Components/BootstrapPagination.d.ts +1 -1
- package/lib/esm/Components/CRUD.d.ts +2 -2
- package/lib/esm/Components/CRUD.js +4 -3
- package/lib/esm/Components/DefaultValidatorOptions.d.ts +1 -1
- package/lib/esm/Components/EntityEditor.d.ts +1 -1
- package/lib/esm/Components/ExternalLoginButton.d.ts +1 -1
- package/lib/esm/Components/FilePickerCore.d.ts +1 -1
- package/lib/esm/Components/FilePickerCore.js +3 -2
- package/lib/esm/Components/GoToTop.js +1 -1
- package/lib/esm/Components/LanguageProvider.d.ts +1 -1
- package/lib/esm/Components/MultiFilePicker.d.ts +1 -1
- package/lib/esm/Components/StepList.d.ts +2 -2
- package/lib/esm/Components/TopProgressBar.d.ts +1 -6
- package/lib/esm/Components/TopProgressBar.js +2 -2
- package/lib/esm/Components/Validator.d.ts +2 -2
- package/lib/esm/index.d.ts +3 -1
- package/lib/esm/index.js +3 -1
- package/package.json +11 -11
- package/src/Components/BootstrapModal.tsx +9 -0
- package/src/Components/BootstrapOptions.tsx +25 -0
- package/src/Components/CRUD.tsx +7 -3
- package/src/Components/EntityEditor.tsx +0 -1
- package/src/Components/FilePickerCore.tsx +3 -2
- package/src/Components/GoToTop.tsx +1 -2
- package/src/Components/ThemeProvider.tsx +1 -1
- package/src/Components/TopProgressBar.tsx +2 -6
- package/src/index.ts +6 -1
package/assets/main.css
CHANGED
|
@@ -1357,3 +1357,40 @@
|
|
|
1357
1357
|
margin-left: -2.40625rem
|
|
1358
1358
|
}
|
|
1359
1359
|
}
|
|
1360
|
+
|
|
1361
|
+
.react-select-container .react-select__control {
|
|
1362
|
+
background-color: var(--bs-body-bg);
|
|
1363
|
+
border-color: var(--bs-gray-300);
|
|
1364
|
+
transition: none;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
.react-select-container .react-select__control:hover {
|
|
1368
|
+
border-color: var(--bs-gray-300);
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
.react-select-container .react-select__menu {
|
|
1372
|
+
background-color: var(--bs-body-bg);
|
|
1373
|
+
border: 1px solid var(--bs-gray-300);
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
.react-select-container .react-select__option {
|
|
1377
|
+
background-color: var(--bs-body-bg);
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
.react-select-container .react-select__option:hover {
|
|
1381
|
+
background-color: var(--bs-gray-300);
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
.react-select-container .react-select__option--is-selected {
|
|
1385
|
+
color: var(--bs-dark);
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
.react-select-container .react-select__indicator-separator {
|
|
1389
|
+
background-color: var(--bs-gray-300);
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
.react-select-container .react-select__placeholder,
|
|
1393
|
+
.react-select-container .react-select__single-value
|
|
1394
|
+
{
|
|
1395
|
+
color: var(--bs-gray-700);
|
|
1396
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Modal } from "reactstrap";
|
|
3
|
+
import { useBootstrapOptions } from "./BootstrapOptions";
|
|
4
|
+
export default function BootstrapModal(props) {
|
|
5
|
+
const bsOptions = useBootstrapOptions();
|
|
6
|
+
return React.createElement(Modal, Object.assign({}, props, { toggle: bsOptions.noCloseModal ? undefined : props.toggle }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import BootstrapOptions from "./BootstrapOptions";
|
|
3
|
+
interface BootstrapOptions {
|
|
4
|
+
noCloseModal: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface BootstrapOptionsProviderProps extends BootstrapOptions {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function useBootstrapOptions(): BootstrapOptions;
|
|
10
|
+
export default function BootstrapOptionsProvider({ children, noCloseModal }: BootstrapOptionsProviderProps): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { createContext, useContext, useMemo } from "react";
|
|
2
|
+
const BootstrapOptionsContext = createContext({
|
|
3
|
+
noCloseModal: false
|
|
4
|
+
});
|
|
5
|
+
export function useBootstrapOptions() {
|
|
6
|
+
return useContext(BootstrapOptionsContext);
|
|
7
|
+
}
|
|
8
|
+
export default function BootstrapOptionsProvider({ children, noCloseModal }) {
|
|
9
|
+
const options = useMemo(() => ({ noCloseModal }), [noCloseModal]);
|
|
10
|
+
return React.createElement(BootstrapOptionsContext.Provider, { value: options }, children);
|
|
11
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BootstrapTableProps } from './BootstrapDataTable';
|
|
3
|
-
|
|
3
|
+
type ModalEntityEditorParams = {
|
|
4
4
|
entity: any;
|
|
5
5
|
title?: string;
|
|
6
6
|
size?: string;
|
|
@@ -10,7 +10,7 @@ declare type ModalEntityEditorParams = {
|
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
};
|
|
12
12
|
export declare function ModalEntityEditor({ entity, title, size, url, onReload, disabled, children }: ModalEntityEditorParams): JSX.Element;
|
|
13
|
-
|
|
13
|
+
type CrudActionProps = {
|
|
14
14
|
id: any;
|
|
15
15
|
edit?: Boolean;
|
|
16
16
|
del: string;
|
|
@@ -22,9 +22,10 @@ import React, { useCallback, useContext, useRef, useState } from 'react';
|
|
|
22
22
|
import { ValidatorProvider } from "react-admin-base";
|
|
23
23
|
import { FormattedMessage } from 'react-intl';
|
|
24
24
|
import { Navigate, Routes, useParams, Route } from 'react-router-dom';
|
|
25
|
-
import { Alert, Button, Col, Form,
|
|
25
|
+
import { Alert, Button, Col, Form, ModalFooter, ModalHeader, Row } from "reactstrap";
|
|
26
26
|
import LoadingButton from '../Components/LoadingButton';
|
|
27
27
|
import BootstrapDataTable, { Actions } from './BootstrapDataTable';
|
|
28
|
+
import BootstrapModal from './BootstrapModal';
|
|
28
29
|
export function ModalEntityEditor({ entity, title, size, url, onReload, disabled, children }) {
|
|
29
30
|
const [, , save, loading] = entity;
|
|
30
31
|
const [open, setOpen] = useState(true);
|
|
@@ -59,7 +60,7 @@ export function ModalEntityEditor({ entity, title, size, url, onReload, disabled
|
|
|
59
60
|
}, [save, saved, error, onReload, url]);
|
|
60
61
|
return React.createElement(React.Fragment, null,
|
|
61
62
|
(saved || !open) && url && React.createElement(Navigate, { to: url, replace: true }),
|
|
62
|
-
React.createElement(
|
|
63
|
+
React.createElement(BootstrapModal, { isOpen: true, size: size, toggle: () => url ? setOpen(false) : onReload(null), fade: false },
|
|
63
64
|
title && React.createElement(ModalHeader, { toggle: () => url ? setOpen(false) : onReload(null) },
|
|
64
65
|
React.createElement("b", null, title)),
|
|
65
66
|
React.createElement(ValidatorProvider, null,
|
|
@@ -103,5 +104,5 @@ export default function CRUD(props) {
|
|
|
103
104
|
React.createElement(Routes, null,
|
|
104
105
|
!noAdd && React.createElement(Route, { path: "create", element: React.createElement(ComponentWrapper, Object.assign({ Component: Component, url: url, onReload: reload }, (defaultParams || {}))) }),
|
|
105
106
|
React.createElement(Route, { path: ":id/edit", element: React.createElement(ComponentWrapper, Object.assign({ Component: Component, url: url, onReload: reload }, (defaultParams || {}))) })),
|
|
106
|
-
React.createElement(BootstrapDataTable, Object.assign({ innerRef: ref, add: (!noAdd && "create") || undefined }, props, { url: apiUrl || url })));
|
|
107
|
+
React.createElement(BootstrapDataTable, Object.assign({ innerRef: ref, add: (!noAdd && "create") || undefined }, props, { url: apiUrl || url }), props.children));
|
|
107
108
|
}
|
|
@@ -6,7 +6,8 @@ import { FormattedMessage } from "react-intl";
|
|
|
6
6
|
import DragAndDropArrow from './DragAndDropArrow';
|
|
7
7
|
const photo_ext = ["png", "jpg", "jpeg", "svg"];
|
|
8
8
|
function is_photo(name) {
|
|
9
|
-
|
|
9
|
+
const sp = (name || '').split('.');
|
|
10
|
+
return photo_ext.indexOf((sp[sp.length - 1] || '').toLowerCase()) !== -1;
|
|
10
11
|
}
|
|
11
12
|
function is_absolute(url) {
|
|
12
13
|
if (url.indexOf("blob:") === 0)
|
|
@@ -25,7 +26,7 @@ export function Relative({ children }) {
|
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
export function Preview({ value }) {
|
|
28
|
-
const name = value.$name;
|
|
29
|
+
const name = value.$name || value.name;
|
|
29
30
|
const src = value.$blob_url || value.$src;
|
|
30
31
|
if (is_photo(name)) {
|
|
31
32
|
return React.createElement("div", { className: "mt-2" },
|
|
@@ -10,7 +10,7 @@ export default class GoToTop extends React.Component {
|
|
|
10
10
|
window.scrollTo(0, 0);
|
|
11
11
|
}
|
|
12
12
|
handleScroll(e) {
|
|
13
|
-
|
|
13
|
+
const newShow = window.scrollY > 100;
|
|
14
14
|
if (newShow !== this.state.show) {
|
|
15
15
|
this.setState({ show: newShow });
|
|
16
16
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
type StepListProps = {
|
|
3
3
|
active: number;
|
|
4
4
|
setActive: (active: number) => {};
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
};
|
|
7
7
|
export default function StepList({ active, setActive, children }: StepListProps): JSX.Element;
|
|
8
|
-
|
|
8
|
+
type StepItemProps = {
|
|
9
9
|
title?: string;
|
|
10
10
|
translate?: string;
|
|
11
11
|
disabled?: boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import NProgress from 'nprogress';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import { useAuth } from "react-admin-base";
|
|
4
|
-
export default function TopProgressBar(
|
|
4
|
+
export default function TopProgressBar() {
|
|
5
5
|
const [api] = useAuth();
|
|
6
6
|
useEffect(function () {
|
|
7
7
|
return api.set_hook(() => NProgress.start(), () => NProgress.done());
|
|
8
8
|
}, [api.set_hook]);
|
|
9
|
-
return
|
|
9
|
+
return null;
|
|
10
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
type ValidatorProps = {
|
|
2
2
|
name: string;
|
|
3
3
|
type: any;
|
|
4
4
|
children: JSX.Element;
|
|
5
5
|
};
|
|
6
6
|
export declare function Validator({ name, type, children }: ValidatorProps): JSX.Element;
|
|
7
|
-
|
|
7
|
+
type ValueValidatorProps = {
|
|
8
8
|
name: string;
|
|
9
9
|
type: any;
|
|
10
10
|
value: any;
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -21,4 +21,6 @@ import StepList, { StepItem } from './Components/StepList';
|
|
|
21
21
|
import PasswordInput from './Components/PasswordInput';
|
|
22
22
|
import DefaultValidatorOptions from './Components/DefaultValidatorOptions';
|
|
23
23
|
import DragAndDropArrow from './Components/DragAndDropArrow';
|
|
24
|
-
|
|
24
|
+
import BootstrapOptionsProvider, { useBootstrapOptions } from './Components/BootstrapOptions';
|
|
25
|
+
import BootstrapModal from './Components/BootstrapModal';
|
|
26
|
+
export { ThemeProvider, useTheme, useAllThemes, useIsMobile, useMenuState, DefaultValidatorOptions, PasswordInput, StepList, StepItem, TopProgressBar, CRUD, ModalEntityEditor, CRUDActions, Relative, ApiSelect, Preview, ExcelExportButton, ExternalLoginButton, SingleFilePicker, MultiFilePicker, ImagePicker, BootstrapTable, EntityEditor, GoToTop, Validator, ValueValidator, ValidationErrors, LoadingButton, BootstrapDataTable, IdColumn, Column, ActionsColumn, Actions, useDataTableContext, RowRenderer, LanguageProvider, useLanguage, LanguageSwitcher, ErrorBoundary, CheckBox, DragAndDropArrow, useBootstrapOptions, BootstrapOptionsProvider, BootstrapModal };
|
package/lib/esm/index.js
CHANGED
|
@@ -21,4 +21,6 @@ import StepList, { StepItem } from './Components/StepList';
|
|
|
21
21
|
import PasswordInput from './Components/PasswordInput';
|
|
22
22
|
import DefaultValidatorOptions from './Components/DefaultValidatorOptions';
|
|
23
23
|
import DragAndDropArrow from './Components/DragAndDropArrow';
|
|
24
|
-
|
|
24
|
+
import BootstrapOptionsProvider, { useBootstrapOptions } from './Components/BootstrapOptions';
|
|
25
|
+
import BootstrapModal from './Components/BootstrapModal';
|
|
26
|
+
export { ThemeProvider, useTheme, useAllThemes, useIsMobile, useMenuState, DefaultValidatorOptions, PasswordInput, StepList, StepItem, TopProgressBar, CRUD, ModalEntityEditor, CRUDActions, Relative, ApiSelect, Preview, ExcelExportButton, ExternalLoginButton, SingleFilePicker, MultiFilePicker, ImagePicker, BootstrapTable, EntityEditor, GoToTop, Validator, ValueValidator, ValidationErrors, LoadingButton, BootstrapDataTable, IdColumn, Column, ActionsColumn, Actions, useDataTableContext, RowRenderer, LanguageProvider, useLanguage, LanguageSwitcher, ErrorBoundary, CheckBox, DragAndDropArrow, useBootstrapOptions, BootstrapOptionsProvider, BootstrapModal };
|
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.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "^18.2.0",
|
|
29
29
|
"react-dom": "^18.2.0",
|
|
30
|
-
"react-intl": "^
|
|
31
|
-
"react-router-dom": "^6.
|
|
30
|
+
"react-intl": "^6.2.5",
|
|
31
|
+
"react-router-dom": "^6.5.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@emotion/react": "^11.10.5",
|
|
35
|
-
"@fortawesome/fontawesome-free": "^6.2.
|
|
36
|
-
"bootstrap": "^5.2.
|
|
35
|
+
"@fortawesome/fontawesome-free": "^6.2.1",
|
|
36
|
+
"bootstrap": "^5.2.3",
|
|
37
37
|
"file-dialog": "^0.0.8",
|
|
38
38
|
"modal-cropper": "^1.2.3",
|
|
39
39
|
"nprogress": "^0.2.0",
|
|
@@ -42,17 +42,17 @@
|
|
|
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
|
-
"react-responsive": "^9.0.
|
|
46
|
-
"react-select": "^5.
|
|
45
|
+
"react-responsive": "^9.0.2",
|
|
46
|
+
"react-select": "^5.7.0",
|
|
47
47
|
"reactstrap": "^9.1.5",
|
|
48
48
|
"rewire": "^6.0.0",
|
|
49
|
-
"sweetalert2": "^11.6.
|
|
49
|
+
"sweetalert2": "^11.6.16"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@types/react": "^18.0.
|
|
52
|
+
"@types/react": "^18.0.26",
|
|
53
53
|
"cross-env": "^7.0.3",
|
|
54
54
|
"nodemon": "^2.0.20",
|
|
55
|
-
"react-intl": "^6.2.
|
|
56
|
-
"typescript": "^4.
|
|
55
|
+
"react-intl": "^6.2.5",
|
|
56
|
+
"typescript": "^4.9.4"
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Modal, ModalProps} from "reactstrap";
|
|
3
|
+
import { useBootstrapOptions } from "./BootstrapOptions";
|
|
4
|
+
|
|
5
|
+
export default function BootstrapModal(props: ModalProps) {
|
|
6
|
+
const bsOptions = useBootstrapOptions();
|
|
7
|
+
|
|
8
|
+
return <Modal {...props} toggle={bsOptions.noCloseModal ? undefined : props.toggle} />;
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, {createContext, ReactNode, useContext, useMemo} from "react";
|
|
2
|
+
import BootstrapOptions from "./BootstrapOptions";
|
|
3
|
+
|
|
4
|
+
interface BootstrapOptions {
|
|
5
|
+
noCloseModal: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface BootstrapOptionsProviderProps extends BootstrapOptions {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const BootstrapOptionsContext = createContext<BootstrapOptions>({
|
|
13
|
+
noCloseModal: false
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export function useBootstrapOptions() {
|
|
17
|
+
return useContext(BootstrapOptionsContext);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function BootstrapOptionsProvider({children,noCloseModal}: BootstrapOptionsProviderProps) {
|
|
21
|
+
const options = useMemo(() => ({noCloseModal}), [noCloseModal]);
|
|
22
|
+
return <BootstrapOptionsContext.Provider value={options}>
|
|
23
|
+
{ children }
|
|
24
|
+
</BootstrapOptionsContext.Provider>;
|
|
25
|
+
}
|
package/src/Components/CRUD.tsx
CHANGED
|
@@ -5,6 +5,8 @@ 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';
|
|
7
7
|
import BootstrapDataTable, { Actions, BootstrapTableProps } from './BootstrapDataTable';
|
|
8
|
+
import BootstrapModal from './BootstrapModal';
|
|
9
|
+
import {useBootstrapOptions} from "./BootstrapOptions";
|
|
8
10
|
|
|
9
11
|
type ModalEntityEditorParams = {
|
|
10
12
|
entity: any;
|
|
@@ -57,7 +59,7 @@ export function ModalEntityEditor({ entity, title, size, url, onReload, disabled
|
|
|
57
59
|
|
|
58
60
|
return <>
|
|
59
61
|
{ (saved || !open) && url && <Navigate to={url} replace />}
|
|
60
|
-
<
|
|
62
|
+
<BootstrapModal isOpen size={size} toggle={() => url ? setOpen(false) : onReload(null)} fade={false}>
|
|
61
63
|
{ title && <ModalHeader toggle={() => url ? setOpen(false) : onReload(null)}>
|
|
62
64
|
<b>{ title }</b>
|
|
63
65
|
</ModalHeader> }
|
|
@@ -83,7 +85,7 @@ export function ModalEntityEditor({ entity, title, size, url, onReload, disabled
|
|
|
83
85
|
</ModalFooter>
|
|
84
86
|
</Form>
|
|
85
87
|
</ValidatorProvider>
|
|
86
|
-
</
|
|
88
|
+
</BootstrapModal>
|
|
87
89
|
</>;
|
|
88
90
|
}
|
|
89
91
|
|
|
@@ -130,6 +132,8 @@ export default function CRUD(props: CRUDProps) {
|
|
|
130
132
|
{ !noAdd && <Route path="create" element={<ComponentWrapper Component={Component} url={url} onReload={reload} {...(defaultParams || {})} />} /> }
|
|
131
133
|
<Route path=":id/edit" element={<ComponentWrapper Component={Component} url={url} onReload={reload} {...(defaultParams || {})} />} />
|
|
132
134
|
</Routes>
|
|
133
|
-
<BootstrapDataTable innerRef={ref} add={(!noAdd && "create") || undefined} {...props} url={apiUrl || url}
|
|
135
|
+
<BootstrapDataTable innerRef={ref} add={(!noAdd && "create") || undefined} {...props} url={apiUrl || url}>
|
|
136
|
+
{props.children}
|
|
137
|
+
</BootstrapDataTable>
|
|
134
138
|
</UrlContext.Provider>;
|
|
135
139
|
}
|
|
@@ -4,7 +4,6 @@ import { FormattedMessage } from "react-intl";
|
|
|
4
4
|
import { Alert, Form } from 'reactstrap';
|
|
5
5
|
import LoadingButton from "../Components/LoadingButton";
|
|
6
6
|
import { ValidationErrors } from './Validator';
|
|
7
|
-
import { Navigate } from 'react-router-dom';
|
|
8
7
|
|
|
9
8
|
type EntityEditorParams = {
|
|
10
9
|
entity: any;
|
|
@@ -9,7 +9,8 @@ import DragAndDropArrow from './DragAndDropArrow';
|
|
|
9
9
|
const photo_ext = ["png", "jpg", "jpeg", "svg"];
|
|
10
10
|
|
|
11
11
|
function is_photo(name) {
|
|
12
|
-
|
|
12
|
+
const sp = (name || '').split('.');
|
|
13
|
+
return photo_ext.indexOf((sp[sp.length - 1] || '').toLowerCase()) !== -1;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
function is_absolute(url) {
|
|
@@ -39,7 +40,7 @@ export function Relative({ children }: RelativeProps) {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
export function Preview({ value }) {
|
|
42
|
-
const name = value.$name;
|
|
43
|
+
const name = value.$name || value.name;
|
|
43
44
|
const src = value.$blob_url || value.$src;
|
|
44
45
|
|
|
45
46
|
if (is_photo(name)) {
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import {FormattedMessage} from "react-intl";
|
|
3
3
|
|
|
4
4
|
export default class GoToTop extends React.Component {
|
|
5
|
-
|
|
6
5
|
state = {show: false};
|
|
7
6
|
|
|
8
7
|
scrollTop(e) {
|
|
@@ -12,7 +11,7 @@ export default class GoToTop extends React.Component {
|
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
handleScroll(e) {
|
|
15
|
-
|
|
14
|
+
const newShow = window.scrollY > 100;
|
|
16
15
|
if (newShow !== this.state.show) {
|
|
17
16
|
this.setState({show: newShow});
|
|
18
17
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { createContext, Dispatch, useContext, useEffect, useMemo, useReducer, useRef } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useLocalStorage } from "react-admin-base";
|
|
3
3
|
|
|
4
4
|
const ThemeContext = createContext(null as any);
|
|
5
5
|
const AllThemesContext = createContext(null as any);
|
|
@@ -2,16 +2,12 @@ import NProgress from 'nprogress';
|
|
|
2
2
|
import React, { useEffect } from 'react';
|
|
3
3
|
import { useAuth } from "react-admin-base";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default function TopProgressBar({ children }: TopProgressBarProps): React.ReactNode {
|
|
5
|
+
export default function TopProgressBar() {
|
|
10
6
|
const [ api ] = useAuth();
|
|
11
7
|
|
|
12
8
|
useEffect(function() {
|
|
13
9
|
return api.set_hook(() => NProgress.start(), () => NProgress.done());
|
|
14
10
|
}, [api.set_hook]);
|
|
15
11
|
|
|
16
|
-
return
|
|
12
|
+
return null;
|
|
17
13
|
}
|
package/src/index.ts
CHANGED
|
@@ -22,6 +22,8 @@ import StepList, { StepItem } from './Components/StepList';
|
|
|
22
22
|
import PasswordInput from './Components/PasswordInput';
|
|
23
23
|
import DefaultValidatorOptions from './Components/DefaultValidatorOptions';
|
|
24
24
|
import DragAndDropArrow from './Components/DragAndDropArrow';
|
|
25
|
+
import BootstrapOptionsProvider, { useBootstrapOptions } from './Components/BootstrapOptions';
|
|
26
|
+
import BootstrapModal from './Components/BootstrapModal';
|
|
25
27
|
|
|
26
28
|
export {
|
|
27
29
|
ThemeProvider, useTheme, useAllThemes,
|
|
@@ -49,5 +51,8 @@ export {
|
|
|
49
51
|
LanguageProvider, useLanguage, LanguageSwitcher,
|
|
50
52
|
ErrorBoundary,
|
|
51
53
|
CheckBox,
|
|
52
|
-
DragAndDropArrow
|
|
54
|
+
DragAndDropArrow,
|
|
55
|
+
useBootstrapOptions,
|
|
56
|
+
BootstrapOptionsProvider,
|
|
57
|
+
BootstrapModal
|
|
53
58
|
};
|