ag-common 0.0.418 → 0.0.419
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.js +34 -35
- package/dist/api/helpers/aws.js +9 -13
- package/dist/api/helpers/cloudfront.js +7 -24
- package/dist/api/helpers/dynamo.js +85 -134
- package/dist/api/helpers/dynamoInfra.js +14 -19
- package/dist/api/helpers/enforceDynamoProvisionCap.js +14 -18
- package/dist/api/helpers/index.js +14 -30
- package/dist/api/helpers/openApiHelpers.d.ts +2 -3
- package/dist/api/helpers/openApiHelpers.js +34 -37
- package/dist/api/helpers/s3.js +81 -126
- package/dist/api/helpers/ses.js +9 -28
- package/dist/api/helpers/sqs.js +9 -26
- package/dist/api/helpers/ssm.js +8 -14
- package/dist/api/helpers/sts.js +16 -34
- package/dist/api/helpers/validateOpenApi.js +92 -103
- package/dist/api/helpers/validations.js +29 -46
- package/dist/api/index.js +2 -18
- package/dist/api/openapi-prefix.js +25 -38
- package/dist/api/types/aws.js +1 -2
- package/dist/api/types/index.js +1 -17
- package/dist/common/const.js +2 -5
- package/dist/common/helpers/array.js +8 -19
- package/dist/common/helpers/async.js +10 -28
- package/dist/common/helpers/binary.js +5 -10
- package/dist/common/helpers/date.js +14 -25
- package/dist/common/helpers/email.js +5 -11
- package/dist/common/helpers/func.js +3 -7
- package/dist/common/helpers/generator.js +9 -24
- package/dist/common/helpers/groupBy.js +3 -9
- package/dist/common/helpers/hashCode.js +3 -9
- package/dist/common/helpers/i18n.js +9 -17
- package/dist/common/helpers/index.js +18 -34
- package/dist/common/helpers/log.js +16 -28
- package/dist/common/helpers/math.js +9 -21
- package/dist/common/helpers/memo.js +3 -7
- package/dist/common/helpers/object.js +20 -35
- package/dist/common/helpers/random.js +4 -10
- package/dist/common/helpers/secondsInNearest.js +2 -7
- package/dist/common/helpers/sleep.js +1 -5
- package/dist/common/helpers/string/base64.js +2 -7
- package/dist/common/helpers/string/chunk.js +1 -5
- package/dist/common/helpers/string/contains.js +2 -7
- package/dist/common/helpers/string/getExtendedStringSegment.js +5 -9
- package/dist/common/helpers/string/index.js +10 -26
- package/dist/common/helpers/string/json.js +1 -5
- package/dist/common/helpers/string/object.js +1 -5
- package/dist/common/helpers/string/surround.js +1 -5
- package/dist/common/helpers/string/trim.js +2 -7
- package/dist/common/helpers/string/truncate.js +1 -5
- package/dist/common/helpers/string/url.js +4 -9
- package/dist/common/index.js +2 -18
- package/dist/index.js +3 -19
- package/dist/ui/components/BorderGradient/index.js +18 -25
- package/dist/ui/components/Button/index.js +17 -25
- package/dist/ui/components/Chevron/index.js +9 -16
- package/dist/ui/components/Close/index.js +6 -13
- package/dist/ui/components/Confirm/Dialog.js +9 -25
- package/dist/ui/components/Confirm/Modal.js +20 -27
- package/dist/ui/components/Confirm/index.js +3 -19
- package/dist/ui/components/Confirm/types.js +1 -2
- package/dist/ui/components/DropdownList/Base.js +33 -64
- package/dist/ui/components/DropdownList/Dialog.js +8 -24
- package/dist/ui/components/DropdownList/index.js +2 -18
- package/dist/ui/components/DropdownList/types.js +1 -2
- package/dist/ui/components/FlexColumn/index.js +4 -14
- package/dist/ui/components/FlexRow/index.js +4 -14
- package/dist/ui/components/HeadersRaw/index.js +20 -27
- package/dist/ui/components/HorizontalScrollBar/index.js +6 -34
- package/dist/ui/components/Icon/index.js +9 -16
- package/dist/ui/components/Image/index.js +10 -28
- package/dist/ui/components/InfiniteScroll/index.js +18 -50
- package/dist/ui/components/KebabDots/index.js +6 -13
- package/dist/ui/components/Loader/index.js +9 -39
- package/dist/ui/components/Modal/Dialog.js +7 -23
- package/dist/ui/components/Modal/Modal.js +19 -49
- package/dist/ui/components/Modal/index.js +3 -19
- package/dist/ui/components/Modal/types.js +1 -2
- package/dist/ui/components/OpenApiCodeBlock/OpenApiCodeBlock.js +26 -34
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/body.js +12 -19
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/getCurlLines.js +6 -11
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/security.js +8 -15
- package/dist/ui/components/OpenApiCodeBlock/curl/index.js +14 -21
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/call.js +8 -15
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/getFetchLines.js +3 -8
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/req.js +27 -34
- package/dist/ui/components/OpenApiCodeBlock/fetch/index.js +11 -18
- package/dist/ui/components/OpenApiCodeBlock/helpers/common.js +7 -17
- package/dist/ui/components/OpenApiCodeBlock/helpers/joinJsx.js +6 -15
- package/dist/ui/components/OpenApiCodeBlock/index.js +2 -18
- package/dist/ui/components/OpenApiCodeBlock/types.js +1 -2
- package/dist/ui/components/PieChart/index.js +11 -18
- package/dist/ui/components/ProgressBar/index.js +15 -45
- package/dist/ui/components/Prompt/Dialog.js +7 -23
- package/dist/ui/components/Prompt/Modal.js +25 -55
- package/dist/ui/components/Prompt/index.js +2 -18
- package/dist/ui/components/RowOrColumn/index.js +7 -17
- package/dist/ui/components/Search/AutoHideSearchBox.js +24 -56
- package/dist/ui/components/Search/Base.js +21 -52
- package/dist/ui/components/Search/Dialog.js +10 -26
- package/dist/ui/components/Search/Inline.js +3 -10
- package/dist/ui/components/Search/Modal.js +10 -17
- package/dist/ui/components/Search/SearchBox.js +26 -58
- package/dist/ui/components/Search/index.js +7 -23
- package/dist/ui/components/Search/types.js +1 -2
- package/dist/ui/components/Sidebar/index.js +18 -25
- package/dist/ui/components/SparkLine/index.js +17 -27
- package/dist/ui/components/Table/index.js +15 -22
- package/dist/ui/components/TextEdit/CheckboxEdit.js +21 -51
- package/dist/ui/components/TextEdit/ColourEdit.js +17 -44
- package/dist/ui/components/TextEdit/LengthBox.js +5 -12
- package/dist/ui/components/TextEdit/ListboxEdit.js +15 -42
- package/dist/ui/components/TextEdit/RadioGroup.js +13 -43
- package/dist/ui/components/TextEdit/TextEdit.js +48 -78
- package/dist/ui/components/TextEdit/common.js +11 -17
- package/dist/ui/components/TextEdit/index.js +6 -22
- package/dist/ui/components/TextEdit/types.js +1 -2
- package/dist/ui/components/TextWithButton/index.js +10 -40
- package/dist/ui/components/TimelineChart/index.js +14 -24
- package/dist/ui/components/Toast/Cross.js +9 -16
- package/dist/ui/components/Toast/Tick.js +4 -11
- package/dist/ui/components/Toast/Warning.js +8 -15
- package/dist/ui/components/Toast/base.js +33 -65
- package/dist/ui/components/Toast/index.js +2 -18
- package/dist/ui/components/Toast/types.js +1 -2
- package/dist/ui/components/UserImage/index.js +17 -48
- package/dist/ui/components/index.js +30 -46
- package/dist/ui/helpers/axiosHelper.js +25 -39
- package/dist/ui/helpers/browserHelpers.js +7 -22
- package/dist/ui/helpers/callOpenApi/cached.js +18 -37
- package/dist/ui/helpers/callOpenApi/direct.js +46 -59
- package/dist/ui/helpers/callOpenApi/helpers.js +25 -40
- package/dist/ui/helpers/callOpenApi/hook.js +47 -36
- package/dist/ui/helpers/callOpenApi/index.js +5 -21
- package/dist/ui/helpers/callOpenApi/types.js +1 -2
- package/dist/ui/helpers/cognito.js +1 -2
- package/dist/ui/helpers/cookie/const.js +2 -5
- package/dist/ui/helpers/cookie/get.js +13 -14
- package/dist/ui/helpers/cookie/index.js +5 -21
- package/dist/ui/helpers/cookie/raw.js +9 -16
- package/dist/ui/helpers/cookie/set.js +10 -15
- package/dist/ui/helpers/cookie/use.js +23 -16
- package/dist/ui/helpers/date.js +10 -15
- package/dist/ui/helpers/debounce.js +5 -10
- package/dist/ui/helpers/dom.js +6 -13
- package/dist/ui/helpers/extractAttributes.js +2 -7
- package/dist/ui/helpers/index.js +25 -41
- package/dist/ui/helpers/jwt.js +1 -2
- package/dist/ui/helpers/plural.js +1 -5
- package/dist/ui/helpers/routes.js +17 -24
- package/dist/ui/helpers/serviceWorker.js +8 -23
- package/dist/ui/helpers/useContextMenu.js +9 -14
- package/dist/ui/helpers/useElementAttribute.js +3 -7
- package/dist/ui/helpers/useGranularHook.js +5 -10
- package/dist/ui/helpers/useInterval.js +8 -12
- package/dist/ui/helpers/useLocalStorage.js +24 -32
- package/dist/ui/helpers/useLockBodyScroll.js +3 -7
- package/dist/ui/helpers/useOnClickOutside.js +7 -12
- package/dist/ui/helpers/useOnScroll.js +15 -21
- package/dist/ui/helpers/useOverloadPageSearch.js +3 -7
- package/dist/ui/helpers/useQueryString.js +14 -20
- package/dist/ui/helpers/useResize.js +8 -12
- package/dist/ui/helpers/useTimeout.js +5 -9
- package/dist/ui/icons/ChevronRight.js +3 -9
- package/dist/ui/icons/CrossIcon.js +5 -12
- package/dist/ui/icons/Door.js +4 -10
- package/dist/ui/icons/HorizontalDots.js +3 -9
- package/dist/ui/icons/Magnify.js +3 -10
- package/dist/ui/icons/Pencil.js +5 -12
- package/dist/ui/icons/Save.js +4 -11
- package/dist/ui/icons/Undo.js +5 -12
- package/dist/ui/icons/UserOutline.js +3 -9
- package/dist/ui/icons/index.js +9 -25
- package/dist/ui/index.js +4 -20
- package/dist/ui/styles/colours.js +7 -12
- package/dist/ui/styles/common.js +14 -22
- package/dist/ui/styles/index.js +4 -20
- package/dist/ui/styles/media.js +7 -10
- package/dist/ui/styles/standaloneStyles.js +10 -16
- package/package.json +18 -17
|
@@ -1,43 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ListboxEdit = void 0;
|
|
27
|
-
const react_1 = __importStar(require("react"));
|
|
28
|
-
const Save_1 = require("../../icons/Save");
|
|
29
|
-
const Undo_1 = require("../../icons/Undo");
|
|
30
|
-
const common_1 = require("../../styles/common");
|
|
31
|
-
const common_2 = require("./common");
|
|
32
|
-
const ListboxEdit = ({ defaultValue, onSubmit, values, canEdit = true,
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Save } from '../../icons/Save';
|
|
3
|
+
import { Undo } from '../../icons/Undo';
|
|
4
|
+
import { noDrag } from '../../styles/common';
|
|
5
|
+
import { IconD as Icon, iconLeft, iconRight, ValueBox } from './common';
|
|
6
|
+
export const ListboxEdit = ({ defaultValue, onSubmit, values, canEdit = true,
|
|
33
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
8
|
renderLabel = (e) => e.toString(), }) => {
|
|
35
|
-
const [value, setValue] =
|
|
36
|
-
|
|
9
|
+
const [value, setValue] = useState(defaultValue);
|
|
10
|
+
useEffect(() => {
|
|
37
11
|
setValue(defaultValue);
|
|
38
12
|
}, [defaultValue]);
|
|
39
|
-
return (
|
|
40
|
-
|
|
13
|
+
return (React.createElement(ValueBox, { ...noDrag },
|
|
14
|
+
React.createElement("select", { size: 5,
|
|
41
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
16
|
value: value.toString(), onChange: (v) => {
|
|
43
17
|
const selected = values[v.target.selectedIndex];
|
|
@@ -45,14 +19,13 @@ renderLabel = (e) => e.toString(), }) => {
|
|
|
45
19
|
return;
|
|
46
20
|
}
|
|
47
21
|
return canEdit ? setValue(selected) : onSubmit(selected);
|
|
48
|
-
} }, values.map((v) => (
|
|
22
|
+
} }, values.map((v) => (React.createElement("option", {
|
|
49
23
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
24
|
key: v.toString(),
|
|
51
25
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
26
|
value: v.toString() }, renderLabel(v))))),
|
|
53
|
-
canEdit && value !== defaultValue && (
|
|
54
|
-
|
|
55
|
-
canEdit && value !== defaultValue && (
|
|
56
|
-
|
|
27
|
+
canEdit && value !== defaultValue && (React.createElement(Icon, { style: iconLeft, onClick: () => value !== defaultValue && onSubmit(value) },
|
|
28
|
+
React.createElement(Save, null))),
|
|
29
|
+
canEdit && value !== defaultValue && (React.createElement(Icon, { style: iconRight, onClick: () => setValue(defaultValue) },
|
|
30
|
+
React.createElement(Undo, null)))));
|
|
57
31
|
};
|
|
58
|
-
exports.ListboxEdit = ListboxEdit;
|
|
@@ -1,54 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.RadioGroup = void 0;
|
|
30
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
31
|
-
const react_1 = __importStar(require("react"));
|
|
32
|
-
const common_1 = require("../../styles/common");
|
|
33
|
-
const FlexColumn_1 = require("../FlexColumn");
|
|
34
|
-
const common_2 = require("./common");
|
|
35
|
-
const Label = styled_1.default.label ``;
|
|
36
|
-
const RadioGroup = ({ defaultValue, onSubmit, values,
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { noDrag } from '../../styles/common';
|
|
4
|
+
import { FlexColumn } from '../FlexColumn';
|
|
5
|
+
import { ValueBox } from './common';
|
|
6
|
+
const Label = styled.label ``;
|
|
7
|
+
export const RadioGroup = ({ defaultValue, onSubmit, values,
|
|
37
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
9
|
renderLabel = (e) => e.toString(),
|
|
39
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
11
|
renderValue = (e) => e.toString(), }) => {
|
|
41
|
-
const [value, setValue] =
|
|
42
|
-
|
|
12
|
+
const [value, setValue] = useState(renderValue(defaultValue));
|
|
13
|
+
useEffect(() => {
|
|
43
14
|
const rv = renderValue(defaultValue);
|
|
44
15
|
if (value !== rv) {
|
|
45
16
|
setValue(rv);
|
|
46
17
|
}
|
|
47
18
|
}, [defaultValue, renderValue, value]);
|
|
48
|
-
return (
|
|
19
|
+
return (React.createElement(ValueBox, { ...noDrag }, values.map((v) => (
|
|
49
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
21
|
+
React.createElement(FlexColumn, { key: v.toString() },
|
|
22
|
+
React.createElement(Label, null, renderLabel(v)),
|
|
23
|
+
React.createElement("input", { type: "radio", key: renderValue(v), value: renderValue(v), checked: renderValue(v) === value, onChange: () => onSubmit(v) }))))));
|
|
53
24
|
};
|
|
54
|
-
exports.RadioGroup = RadioGroup;
|
|
@@ -1,54 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.TextEdit = exports.ValueReadonly = void 0;
|
|
30
1
|
/* eslint-disable react/display-name */
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
${
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState, } from 'react';
|
|
5
|
+
import { filterDataProps } from '../../helpers/dom';
|
|
6
|
+
import { useOnClickOutside } from '../../helpers/useOnClickOutside';
|
|
7
|
+
import { Pencil } from '../../icons/Pencil';
|
|
8
|
+
import { Save } from '../../icons/Save';
|
|
9
|
+
import { Undo } from '../../icons/Undo';
|
|
10
|
+
import { noDrag } from '../../styles/common';
|
|
11
|
+
import { iconLeft, iconRight, ValueBox, valueCss } from './common';
|
|
12
|
+
import { TextEditLengthBox } from './LengthBox';
|
|
13
|
+
export const ValueReadonly = styled.div `
|
|
14
|
+
${valueCss};
|
|
44
15
|
word-break: break-word;
|
|
45
16
|
flex-basis: calc(100% - 3rem);
|
|
46
17
|
`;
|
|
47
|
-
const basecss =
|
|
18
|
+
const basecss = css `
|
|
48
19
|
outline: none;
|
|
49
20
|
border: 0;
|
|
50
21
|
word-break: break-word;
|
|
51
|
-
${
|
|
22
|
+
${valueCss};
|
|
52
23
|
resize: none;
|
|
53
24
|
overflow: hidden;
|
|
54
25
|
background-color: white;
|
|
@@ -59,19 +30,19 @@ const basecss = (0, react_1.css) `
|
|
|
59
30
|
color: #bbb;
|
|
60
31
|
}
|
|
61
32
|
`;
|
|
62
|
-
const ValueTextArea =
|
|
33
|
+
const ValueTextArea = styled.textarea `
|
|
63
34
|
${basecss}
|
|
64
35
|
&[data-editing='true'] {
|
|
65
36
|
min-height: 5rem;
|
|
66
37
|
}
|
|
67
38
|
`;
|
|
68
|
-
const ValueTextBox =
|
|
39
|
+
const ValueTextBox = styled.input `
|
|
69
40
|
${basecss}
|
|
70
41
|
`;
|
|
71
|
-
const ValueBoxEdit = (
|
|
42
|
+
const ValueBoxEdit = styled(ValueBox) `
|
|
72
43
|
border: solid 1px #ccc;
|
|
73
44
|
`;
|
|
74
|
-
const Right =
|
|
45
|
+
const Right = styled.div `
|
|
75
46
|
display: flex;
|
|
76
47
|
flex-flow: row;
|
|
77
48
|
align-content: center;
|
|
@@ -81,7 +52,7 @@ const Right = styled_1.default.div `
|
|
|
81
52
|
right: 0.5rem;
|
|
82
53
|
}
|
|
83
54
|
`;
|
|
84
|
-
const Icon =
|
|
55
|
+
const Icon = styled.div `
|
|
85
56
|
width: 1.5rem;
|
|
86
57
|
display: flex;
|
|
87
58
|
cursor: pointer;
|
|
@@ -89,24 +60,24 @@ const Icon = styled_1.default.div `
|
|
|
89
60
|
filter: saturate(3);
|
|
90
61
|
}
|
|
91
62
|
`;
|
|
92
|
-
|
|
63
|
+
export const TextEdit = forwardRef((p, ref) => {
|
|
93
64
|
const { defaultValue = '', defaultEditing, disableEdit = false, singleLine = false, noGrow = false, allowUndo = true, } = p;
|
|
94
|
-
const divRef =
|
|
95
|
-
const taref =
|
|
96
|
-
const [value, setValue] =
|
|
97
|
-
const [editing, setEditingRaw] =
|
|
65
|
+
const divRef = useRef(null);
|
|
66
|
+
const taref = useRef(null);
|
|
67
|
+
const [value, setValue] = useState(defaultValue);
|
|
68
|
+
const [editing, setEditingRaw] = useState(!!defaultEditing);
|
|
98
69
|
const valueChange = value !== defaultValue;
|
|
99
|
-
|
|
70
|
+
useImperativeHandle(ref, () => ({
|
|
100
71
|
setValue: (v) => {
|
|
101
72
|
if (v === value) {
|
|
102
73
|
return;
|
|
103
74
|
}
|
|
104
75
|
setValue(v);
|
|
105
76
|
},
|
|
106
|
-
focus: () =>
|
|
107
|
-
getValue: () =>
|
|
77
|
+
focus: () => taref.current?.focus(),
|
|
78
|
+
getValue: () => taref.current?.value,
|
|
108
79
|
}));
|
|
109
|
-
|
|
80
|
+
useOnClickOutside({
|
|
110
81
|
disabled: p.onClickOutsideWithNoValue === null || disableEdit,
|
|
111
82
|
ref: divRef,
|
|
112
83
|
moveMouseOutside: false,
|
|
@@ -125,34 +96,34 @@ exports.TextEdit = (0, react_2.forwardRef)((p, ref) => {
|
|
|
125
96
|
setEditingRaw(false);
|
|
126
97
|
}
|
|
127
98
|
});
|
|
128
|
-
const setEditing =
|
|
99
|
+
const setEditing = useCallback((b) => {
|
|
129
100
|
setEditingRaw(b);
|
|
130
101
|
if (p.onEditingChange) {
|
|
131
102
|
p.onEditingChange(b);
|
|
132
103
|
}
|
|
133
104
|
}, [p]);
|
|
134
|
-
|
|
135
|
-
if (
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (defaultEditing?.focus && taref.current) {
|
|
136
107
|
taref.current.focus();
|
|
137
108
|
}
|
|
138
|
-
}, [defaultEditing
|
|
109
|
+
}, [defaultEditing?.focus]);
|
|
139
110
|
if (!editing || disableEdit) {
|
|
140
|
-
return (
|
|
111
|
+
return (React.createElement(ValueBox, { ...noDrag, className: p.className, "data-editing": "false", onClick: () => p.onClickNotEditing?.(), "data-pointer": p.onClickNotEditing ? 'true' : 'false', "data-nogrow": noGrow, ...filterDataProps(p) },
|
|
141
112
|
p.leftContent || null,
|
|
142
|
-
|
|
143
|
-
|
|
113
|
+
React.createElement(ValueReadonly, { "data-type": "text" }, value || React.createElement("span", { style: { color: '#ccc' } }, p.placeholder)),
|
|
114
|
+
React.createElement(Right, null, !disableEdit && (React.createElement(Icon, { style: iconRight, onClick: (e) => {
|
|
144
115
|
e.stopPropagation();
|
|
145
116
|
setEditing(true);
|
|
146
117
|
} },
|
|
147
|
-
|
|
118
|
+
React.createElement(Pencil, null))))));
|
|
148
119
|
}
|
|
149
120
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
150
121
|
const Comp = !singleLine ? ValueTextArea : ValueTextBox;
|
|
151
|
-
return (
|
|
122
|
+
return (React.createElement(ValueBoxEdit, { ...noDrag, className: p.className, "data-editing": "true",
|
|
152
123
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
153
|
-
ref: ref, tabIndex: -1, "data-nogrow": noGrow
|
|
124
|
+
ref: ref, tabIndex: -1, "data-nogrow": noGrow, ...filterDataProps(p) },
|
|
154
125
|
p.leftContent || null,
|
|
155
|
-
|
|
126
|
+
React.createElement(Comp, { tabIndex: editing ? 0 : undefined, "data-editing": "true", "data-valuechange": valueChange.toString(),
|
|
156
127
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
157
128
|
ref: taref, "data-type": "text", value: value, onChange: (v) => {
|
|
158
129
|
setValue(v.currentTarget.value);
|
|
@@ -162,8 +133,7 @@ exports.TextEdit = (0, react_2.forwardRef)((p, ref) => {
|
|
|
162
133
|
}, placeholder: p.placeholder, rows: singleLine ? 1 : undefined, maxLength: p.maxLength,
|
|
163
134
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
164
135
|
onKeyDown: (e) => {
|
|
165
|
-
|
|
166
|
-
if (((_a = p.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(p, e)) === false) {
|
|
136
|
+
if (p.onKeyDown?.(e) === false) {
|
|
167
137
|
e.preventDefault();
|
|
168
138
|
return;
|
|
169
139
|
}
|
|
@@ -171,14 +141,14 @@ exports.TextEdit = (0, react_2.forwardRef)((p, ref) => {
|
|
|
171
141
|
p.onSubmit(value, true);
|
|
172
142
|
}
|
|
173
143
|
} }),
|
|
174
|
-
p.maxLength && (
|
|
175
|
-
|
|
176
|
-
allowUndo && (
|
|
177
|
-
valueChange && (
|
|
178
|
-
|
|
179
|
-
(valueChange || editing !== !!defaultEditing) && (
|
|
144
|
+
p.maxLength && (React.createElement(Right, { "data-singleline": singleLine },
|
|
145
|
+
React.createElement(TextEditLengthBox, { min: value.length, max: p.maxLength }))),
|
|
146
|
+
allowUndo && (React.createElement(Right, null,
|
|
147
|
+
valueChange && (React.createElement(Icon, { style: iconLeft, onClick: () => valueChange && p.onSubmit(value, false) },
|
|
148
|
+
React.createElement(Save, null))),
|
|
149
|
+
(valueChange || editing !== !!defaultEditing) && (React.createElement(Icon, { style: iconRight, onClick: () => {
|
|
180
150
|
setEditing(!!defaultEditing);
|
|
181
151
|
setValue(defaultValue);
|
|
182
152
|
} },
|
|
183
|
-
|
|
153
|
+
React.createElement(Undo, null)))))));
|
|
184
154
|
});
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.iconLeft = exports.iconRight = exports.IconD = exports.ValueInputCB = exports.valueCss = exports.ValueBox = void 0;
|
|
7
|
-
const react_1 = require("@emotion/react");
|
|
8
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
9
|
-
const colours_1 = require("../../styles/colours");
|
|
10
|
-
exports.ValueBox = styled_1.default.div `
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { colours } from '../../styles/colours';
|
|
4
|
+
export const ValueBox = styled.div `
|
|
11
5
|
padding: 0.5rem;
|
|
12
6
|
|
|
13
7
|
display: flex;
|
|
@@ -27,7 +21,7 @@ exports.ValueBox = styled_1.default.div `
|
|
|
27
21
|
flex-grow: 0;
|
|
28
22
|
}
|
|
29
23
|
`;
|
|
30
|
-
|
|
24
|
+
export const valueCss = css `
|
|
31
25
|
width: 100%;
|
|
32
26
|
height: 100%;
|
|
33
27
|
word-break: break-all;
|
|
@@ -41,10 +35,10 @@ exports.valueCss = (0, react_1.css) `
|
|
|
41
35
|
height: 1.5rem;
|
|
42
36
|
}
|
|
43
37
|
`;
|
|
44
|
-
|
|
45
|
-
${
|
|
38
|
+
export const ValueInputCB = styled.input `
|
|
39
|
+
${valueCss};
|
|
46
40
|
`;
|
|
47
|
-
|
|
41
|
+
export const IconD = styled.div `
|
|
48
42
|
z-index: 1;
|
|
49
43
|
font-size: 1rem;
|
|
50
44
|
width: 1.5rem;
|
|
@@ -52,8 +46,8 @@ exports.IconD = styled_1.default.div `
|
|
|
52
46
|
position: absolute;
|
|
53
47
|
cursor: pointer;
|
|
54
48
|
svg {
|
|
55
|
-
fill: ${
|
|
49
|
+
fill: ${colours.notificationBlue};
|
|
56
50
|
}
|
|
57
51
|
`;
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
export const iconRight = { right: '0' };
|
|
53
|
+
export const iconLeft = { right: '1.5rem' };
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./CheckboxEdit"), exports);
|
|
18
|
-
__exportStar(require("./ColourEdit"), exports);
|
|
19
|
-
__exportStar(require("./ListboxEdit"), exports);
|
|
20
|
-
__exportStar(require("./RadioGroup"), exports);
|
|
21
|
-
__exportStar(require("./TextEdit"), exports);
|
|
22
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
export * from './CheckboxEdit';
|
|
2
|
+
export * from './ColourEdit';
|
|
3
|
+
export * from './ListboxEdit';
|
|
4
|
+
export * from './RadioGroup';
|
|
5
|
+
export * from './TextEdit';
|
|
6
|
+
export * from './types';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,39 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.TextWithButton = void 0;
|
|
30
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
31
|
-
const react_1 = __importStar(require("react"));
|
|
32
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
const Base = styled.div `
|
|
33
4
|
display: flex;
|
|
34
5
|
flex-flow: row;
|
|
35
6
|
`;
|
|
36
|
-
const Input =
|
|
7
|
+
const Input = styled.input `
|
|
37
8
|
flex-grow: 1;
|
|
38
9
|
border: solid 3px #ccc;
|
|
39
10
|
border-right: 0;
|
|
@@ -46,7 +17,7 @@ const Input = styled_1.default.input `
|
|
|
46
17
|
}
|
|
47
18
|
outline: 0;
|
|
48
19
|
`;
|
|
49
|
-
const Button =
|
|
20
|
+
const Button = styled.button `
|
|
50
21
|
padding: 2rem;
|
|
51
22
|
padding-top: 1rem;
|
|
52
23
|
padding-bottom: 1rem;
|
|
@@ -67,11 +38,10 @@ const Button = styled_1.default.button `
|
|
|
67
38
|
background-color: #ccc;
|
|
68
39
|
}
|
|
69
40
|
`;
|
|
70
|
-
const TextWithButton = ({ submitText = 'Submit', placeholder, validateF, onSubmit, }) => {
|
|
71
|
-
const [value, setValue] =
|
|
41
|
+
export const TextWithButton = ({ submitText = 'Submit', placeholder, validateF, onSubmit, }) => {
|
|
42
|
+
const [value, setValue] = useState('');
|
|
72
43
|
const valid = !validateF ? true : validateF(value);
|
|
73
|
-
return (
|
|
74
|
-
|
|
75
|
-
|
|
44
|
+
return (React.createElement(Base, null,
|
|
45
|
+
React.createElement(Input, { "data-type": "input", "data-valid": valid, placeholder: placeholder, value: value, onChange: (s) => setValue(s.target.value), onKeyDown: (e) => e.key === 'Enter' && valid && onSubmit(value) }),
|
|
46
|
+
React.createElement(Button, { "data-type": "button", "data-valid": valid, disabled: !valid, onClick: () => valid && onSubmit(value) }, submitText)));
|
|
76
47
|
};
|
|
77
|
-
exports.TextWithButton = TextWithButton;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TimelineChart = void 0;
|
|
7
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
const Base = styled.div `
|
|
10
4
|
display: flex;
|
|
11
5
|
flex-flow: column;
|
|
12
6
|
justify-content: center;
|
|
@@ -17,9 +11,9 @@ const Base = styled_1.default.div `
|
|
|
17
11
|
overflow: initial;
|
|
18
12
|
}
|
|
19
13
|
`;
|
|
20
|
-
const TimelineChart = ({ series, strokeWidth = 3, className, }) => {
|
|
14
|
+
export const TimelineChart = ({ series, strokeWidth = 3, className, }) => {
|
|
21
15
|
if (series.length === 0) {
|
|
22
|
-
return
|
|
16
|
+
return React.createElement(Base, null);
|
|
23
17
|
}
|
|
24
18
|
const width = 600;
|
|
25
19
|
const height = 200;
|
|
@@ -29,13 +23,13 @@ const TimelineChart = ({ series, strokeWidth = 3, className, }) => {
|
|
|
29
23
|
const xMax = Math.max(...xValues);
|
|
30
24
|
const yMin = Math.min(...yValues);
|
|
31
25
|
const yMax = Math.max(...yValues);
|
|
32
|
-
const xScale = (x) =>
|
|
26
|
+
const xScale = (x) => Math.ceil(width * ((x - xMin) / (xMax - xMin))) ?? 0;
|
|
33
27
|
const yScale = (y) => {
|
|
34
28
|
let ret = Math.ceil(height * ((yMax - y) / (yMax - yMin)));
|
|
35
29
|
if (isNaN(ret)) {
|
|
36
30
|
ret = y;
|
|
37
31
|
}
|
|
38
|
-
return ret
|
|
32
|
+
return ret ?? y;
|
|
39
33
|
};
|
|
40
34
|
const getPathData = ({ data }) => {
|
|
41
35
|
const pd1 = data
|
|
@@ -48,15 +42,11 @@ const TimelineChart = ({ series, strokeWidth = 3, className, }) => {
|
|
|
48
42
|
const pathData = pd1.map(({ xScaled, yScaled }, i) => i === 0 ? `M${xScaled} ${yScaled}` : ` L${xScaled} ${yScaled}`);
|
|
49
43
|
return pathData.join('\n');
|
|
50
44
|
};
|
|
51
|
-
return (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
react_1.default.createElement("text", { x: xScale((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.x) + strokeWidth * 2, y: yScale((_b = data[data.length - 1]) === null || _b === void 0 ? void 0 : _b.y), fontSize: "12", textAnchor: "middle", dominantBaseline: "middle", stroke: "white", strokeWidth: '3px' }, label),
|
|
59
|
-
react_1.default.createElement("text", { x: xScale((_c = data === null || data === void 0 ? void 0 : data[0]) === null || _c === void 0 ? void 0 : _c.x) + strokeWidth * 2, y: yScale((_d = data[data.length - 1]) === null || _d === void 0 ? void 0 : _d.y), fontSize: "12", textAnchor: "middle", dominantBaseline: "middle", fill: "black" }, label)))));
|
|
60
|
-
}))));
|
|
45
|
+
return (React.createElement(Base, { className: className },
|
|
46
|
+
React.createElement("svg", { viewBox: `0 -10 ${width} ${height + 20}` }, series.map(({ color, data, label, key, onClick, title }) => (React.createElement("g", { key: key },
|
|
47
|
+
React.createElement("title", null, title || label),
|
|
48
|
+
React.createElement("path", { d: getPathData({ color, data, label, key }), fill: "none", stroke: color, strokeWidth: strokeWidth, onClick: () => onClick?.(), style: { cursor: onClick ? 'pointer' : 'default' } }),
|
|
49
|
+
label && (React.createElement(React.Fragment, null,
|
|
50
|
+
React.createElement("text", { x: xScale(data?.[0]?.x) + strokeWidth * 2, y: yScale(data[data.length - 1]?.y), fontSize: "12", textAnchor: "middle", dominantBaseline: "middle", stroke: "white", strokeWidth: '3px' }, label),
|
|
51
|
+
React.createElement("text", { x: xScale(data?.[0]?.x) + strokeWidth * 2, y: yScale(data[data.length - 1]?.y), fontSize: "12", textAnchor: "middle", dominantBaseline: "middle", fill: "black" }, label)))))))));
|
|
61
52
|
};
|
|
62
|
-
exports.TimelineChart = TimelineChart;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Cross = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
1
|
+
import React from 'react';
|
|
8
2
|
//red cross in circle
|
|
9
|
-
const Cross = () => (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
exports.Cross = Cross;
|
|
3
|
+
export const Cross = () => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 48 48" },
|
|
4
|
+
React.createElement("defs", null,
|
|
5
|
+
React.createElement("linearGradient", { id: "a", x2: "0", y1: "47.37", y2: "-1.429", gradientUnits: "userSpaceOnUse" },
|
|
6
|
+
React.createElement("stop", { stopColor: "#c52828" }),
|
|
7
|
+
React.createElement("stop", { offset: "1", stopColor: "#ff5454" }))),
|
|
8
|
+
React.createElement("g", { style: { fillOpacity: 1 }, transform: "translate(-58.37 .882) scale(.99999)" },
|
|
9
|
+
React.createElement("circle", { cx: "82.37", cy: "23.12", r: "24", fill: "url(#a)", style: { fillOpacity: 1, fill: '#d33' } }),
|
|
10
|
+
React.createElement("path", { fill: "#fff", fillOpacity: ".842", d: "m87.77 23.725 5.939-5.939c.377-.372.566-.835.566-1.373 0-.54-.189-.997-.566-1.374l-2.747-2.747a1.888 1.888 0 0 0-1.373-.564c-.539 0-.997.186-1.374.564l-5.939 5.939-5.939-5.939a1.889 1.889 0 0 0-1.374-.564c-.539 0-.997.186-1.374.564l-2.748 2.747a1.873 1.873 0 0 0-.566 1.374c0 .54.188.997.566 1.373l5.939 5.939-5.939 5.94a1.862 1.862 0 0 0-.566 1.373c0 .54.188.997.566 1.373l2.748 2.747c.377.378.835.564 1.374.564.539 0 .997-.186 1.374-.564l5.939-5.939 5.94 5.939c.377.378.835.564 1.374.564.539 0 .997-.186 1.373-.564l2.747-2.747c.377-.372.566-.835.566-1.373 0-.54-.188-.997-.566-1.373l-5.939-5.94", style: { fillOpacity: 1, fill: '#fff' } }))));
|