ag-common 0.0.252 → 0.0.255
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/api/helpers/api.d.ts +1 -1
- package/dist/api/helpers/openApiHelpers.js +1 -1
- package/dist/common/helpers/date.d.ts +1 -1
- package/dist/ui/components/Chevron/index.d.ts +0 -1
- package/dist/ui/components/Confirm/Modal.d.ts +0 -1
- package/dist/ui/components/DropdownList/index.d.ts +0 -1
- package/dist/ui/components/DropdownList/types.d.ts +0 -1
- package/dist/ui/components/HeadersRaw/index.d.ts +0 -1
- package/dist/ui/components/KebabDots/index.d.ts +0 -1
- package/dist/ui/components/Loader/index.d.ts +0 -1
- package/dist/ui/components/LoginButton/index.d.ts +0 -1
- package/dist/ui/components/LogoutButton/index.d.ts +0 -1
- package/dist/ui/components/Modal/index.d.ts +0 -1
- package/dist/ui/components/OpenApiCodeBlock/OpenApiCodeBlock.d.ts +0 -1
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/body.d.ts +0 -1
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/security.d.ts +0 -1
- package/dist/ui/components/OpenApiCodeBlock/curl/index.d.ts +0 -1
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/call.d.ts +0 -1
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/req.d.ts +0 -1
- package/dist/ui/components/OpenApiCodeBlock/fetch/index.d.ts +0 -1
- package/dist/ui/components/OpenApiCodeBlock/helpers/joinJsx.d.ts +0 -1
- package/dist/ui/components/OpenApiCodeBlock/types.d.ts +0 -1
- package/dist/ui/components/Prompt/Modal.d.ts +0 -1
- package/dist/ui/components/Search/Base.d.ts +0 -1
- package/dist/ui/components/Search/Inline.d.ts +0 -1
- package/dist/ui/components/Search/Modal.d.ts +0 -1
- package/dist/ui/components/Search/types.d.ts +0 -1
- package/dist/ui/components/Sidebar/index.d.ts +0 -1
- package/dist/ui/components/SparkLine/index.d.ts +0 -1
- package/dist/ui/components/Table/index.d.ts +0 -1
- package/dist/ui/components/TextEdit/CheckboxEdit.d.ts +0 -1
- package/dist/ui/components/TextEdit/ColourEdit.d.ts +0 -1
- package/dist/ui/components/TextEdit/LengthBox.d.ts +0 -1
- package/dist/ui/components/TextEdit/ListboxEdit.d.ts +8 -5
- package/dist/ui/components/TextEdit/ListboxEdit.js +12 -2
- package/dist/ui/components/TextEdit/RadioGroup.d.ts +0 -1
- package/dist/ui/components/TextEdit/RadioGroup.js +7 -4
- package/dist/ui/components/TextEdit/TextEdit.d.ts +0 -1
- package/dist/ui/components/TextEdit/TextEdit.js +1 -1
- package/dist/ui/components/TextEdit/images.d.ts +0 -1
- package/dist/ui/components/Toast/index.d.ts +1 -2
- package/dist/ui/components/UserImage/index.d.ts +0 -1
- package/dist/ui/helpers/date.d.ts +1 -1
- package/dist/ui/helpers/jwt.d.ts +2 -2
- package/dist/ui/helpers/useLocalStorage.d.ts +3 -3
- package/package.json +13 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { APIGatewayProxyResult, DYNAMOKEYS } from '../types';
|
|
2
2
|
export declare const returnCode: <T>(statusCode: number, body?: T | undefined, extraHeaders?: {
|
|
3
3
|
[a: string]: string;
|
|
4
|
-
} | undefined, fullSiteUrl?: string
|
|
4
|
+
} | undefined, fullSiteUrl?: string) => APIGatewayProxyResult;
|
|
5
5
|
/**
|
|
6
6
|
* strip all dynamo generated keys. can optionally keep PK
|
|
7
7
|
* @param record
|
|
@@ -136,7 +136,7 @@ const openApiImpl = (p) => {
|
|
|
136
136
|
const entry = `${endpointsBase}${fullPath}/${verb.toUpperCase()}.ts`;
|
|
137
137
|
const lambdaV = new aws_cdk_lib_1.aws_lambda_nodejs.NodejsFunction(stack, lambdaName, {
|
|
138
138
|
functionName: lambdaName,
|
|
139
|
-
runtime: aws_cdk_lib_1.aws_lambda.Runtime.
|
|
139
|
+
runtime: aws_cdk_lib_1.aws_lambda.Runtime.NODEJS_16_X,
|
|
140
140
|
handler: 'handler',
|
|
141
141
|
environment: lc.environment,
|
|
142
142
|
memorySize: lc.memory,
|
|
@@ -11,4 +11,4 @@ export declare const CSharpToJs: (charpTicks: number) => Date;
|
|
|
11
11
|
* @param date default = now
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
|
-
export declare const dateTimeToNearestMinute: (minutes: number, date?: Date
|
|
14
|
+
export declare const dateTimeToNearestMinute: (minutes: number, date?: Date) => Date;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const ModalItem: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
2
|
export declare const Modal: ({ open, setOpen, children, position, topPosition, showCloseButton, closeOnMoveMouseOutside, className, closeOnClickOutside, }: {
|
|
4
3
|
open: boolean;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const joinJsx: (items: (JSX.Element | undefined)[], sep: JSX.Element[]) => JSX.Element[];
|
|
3
2
|
export declare const joinJsxWithSlash: (items: (JSX.Element | undefined)[]) => JSX.Element[];
|
|
4
3
|
export declare const joinJsxWithComma: (items: (JSX.Element | undefined)[]) => JSX.Element[];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ISearchDialog, TSearchModalRes } from './types';
|
|
3
2
|
export declare const SearchBase: <T>({ onSelectItem, onSearchTextChange, placeholderText, closeText, renderItem, displayItems, willDisplayItem, getKeyF, }: ISearchDialog<T> & {
|
|
4
3
|
onSearchTextChange?: ((v: string) => void) | undefined;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
values: string[];
|
|
1
|
+
export declare const ListboxEdit: <T>({ defaultValue, onSubmit, values, canEdit, renderLabel, }: {
|
|
2
|
+
defaultValue: T;
|
|
3
|
+
onSubmit: (val: T) => void;
|
|
4
|
+
values: T[];
|
|
6
5
|
/**
|
|
7
6
|
* if true can revert or explicit save. default true
|
|
8
7
|
*/
|
|
9
8
|
canEdit?: boolean | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* can overload the render of the label. defaults to toString
|
|
11
|
+
*/
|
|
12
|
+
renderLabel?: ((a: T) => string) | undefined;
|
|
10
13
|
}) => JSX.Element;
|
|
@@ -28,13 +28,23 @@ const images_1 = require("./images");
|
|
|
28
28
|
const common_1 = require("./common");
|
|
29
29
|
const common_2 = require("../../styles/common");
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
|
-
const ListboxEdit = ({ defaultValue, onSubmit, values, canEdit = true,
|
|
31
|
+
const ListboxEdit = ({ defaultValue, onSubmit, values, canEdit = true,
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
+
renderLabel = (e) => e.toString(), }) => {
|
|
32
34
|
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
33
35
|
(0, react_1.useEffect)(() => {
|
|
34
36
|
setValue(defaultValue);
|
|
35
37
|
}, [defaultValue]);
|
|
36
38
|
return (react_1.default.createElement(common_1.ValueBox, Object.assign({}, common_2.noDrag),
|
|
37
|
-
react_1.default.createElement("select", { size: 5,
|
|
39
|
+
react_1.default.createElement("select", { size: 5,
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
value: value.toString(), onChange: (v) => canEdit
|
|
42
|
+
? setValue(v.target.value)
|
|
43
|
+
: onSubmit(v.target.value) }, values.map((v) => (react_1.default.createElement("option", {
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
+
key: value.toString(),
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
value: value.toString() }, renderLabel(v))))),
|
|
38
48
|
canEdit && value !== defaultValue && (react_1.default.createElement(common_1.IconD, { style: common_1.iconLeft, onClick: () => value !== defaultValue && onSubmit(value) },
|
|
39
49
|
react_1.default.createElement(images_1.SaveIcon, null))),
|
|
40
50
|
canEdit && value !== defaultValue && (react_1.default.createElement(common_1.IconD, { style: common_1.iconRight, onClick: () => setValue(defaultValue) },
|
|
@@ -40,12 +40,15 @@ renderLabel = (e) => e.toString(),
|
|
|
40
40
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
41
|
renderValue = (e) => e.toString(), }) => {
|
|
42
42
|
const [name] = (0, react_1.useState)((0, math_1.getRandomInt)(10000).toString());
|
|
43
|
-
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
43
|
+
const [value, setValue] = (0, react_1.useState)(renderValue(defaultValue));
|
|
44
44
|
(0, react_1.useEffect)(() => {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const rv = renderValue(defaultValue);
|
|
46
|
+
if (value !== rv) {
|
|
47
|
+
setValue(rv);
|
|
48
|
+
}
|
|
49
|
+
}, [defaultValue, renderValue, value]);
|
|
47
50
|
return (react_1.default.createElement(common_1.ValueBox, Object.assign({}, common_2.noDrag), values.map((v) => (react_1.default.createElement(FlexColumn_1.FlexColumn, { key: name + v },
|
|
48
51
|
react_1.default.createElement(Label, null, renderLabel(v)),
|
|
49
|
-
react_1.default.createElement("input", { type: "radio", key: renderValue(v), value: renderValue(v), name: name, checked: v === value, onChange: () => onSubmit(v) }))))));
|
|
52
|
+
react_1.default.createElement("input", { type: "radio", key: renderValue(v), value: renderValue(v), name: name, checked: renderValue(v) === value, onChange: () => onSubmit(v) }))))));
|
|
50
53
|
};
|
|
51
54
|
exports.RadioGroup = RadioGroup;
|
|
@@ -124,7 +124,7 @@ const TextEdit = ({ defaultValue = '', defaultEditing, disableEdit = false, plac
|
|
|
124
124
|
if (!editing || disableEdit) {
|
|
125
125
|
return (react_1.default.createElement(common_1.ValueBox, Object.assign({}, common_2.noDrag, { className: className, "data-editing": "false", onClick: () => onClickNotEditing === null || onClickNotEditing === void 0 ? void 0 : onClickNotEditing(), "data-pointer": onClickNotEditing ? 'true' : 'false', "data-nogrow": noGrow }, attributes),
|
|
126
126
|
leftContent || null,
|
|
127
|
-
react_1.default.createElement(exports.ValueReadonly, { "data-type": "text" }, value),
|
|
127
|
+
react_1.default.createElement(exports.ValueReadonly, { "data-type": "text" }, value || react_1.default.createElement("span", { style: { color: '#ccc' } }, placeholder)),
|
|
128
128
|
react_1.default.createElement(Right, null, !disableEdit && (react_1.default.createElement(Icon, { style: common_1.iconRight, onClick: (e) => {
|
|
129
129
|
e.stopPropagation();
|
|
130
130
|
setEditing(true);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ToastPosition } from 'react-hot-toast';
|
|
3
2
|
export interface IToastOptions {
|
|
4
3
|
appearance: 'error' | 'success';
|
|
5
4
|
autoClose?: number;
|
|
6
5
|
}
|
|
7
|
-
export declare const addToast: (m: string, options?: IToastOptions
|
|
6
|
+
export declare const addToast: (m: string, options?: IToastOptions) => void;
|
|
8
7
|
export declare const ToastProvider: ({ position }: {
|
|
9
8
|
position: ToastPosition;
|
|
10
9
|
}) => JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const daydiffstr: (dayticks: number) => string;
|
|
2
|
-
export declare const getDMY: (date: Date, dayOffset?: number
|
|
2
|
+
export declare const getDMY: (date: Date, dayOffset?: number) => string;
|
package/dist/ui/helpers/jwt.d.ts
CHANGED
|
@@ -74,5 +74,5 @@ export interface AuthedUserContext {
|
|
|
74
74
|
refreshToken: () => Promise<User | undefined>;
|
|
75
75
|
}
|
|
76
76
|
export declare const getBearerToken: (jwt?: {
|
|
77
|
-
id_token?: string
|
|
78
|
-
}
|
|
77
|
+
id_token?: string;
|
|
78
|
+
}) => string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const clearLocalStorageItem: (key: string) => void;
|
|
2
|
-
export declare const clearAllLocalStorage: (except?: string[]
|
|
3
|
-
export declare const setLocalStorageItem: <T>(key: string, value: T, ttl?: number
|
|
4
|
-
export declare const getLocalStorageItem: <T>(key: string, initialValue: T, ttl?: number
|
|
2
|
+
export declare const clearAllLocalStorage: (except?: string[]) => void;
|
|
3
|
+
export declare const setLocalStorageItem: <T>(key: string, value: T, ttl?: number) => void;
|
|
4
|
+
export declare const getLocalStorageItem: <T>(key: string, initialValue: T, ttl?: number) => T;
|
|
5
5
|
export declare function UseLocalStorage<T>(key: string, initialValue: T, ttl?: number): [T, (value: T | ((a: T) => T)) => void];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ag-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.255",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Andrei Gec <@andreigec> (https://gec.dev/)",
|
|
@@ -30,22 +30,22 @@
|
|
|
30
30
|
"typescript": "4.x"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@babel/core": "7.18.
|
|
34
|
-
"@storybook/addon-actions": "6.5.
|
|
35
|
-
"@storybook/addon-docs": "6.5.
|
|
36
|
-
"@storybook/addon-essentials": "6.5.
|
|
37
|
-
"@storybook/addon-interactions": "6.5.
|
|
38
|
-
"@storybook/addon-links": "6.5.
|
|
39
|
-
"@storybook/addons": "6.5.
|
|
40
|
-
"@storybook/react": "6.5.
|
|
41
|
-
"@storybook/theming": "6.5.
|
|
33
|
+
"@babel/core": "7.18.2",
|
|
34
|
+
"@storybook/addon-actions": "6.5.6",
|
|
35
|
+
"@storybook/addon-docs": "6.5.6",
|
|
36
|
+
"@storybook/addon-essentials": "6.5.6",
|
|
37
|
+
"@storybook/addon-interactions": "6.5.6",
|
|
38
|
+
"@storybook/addon-links": "6.5.6",
|
|
39
|
+
"@storybook/addons": "6.5.6",
|
|
40
|
+
"@storybook/react": "6.5.6",
|
|
41
|
+
"@storybook/theming": "6.5.6",
|
|
42
42
|
"@types/jsonwebtoken": "8.5.8",
|
|
43
|
-
"@types/node": "17.0.
|
|
43
|
+
"@types/node": "17.0.36",
|
|
44
44
|
"@types/react": "17.0.43",
|
|
45
45
|
"@types/react-dom": "17.0.14",
|
|
46
46
|
"@types/styled-components": "5.1.25",
|
|
47
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
48
|
-
"@typescript-eslint/parser": "5.
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "5.27.0",
|
|
48
|
+
"@typescript-eslint/parser": "5.27.0",
|
|
49
49
|
"cross-env": "7.0.3",
|
|
50
50
|
"eslint": "8.16.0",
|
|
51
51
|
"eslint-config-airbnb-typescript": "17.0.0",
|