@reltio/components 1.4.1320 → 1.4.1322
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.
|
@@ -87,14 +87,14 @@ var DateRangeEditor = function (_a) {
|
|
|
87
87
|
var placeholder = localeFormat + (dataTypeDefinition.type === mdm_sdk_1.DataTypes.TYPE_TIMESTAMP ? ' HH:MM' : '');
|
|
88
88
|
var rangeOptions = (0, react_1.useMemo)(function () {
|
|
89
89
|
return options ||
|
|
90
|
-
Object.values(mdm_sdk_1.
|
|
90
|
+
Object.values(mdm_sdk_1.AllDateRangeValues).map(function (option) { return ({ value: option, label: (0, mdm_sdk_1.getRangeOptionLabel)(option) }); });
|
|
91
91
|
}, [options]);
|
|
92
92
|
var inputRef = (0, react_1.useRef)(null);
|
|
93
93
|
var _h = (0, react_1.useState)(false), open = _h[0], setOpen = _h[1];
|
|
94
94
|
var _j = (0, react_1.useState)(), customValue = _j[0], setCustomValue = _j[1];
|
|
95
95
|
var styles = (0, styles_1.useStyles)();
|
|
96
96
|
var onItemClick = function (value) {
|
|
97
|
-
if (value === mdm_sdk_1.
|
|
97
|
+
if (value === mdm_sdk_1.AllDateRangeValues.PICK_DATE) {
|
|
98
98
|
setCustomValue(value);
|
|
99
99
|
}
|
|
100
100
|
else {
|
package/cjs/hooks/useAPI/API.js
CHANGED
|
@@ -140,18 +140,15 @@ var validateParams = function (params, permissions) {
|
|
|
140
140
|
var url = params.url;
|
|
141
141
|
if (!url)
|
|
142
142
|
return { errorMessage: 'URL is empty' };
|
|
143
|
-
var allowed = permissions === null || permissions === void 0 ? void 0 : permissions.some(function (
|
|
144
|
-
var
|
|
145
|
-
var
|
|
146
|
-
var
|
|
147
|
-
var
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
(
|
|
152
|
-
(host && protocolAndHost === formattedPerm) ||
|
|
153
|
-
(formattedPerm && formattedPerm.indexOf('/') === 0 && url && url.indexOf(formattedPerm) === 0) ||
|
|
154
|
-
(formattedPerm && re.test(url)));
|
|
143
|
+
var allowed = permissions === null || permissions === void 0 ? void 0 : permissions.some(function (permission) {
|
|
144
|
+
var _a;
|
|
145
|
+
var urlOrigin = (_a = url.match(/^(https?:\/\/[^:/?#]*).*$/)) === null || _a === void 0 ? void 0 : _a[1];
|
|
146
|
+
var permRegex = new RegExp('^' + permission + '$');
|
|
147
|
+
var decodedPerm = permission.replace(/\/*$/, '');
|
|
148
|
+
return (decodedPerm === url ||
|
|
149
|
+
(urlOrigin && urlOrigin === decodedPerm) ||
|
|
150
|
+
((decodedPerm === null || decodedPerm === void 0 ? void 0 : decodedPerm.startsWith('/')) && (url === null || url === void 0 ? void 0 : url.startsWith(decodedPerm))) ||
|
|
151
|
+
(permission && permRegex.test(url)));
|
|
155
152
|
});
|
|
156
153
|
if (!allowed || ((permissions === null || permissions === void 0 ? void 0 : permissions.length) || 0) === 0) {
|
|
157
154
|
return { errorMessage: 'Not enough permissions' };
|
|
@@ -26,7 +26,7 @@ import classnames from 'classnames';
|
|
|
26
26
|
import moment from 'moment';
|
|
27
27
|
import i18n from 'ui-i18n';
|
|
28
28
|
import { always, cond, curry, defaultTo, identity, is, isNil, map, pipe, prop, propEq } from 'ramda';
|
|
29
|
-
import { DataTypes,
|
|
29
|
+
import { DataTypes, AllDateRangeValues, formatDataTypeValue, getDateRangeByValue, getRangeOptionLabel, isEmptyValue } from '@reltio/mdm-sdk';
|
|
30
30
|
import TextField from '@material-ui/core/TextField';
|
|
31
31
|
import MenuItem from '@material-ui/core/MenuItem';
|
|
32
32
|
import Typography from '@material-ui/core/Typography';
|
|
@@ -59,14 +59,14 @@ var DateRangeEditor = function (_a) {
|
|
|
59
59
|
var placeholder = localeFormat + (dataTypeDefinition.type === DataTypes.TYPE_TIMESTAMP ? ' HH:MM' : '');
|
|
60
60
|
var rangeOptions = useMemo(function () {
|
|
61
61
|
return options ||
|
|
62
|
-
Object.values(
|
|
62
|
+
Object.values(AllDateRangeValues).map(function (option) { return ({ value: option, label: getRangeOptionLabel(option) }); });
|
|
63
63
|
}, [options]);
|
|
64
64
|
var inputRef = useRef(null);
|
|
65
65
|
var _h = useState(false), open = _h[0], setOpen = _h[1];
|
|
66
66
|
var _j = useState(), customValue = _j[0], setCustomValue = _j[1];
|
|
67
67
|
var styles = useStyles();
|
|
68
68
|
var onItemClick = function (value) {
|
|
69
|
-
if (value ===
|
|
69
|
+
if (value === AllDateRangeValues.PICK_DATE) {
|
|
70
70
|
setCustomValue(value);
|
|
71
71
|
}
|
|
72
72
|
else {
|
package/esm/hooks/useAPI/API.js
CHANGED
|
@@ -137,18 +137,15 @@ var validateParams = function (params, permissions) {
|
|
|
137
137
|
var url = params.url;
|
|
138
138
|
if (!url)
|
|
139
139
|
return { errorMessage: 'URL is empty' };
|
|
140
|
-
var allowed = permissions === null || permissions === void 0 ? void 0 : permissions.some(function (
|
|
141
|
-
var
|
|
142
|
-
var
|
|
143
|
-
var
|
|
144
|
-
var
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
(
|
|
149
|
-
(host && protocolAndHost === formattedPerm) ||
|
|
150
|
-
(formattedPerm && formattedPerm.indexOf('/') === 0 && url && url.indexOf(formattedPerm) === 0) ||
|
|
151
|
-
(formattedPerm && re.test(url)));
|
|
140
|
+
var allowed = permissions === null || permissions === void 0 ? void 0 : permissions.some(function (permission) {
|
|
141
|
+
var _a;
|
|
142
|
+
var urlOrigin = (_a = url.match(/^(https?:\/\/[^:/?#]*).*$/)) === null || _a === void 0 ? void 0 : _a[1];
|
|
143
|
+
var permRegex = new RegExp('^' + permission + '$');
|
|
144
|
+
var decodedPerm = permission.replace(/\/*$/, '');
|
|
145
|
+
return (decodedPerm === url ||
|
|
146
|
+
(urlOrigin && urlOrigin === decodedPerm) ||
|
|
147
|
+
((decodedPerm === null || decodedPerm === void 0 ? void 0 : decodedPerm.startsWith('/')) && (url === null || url === void 0 ? void 0 : url.startsWith(decodedPerm))) ||
|
|
148
|
+
(permission && permRegex.test(url)));
|
|
152
149
|
});
|
|
153
150
|
if (!allowed || ((permissions === null || permissions === void 0 ? void 0 : permissions.length) || 0) === 0) {
|
|
154
151
|
return { errorMessage: 'Not enough permissions' };
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1322",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@date-io/moment": "^1.3.5",
|
|
9
9
|
"@react-google-maps/api": "2.7.0",
|
|
10
|
-
"@reltio/mdm-module": "^1.4.
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
10
|
+
"@reltio/mdm-module": "^1.4.1322",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1322",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|