@rio-cloud/rio-uikit 1.4.1 → 1.5.0
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/.DS_Store +0 -0
- package/FadeExpander.d.ts +2 -0
- package/FadeExpander.js +2 -0
- package/FadeUp.d.ts +2 -0
- package/FadeUp.js +2 -0
- package/XAxis.d.ts +2 -0
- package/XAxis.js +2 -0
- package/YAxis.d.ts +2 -0
- package/YAxis.js +2 -0
- package/components/applicationLayout/ApplicationLayoutBody.d.ts +5 -0
- package/components/applicationLayout/ApplicationLayoutBody.js +10 -1
- package/components/charts/Area.d.ts +11 -3
- package/components/charts/Area.js +9 -1
- package/components/charts/AreaChart.d.ts +4 -3
- package/components/charts/AreaChart.js +9 -8
- package/components/charts/Bar.d.ts +6 -2
- package/components/charts/Bar.js +3 -4
- package/components/charts/BarChart.d.ts +2 -1
- package/components/charts/BarChart.js +8 -4
- package/components/charts/ComposedChart.d.ts +6 -5
- package/components/charts/ComposedChart.js +16 -11
- package/components/charts/Line.d.ts +11 -3
- package/components/charts/Line.js +9 -1
- package/components/charts/LineChart.d.ts +6 -4
- package/components/charts/LineChart.js +10 -9
- package/components/charts/ReferenceLine.d.ts +8 -4
- package/components/charts/ReferenceLine.js +18 -2
- package/components/charts/XAxis.d.ts +7 -0
- package/components/charts/XAxis.js +18 -0
- package/components/charts/YAxis.d.ts +5 -0
- package/components/charts/YAxis.js +2 -0
- package/components/collapse/Collapse.js +3 -2
- package/components/fade/FadeExpander.d.ts +27 -0
- package/components/fade/FadeExpander.js +41 -0
- package/components/fade/FadeUp.d.ts +27 -0
- package/components/fade/FadeUp.js +28 -0
- package/components/listMenu/ListMenu.d.ts +7 -0
- package/components/listMenu/ListMenu.js +6 -3
- package/components/map/components/features/Route.d.ts +13 -2
- package/components/map/components/features/Route.js +19 -11
- package/components/map/components/features/basics/Polygon.d.ts +1 -0
- package/components/map/components/features/basics/Polygon.js +1 -0
- package/components/map/components/features/basics/Polyline.d.ts +3 -1
- package/components/map/components/features/basics/Polyline.js +5 -16
- package/components/map/components/features/basics/polygonColors.d.ts +252 -0
- package/components/map/components/features/basics/polygonColors.js +252 -0
- package/components/map/utils/mapTypes.d.ts +1 -1
- package/components/map/utils/mapTypes.js +2 -0
- package/components/mapMarker/SingleMapMarker.d.ts +3 -2
- package/components/mapMarker/SingleMapMarker.js +3 -3
- package/components/selects/BaseSelectDropdown.d.ts +0 -1
- package/components/selects/BaseSelectDropdown.js +7 -1
- package/components/selects/Multiselect.js +1 -4
- package/components/selects/Select.d.ts +1 -1
- package/components/selects/Select.js +1 -4
- package/components/smoothScrollbars/SmoothScrollbars.js +28 -3
- package/hooks/useSorting.d.ts +29 -0
- package/hooks/useSorting.js +41 -0
- package/lib/es/FadeExpander.d.ts +2 -0
- package/lib/es/FadeExpander.js +7 -0
- package/lib/es/FadeUp.d.ts +2 -0
- package/lib/es/FadeUp.js +7 -0
- package/lib/es/XAxis.d.ts +2 -0
- package/lib/es/XAxis.js +7 -0
- package/lib/es/YAxis.d.ts +2 -0
- package/lib/es/YAxis.js +7 -0
- package/lib/es/components/applicationLayout/ApplicationLayoutBody.d.ts +5 -0
- package/lib/es/components/applicationLayout/ApplicationLayoutBody.js +10 -1
- package/lib/es/components/charts/Area.d.ts +11 -3
- package/lib/es/components/charts/Area.js +11 -1
- package/lib/es/components/charts/AreaChart.d.ts +4 -3
- package/lib/es/components/charts/AreaChart.js +8 -7
- package/lib/es/components/charts/Bar.d.ts +6 -2
- package/lib/es/components/charts/Bar.js +5 -4
- package/lib/es/components/charts/BarChart.d.ts +2 -1
- package/lib/es/components/charts/BarChart.js +7 -3
- package/lib/es/components/charts/ComposedChart.d.ts +6 -5
- package/lib/es/components/charts/ComposedChart.js +15 -10
- package/lib/es/components/charts/Line.d.ts +11 -3
- package/lib/es/components/charts/Line.js +11 -1
- package/lib/es/components/charts/LineChart.d.ts +6 -4
- package/lib/es/components/charts/LineChart.js +9 -8
- package/lib/es/components/charts/ReferenceLine.d.ts +8 -4
- package/lib/es/components/charts/ReferenceLine.js +21 -2
- package/lib/es/components/charts/XAxis.d.ts +7 -0
- package/lib/es/components/charts/XAxis.js +23 -0
- package/lib/es/components/charts/YAxis.d.ts +5 -0
- package/lib/es/components/charts/YAxis.js +4 -0
- package/lib/es/components/collapse/Collapse.js +3 -2
- package/lib/es/components/fade/FadeExpander.d.ts +27 -0
- package/lib/es/components/fade/FadeExpander.js +43 -0
- package/lib/es/components/fade/FadeUp.d.ts +27 -0
- package/lib/es/components/fade/FadeUp.js +30 -0
- package/lib/es/components/listMenu/ListMenu.d.ts +7 -0
- package/lib/es/components/listMenu/ListMenu.js +6 -3
- package/lib/es/components/map/components/features/Route.d.ts +13 -2
- package/lib/es/components/map/components/features/Route.js +20 -12
- package/lib/es/components/map/components/features/basics/Polygon.d.ts +1 -0
- package/lib/es/components/map/components/features/basics/Polygon.js +10 -0
- package/lib/es/components/map/components/features/basics/Polyline.d.ts +3 -1
- package/lib/es/components/map/components/features/basics/Polyline.js +5 -16
- package/lib/es/components/map/components/features/basics/polygonColors.d.ts +252 -0
- package/lib/es/components/map/components/features/basics/polygonColors.js +255 -0
- package/lib/es/components/map/utils/mapTypes.d.ts +1 -1
- package/lib/es/components/map/utils/mapTypes.js +2 -0
- package/lib/es/components/mapMarker/SingleMapMarker.d.ts +3 -2
- package/lib/es/components/mapMarker/SingleMapMarker.js +3 -3
- package/lib/es/components/selects/BaseSelectDropdown.d.ts +0 -1
- package/lib/es/components/selects/BaseSelectDropdown.js +6 -0
- package/lib/es/components/selects/Multiselect.js +1 -4
- package/lib/es/components/selects/Select.d.ts +1 -1
- package/lib/es/components/selects/Select.js +1 -4
- package/lib/es/components/smoothScrollbars/SmoothScrollbars.js +27 -2
- package/lib/es/hooks/useSorting.d.ts +29 -0
- package/lib/es/hooks/useSorting.js +43 -0
- package/lib/es/storageUtils.d.ts +1 -0
- package/lib/es/storageUtils.js +4 -0
- package/lib/es/styles/variables/colors/colors.json +4 -3
- package/lib/es/urlFeatureToggles.d.ts +1 -0
- package/lib/es/urlFeatureToggles.js +4 -0
- package/lib/es/useSorting.d.ts +2 -0
- package/lib/es/useSorting.js +7 -0
- package/lib/es/utils/storageUtils.d.ts +5 -0
- package/lib/es/utils/storageUtils.js +32 -0
- package/lib/es/utils/urlFeatureToggles.d.ts +10 -0
- package/lib/es/utils/urlFeatureToggles.js +41 -0
- package/lib/es/version.json +1 -1
- package/package.json +15 -4
- package/storageUtils.d.ts +1 -0
- package/storageUtils.js +1 -0
- package/styles/variables/colors/colors.json +4 -3
- package/urlFeatureToggles.d.ts +1 -0
- package/urlFeatureToggles.js +1 -0
- package/useSorting.d.ts +2 -0
- package/useSorting.js +2 -0
- package/utils/storageUtils.d.ts +5 -0
- package/utils/storageUtils.js +29 -0
- package/utils/urlFeatureToggles.d.ts +10 -0
- package/utils/urlFeatureToggles.js +32 -0
- package/version.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.detectFeatureToggles = exports.asNumber = exports.asString = exports.asBoolean = exports.cleanupOldToggles = exports.DEFAULT_PREFIX = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const qs_1 = tslib_1.__importDefault(require("qs"));
|
|
6
|
+
const mapValues_1 = tslib_1.__importDefault(require("lodash/fp/mapValues"));
|
|
7
|
+
const forEach_1 = tslib_1.__importDefault(require("lodash/fp/forEach"));
|
|
8
|
+
const get_1 = tslib_1.__importDefault(require("lodash/fp/get"));
|
|
9
|
+
const storageUtils_1 = require("./storageUtils");
|
|
10
|
+
exports.DEFAULT_PREFIX = 'featureToggle.';
|
|
11
|
+
const cleanupOldToggles = (oldToggles, prefix) => {
|
|
12
|
+
try {
|
|
13
|
+
(0, forEach_1.default)(toggle => storageUtils_1.storage.removeItem(toggle, prefix), oldToggles);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
console.error(error);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.cleanupOldToggles = cleanupOldToggles;
|
|
20
|
+
const detectToggle = (param, prefix, transformFn) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const [_, searchParams = ''] = window.location.hash.split('?');
|
|
23
|
+
const urlSearchParams = qs_1.default.parse(searchParams);
|
|
24
|
+
const urlValue = ((_a = (0, get_1.default)(param, urlSearchParams)) === null || _a === void 0 ? void 0 : _a.toString()) || '';
|
|
25
|
+
const storageValue = urlValue ? storageUtils_1.storage.save(param, urlValue, prefix) : storageUtils_1.storage.load(param, prefix);
|
|
26
|
+
return storageValue && transformFn(storageValue);
|
|
27
|
+
};
|
|
28
|
+
const transformBoolean = (value) => value === 'true' || value === '1';
|
|
29
|
+
const transformString = (value) => value || '';
|
|
30
|
+
const transformNumber = (value) => (value !== null ? Number.parseFloat(value) : 0);
|
|
31
|
+
const asBoolean = (urlParamName) => (prefix) => detectToggle(urlParamName, prefix, transformBoolean);
|
|
32
|
+
exports.asBoolean = asBoolean;
|
|
33
|
+
const asString = (urlParamName) => (prefix) => detectToggle(urlParamName, prefix, transformString);
|
|
34
|
+
exports.asString = asString;
|
|
35
|
+
const asNumber = (urlParamName) => (prefix) => detectToggle(urlParamName, prefix, transformNumber);
|
|
36
|
+
exports.asNumber = asNumber;
|
|
37
|
+
const detectFeatureToggles = (toggleDefinitions, oldToggles = [], prefix = exports.DEFAULT_PREFIX) => {
|
|
38
|
+
(0, exports.cleanupOldToggles)(oldToggles, prefix);
|
|
39
|
+
return (0, mapValues_1.default)(toggleFn => toggleFn(prefix), toggleDefinitions);
|
|
40
|
+
};
|
|
41
|
+
exports.detectFeatureToggles = detectFeatureToggles;
|
package/lib/es/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rio-cloud/rio-uikit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "The RIO UIKIT component library",
|
|
5
5
|
"repository": "https://bitbucket.collaboration-man.com/projects/RIOFRONT/repos/uikit-web/browse",
|
|
6
6
|
"scripts": {
|
|
@@ -43,14 +43,18 @@
|
|
|
43
43
|
"module": "index.js",
|
|
44
44
|
"types": "index.d.ts",
|
|
45
45
|
"less": "./styles/css/rio-uikit.less",
|
|
46
|
-
"files": [
|
|
46
|
+
"files": [
|
|
47
|
+
"**/*.*"
|
|
48
|
+
],
|
|
47
49
|
"devDependencies": {
|
|
48
50
|
"@testing-library/dom": "9.3.3",
|
|
49
51
|
"@testing-library/jest-dom": "5.17.0",
|
|
50
52
|
"@testing-library/react": "12.1.5",
|
|
53
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
51
54
|
"@testing-library/user-event": "14.5.2",
|
|
52
55
|
"@types/heremaps": "3.1.14",
|
|
53
56
|
"@types/lodash": "4.17.7",
|
|
57
|
+
"@types/qs": "^6.9.16",
|
|
54
58
|
"@types/react": "18.3.5",
|
|
55
59
|
"@types/react-dom": "18.3.0",
|
|
56
60
|
"@types/react-input-mask": "3.0.5",
|
|
@@ -114,6 +118,7 @@
|
|
|
114
118
|
"natural-orderby": "3.0.2",
|
|
115
119
|
"process": "0.11.10",
|
|
116
120
|
"prop-types": "15.8.1",
|
|
121
|
+
"qs": "6.13.0",
|
|
117
122
|
"react-bootstrap": "1.6.4",
|
|
118
123
|
"react-content-loader": "6.2.1",
|
|
119
124
|
"react-custom-scrollbars-2": "^4.5.0",
|
|
@@ -130,6 +135,12 @@
|
|
|
130
135
|
"overrides": {
|
|
131
136
|
"iframe-resizer": "4.3.11"
|
|
132
137
|
},
|
|
133
|
-
"pre-commit": [
|
|
134
|
-
|
|
138
|
+
"pre-commit": [
|
|
139
|
+
"format-code"
|
|
140
|
+
],
|
|
141
|
+
"browserslist": [
|
|
142
|
+
"> 0.5%",
|
|
143
|
+
"Firefox ESR",
|
|
144
|
+
"not dead"
|
|
145
|
+
]
|
|
135
146
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './utils/storageUtils';
|
package/storageUtils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './utils/storageUtils';
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"gray-light": "#D0D8DE",
|
|
11
11
|
"gray-lighter": "#E5EBF0",
|
|
12
12
|
"gray-lightest": "#f6f8f9",
|
|
13
|
-
"gray-decent": "#
|
|
13
|
+
"gray-decent": "#fcfcfd",
|
|
14
14
|
"brand-primary": "#30b4c0",
|
|
15
15
|
"brand-secondary": "#b23672",
|
|
16
16
|
"brand-primary-decent": "#f4fbfc",
|
|
@@ -31,13 +31,14 @@
|
|
|
31
31
|
"color-map-marker-text": "#ffffff",
|
|
32
32
|
"color-map-marker-active": "#ffffff",
|
|
33
33
|
"color-map-marker-asset": "#2a3740",
|
|
34
|
-
"color-map-marker-poi": "#
|
|
35
|
-
"color-map-marker-geofence": "#
|
|
34
|
+
"color-map-marker-poi": "#d5429f",
|
|
35
|
+
"color-map-marker-geofence": "#f9636e",
|
|
36
36
|
"color-map-marker-route": "#36afd7",
|
|
37
37
|
"color-map-marker-info": "#3f759b",
|
|
38
38
|
"color-map-marker-success": "#5cb85c",
|
|
39
39
|
"color-map-marker-warning": "#ff8e3c",
|
|
40
40
|
"color-map-marker-danger": "#e22837",
|
|
41
|
+
"color-map-marker-restrictions": "#8F68ED",
|
|
41
42
|
"color-rating-1": "#e22837",
|
|
42
43
|
"color-rating-2": "#ff8e3c",
|
|
43
44
|
"color-rating-3": "#f8c575",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './utils/urlFeatureToggles';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './utils/urlFeatureToggles';
|
package/useSorting.d.ts
ADDED
package/useSorting.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const localStorage = window.localStorage;
|
|
2
|
+
const STORAGE_PREFIX = '';
|
|
3
|
+
const save = (key, value, prefix = STORAGE_PREFIX) => {
|
|
4
|
+
try {
|
|
5
|
+
localStorage.setItem(`${prefix}${key}`, JSON.stringify(value));
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
catch (_) {
|
|
9
|
+
// Intentionally left blank
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const removeItem = (key, prefix = STORAGE_PREFIX) => {
|
|
13
|
+
try {
|
|
14
|
+
localStorage.removeItem(`${prefix}${key}`);
|
|
15
|
+
}
|
|
16
|
+
catch (_) {
|
|
17
|
+
// Intentionally left blank
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const load = (key, prefix = STORAGE_PREFIX) => {
|
|
21
|
+
try {
|
|
22
|
+
const item = localStorage.getItem(`${prefix}${key}`);
|
|
23
|
+
return item && JSON.parse(item);
|
|
24
|
+
}
|
|
25
|
+
catch (_) {
|
|
26
|
+
// Intentionally left blank
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export const storage = { save, load, removeItem };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
export declare const DEFAULT_PREFIX = "featureToggle.";
|
|
3
|
+
export type ToggleType = string | boolean | number;
|
|
4
|
+
export declare const cleanupOldToggles: (oldToggles: string[], prefix: string) => void;
|
|
5
|
+
export declare const asBoolean: (urlParamName: string) => (prefix: string) => ToggleType | undefined;
|
|
6
|
+
export declare const asString: (urlParamName: string) => (prefix: string) => ToggleType | undefined;
|
|
7
|
+
export declare const asNumber: (urlParamName: string) => (prefix: string) => ToggleType | undefined;
|
|
8
|
+
export declare const detectFeatureToggles: (toggleDefinitions: {
|
|
9
|
+
[key: string]: (paramName: string) => ToggleType | undefined;
|
|
10
|
+
}, oldToggles?: string[], prefix?: string) => import("lodash").Dictionary<ToggleType | undefined>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import qs from 'qs';
|
|
2
|
+
import mapValues from 'lodash/fp/mapValues';
|
|
3
|
+
import forEach from 'lodash/fp/forEach';
|
|
4
|
+
import get from 'lodash/fp/get';
|
|
5
|
+
import { storage } from './storageUtils';
|
|
6
|
+
export const DEFAULT_PREFIX = 'featureToggle.';
|
|
7
|
+
export const cleanupOldToggles = (oldToggles, prefix) => {
|
|
8
|
+
try {
|
|
9
|
+
forEach(toggle => storage.removeItem(toggle, prefix), oldToggles);
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
console.error(error);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const detectToggle = (param, prefix, transformFn) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const [_, searchParams = ''] = window.location.hash.split('?');
|
|
18
|
+
const urlSearchParams = qs.parse(searchParams);
|
|
19
|
+
const urlValue = ((_a = get(param, urlSearchParams)) === null || _a === void 0 ? void 0 : _a.toString()) || '';
|
|
20
|
+
const storageValue = urlValue ? storage.save(param, urlValue, prefix) : storage.load(param, prefix);
|
|
21
|
+
return storageValue && transformFn(storageValue);
|
|
22
|
+
};
|
|
23
|
+
const transformBoolean = (value) => value === 'true' || value === '1';
|
|
24
|
+
const transformString = (value) => value || '';
|
|
25
|
+
const transformNumber = (value) => (value !== null ? Number.parseFloat(value) : 0);
|
|
26
|
+
export const asBoolean = (urlParamName) => (prefix) => detectToggle(urlParamName, prefix, transformBoolean);
|
|
27
|
+
export const asString = (urlParamName) => (prefix) => detectToggle(urlParamName, prefix, transformString);
|
|
28
|
+
export const asNumber = (urlParamName) => (prefix) => detectToggle(urlParamName, prefix, transformNumber);
|
|
29
|
+
export const detectFeatureToggles = (toggleDefinitions, oldToggles = [], prefix = DEFAULT_PREFIX) => {
|
|
30
|
+
cleanupOldToggles(oldToggles, prefix);
|
|
31
|
+
return mapValues(toggleFn => toggleFn(prefix), toggleDefinitions);
|
|
32
|
+
};
|
package/version.json
CHANGED