react-admin-base-bootstrap 0.8.23 → 0.9.1
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 +0 -0
- package/lib/esm/Components/ThemeProvider.d.ts +12 -0
- package/lib/esm/Components/ThemeProvider.js +49 -0
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js +2 -2
- package/package.json +12 -16
- package/src/Components/ThemeProvider.tsx +42 -2
- package/src/index.ts +2 -2
- package/build.js +0 -24
- package/watch.js +0 -58
package/bun.lockb
CHANGED
|
Binary file
|
|
@@ -6,3 +6,15 @@ export default function ThemeProvider({ themes, defaultTheme, children }: {
|
|
|
6
6
|
defaultTheme: any;
|
|
7
7
|
children: any;
|
|
8
8
|
}): React.JSX.Element;
|
|
9
|
+
export declare function rawCssLoader(cb: any): Promise<{
|
|
10
|
+
default: {
|
|
11
|
+
use: () => Promise<void>;
|
|
12
|
+
unuse: () => void;
|
|
13
|
+
};
|
|
14
|
+
}>;
|
|
15
|
+
export declare function urlCssLoader(link: any): Promise<{
|
|
16
|
+
default: {
|
|
17
|
+
use: () => void;
|
|
18
|
+
unuse: () => void;
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import React, { createContext, useContext, useEffect, useMemo } from "react";
|
|
2
11
|
import { useLocalStorage } from "react-admin-base";
|
|
3
12
|
const ThemeContext = createContext(null);
|
|
@@ -26,3 +35,43 @@ export default function ThemeProvider({ themes, defaultTheme, children }) {
|
|
|
26
35
|
return React.createElement(AllThemesContext.Provider, { value: themes },
|
|
27
36
|
React.createElement(ThemeContext.Provider, { value: val }, children));
|
|
28
37
|
}
|
|
38
|
+
export function rawCssLoader(cb) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const styleTag = document.createElement('style');
|
|
41
|
+
let loaded = false;
|
|
42
|
+
return {
|
|
43
|
+
default: {
|
|
44
|
+
use: function () {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
document.head.appendChild(styleTag);
|
|
47
|
+
if (!loaded) {
|
|
48
|
+
loaded = true;
|
|
49
|
+
styleTag.innerHTML = yield cb();
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
unuse: function () {
|
|
54
|
+
document.head.removeChild(styleTag);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export function urlCssLoader(link) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const linkTag = document.createElement('link');
|
|
63
|
+
linkTag.rel = 'stylesheet';
|
|
64
|
+
linkTag.type = 'text/css';
|
|
65
|
+
linkTag.href = link;
|
|
66
|
+
return {
|
|
67
|
+
default: {
|
|
68
|
+
use: function () {
|
|
69
|
+
document.head.appendChild(linkTag);
|
|
70
|
+
},
|
|
71
|
+
unuse: function () {
|
|
72
|
+
document.head.removeChild(linkTag);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -16,11 +16,11 @@ import CheckBox from './Components/CheckBox';
|
|
|
16
16
|
import ErrorBoundary from './Components/ErrorBoundary';
|
|
17
17
|
import { useMenuState, useIsMobile } from './Components/MenuState';
|
|
18
18
|
import TopProgressBar from './Components/TopProgressBar';
|
|
19
|
-
import ThemeProvider, { useTheme, useAllThemes } from './Components/ThemeProvider';
|
|
19
|
+
import ThemeProvider, { useTheme, useAllThemes, rawCssLoader, urlCssLoader } from './Components/ThemeProvider';
|
|
20
20
|
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
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, CustomRenderer, LanguageProvider, useLanguage, LanguageSwitcher, ErrorBoundary, CheckBox, DragAndDropArrow, useBootstrapOptions, BootstrapOptionsProvider, BootstrapModal, CreateSelect, useRow, useRows };
|
|
26
|
+
export { ThemeProvider, useTheme, useAllThemes, rawCssLoader, urlCssLoader, 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, CustomRenderer, LanguageProvider, useLanguage, LanguageSwitcher, ErrorBoundary, CheckBox, DragAndDropArrow, useBootstrapOptions, BootstrapOptionsProvider, BootstrapModal, CreateSelect, useRow, useRows };
|
package/lib/esm/index.js
CHANGED
|
@@ -16,11 +16,11 @@ import CheckBox from './Components/CheckBox';
|
|
|
16
16
|
import ErrorBoundary from './Components/ErrorBoundary';
|
|
17
17
|
import { useMenuState, useIsMobile } from './Components/MenuState';
|
|
18
18
|
import TopProgressBar from './Components/TopProgressBar';
|
|
19
|
-
import ThemeProvider, { useTheme, useAllThemes } from './Components/ThemeProvider';
|
|
19
|
+
import ThemeProvider, { useTheme, useAllThemes, rawCssLoader, urlCssLoader } from './Components/ThemeProvider';
|
|
20
20
|
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
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, CustomRenderer, LanguageProvider, useLanguage, LanguageSwitcher, ErrorBoundary, CheckBox, DragAndDropArrow, useBootstrapOptions, BootstrapOptionsProvider, BootstrapModal, CreateSelect, useRow, useRows };
|
|
26
|
+
export { ThemeProvider, useTheme, useAllThemes, rawCssLoader, urlCssLoader, 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, CustomRenderer, LanguageProvider, useLanguage, LanguageSwitcher, ErrorBoundary, CheckBox, DragAndDropArrow, useBootstrapOptions, BootstrapOptionsProvider, BootstrapModal, CreateSelect, useRow, useRows };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-admin-base-bootstrap",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -27,32 +27,28 @@
|
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "^18.2.0",
|
|
29
29
|
"react-dom": "^18.2.0",
|
|
30
|
-
"react-intl": "^6.
|
|
31
|
-
"react-router-dom": "^6.
|
|
30
|
+
"react-intl": "^6.6.1",
|
|
31
|
+
"react-router-dom": "^6.21.3"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@emotion/react": "^11.11.
|
|
35
|
-
"@fortawesome/fontawesome-free": "^6.
|
|
36
|
-
"bootstrap": "^5.3.
|
|
34
|
+
"@emotion/react": "^11.11.3",
|
|
35
|
+
"@fortawesome/fontawesome-free": "^6.5.1",
|
|
36
|
+
"bootstrap": "^5.3.2",
|
|
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.
|
|
41
|
+
"react-admin-base": "^0.9.0",
|
|
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.
|
|
47
|
-
"reactstrap": "^9.2.
|
|
48
|
-
"
|
|
49
|
-
"sweetalert2": "^11.7.12"
|
|
46
|
+
"react-select": "^5.8.0",
|
|
47
|
+
"reactstrap": "^9.2.2",
|
|
48
|
+
"sweetalert2": "^11.10.4"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"nodemon": "^2.0.22",
|
|
55
|
-
"react-intl": "^6.4.4",
|
|
56
|
-
"typescript": "^5.1.3"
|
|
51
|
+
"nodemon": "^3.0.3",
|
|
52
|
+
"typescript": "^5.3.3"
|
|
57
53
|
}
|
|
58
54
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext,
|
|
1
|
+
import React, { createContext, useContext, useEffect, useMemo, useReducer, useRef } from "react";
|
|
2
2
|
import { useLocalStorage } from "react-admin-base";
|
|
3
3
|
|
|
4
4
|
const ThemeContext = createContext(null as any);
|
|
@@ -9,7 +9,7 @@ export function useTheme() {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export function useAllThemes() {
|
|
12
|
-
return useContext(AllThemesContext);
|
|
12
|
+
return useContext(AllThemesContext);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export default function ThemeProvider({ themes, defaultTheme, children }) {
|
|
@@ -38,3 +38,43 @@ export default function ThemeProvider({ themes, defaultTheme, children }) {
|
|
|
38
38
|
</ThemeContext.Provider>
|
|
39
39
|
</AllThemesContext.Provider>;
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
export async function rawCssLoader(cb) {
|
|
43
|
+
const styleTag = document.createElement('style');
|
|
44
|
+
|
|
45
|
+
let loaded = false;
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
default: {
|
|
49
|
+
use: async function() {
|
|
50
|
+
document.head.appendChild(styleTag);
|
|
51
|
+
|
|
52
|
+
if (!loaded) {
|
|
53
|
+
loaded = true;
|
|
54
|
+
styleTag.innerHTML = await cb();
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
unuse: function() {
|
|
58
|
+
document.head.removeChild(styleTag);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export async function urlCssLoader(link) {
|
|
65
|
+
const linkTag = document.createElement('link');
|
|
66
|
+
linkTag.rel = 'stylesheet';
|
|
67
|
+
linkTag.type = 'text/css';
|
|
68
|
+
linkTag.href = link;
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
default: {
|
|
72
|
+
use: function() {
|
|
73
|
+
document.head.appendChild(linkTag);
|
|
74
|
+
},
|
|
75
|
+
unuse: function() {
|
|
76
|
+
document.head.removeChild(linkTag);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -17,7 +17,7 @@ import CheckBox from './Components/CheckBox';
|
|
|
17
17
|
import ErrorBoundary from './Components/ErrorBoundary';
|
|
18
18
|
import { useMenuState, useIsMobile } from './Components/MenuState';
|
|
19
19
|
import TopProgressBar from './Components/TopProgressBar';
|
|
20
|
-
import ThemeProvider, { useTheme, useAllThemes } from './Components/ThemeProvider';
|
|
20
|
+
import ThemeProvider, { useTheme, useAllThemes, rawCssLoader, urlCssLoader } from './Components/ThemeProvider';
|
|
21
21
|
import StepList, { StepItem } from './Components/StepList';
|
|
22
22
|
import PasswordInput from './Components/PasswordInput';
|
|
23
23
|
import DefaultValidatorOptions from './Components/DefaultValidatorOptions';
|
|
@@ -26,7 +26,7 @@ import BootstrapOptionsProvider, { useBootstrapOptions } from './Components/Boot
|
|
|
26
26
|
import BootstrapModal from './Components/BootstrapModal';
|
|
27
27
|
|
|
28
28
|
export {
|
|
29
|
-
ThemeProvider, useTheme, useAllThemes,
|
|
29
|
+
ThemeProvider, useTheme, useAllThemes, rawCssLoader, urlCssLoader,
|
|
30
30
|
useIsMobile, useMenuState,
|
|
31
31
|
DefaultValidatorOptions,
|
|
32
32
|
PasswordInput,
|
package/build.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const rewire = require('rewire');
|
|
3
|
-
const webpackConfig = rewire('react-scripts/scripts/build');
|
|
4
|
-
const config = webpackConfig.__get__('config');
|
|
5
|
-
|
|
6
|
-
addLazyLoadingStyleLoader(config.module);
|
|
7
|
-
|
|
8
|
-
function addLazyLoadingStyleLoader(config) {
|
|
9
|
-
const cssLoader = config.rules[1].oneOf[5];
|
|
10
|
-
|
|
11
|
-
config.rules[1].oneOf.splice(5, 2, {
|
|
12
|
-
...cssLoader,
|
|
13
|
-
use: [
|
|
14
|
-
{
|
|
15
|
-
loader: require.resolve('style-loader'),
|
|
16
|
-
options: {
|
|
17
|
-
injectType: 'lazyStyleTag'
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
cssLoader.use[1],
|
|
21
|
-
cssLoader.use[2]
|
|
22
|
-
]
|
|
23
|
-
});
|
|
24
|
-
}
|
package/watch.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const rewire = require('rewire');
|
|
3
|
-
const webpackConfig = rewire('react-scripts/scripts/start');
|
|
4
|
-
const oldConfigFactory = webpackConfig.__get__('configFactory');
|
|
5
|
-
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
const path = require('path');
|
|
8
|
-
|
|
9
|
-
webpackConfig.__set__('configFactory', function(env) {
|
|
10
|
-
const config = oldConfigFactory(env);
|
|
11
|
-
|
|
12
|
-
// disable use modules outside of src
|
|
13
|
-
config.resolve.plugins = config.resolve.plugins.filter(plugin => !(plugin instanceof ModuleScopePlugin));
|
|
14
|
-
|
|
15
|
-
// disable local node_modules/ path
|
|
16
|
-
config.resolve.modules.shift();
|
|
17
|
-
|
|
18
|
-
// add aliased packages from /opt/packages
|
|
19
|
-
for (const alias of find_custom_packages('/opt/packages')){
|
|
20
|
-
config.resolve.alias[alias.name] = alias.path;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
addLazyLoadingStyleLoader(config.module);
|
|
24
|
-
|
|
25
|
-
console.log(config);
|
|
26
|
-
//process.exit(0);
|
|
27
|
-
|
|
28
|
-
return config;
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
function* find_custom_packages(location) {
|
|
32
|
-
const dir = fs.opendirSync(location, { withFileTypes: true });
|
|
33
|
-
let dirent;
|
|
34
|
-
while ((dirent = dir.readSync()) !== null) {
|
|
35
|
-
if (dirent.isSymbolicLink()) {
|
|
36
|
-
yield {name: dirent.name, path: fs.realpathSync(path.join(location, dirent.name))};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
dir.closeSync();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function addLazyLoadingStyleLoader(config) {
|
|
43
|
-
const cssLoader = config.rules[1].oneOf[5];
|
|
44
|
-
|
|
45
|
-
config.rules[1].oneOf.splice(5, 2, {
|
|
46
|
-
...cssLoader,
|
|
47
|
-
use: [
|
|
48
|
-
{
|
|
49
|
-
loader: cssLoader.use[0],
|
|
50
|
-
options: {
|
|
51
|
-
injectType: 'lazyStyleTag'
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
cssLoader.use[1],
|
|
55
|
-
cssLoader.use[2]
|
|
56
|
-
]
|
|
57
|
-
});
|
|
58
|
-
}
|