ag-common 0.0.305 → 0.0.308
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/ui/components/FlexColumn/index.d.ts +3 -8
- package/dist/ui/components/FlexColumn/index.js +2 -2
- package/dist/ui/components/FlexRow/index.d.ts +3 -9
- package/dist/ui/components/FlexRow/index.js +1 -1
- package/dist/ui/components/RowOrColumn/index.d.ts +5 -2
- package/dist/ui/components/RowOrColumn/index.js +5 -2
- package/dist/ui/components/Search/Base.js +1 -1
- package/dist/ui/components/TextEdit/TextEdit.js +2 -2
- package/dist/ui/helpers/routes.d.ts +10 -6
- package/dist/ui/helpers/routes.js +13 -7
- package/package.json +1 -1
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
center?: boolean;
|
|
5
|
-
allowOverflow?: boolean;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
className?: string;
|
|
8
|
-
}) => JSX.Element;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IRowOrColumn } from '../RowOrColumn';
|
|
3
|
+
export declare const FlexColumn: (props: IRowOrColumn) => JSX.Element;
|
|
@@ -19,13 +19,13 @@ const Base = styled_components_1.default.div `
|
|
|
19
19
|
flex-grow: 0;
|
|
20
20
|
}
|
|
21
21
|
overflow: visible;
|
|
22
|
-
&[data-
|
|
22
|
+
&[data-enableoverflow='false'] {
|
|
23
23
|
overflow: hidden;
|
|
24
24
|
max-width: 100%;
|
|
25
25
|
}
|
|
26
26
|
`;
|
|
27
27
|
const FlexColumn = (props) => {
|
|
28
28
|
var _a, _b, _c;
|
|
29
|
-
return (react_1.default.createElement(Base, Object.assign({ "data-nogrow": (_a = props.noGrow) !== null && _a !== void 0 ? _a : false, "data-center": (_b = props.center) !== null && _b !== void 0 ? _b : false, "data-
|
|
29
|
+
return (react_1.default.createElement(Base, Object.assign({ title: props.title, "data-nogrow": (_a = props.noGrow) !== null && _a !== void 0 ? _a : false, "data-center": (_b = props.center) !== null && _b !== void 0 ? _b : false, "data-enableoverflow": (_c = props.enableOverflow) !== null && _c !== void 0 ? _c : false }, props), props.children));
|
|
30
30
|
};
|
|
31
31
|
exports.FlexColumn = FlexColumn;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
noGrow?: boolean;
|
|
5
|
-
center?: boolean;
|
|
6
|
-
enableOverflow?: boolean;
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
className?: string;
|
|
9
|
-
}) => JSX.Element;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IRowOrColumn } from '../RowOrColumn';
|
|
3
|
+
export declare const FlexRow: (props: IRowOrColumn) => JSX.Element;
|
|
@@ -36,6 +36,6 @@ const Base = styled_components_1.default.div `
|
|
|
36
36
|
`;
|
|
37
37
|
const FlexRow = (props) => {
|
|
38
38
|
var _a, _b, _c, _d;
|
|
39
|
-
return (react_1.default.createElement(Base, Object.assign({ "data-nowrap": (_a = props.noWrap) !== null && _a !== void 0 ? _a : false, "data-nogrow": (_b = props.noGrow) !== null && _b !== void 0 ? _b : false, "data-center": (_c = props.center) !== null && _c !== void 0 ? _c : false, "data-enableoverflow": (_d = props.enableOverflow) !== null && _d !== void 0 ? _d : false }, props), props.children));
|
|
39
|
+
return (react_1.default.createElement(Base, Object.assign({ title: props.title, "data-nowrap": (_a = props.noWrap) !== null && _a !== void 0 ? _a : false, "data-nogrow": (_b = props.noGrow) !== null && _b !== void 0 ? _b : false, "data-center": (_c = props.center) !== null && _c !== void 0 ? _c : false, "data-enableoverflow": (_d = props.enableOverflow) !== null && _d !== void 0 ? _d : false }, props), props.children));
|
|
40
40
|
};
|
|
41
41
|
exports.FlexRow = FlexRow;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export interface IRowOrColumn {
|
|
3
3
|
noGrow?: boolean;
|
|
4
4
|
center?: boolean;
|
|
5
5
|
noWrap?: boolean;
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
className?: string;
|
|
8
|
-
|
|
8
|
+
title?: string;
|
|
9
|
+
enableOverflow?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const RowOrColumn: (props: IRowOrColumn) => JSX.Element;
|
|
@@ -31,9 +31,12 @@ const Base = styled_components_1.default.div `
|
|
|
31
31
|
flex-grow: 0;
|
|
32
32
|
width: auto;
|
|
33
33
|
}
|
|
34
|
+
&[data-enableoverflow='true'] {
|
|
35
|
+
overflow: visible;
|
|
36
|
+
}
|
|
34
37
|
`;
|
|
35
38
|
const RowOrColumn = (props) => {
|
|
36
|
-
var _a, _b, _c;
|
|
37
|
-
return (react_1.default.createElement(Base, Object.assign({ "data-nogrow": (_a = props.noGrow) !== null && _a !== void 0 ? _a : false, "data-center": (_b = props.center) !== null && _b !== void 0 ? _b : false, "data-nowrap": (_c = props.noWrap) !== null && _c !== void 0 ? _c : false }, props), props.children));
|
|
39
|
+
var _a, _b, _c, _d;
|
|
40
|
+
return (react_1.default.createElement(Base, Object.assign({ title: props.title, "data-nogrow": (_a = props.noGrow) !== null && _a !== void 0 ? _a : false, "data-center": (_b = props.center) !== null && _b !== void 0 ? _b : false, "data-nowrap": (_c = props.noWrap) !== null && _c !== void 0 ? _c : false, "data-enableoverflow": (_d = props.enableOverflow) !== null && _d !== void 0 ? _d : false }, props), props.children));
|
|
38
41
|
};
|
|
39
42
|
exports.RowOrColumn = RowOrColumn;
|
|
@@ -108,7 +108,7 @@ const SearchBase = ({ onSelectItem, onSearchTextChange, placeholderText, renderI
|
|
|
108
108
|
const textEditRef = (0, react_1.createRef)();
|
|
109
109
|
return (react_1.default.createElement(Base, { className: className },
|
|
110
110
|
react_1.default.createElement(SearchBox, { "data-type": "search" },
|
|
111
|
-
react_1.default.createElement(TextEdit_1.TextEdit, { ref: textEditRef, placeholder: placeholderText,
|
|
111
|
+
react_1.default.createElement(TextEdit_1.TextEdit, { ref: textEditRef, placeholder: placeholderText, defaultEditing: { focus: true }, singleLine: true, leftContent: react_1.default.createElement(Icon, null, MagnifyIconSvg), noGrow: true, allowUndo: false, onEscape: () => resWrap(undefined), onClickOutsideWithNoValue: null, onSubmit: (v) => (0, helpers_1.debounce)(() => {
|
|
112
112
|
setSearchText(v);
|
|
113
113
|
onSearchTextChange === null || onSearchTextChange === void 0 ? void 0 : onSearchTextChange(v);
|
|
114
114
|
}, { key: 'pagesearch', time: 200 }) }),
|
|
@@ -69,7 +69,7 @@ const Right = styled_components_1.default.div `
|
|
|
69
69
|
display: flex;
|
|
70
70
|
flex-flow: row;
|
|
71
71
|
align-content: center;
|
|
72
|
-
&[data-
|
|
72
|
+
&[data-singleline='false'] {
|
|
73
73
|
position: absolute;
|
|
74
74
|
bottom: 0.5rem;
|
|
75
75
|
right: 0.5rem;
|
|
@@ -162,7 +162,7 @@ exports.TextEdit = (0, react_1.forwardRef)((p, ref) => {
|
|
|
162
162
|
onEscape();
|
|
163
163
|
}
|
|
164
164
|
} }),
|
|
165
|
-
maxLength && (react_1.default.createElement(Right, { "data-
|
|
165
|
+
maxLength && (react_1.default.createElement(Right, { "data-singleline": singleLine },
|
|
166
166
|
react_1.default.createElement(LengthBox_1.TextEditLengthBox, { min: value.length, max: maxLength }))),
|
|
167
167
|
allowUndo && (react_1.default.createElement(Right, null,
|
|
168
168
|
valueChange && (react_1.default.createElement(Icon, { style: common_1.iconLeft, onClick: () => valueChange && onSubmit(value, false) },
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ICognitoAuth } from './cognito';
|
|
2
2
|
import { AxiosWrapperLite } from './jwt';
|
|
3
3
|
import { TLang } from '../../common/helpers/i18n';
|
|
4
|
+
export declare type TProtocol = 'http:' | 'https:';
|
|
4
5
|
export interface LocationSubset {
|
|
5
6
|
/**
|
|
6
7
|
* slash only path eg /aaa/bbb
|
|
@@ -22,10 +23,7 @@ export interface LocationSubset {
|
|
|
22
23
|
* protocol less up to first slash eg aaa.com:1111
|
|
23
24
|
*/
|
|
24
25
|
host: string;
|
|
25
|
-
|
|
26
|
-
* eg http: or https:
|
|
27
|
-
*/
|
|
28
|
-
protocol: string;
|
|
26
|
+
protocol: TProtocol;
|
|
29
27
|
/**
|
|
30
28
|
* full url
|
|
31
29
|
*/
|
|
@@ -65,7 +63,7 @@ export interface IStateCommon<TRequest extends IRequestCommon> extends IInitialS
|
|
|
65
63
|
* @param param0
|
|
66
64
|
* @returns
|
|
67
65
|
*/
|
|
68
|
-
export declare const getClientOrServerReqHref: ({ url: { href, query }, forceServer, userAgent, darkMode, defaultHost, }: {
|
|
66
|
+
export declare const getClientOrServerReqHref: ({ url: { href, query, protocol }, forceServer, userAgent, darkMode, defaultHost, }: {
|
|
69
67
|
url: {
|
|
70
68
|
/**
|
|
71
69
|
* parse querystring keyvalues
|
|
@@ -75,6 +73,7 @@ export declare const getClientOrServerReqHref: ({ url: { href, query }, forceSer
|
|
|
75
73
|
* full url
|
|
76
74
|
*/
|
|
77
75
|
href?: string | undefined;
|
|
76
|
+
protocol: TProtocol;
|
|
78
77
|
};
|
|
79
78
|
/**
|
|
80
79
|
* if true, wont use window location. default false
|
|
@@ -96,13 +95,14 @@ export declare const getClientOrServerReqHref: ({ url: { href, query }, forceSer
|
|
|
96
95
|
* get server side parsed url
|
|
97
96
|
* @param param0 * @returns
|
|
98
97
|
*/
|
|
99
|
-
export declare const getServerReq: ({ defaultHost, pathname, query, headers, }: {
|
|
98
|
+
export declare const getServerReq: ({ defaultHost, pathname, query, headers, encrypted, }: {
|
|
100
99
|
/**
|
|
101
100
|
* eg ctx?.req?.headers || {}
|
|
102
101
|
*/
|
|
103
102
|
headers: {
|
|
104
103
|
host?: string;
|
|
105
104
|
'user-agent'?: string;
|
|
105
|
+
'x-forwarded-proto'?: 'http' | 'https';
|
|
106
106
|
};
|
|
107
107
|
/** what to use if host is not available on headers */
|
|
108
108
|
defaultHost: string;
|
|
@@ -114,6 +114,10 @@ export declare const getServerReq: ({ defaultHost, pathname, query, headers, }:
|
|
|
114
114
|
* eg ctx.query
|
|
115
115
|
*/
|
|
116
116
|
query: Record<string, string | string[] | undefined>;
|
|
117
|
+
/**
|
|
118
|
+
* eg (ctx?.req?.socket as any)?.encrypted)
|
|
119
|
+
*/
|
|
120
|
+
encrypted: boolean;
|
|
117
121
|
}) => {
|
|
118
122
|
url: LocationSubset;
|
|
119
123
|
userAgent: string;
|
|
@@ -34,10 +34,11 @@ const getRenderLanguage = ({ defaultHost, url, }) => {
|
|
|
34
34
|
* @param param0
|
|
35
35
|
* @returns
|
|
36
36
|
*/
|
|
37
|
-
const getClientOrServerReqHref = ({ url: { href, query }, forceServer = false, userAgent, darkMode, defaultHost, }) => {
|
|
37
|
+
const getClientOrServerReqHref = ({ url: { href, query, protocol }, forceServer = false, userAgent, darkMode, defaultHost, }) => {
|
|
38
38
|
if (typeof window !== 'undefined') {
|
|
39
39
|
if (!forceServer) {
|
|
40
40
|
href = window.location.href;
|
|
41
|
+
protocol = window.location.protocol;
|
|
41
42
|
}
|
|
42
43
|
darkMode =
|
|
43
44
|
window.matchMedia &&
|
|
@@ -53,11 +54,11 @@ const getClientOrServerReqHref = ({ url: { href, query }, forceServer = false, u
|
|
|
53
54
|
const url = {
|
|
54
55
|
hash: parsed.hash || '',
|
|
55
56
|
host: parsed.host || '',
|
|
56
|
-
origin: `${
|
|
57
|
-
href: `${
|
|
57
|
+
origin: `${protocol}//${parsed.host}`,
|
|
58
|
+
href: `${protocol}//${parsed.host}${parsed.path}${parsed.hash || ''}`,
|
|
58
59
|
path: `${parsed.path}${parsed.hash || ''}`,
|
|
59
60
|
pathname: parsed.pathname || '',
|
|
60
|
-
protocol:
|
|
61
|
+
protocol: protocol || '',
|
|
61
62
|
query: Object.assign(Object.assign({}, query), (0, string_1.stringToObject)(parsed.query || '', '=', '&')),
|
|
62
63
|
};
|
|
63
64
|
return {
|
|
@@ -73,12 +74,16 @@ exports.getClientOrServerReqHref = getClientOrServerReqHref;
|
|
|
73
74
|
* get server side parsed url
|
|
74
75
|
* @param param0 * @returns
|
|
75
76
|
*/
|
|
76
|
-
const getServerReq = ({ defaultHost, pathname, query, headers, }) => {
|
|
77
|
-
var _a;
|
|
77
|
+
const getServerReq = ({ defaultHost, pathname, query, headers, encrypted, }) => {
|
|
78
|
+
var _a, _b;
|
|
78
79
|
const href = calculateServerHref({
|
|
79
80
|
host: headers.host || defaultHost,
|
|
80
81
|
pathname,
|
|
81
82
|
});
|
|
83
|
+
let protocol = 'http:';
|
|
84
|
+
if (((_a = headers['x-forwarded-proto']) === null || _a === void 0 ? void 0 : _a.includes('https')) || encrypted) {
|
|
85
|
+
protocol = 'https:';
|
|
86
|
+
}
|
|
82
87
|
const parsedQuery = !query || Object.keys(query).length === 0
|
|
83
88
|
? undefined
|
|
84
89
|
: (0, object_1.castStringlyObject)(query);
|
|
@@ -86,9 +91,10 @@ const getServerReq = ({ defaultHost, pathname, query, headers, }) => {
|
|
|
86
91
|
url: {
|
|
87
92
|
href,
|
|
88
93
|
query: parsedQuery,
|
|
94
|
+
protocol,
|
|
89
95
|
},
|
|
90
96
|
forceServer: true,
|
|
91
|
-
userAgent: (
|
|
97
|
+
userAgent: (_b = headers['user-agent']) === null || _b === void 0 ? void 0 : _b.toLowerCase(),
|
|
92
98
|
defaultHost,
|
|
93
99
|
});
|
|
94
100
|
return ret;
|