ag-common 0.0.142 → 0.0.146
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare function DropdownList<T>({ options, value, onChange, placeholder, className, renderF, children, shadow, }: {
|
|
2
|
+
export declare function DropdownList<T>({ options, value, onChange, placeholder, className, renderF, children, shadow, maxHeight, }: {
|
|
3
3
|
options: T[];
|
|
4
4
|
value?: T;
|
|
5
5
|
onChange: (v: T, index: number) => void;
|
|
@@ -11,4 +11,8 @@ export declare function DropdownList<T>({ options, value, onChange, placeholder,
|
|
|
11
11
|
* colour of dropdown shadow. default #555
|
|
12
12
|
*/
|
|
13
13
|
shadow?: string;
|
|
14
|
+
/**
|
|
15
|
+
* max height of items list. default 50vh
|
|
16
|
+
*/
|
|
17
|
+
maxHeight?: string;
|
|
14
18
|
}): JSX.Element;
|
|
@@ -45,6 +45,12 @@ const SItems = styled_components_1.default.div `
|
|
|
45
45
|
cursor: default;
|
|
46
46
|
width: 100%;
|
|
47
47
|
max-width: 95vw;
|
|
48
|
+
${({ maxHeight }) => maxHeight &&
|
|
49
|
+
(0, styled_components_1.css) `
|
|
50
|
+
max-height: ${maxHeight};
|
|
51
|
+
`}
|
|
52
|
+
|
|
53
|
+
overflow-y: scroll;
|
|
48
54
|
${({ open }) => open &&
|
|
49
55
|
(0, styled_components_1.css) `
|
|
50
56
|
display: flex;
|
|
@@ -82,7 +88,7 @@ const SItem = styled_components_1.default.div `
|
|
|
82
88
|
background-color: rgba(0, 0, 0, 0.2);
|
|
83
89
|
}
|
|
84
90
|
`;
|
|
85
|
-
function DropdownList({ options, value, onChange, placeholder, className, renderF, children, shadow = '#555', }) {
|
|
91
|
+
function DropdownList({ options, value, onChange, placeholder, className, renderF, children, shadow = '#555', maxHeight = '50vh', }) {
|
|
86
92
|
var _a, _b;
|
|
87
93
|
const ref = (0, react_1.useRef)(null);
|
|
88
94
|
const [state, setState] = (0, react_1.useState)(value);
|
|
@@ -124,7 +130,7 @@ function DropdownList({ options, value, onChange, placeholder, className, render
|
|
|
124
130
|
e.preventDefault();
|
|
125
131
|
setOpen(!open);
|
|
126
132
|
} },
|
|
127
|
-
react_1.default.createElement(SItems, { open: open, style: style, shadow: shadow }, open &&
|
|
133
|
+
react_1.default.createElement(SItems, { open: open, style: style, shadow: shadow, maxHeight: maxHeight }, open &&
|
|
128
134
|
options.map((s, i) => (react_1.default.createElement(SItem, { key: renderF(s), selected: s === state, onClick: (e) => {
|
|
129
135
|
if (s !== state) {
|
|
130
136
|
onChange(s, i);
|
|
@@ -70,7 +70,7 @@ export interface IStateCommon<TRequest extends IRequestCommon> extends IInitialS
|
|
|
70
70
|
export declare const getClientOrServerReqHref: ({ href }: {
|
|
71
71
|
href?: string | undefined;
|
|
72
72
|
}) => LocationSubset;
|
|
73
|
-
export declare const
|
|
73
|
+
export declare const getServerReq: ({ host, pathname, }: {
|
|
74
74
|
pathname: string;
|
|
75
75
|
host: string;
|
|
76
76
|
}) => LocationSubset;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getServerReq = exports.getClientOrServerReqHref = void 0;
|
|
4
4
|
const url_1 = require("url");
|
|
5
5
|
const string_1 = require("../../common/helpers/string");
|
|
6
6
|
const calculateServerHref = ({ host, pathname, }) => {
|
|
@@ -15,7 +15,7 @@ const calculateServerHref = ({ host, pathname, }) => {
|
|
|
15
15
|
href += 'https://';
|
|
16
16
|
}
|
|
17
17
|
href += host + pathname;
|
|
18
|
-
return href;
|
|
18
|
+
return decodeURIComponent(href);
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* get parsed url. will use window if possible
|
|
@@ -43,11 +43,11 @@ const getClientOrServerReqHref = ({ href }) => {
|
|
|
43
43
|
return ret;
|
|
44
44
|
};
|
|
45
45
|
exports.getClientOrServerReqHref = getClientOrServerReqHref;
|
|
46
|
-
const
|
|
46
|
+
const getServerReq = ({ host, pathname, }) => {
|
|
47
47
|
const href = calculateServerHref({
|
|
48
48
|
host,
|
|
49
49
|
pathname,
|
|
50
50
|
});
|
|
51
51
|
return (0, exports.getClientOrServerReqHref)({ href });
|
|
52
52
|
};
|
|
53
|
-
exports.
|
|
53
|
+
exports.getServerReq = getServerReq;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ag-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.146",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Andrei Gec <@andreigec> (https://gec.dev/)",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"aws-cdk-lib": "2.x",
|
|
17
|
-
"aws-sdk": "2.
|
|
18
|
-
"axios": "0.
|
|
17
|
+
"aws-sdk": "2.1073.0",
|
|
18
|
+
"axios": "0.26.0",
|
|
19
19
|
"constructs": "10.x",
|
|
20
20
|
"jsonwebtoken": "8.5.1",
|
|
21
21
|
"jwks-rsa": "2.0.5",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@types/styled-components": "5.1.22",
|
|
36
36
|
"@typescript-eslint/eslint-plugin": "5.11.0",
|
|
37
37
|
"@typescript-eslint/parser": "5.11.0",
|
|
38
|
-
"eslint": "8.
|
|
38
|
+
"eslint": "8.9.0",
|
|
39
39
|
"eslint-config-airbnb-typescript": "16.1.0",
|
|
40
40
|
"eslint-config-prettier": "8.3.0",
|
|
41
41
|
"eslint-config-react-app": "7.0.0",
|