ag-common 0.0.102 → 0.0.106
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.
|
@@ -102,17 +102,20 @@ function DropdownList({ options, value, onChange, placeholder, className, render
|
|
|
102
102
|
if (JSON.stringify(newv) !== JSON.stringify(value))
|
|
103
103
|
setState(newv);
|
|
104
104
|
}, [options, value]);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
let style = {};
|
|
106
|
+
if (open) {
|
|
107
|
+
const maxLen = Math.max(...options.map((s) => renderF(s).length));
|
|
108
|
+
style = {
|
|
109
|
+
width: `calc(${maxLen}ch + 2rem)`,
|
|
110
|
+
};
|
|
111
|
+
const minLeft = (0, dom_1.convertRemToPixels)(2 + maxLen / 2);
|
|
112
|
+
const offsetList = (_b = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetLeft) !== null && _b !== void 0 ? _b : 0;
|
|
113
|
+
if (offsetList < minLeft) {
|
|
114
|
+
style.left = 0;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
style.right = 0;
|
|
118
|
+
}
|
|
116
119
|
}
|
|
117
120
|
return (react_1.default.createElement(SBase, { className: className, ref: ref, title: placeholder, onClick: (e) => {
|
|
118
121
|
e.stopPropagation();
|
package/dist/ui/helpers/dom.js
CHANGED
|
@@ -8,5 +8,11 @@ const domContains = (e, x, y) => {
|
|
|
8
8
|
return e.x <= x && x <= e.x + e.width && e.y <= y && y <= e.y + e.height;
|
|
9
9
|
};
|
|
10
10
|
exports.domContains = domContains;
|
|
11
|
-
const convertRemToPixels = (rem) =>
|
|
11
|
+
const convertRemToPixels = (rem) => {
|
|
12
|
+
let fontSize = '16px';
|
|
13
|
+
if (typeof window !== 'undefined') {
|
|
14
|
+
fontSize = getComputedStyle(document.documentElement).fontSize;
|
|
15
|
+
}
|
|
16
|
+
return rem * parseFloat(fontSize);
|
|
17
|
+
};
|
|
12
18
|
exports.convertRemToPixels = convertRemToPixels;
|
|
@@ -4,7 +4,5 @@ declare type AxiosWrapperWrap<T> = AxiosWrapper<T | undefined> & {
|
|
|
4
4
|
loaded: boolean;
|
|
5
5
|
loadcount: number;
|
|
6
6
|
};
|
|
7
|
-
export declare const useCallOpenApi: <T, TDefaultApi>(p: ICallOpenApi<T, TDefaultApi>
|
|
8
|
-
cacheKey: string;
|
|
9
|
-
}) => AxiosWrapperWrap<T>;
|
|
7
|
+
export declare const useCallOpenApi: <T, TDefaultApi>(p: ICallOpenApi<T, TDefaultApi>) => AxiosWrapperWrap<T>;
|
|
10
8
|
export {};
|
|
@@ -5,16 +5,8 @@ const react_1 = require("react");
|
|
|
5
5
|
const log_1 = require("../../common/helpers/log");
|
|
6
6
|
const object_1 = require("../../common/helpers/object");
|
|
7
7
|
const getTimeSeconds = () => Math.ceil(new Date().getTime() / 1000);
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
-
if (!process.nodeLocalStorage) {
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
process.nodeLocalStorage = {};
|
|
13
|
-
}
|
|
14
8
|
const clearLocalStorageItem = (key) => {
|
|
15
9
|
if (typeof window === 'undefined') {
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
-
delete process.nodeLocalStorage[key];
|
|
18
10
|
return;
|
|
19
11
|
}
|
|
20
12
|
try {
|
|
@@ -28,8 +20,6 @@ exports.clearLocalStorageItem = clearLocalStorageItem;
|
|
|
28
20
|
const clearAllLocalStorage = (except) => {
|
|
29
21
|
try {
|
|
30
22
|
if (typeof window === 'undefined') {
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
-
process.nodeLocalStorage = {};
|
|
33
23
|
return;
|
|
34
24
|
}
|
|
35
25
|
for (let i = 0; i < localStorage.length; i += 1) {
|
|
@@ -48,8 +38,6 @@ exports.clearAllLocalStorage = clearAllLocalStorage;
|
|
|
48
38
|
const setLocalStorageItem = (key, value, ttl) => {
|
|
49
39
|
try {
|
|
50
40
|
if (typeof window === 'undefined') {
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
|
-
process.nodeLocalStorage[key] = value;
|
|
53
41
|
return;
|
|
54
42
|
}
|
|
55
43
|
const set = {
|
|
@@ -66,9 +54,7 @@ const setLocalStorageItem = (key, value, ttl) => {
|
|
|
66
54
|
exports.setLocalStorageItem = setLocalStorageItem;
|
|
67
55
|
const getLocalStorageItem = (key, initialValue, ttl) => {
|
|
68
56
|
if (typeof window === 'undefined') {
|
|
69
|
-
|
|
70
|
-
const value = process.nodeLocalStorage[key] || initialValue;
|
|
71
|
-
return value;
|
|
57
|
+
return initialValue;
|
|
72
58
|
}
|
|
73
59
|
const itemraw = window.localStorage.getItem(key);
|
|
74
60
|
const item = (0, object_1.tryJsonParse)(itemraw, undefined);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ag-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.106",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Andrei Gec <@andreigec> (https://gec.dev/)",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"start": "tsc --watch"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"aws-sdk": "2.
|
|
16
|
+
"aws-sdk": "2.1064.0",
|
|
17
17
|
"axios": "0.25.0",
|
|
18
18
|
"jsonwebtoken": "8.5.1",
|
|
19
19
|
"jwks-rsa": "2.0.5",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/jsonwebtoken": "8.5.8",
|
|
31
|
-
"@types/node": "17.0.
|
|
31
|
+
"@types/node": "17.0.12",
|
|
32
32
|
"@types/react": "17.0.38",
|
|
33
33
|
"@types/react-dom": "17.0.11",
|
|
34
34
|
"@types/styled-components": "5.1.21",
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "5.10.
|
|
36
|
-
"@typescript-eslint/parser": "5.10.
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "5.10.1",
|
|
36
|
+
"@typescript-eslint/parser": "5.10.1",
|
|
37
37
|
"eslint": "8.7.0",
|
|
38
38
|
"eslint-config-airbnb-typescript": "16.1.0",
|
|
39
39
|
"eslint-config-prettier": "8.3.0",
|