asab_webui_components 25.6.2 → 26.1.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/dist/abc/Service.js +0 -1
- package/dist/components/AdvancedCard/AdvancedCard.js +4 -4
- package/dist/components/AdvancedCard/AdvancedCard.jsx +5 -5
- package/dist/components/AsabReactJson/AsabReactJson.js +3 -3
- package/dist/components/AsabReactJson/AsabReactJson.jsx +4 -4
- package/dist/components/Context/store/AppStore.js +68 -0
- package/dist/components/Context/store/AppStore.jsx +59 -0
- package/dist/components/Context/store/reducer/reducerRegistry.js +44 -0
- package/dist/components/Context/store/reducer/reducerRegistry.jsx +31 -0
- package/dist/components/DataTable/Table.js +4 -7
- package/dist/components/DataTable/index.js +2 -2
- package/dist/components/DateTime/utils/useDateFNSLocale.js +2 -2
- package/dist/index.js +27 -1
- package/dist/seacat-auth/components/ButtonWithAuthz.js +2 -3
- package/dist/seacat-auth/components/Credentials/Credentials.js +2 -5
- package/dist/seacat-auth/components/LinkWithAuthz.js +2 -3
- package/dist/seacat-auth/components/Switches/ControlledSwitchWithAuthz.js +2 -3
- package/dist/seacat-auth/components/Switches/UncontrolledSwitchWithAuthz.js +2 -3
- package/dist/seacat-auth/utils/isAuthorized.js +7 -9
- package/package.json +5 -7
package/dist/abc/Service.js
CHANGED
|
@@ -6,17 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.AdvancedCard = AdvancedCard;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
10
|
-
var _reactJsonView = _interopRequireDefault(require("react-json-view"));
|
|
9
|
+
var _reactJsonView = _interopRequireDefault(require("@microlink/react-json-view"));
|
|
11
10
|
var _reactstrap = require("reactstrap");
|
|
11
|
+
var _AppStore = require("../Context/store/AppStore.js");
|
|
12
12
|
// This is a card that displays data on the page in JSON format after hotkeys are pressed `ctrl + shift + 1`
|
|
13
13
|
function AdvancedCard(_ref) {
|
|
14
14
|
var {
|
|
15
15
|
data,
|
|
16
16
|
cardClassname = ''
|
|
17
17
|
} = _ref;
|
|
18
|
-
var theme = (0,
|
|
19
|
-
var advmode = (0,
|
|
18
|
+
var theme = (0, _AppStore.useAppSelector)(state => state.theme);
|
|
19
|
+
var advmode = (0, _AppStore.useAppSelector)(state => {
|
|
20
20
|
var _state$advmode;
|
|
21
21
|
return (_state$advmode = state.advmode) === null || _state$advmode === void 0 ? void 0 : _state$advmode.enabled;
|
|
22
22
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import ReactJson from 'react-json-view';
|
|
2
|
+
import ReactJsonView from '@microlink/react-json-view'
|
|
4
3
|
import { Card, CardHeader, CardBody } from 'reactstrap';
|
|
4
|
+
import { useAppSelector } from '../Context/store/AppStore.jsx';
|
|
5
5
|
|
|
6
6
|
// This is a card that displays data on the page in JSON format after hotkeys are pressed `ctrl + shift + 1`
|
|
7
7
|
export function AdvancedCard ({ data, cardClassname='' }) {
|
|
8
|
-
const theme =
|
|
9
|
-
const advmode =
|
|
8
|
+
const theme = useAppSelector(state => state.theme);
|
|
9
|
+
const advmode = useAppSelector(state => state.advmode?.enabled);
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
12
|
advmode ?
|
|
@@ -20,7 +20,7 @@ export function AdvancedCard ({ data, cardClassname='' }) {
|
|
|
20
20
|
</div>
|
|
21
21
|
</CardHeader>
|
|
22
22
|
<CardBody>
|
|
23
|
-
<
|
|
23
|
+
<ReactJsonView
|
|
24
24
|
src={data}
|
|
25
25
|
theme={(theme === 'dark') ? 'chalk' : 'rjv-default'}
|
|
26
26
|
name={false}
|
|
@@ -8,8 +8,8 @@ exports.AsabReactJson = void 0;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var _reactJsonView = _interopRequireDefault(require("react-json-view"));
|
|
12
|
-
var
|
|
11
|
+
var _reactJsonView = _interopRequireDefault(require("@microlink/react-json-view"));
|
|
12
|
+
var _AppStore = require("../Context/store/AppStore.js");
|
|
13
13
|
var _excluded = ["src"];
|
|
14
14
|
/*
|
|
15
15
|
Props to pass on for AsabReactJson:
|
|
@@ -23,7 +23,7 @@ var AsabReactJson = _ref => {
|
|
|
23
23
|
src
|
|
24
24
|
} = _ref,
|
|
25
25
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
26
|
-
var theme = (0,
|
|
26
|
+
var theme = (0, _AppStore.useAppSelector)(state => state.theme);
|
|
27
27
|
|
|
28
28
|
// The function looks through the received data and if there is a BigInt there, it transforms it into a string
|
|
29
29
|
var convertBigIntToString = data => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import ReactJsonView from '@microlink/react-json-view'
|
|
4
|
+
import { useAppSelector } from '../Context/store/AppStore.jsx';
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
Props to pass on for AsabReactJson:
|
|
@@ -11,7 +11,7 @@ import { useSelector } from 'react-redux';
|
|
|
11
11
|
|
|
12
12
|
// Component wraps ReactJson to handle BigInt numbers and turn them into strings
|
|
13
13
|
export const AsabReactJson = ({src, ...props}) => {
|
|
14
|
-
const theme =
|
|
14
|
+
const theme = useAppSelector(state => state.theme);
|
|
15
15
|
|
|
16
16
|
// The function looks through the received data and if there is a BigInt there, it transforms it into a string
|
|
17
17
|
const convertBigIntToString = (data) => {
|
|
@@ -28,7 +28,7 @@ export const AsabReactJson = ({src, ...props}) => {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<
|
|
31
|
+
<ReactJsonView
|
|
32
32
|
src={convertBigIntToString((src))}
|
|
33
33
|
theme={(theme === 'dark') ? 'chalk' : 'rjv-default'}
|
|
34
34
|
{...props}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.AppStoreProvider = AppStoreProvider;
|
|
8
|
+
exports.useAppSelector = useAppSelector;
|
|
9
|
+
exports.useAppStore = useAppStore;
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _reducerRegistry = require("./reducer/reducerRegistry.js");
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // App store context (redux like App store)
|
|
16
|
+
// Method to combine reducers
|
|
17
|
+
function combineReducers(reducers) {
|
|
18
|
+
return (state, action) => Object.keys(reducers).reduce((acc, key) => _objectSpread(_objectSpread({}, acc), {}, {
|
|
19
|
+
[key]: reducers[key](state[key], action)
|
|
20
|
+
}), state);
|
|
21
|
+
}
|
|
22
|
+
var AppStoreContext = /*#__PURE__*/(0, _react.createContext)();
|
|
23
|
+
|
|
24
|
+
// App store
|
|
25
|
+
function AppStoreProvider(_ref) {
|
|
26
|
+
var {
|
|
27
|
+
children,
|
|
28
|
+
app
|
|
29
|
+
} = _ref;
|
|
30
|
+
// Keep the initial state from the registry at mount
|
|
31
|
+
var initialState = (0, _reducerRegistry.getInitialStates)();
|
|
32
|
+
// Pulls the current reducer set on every action:
|
|
33
|
+
var reducerFn = (0, _react.useCallback)((state, action) => {
|
|
34
|
+
return combineReducers((0, _reducerRegistry.getReducers)())(state, action);
|
|
35
|
+
}, []);
|
|
36
|
+
var [state, dispatch] = (0, _react.useReducer)(reducerFn, initialState);
|
|
37
|
+
|
|
38
|
+
// Set the global dispatch and state references
|
|
39
|
+
app.AppStore.dispatch = dispatch;
|
|
40
|
+
app.AppStore.state = state;
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(AppStoreContext.Provider, {
|
|
42
|
+
value: {
|
|
43
|
+
state,
|
|
44
|
+
dispatch
|
|
45
|
+
}
|
|
46
|
+
}, children);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// App store hook
|
|
50
|
+
function useAppStore() {
|
|
51
|
+
/*
|
|
52
|
+
Returns provider context i.e. dispatch
|
|
53
|
+
const { dispatch } = useAppStore();
|
|
54
|
+
*/
|
|
55
|
+
return (0, _react.useContext)(AppStoreContext);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// App store selector
|
|
59
|
+
function useAppSelector(selector) {
|
|
60
|
+
/*
|
|
61
|
+
Returns provider context state
|
|
62
|
+
const myState = useAppSelector(state => state.myState);
|
|
63
|
+
*/
|
|
64
|
+
var {
|
|
65
|
+
state
|
|
66
|
+
} = useAppStore();
|
|
67
|
+
return selector(state);
|
|
68
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// App store context (redux like App store)
|
|
2
|
+
import React, { createContext, useReducer, useContext, useCallback } from 'react';
|
|
3
|
+
import { getReducers, getInitialStates } from './reducer/reducerRegistry.jsx';
|
|
4
|
+
|
|
5
|
+
// Method to combine reducers
|
|
6
|
+
function combineReducers(reducers) {
|
|
7
|
+
return (state, action) =>
|
|
8
|
+
Object.keys(reducers).reduce(
|
|
9
|
+
(acc, key) => ({
|
|
10
|
+
...acc,
|
|
11
|
+
[key]: reducers[key](state[key], action),
|
|
12
|
+
}),
|
|
13
|
+
state
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const AppStoreContext = createContext();
|
|
18
|
+
|
|
19
|
+
// App store
|
|
20
|
+
export function AppStoreProvider({ children, app }) {
|
|
21
|
+
// Keep the initial state from the registry at mount
|
|
22
|
+
const initialState = getInitialStates();
|
|
23
|
+
// Pulls the current reducer set on every action:
|
|
24
|
+
const reducerFn = useCallback((state, action) => {
|
|
25
|
+
return combineReducers(getReducers())(state, action);
|
|
26
|
+
}, []);
|
|
27
|
+
|
|
28
|
+
const [state, dispatch] = useReducer(reducerFn, initialState);
|
|
29
|
+
|
|
30
|
+
// Set the global dispatch and state references
|
|
31
|
+
app.AppStore.dispatch = dispatch;
|
|
32
|
+
app.AppStore.state = state;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<AppStoreContext.Provider value={{ state, dispatch }}>
|
|
36
|
+
{children}
|
|
37
|
+
</AppStoreContext.Provider>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// App store hook
|
|
42
|
+
export function useAppStore() {
|
|
43
|
+
/*
|
|
44
|
+
Returns provider context i.e. dispatch
|
|
45
|
+
const { dispatch } = useAppStore();
|
|
46
|
+
*/
|
|
47
|
+
return useContext(AppStoreContext);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// App store selector
|
|
51
|
+
export function useAppSelector(selector) {
|
|
52
|
+
/*
|
|
53
|
+
Returns provider context state
|
|
54
|
+
|
|
55
|
+
const myState = useAppSelector(state => state.myState);
|
|
56
|
+
*/
|
|
57
|
+
const { state } = useAppStore();
|
|
58
|
+
return selector(state);
|
|
59
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getInitialStates = getInitialStates;
|
|
8
|
+
exports.getReducers = getReducers;
|
|
9
|
+
exports.registerReducer = registerReducer;
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
+
// Reducer registry for dynamic reducer registration
|
|
14
|
+
var reducers = {};
|
|
15
|
+
var initialStates = {};
|
|
16
|
+
|
|
17
|
+
// Register reducer
|
|
18
|
+
function registerReducer(key, reducer) {
|
|
19
|
+
/*
|
|
20
|
+
The initial state is retrieved by calling the reducer with an undefined state
|
|
21
|
+
This can be handled because of default `state = initialState` pattern in the reducers
|
|
22
|
+
*/
|
|
23
|
+
var initialState = reducer(undefined, {
|
|
24
|
+
type: '@@ASAB_APP_STORE/INIT_STATE'
|
|
25
|
+
}); // @@ASAB_APP_STORE/INIT_STATE type used to avoid any potential reducer type collision
|
|
26
|
+
|
|
27
|
+
// Avoid overriding the reducer
|
|
28
|
+
if (reducers[key]) {
|
|
29
|
+
console.warn("".concat(key, ": reducer already registered."));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
reducers[key] = reducer;
|
|
33
|
+
initialStates[key] = initialState;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Get reducers
|
|
37
|
+
function getReducers() {
|
|
38
|
+
return _objectSpread({}, reducers);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Get initial states in AppStore
|
|
42
|
+
function getInitialStates() {
|
|
43
|
+
return _objectSpread({}, initialStates);
|
|
44
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Reducer registry for dynamic reducer registration
|
|
2
|
+
const reducers = {};
|
|
3
|
+
const initialStates = {};
|
|
4
|
+
|
|
5
|
+
// Register reducer
|
|
6
|
+
export function registerReducer(key, reducer) {
|
|
7
|
+
/*
|
|
8
|
+
The initial state is retrieved by calling the reducer with an undefined state
|
|
9
|
+
This can be handled because of default `state = initialState` pattern in the reducers
|
|
10
|
+
*/
|
|
11
|
+
const initialState = reducer(undefined, { type: '@@ASAB_APP_STORE/INIT_STATE' }); // @@ASAB_APP_STORE/INIT_STATE type used to avoid any potential reducer type collision
|
|
12
|
+
|
|
13
|
+
// Avoid overriding the reducer
|
|
14
|
+
if (reducers[key]) {
|
|
15
|
+
console.warn(`${key}: reducer already registered.`);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
reducers[key] = reducer;
|
|
20
|
+
initialStates[key] = initialState;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Get reducers
|
|
24
|
+
export function getReducers() {
|
|
25
|
+
return { ...reducers };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Get initial states in AppStore
|
|
29
|
+
export function getInitialStates() {
|
|
30
|
+
return { ...initialStates };
|
|
31
|
+
}
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _reactRedux = require("react-redux");
|
|
11
10
|
var _reactRouterDom = require("react-router-dom");
|
|
12
|
-
var _reactJsonView = _interopRequireDefault(require("react-json-view"));
|
|
11
|
+
var _reactJsonView = _interopRequireDefault(require("@microlink/react-json-view"));
|
|
13
12
|
var _reactstrap = require("reactstrap");
|
|
13
|
+
var _AppStore = require("../Context/store/AppStore.js");
|
|
14
14
|
var _DateTime = require("../DateTime/absolute/DateTime.js");
|
|
15
15
|
var _Buttons = require("./Buttons");
|
|
16
16
|
require("./DataTable.scss");
|
|
@@ -162,7 +162,7 @@ var TableRow = _ref3 => {
|
|
|
162
162
|
} = _ref3;
|
|
163
163
|
var [isAdvUnwrapped, setAdvUnwrapped] = (0, _react.useState)(false);
|
|
164
164
|
var [isSubUnwrapped, setSubUnwrapped] = (0, _react.useState)(collapseChildren == false ? true : false);
|
|
165
|
-
var theme = (0,
|
|
165
|
+
var theme = (0, _AppStore.useAppSelector)(state => state === null || state === void 0 ? void 0 : state.theme);
|
|
166
166
|
var getStyle = obj => {
|
|
167
167
|
if (rowStyle !== null && rowStyle !== void 0 && rowStyle.condition && rowStyle !== null && rowStyle !== void 0 && rowStyle.condition(obj)) {
|
|
168
168
|
return rowStyle.style;
|
|
@@ -268,7 +268,4 @@ var ASABTable = _ref4 => {
|
|
|
268
268
|
key: idx
|
|
269
269
|
}))));
|
|
270
270
|
};
|
|
271
|
-
var
|
|
272
|
-
theme: state.theme
|
|
273
|
-
});
|
|
274
|
-
var _default = exports.default = (0, _reactRedux.connect)(mapStateToProps)(ASABTable);
|
|
271
|
+
var _default = exports.default = ASABTable;
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.DataTable = DataTable;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _reactI18next = require("react-i18next");
|
|
10
|
-
var
|
|
10
|
+
var _AppStore = require("../Context/store/AppStore.js");
|
|
11
11
|
var _reactstrap = require("reactstrap");
|
|
12
12
|
var _Table = _interopRequireDefault(require("./Table"));
|
|
13
13
|
var _Pagination = _interopRequireDefault(require("./Pagination"));
|
|
@@ -56,7 +56,7 @@ function DataTable(_ref) {
|
|
|
56
56
|
var [isLimitOpen, setLimitDropdown] = (0, _react.useState)(false);
|
|
57
57
|
var timeoutRef = (0, _react.useRef)(null);
|
|
58
58
|
var [countDigit, setCountDigit] = (0, _react.useState)(1);
|
|
59
|
-
var advMode = (0,
|
|
59
|
+
var advMode = (0, _AppStore.useAppSelector)(state => state.advmode.enabled);
|
|
60
60
|
var {
|
|
61
61
|
t
|
|
62
62
|
} = (0, _reactI18next.useTranslation)();
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _AppStore = require("../../Context/store/AppStore.js");
|
|
10
10
|
var _cs = _interopRequireDefault(require("date-fns/locale/cs"));
|
|
11
11
|
// (possible exports: af, ar, arDZ, arEG, arMA, arSA, arTN, az, be, beTarask, bg, bn, bs, ca, cs, cy, da, de, deAT, el, enAU, enCA, enGB, enIE, enIN, enNZ, enUS, enZA, eo, es, et, eu, faIR, fi, fr, frCA, frCH, fy, gd, gl, gu, he, hi, hr, ht, hu, hy, id, is, it, itCH, ja, jaHira, ka, kk, km, kn, ko, lb, lt, lv, mk, mn, ms, mt, nb, nl, nlBE, nn, oc, pl, pt, ptBR, ro, ru, sk, sl, sq, sr, srLatn, sv, ta, te, th, tr, ug, uk, uz, uzCyrl, vi, zhCN, zhHK, zhTW)
|
|
12
12
|
|
|
@@ -32,7 +32,7 @@ var availableLocales = {
|
|
|
32
32
|
cs: _cs.default
|
|
33
33
|
};
|
|
34
34
|
var useDateFNSLocale = () => {
|
|
35
|
-
var language = (0,
|
|
35
|
+
var language = (0, _AppStore.useAppSelector)(state => state.language.current);
|
|
36
36
|
var [locale, setLocale] = (0, _react.useState)(undefined);
|
|
37
37
|
(0, _react.useEffect)(() => {
|
|
38
38
|
setLocale(availableLocales[language] || undefined);
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,12 @@ Object.defineProperty(exports, "AdvancedCard", {
|
|
|
10
10
|
return _AdvancedCard.AdvancedCard;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
+
Object.defineProperty(exports, "AppStoreProvider", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _AppStore.AppStoreProvider;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
13
19
|
Object.defineProperty(exports, "AsabReactJson", {
|
|
14
20
|
enumerable: true,
|
|
15
21
|
get: function get() {
|
|
@@ -208,6 +214,12 @@ Object.defineProperty(exports, "problemMarkers", {
|
|
|
208
214
|
return _problemMarkers.problemMarkers;
|
|
209
215
|
}
|
|
210
216
|
});
|
|
217
|
+
Object.defineProperty(exports, "registerReducer", {
|
|
218
|
+
enumerable: true,
|
|
219
|
+
get: function get() {
|
|
220
|
+
return _reducerRegistry.registerReducer;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
211
223
|
Object.defineProperty(exports, "removeFileExtension", {
|
|
212
224
|
enumerable: true,
|
|
213
225
|
get: function get() {
|
|
@@ -244,6 +256,18 @@ Object.defineProperty(exports, "translateFromContent", {
|
|
|
244
256
|
return _translateFromContent.translateFromContent;
|
|
245
257
|
}
|
|
246
258
|
});
|
|
259
|
+
Object.defineProperty(exports, "useAppSelector", {
|
|
260
|
+
enumerable: true,
|
|
261
|
+
get: function get() {
|
|
262
|
+
return _AppStore.useAppSelector;
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
Object.defineProperty(exports, "useAppStore", {
|
|
266
|
+
enumerable: true,
|
|
267
|
+
get: function get() {
|
|
268
|
+
return _AppStore.useAppStore;
|
|
269
|
+
}
|
|
270
|
+
});
|
|
247
271
|
Object.defineProperty(exports, "useDateFNSLocale", {
|
|
248
272
|
enumerable: true,
|
|
249
273
|
get: function get() {
|
|
@@ -303,9 +327,11 @@ var _problemMarkers = require("./utils/monaco/problemMarkers.js");
|
|
|
303
327
|
var _ResultCard = require("./components/ResultCard/ResultCard");
|
|
304
328
|
var _AdvancedCard = require("./components/AdvancedCard/AdvancedCard.js");
|
|
305
329
|
var _AsabReactJson = require("./components/AsabReactJson/AsabReactJson.js");
|
|
306
|
-
var _PubSubContext = require("./components/Context/PubSubContext");
|
|
307
330
|
var _FullscreenButton = require("./components/FullscreenButton.js");
|
|
308
331
|
var _AttentionRequiredBadge = require("./components/AttentionRequired/AttentionRequiredBadge.js");
|
|
309
332
|
var _RendererWrapper = require("./components/RendererWrapper/RendererWrapper.js");
|
|
333
|
+
var _PubSubContext = require("./components/Context/PubSubContext");
|
|
334
|
+
var _AppStore = require("./components/Context/store/AppStore.js");
|
|
335
|
+
var _reducerRegistry = require("./components/Context/store/reducer/reducerRegistry.js");
|
|
310
336
|
var _Pagination = _interopRequireDefault(require("./components/DataTable/Pagination"));
|
|
311
337
|
var _DataTable2 = require("./components/DataTable");
|
|
@@ -38,12 +38,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
38
38
|
|
|
39
39
|
Example:
|
|
40
40
|
|
|
41
|
-
import { ButtonWithAuthz } from 'asab_webui_components';
|
|
42
|
-
import { useSelector } from 'react-redux';
|
|
41
|
+
import { ButtonWithAuthz, useAppSelector } from 'asab_webui_components';
|
|
43
42
|
|
|
44
43
|
...
|
|
45
44
|
|
|
46
|
-
const resources =
|
|
45
|
+
const resources = useAppSelector(state => state.auth?.resources);
|
|
47
46
|
|
|
48
47
|
...
|
|
49
48
|
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Credentials = Credentials;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactRedux = require("react-redux");
|
|
9
8
|
var _LinkWithAuthz = require("../LinkWithAuthz");
|
|
10
9
|
var _fetchAndStoreCredentials = require("../../utils/fetchAndStoreCredentials");
|
|
11
10
|
require("./Credentials.scss");
|
|
@@ -20,6 +19,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
20
19
|
*/
|
|
21
20
|
|
|
22
21
|
function Credentials(_ref) {
|
|
22
|
+
var _app$AppStore;
|
|
23
23
|
var {
|
|
24
24
|
app,
|
|
25
25
|
credentials_id,
|
|
@@ -29,10 +29,7 @@ function Credentials(_ref) {
|
|
|
29
29
|
if (credentials_id == undefined) {
|
|
30
30
|
return '';
|
|
31
31
|
}
|
|
32
|
-
var resources = (
|
|
33
|
-
var _state$auth;
|
|
34
|
-
return state === null || state === void 0 || (_state$auth = state.auth) === null || _state$auth === void 0 ? void 0 : _state$auth.resources;
|
|
35
|
-
});
|
|
32
|
+
var resources = ((_app$AppStore = app.AppStore) === null || _app$AppStore === void 0 || (_app$AppStore = _app$AppStore.state) === null || _app$AppStore === void 0 || (_app$AppStore = _app$AppStore.auth) === null || _app$AppStore === void 0 ? void 0 : _app$AppStore.resources) || [];
|
|
36
33
|
var resource = 'seacat:credentials:access'; // Resource required to access the Credentials List Screen
|
|
37
34
|
|
|
38
35
|
// Validation on props.app
|
|
@@ -25,12 +25,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
25
25
|
|
|
26
26
|
Example:
|
|
27
27
|
|
|
28
|
-
import { LinkWithAuthz } from 'asab_webui_components';
|
|
29
|
-
import { useSelector } from 'react-redux';
|
|
28
|
+
import { LinkWithAuthz, useAppSelector } from 'asab_webui_components';
|
|
30
29
|
|
|
31
30
|
...
|
|
32
31
|
|
|
33
|
-
const resources =
|
|
32
|
+
const resources = useAppSelector(state => state.auth?.resources);
|
|
34
33
|
const roleAccessResource = "any:role:access";
|
|
35
34
|
|
|
36
35
|
...
|
|
@@ -37,12 +37,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
37
37
|
|
|
38
38
|
Example:
|
|
39
39
|
|
|
40
|
-
import { ControlledSwitchWithAuthz } from 'asab_webui_components';
|
|
41
|
-
import { useSelector } from 'react-redux';
|
|
40
|
+
import { ControlledSwitchWithAuthz, useAppSelector } from 'asab_webui_components';
|
|
42
41
|
|
|
43
42
|
...
|
|
44
43
|
|
|
45
|
-
const resources =
|
|
44
|
+
const resources = useAppSelector(state => state.auth?.resources);
|
|
46
45
|
|
|
47
46
|
...
|
|
48
47
|
|
|
@@ -37,12 +37,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
37
37
|
|
|
38
38
|
Example:
|
|
39
39
|
|
|
40
|
-
import { UncontrolledSwitchWithAuthz } from 'asab_webui_components';
|
|
41
|
-
import { useSelector } from 'react-redux';
|
|
40
|
+
import { UncontrolledSwitchWithAuthz, useAppSelector } from 'asab_webui_components';
|
|
42
41
|
|
|
43
42
|
...
|
|
44
43
|
|
|
45
|
-
const resources =
|
|
44
|
+
const resources = useAppSelector(state => state.auth?.resources);
|
|
46
45
|
|
|
47
46
|
...
|
|
48
47
|
|
|
@@ -4,26 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isAuthorized = isAuthorized;
|
|
7
|
-
var _reactRedux = require("react-redux");
|
|
8
7
|
/*
|
|
9
8
|
This component validates if the resource is suitable or not to grant access to parts of the application. If the isAuthorized returns true, the resource is valid.
|
|
10
9
|
|
|
11
|
-
isAuthorized has
|
|
10
|
+
isAuthorized has 2 arguments:
|
|
12
11
|
resourcesArray - array (this is an array of resources required for the validation)
|
|
12
|
+
app - a Application object with info about AppStore
|
|
13
13
|
|
|
14
14
|
Usage:
|
|
15
15
|
1. Import this component from asab-component-webui
|
|
16
16
|
import { isAuthorized } from 'asab_webui_components';
|
|
17
|
-
2. Put the component in a variable and pass an array of resources as an
|
|
18
|
-
const invalidResource = isAuthorized(['some:resource']);
|
|
17
|
+
2. Put the component in a variable and pass an array of resources and the application object as an argument.
|
|
18
|
+
const invalidResource = isAuthorized(['some:resource'], props.app);
|
|
19
19
|
3. Use this variable in the code.
|
|
20
20
|
variable returns true or false
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
function isAuthorized(resourcesArray) {
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
return ((_state$auth = state.auth) === null || _state$auth === void 0 ? void 0 : _state$auth.resources) || [];
|
|
27
|
-
});
|
|
23
|
+
function isAuthorized(resourcesArray, app) {
|
|
24
|
+
var _app$AppStore;
|
|
25
|
+
var resources = (app === null || app === void 0 || (_app$AppStore = app.AppStore) === null || _app$AppStore === void 0 || (_app$AppStore = _app$AppStore.state) === null || _app$AppStore === void 0 || (_app$AppStore = _app$AppStore.auth) === null || _app$AppStore === void 0 ? void 0 : _app$AppStore.resources) || [];
|
|
28
26
|
return resources.includes('authz:superuser') || resourcesArray.some(resource => resources.includes(resource));
|
|
29
27
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asab_webui_components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.1.1",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"description": "TeskaLabs ASAB WebUI Components Library",
|
|
6
6
|
"contributors": [
|
|
@@ -46,15 +46,13 @@
|
|
|
46
46
|
"bootstrap-icons": "^1.10.5",
|
|
47
47
|
"date-fns": "^2.30.0",
|
|
48
48
|
"i18next": "^20.3.5",
|
|
49
|
-
"react": "^
|
|
50
|
-
"react-dom": "^
|
|
49
|
+
"react": "^19.0.0",
|
|
50
|
+
"react-dom": "^19.0.0",
|
|
51
51
|
"react-i18next": "^11.8.12",
|
|
52
|
-
"react-json-view": "^1.
|
|
53
|
-
"react-redux": "^7.2.0",
|
|
52
|
+
"@microlink/react-json-view": "^1.26.2",
|
|
54
53
|
"react-router": "^6.16.0",
|
|
55
54
|
"react-router-dom": "^6.16.0",
|
|
56
|
-
"reactstrap": "^9.2.0"
|
|
57
|
-
"redux": "^4.0.5"
|
|
55
|
+
"reactstrap": "^9.2.0"
|
|
58
56
|
},
|
|
59
57
|
"scripts": {
|
|
60
58
|
"build": "babel src --extensions '.js,.jsx' --out-dir dist && copyfiles -u 1 'src/**/*.{scss,jsx}' dist",
|