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,36 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.ProgressBar = void 0;
|
|
30
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
31
|
-
const react_1 = __importStar(require("react"));
|
|
32
|
-
const styles_1 = require("../../styles");
|
|
33
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { colours } from '../../styles';
|
|
4
|
+
const Base = styled.div `
|
|
34
5
|
position: relative;
|
|
35
6
|
min-width: 5rem;
|
|
36
7
|
width: 100%;
|
|
@@ -38,13 +9,13 @@ const Base = styled_1.default.div `
|
|
|
38
9
|
border-radius: 1rem;
|
|
39
10
|
overflow: hidden;
|
|
40
11
|
`;
|
|
41
|
-
const Bar =
|
|
12
|
+
const Bar = styled.div `
|
|
42
13
|
position: absolute;
|
|
43
14
|
top: 0;
|
|
44
15
|
bottom: 0;
|
|
45
16
|
left: 0;
|
|
46
17
|
`;
|
|
47
|
-
const Dot =
|
|
18
|
+
const Dot = styled.div `
|
|
48
19
|
position: absolute;
|
|
49
20
|
top: calc(50% - 0.25rem);
|
|
50
21
|
width: 0.5rem;
|
|
@@ -56,30 +27,29 @@ const Dot = styled_1.default.div `
|
|
|
56
27
|
background-color: #333;
|
|
57
28
|
}
|
|
58
29
|
`;
|
|
59
|
-
const ProgressBar = (p) => {
|
|
60
|
-
const { transitionToMs = 200, frontColour =
|
|
61
|
-
const [barWidth, setBarWidth] =
|
|
62
|
-
|
|
30
|
+
export const ProgressBar = (p) => {
|
|
31
|
+
const { transitionToMs = 200, frontColour = colours.notificationBlue, backColour = '#eee', dotPercentages = [25, 50, 75], } = p;
|
|
32
|
+
const [barWidth, setBarWidth] = useState((p.min / p.max) * 100);
|
|
33
|
+
useEffect(() => {
|
|
63
34
|
const newbw = (p.min / p.max) * 100;
|
|
64
35
|
if (barWidth !== newbw) {
|
|
65
36
|
setBarWidth(newbw);
|
|
66
37
|
}
|
|
67
38
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
68
39
|
}, [p.min, p.max]);
|
|
69
|
-
|
|
40
|
+
useEffect(() => {
|
|
70
41
|
if (transitionToMs) {
|
|
71
42
|
setBarWidth(p.max);
|
|
72
43
|
}
|
|
73
44
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
74
45
|
}, []);
|
|
75
|
-
return (
|
|
46
|
+
return (React.createElement(Base, { style: {
|
|
76
47
|
backgroundColor: backColour,
|
|
77
48
|
}, className: p.className },
|
|
78
|
-
|
|
49
|
+
React.createElement(Bar, { style: {
|
|
79
50
|
width: `${barWidth}%`,
|
|
80
51
|
backgroundColor: frontColour,
|
|
81
52
|
transition: `width ${transitionToMs}ms linear`,
|
|
82
|
-
} }),
|
|
83
|
-
dotPercentages
|
|
53
|
+
} }),
|
|
54
|
+
dotPercentages?.map((v) => (React.createElement(Dot, { key: v, style: { left: `calc(${v}% - 0.25rem)` }, "data-invert": v > barWidth })))));
|
|
84
55
|
};
|
|
85
|
-
exports.ProgressBar = ProgressBar;
|
|
@@ -1,26 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.PromptDialog = void 0;
|
|
16
|
-
const react_1 = __importDefault(require("react"));
|
|
17
|
-
const client_1 = require("react-dom/client");
|
|
18
|
-
const Modal_1 = require("./Modal");
|
|
19
|
-
const PromptDialog = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { PromptModal } from './Modal';
|
|
4
|
+
export const PromptDialog = async (p) => {
|
|
20
5
|
return new Promise((res) => {
|
|
21
6
|
const wrapper = document.body.appendChild(document.createElement('div'));
|
|
22
|
-
const root =
|
|
23
|
-
root.render(
|
|
7
|
+
const root = createRoot(wrapper);
|
|
8
|
+
root.render(React.createElement(PromptModal, { ...p, res: res, root: root, wrapper: wrapper }));
|
|
24
9
|
});
|
|
25
|
-
}
|
|
26
|
-
exports.PromptDialog = PromptDialog;
|
|
10
|
+
};
|
|
@@ -1,84 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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.PromptModal = void 0;
|
|
30
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
31
|
-
const react_1 = __importStar(require("react"));
|
|
32
|
-
const Button_1 = require("../Button");
|
|
33
|
-
const FlexColumn_1 = require("../FlexColumn");
|
|
34
|
-
const FlexRow_1 = require("../FlexRow");
|
|
35
|
-
const Modal_1 = require("../Modal/Modal");
|
|
36
|
-
const TextEdit_1 = require("../TextEdit");
|
|
37
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { Button } from '../Button';
|
|
4
|
+
import { FlexColumn } from '../FlexColumn';
|
|
5
|
+
import { FlexRow } from '../FlexRow';
|
|
6
|
+
import { Modal } from '../Modal/Modal';
|
|
7
|
+
import { TextEdit } from '../TextEdit';
|
|
8
|
+
const Base = styled.div `
|
|
38
9
|
width: 95vw;
|
|
39
10
|
max-width: 30rem;
|
|
40
11
|
height: 50vh;
|
|
41
12
|
max-height: 15rem;
|
|
42
13
|
padding: 1rem;
|
|
43
14
|
`;
|
|
44
|
-
const Content = (
|
|
15
|
+
const Content = styled(FlexColumn) `
|
|
45
16
|
height: 100%;
|
|
46
17
|
`;
|
|
47
|
-
const TopText =
|
|
18
|
+
const TopText = styled.div `
|
|
48
19
|
font-weight: bold;
|
|
49
20
|
border-bottom: solid 1px #ccc;
|
|
50
21
|
padding-bottom: 0.25rem;
|
|
51
22
|
font-size: 1.5rem;
|
|
52
23
|
margin-bottom: 1rem;
|
|
53
24
|
`;
|
|
54
|
-
const BottomText =
|
|
25
|
+
const BottomText = styled.div `
|
|
55
26
|
padding-bottom: 0.25rem;
|
|
56
27
|
font-size: 1.1rem;
|
|
57
28
|
`;
|
|
58
|
-
const Bottom = (
|
|
29
|
+
const Bottom = styled(FlexRow) `
|
|
59
30
|
margin-top: auto;
|
|
60
31
|
justify-content: flex-end;
|
|
61
32
|
> button:first-of-type {
|
|
62
33
|
margin-right: 1rem;
|
|
63
34
|
}
|
|
64
35
|
`;
|
|
65
|
-
const PromptModal = ({ root, wrapper, res, bottomText, topText, okText = 'OK', cancelText = 'Cancel', defaultValue, placeholder, }) => {
|
|
66
|
-
const [text, setText] =
|
|
36
|
+
export const PromptModal = ({ root, wrapper, res, bottomText, topText, okText = 'OK', cancelText = 'Cancel', defaultValue, placeholder, }) => {
|
|
37
|
+
const [text, setText] = useState(defaultValue || '');
|
|
67
38
|
const ret = (v) => {
|
|
68
39
|
try {
|
|
69
40
|
res(v);
|
|
70
41
|
}
|
|
71
42
|
finally {
|
|
72
|
-
root
|
|
73
|
-
wrapper
|
|
43
|
+
root?.unmount();
|
|
44
|
+
wrapper?.remove();
|
|
74
45
|
}
|
|
75
46
|
};
|
|
76
|
-
return (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
topText &&
|
|
80
|
-
|
|
81
|
-
|
|
47
|
+
return (React.createElement(Modal, { position: "center", topPosition: "center", open: true, setOpen: () => ret(undefined), showCloseButton: false, closeOnClickOutside: false },
|
|
48
|
+
React.createElement(Base, null,
|
|
49
|
+
React.createElement(Content, null,
|
|
50
|
+
topText && React.createElement(TopText, null, topText),
|
|
51
|
+
React.createElement(BottomText, null, bottomText),
|
|
52
|
+
React.createElement(TextEdit, { defaultValue: text, onSubmit: (c, enter) => {
|
|
82
53
|
if (enter) {
|
|
83
54
|
ret(c);
|
|
84
55
|
}
|
|
@@ -86,8 +57,7 @@ const PromptModal = ({ root, wrapper, res, bottomText, topText, okText = 'OK', c
|
|
|
86
57
|
setText(c);
|
|
87
58
|
}
|
|
88
59
|
}, placeholder: placeholder, defaultEditing: { focus: true }, singleLine: true, noGrow: true, allowUndo: false }),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
60
|
+
React.createElement(Bottom, { noGrow: true },
|
|
61
|
+
React.createElement(Button, { onClick: () => ret(text) }, okText),
|
|
62
|
+
React.createElement(Button, { invert: true, onClick: () => ret(undefined) }, cancelText))))));
|
|
92
63
|
};
|
|
93
|
-
exports.PromptModal = PromptModal;
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 __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("./Dialog"), exports);
|
|
18
|
-
__exportStar(require("./Modal"), exports);
|
|
1
|
+
export * from './Dialog';
|
|
2
|
+
export * from './Modal';
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.RowOrColumn = void 0;
|
|
7
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const media_1 = require("../../styles/media");
|
|
10
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { bigScreen, smallScreen } from '../../styles/media';
|
|
4
|
+
const Base = styled.div `
|
|
11
5
|
display: flex;
|
|
12
6
|
flex-flow: row wrap;
|
|
13
7
|
flex-grow: 1;
|
|
14
8
|
width: 100%;
|
|
15
|
-
@media ${
|
|
9
|
+
@media ${bigScreen} {
|
|
16
10
|
&[data-nowrap='true'] {
|
|
17
11
|
flex-flow: row;
|
|
18
12
|
}
|
|
19
13
|
}
|
|
20
14
|
|
|
21
|
-
@media ${
|
|
15
|
+
@media ${smallScreen} {
|
|
22
16
|
flex-flow: column;
|
|
23
17
|
overflow: unset;
|
|
24
18
|
}
|
|
@@ -35,8 +29,4 @@ const Base = styled_1.default.div `
|
|
|
35
29
|
overflow: visible;
|
|
36
30
|
}
|
|
37
31
|
`;
|
|
38
|
-
const RowOrColumn = (props) => {
|
|
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));
|
|
41
|
-
};
|
|
42
|
-
exports.RowOrColumn = RowOrColumn;
|
|
32
|
+
export const RowOrColumn = (props) => (React.createElement(Base, { title: props.title, "data-nogrow": props.noGrow ?? false, "data-center": props.center ?? false, "data-nowrap": props.noWrap ?? false, "data-enableoverflow": props.enableOverflow ?? false, ...props }, props.children));
|
|
@@ -1,49 +1,20 @@
|
|
|
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.AutoHideSearchBox = void 0;
|
|
30
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
31
|
-
const react_1 = __importStar(require("react"));
|
|
32
|
-
const useGranularHook_1 = require("../../helpers/useGranularHook");
|
|
33
|
-
const icons_1 = require("../../icons");
|
|
34
|
-
const styles_1 = require("../../styles");
|
|
35
|
-
const SearchBox_1 = require("./SearchBox");
|
|
36
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React, { createRef, useState } from 'react';
|
|
3
|
+
import { useGranularEffect } from '../../helpers/useGranularHook';
|
|
4
|
+
import { CrossIcon, Magnify } from '../../icons';
|
|
5
|
+
import { bigScreen, smallScreen } from '../../styles';
|
|
6
|
+
import { SearchBox } from './SearchBox';
|
|
7
|
+
const Base = styled.div `
|
|
37
8
|
display: flex;
|
|
38
9
|
flex-flow: row;
|
|
39
10
|
align-items: center;
|
|
40
11
|
margin-left: 1rem;
|
|
41
12
|
|
|
42
|
-
@media ${
|
|
13
|
+
@media ${bigScreen} {
|
|
43
14
|
width: 20rem;
|
|
44
15
|
}
|
|
45
16
|
`;
|
|
46
|
-
const Icon =
|
|
17
|
+
const Icon = styled.div `
|
|
47
18
|
display: flex;
|
|
48
19
|
margin-right: 0.5rem;
|
|
49
20
|
> svg {
|
|
@@ -52,7 +23,7 @@ const Icon = styled_1.default.div `
|
|
|
52
23
|
fill: white;
|
|
53
24
|
}
|
|
54
25
|
`;
|
|
55
|
-
const SearchBoxStyled = (
|
|
26
|
+
const SearchBoxStyled = styled(SearchBox) `
|
|
56
27
|
transition: width 200ms ease-in-out;
|
|
57
28
|
|
|
58
29
|
overflow: hidden;
|
|
@@ -61,36 +32,34 @@ const SearchBoxStyled = (0, styled_1.default)(SearchBox_1.SearchBox) `
|
|
|
61
32
|
width: 0;
|
|
62
33
|
padding: 0;
|
|
63
34
|
}
|
|
64
|
-
@media ${
|
|
35
|
+
@media ${smallScreen} {
|
|
65
36
|
padding: 0;
|
|
66
37
|
}
|
|
67
38
|
`;
|
|
68
|
-
const AutoHideSearchBox = (p) => {
|
|
69
|
-
const [open, setOpen] =
|
|
70
|
-
const textEditRef =
|
|
71
|
-
|
|
72
|
-
var _a;
|
|
39
|
+
export const AutoHideSearchBox = (p) => {
|
|
40
|
+
const [open, setOpen] = useState(!!p.searchText);
|
|
41
|
+
const textEditRef = createRef();
|
|
42
|
+
useGranularEffect(() => {
|
|
73
43
|
const newOpen = !!p.searchText;
|
|
74
44
|
if (newOpen !== open) {
|
|
75
45
|
setOpen(!open);
|
|
76
|
-
|
|
46
|
+
p.onOpenToggle?.(!open);
|
|
77
47
|
}
|
|
78
48
|
}, [p.searchText], [open]);
|
|
79
|
-
return (
|
|
80
|
-
|
|
81
|
-
var _a, _b;
|
|
49
|
+
return (React.createElement(Base, { className: p.className, "data-open": open },
|
|
50
|
+
React.createElement(Icon, { style: { cursor: 'pointer' }, onClick: () => {
|
|
82
51
|
if (open) {
|
|
83
52
|
p.setSearchText('', false);
|
|
84
53
|
}
|
|
85
54
|
setOpen(!open);
|
|
86
|
-
|
|
55
|
+
p.onOpenToggle?.(!open);
|
|
87
56
|
if (!open) {
|
|
88
|
-
|
|
57
|
+
textEditRef.current?.focus();
|
|
89
58
|
}
|
|
90
59
|
} },
|
|
91
|
-
open &&
|
|
92
|
-
!open &&
|
|
93
|
-
|
|
60
|
+
open && React.createElement(CrossIcon, null),
|
|
61
|
+
!open && React.createElement(Magnify, { colour: "white" })),
|
|
62
|
+
React.createElement(SearchBoxStyled, { ref: textEditRef, ...p, className: "", "data-open": open, defaultValue: p.searchText, setSearchText: (val, enter) => {
|
|
94
63
|
//we dont want empty enters to do anything
|
|
95
64
|
if (val === '' && enter) {
|
|
96
65
|
p.setSearchText(val, false);
|
|
@@ -98,6 +67,5 @@ const AutoHideSearchBox = (p) => {
|
|
|
98
67
|
else {
|
|
99
68
|
p.setSearchText(val, enter);
|
|
100
69
|
}
|
|
101
|
-
} })))
|
|
70
|
+
} })));
|
|
102
71
|
};
|
|
103
|
-
exports.AutoHideSearchBox = AutoHideSearchBox;
|
|
@@ -1,44 +1,15 @@
|
|
|
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.SearchBase = void 0;
|
|
30
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
31
|
-
const react_1 = __importStar(require("react"));
|
|
32
|
-
const array_1 = require("../../../common/helpers/array");
|
|
33
|
-
const styles_1 = require("../../styles");
|
|
34
|
-
const SearchBox_1 = require("./SearchBox");
|
|
35
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { take } from '../../../common/helpers/array';
|
|
4
|
+
import { smallScreen } from '../../styles';
|
|
5
|
+
import { SearchBox } from './SearchBox';
|
|
6
|
+
const Base = styled.div `
|
|
36
7
|
display: flex;
|
|
37
8
|
flex-flow: column;
|
|
38
9
|
flex-grow: 1;
|
|
39
10
|
width: 100%;
|
|
40
11
|
`;
|
|
41
|
-
const Content =
|
|
12
|
+
const Content = styled.div `
|
|
42
13
|
width: calc(100% - 2rem);
|
|
43
14
|
margin: auto;
|
|
44
15
|
display: flex;
|
|
@@ -53,37 +24,35 @@ const Content = styled_1.default.div `
|
|
|
53
24
|
&[data-hasitems='true'] {
|
|
54
25
|
padding-bottom: 0.5rem;
|
|
55
26
|
}
|
|
56
|
-
@media ${
|
|
27
|
+
@media ${smallScreen} {
|
|
57
28
|
margin: 0;
|
|
58
29
|
width: 100%;
|
|
59
30
|
margin-top: 1rem;
|
|
60
31
|
}
|
|
61
32
|
`;
|
|
62
|
-
const Row =
|
|
33
|
+
const Row = styled.div `
|
|
63
34
|
width: 100%;
|
|
64
35
|
cursor: pointer;
|
|
65
36
|
`;
|
|
66
|
-
const SearchBase = (p) => {
|
|
67
|
-
var _a, _b, _c, _d;
|
|
37
|
+
export const SearchBase = (p) => {
|
|
68
38
|
const { maxDisplayItems = 20 } = p;
|
|
69
|
-
const [searchText, setSearchText] =
|
|
39
|
+
const [searchText, setSearchText] = useState(p.defaultValue ?? '');
|
|
70
40
|
const resWrap = (foundItem) => {
|
|
71
|
-
var _a, _b;
|
|
72
41
|
if (!foundItem) {
|
|
73
|
-
|
|
42
|
+
p.onSelectItem?.(undefined);
|
|
74
43
|
}
|
|
75
44
|
else {
|
|
76
|
-
|
|
45
|
+
p.onSelectItem?.({ foundItem, searchText });
|
|
77
46
|
}
|
|
78
47
|
};
|
|
79
48
|
const filteredItemsRaw = p.displayItems.filter((i) => p.willDisplayItem(searchText, i));
|
|
80
|
-
const { part: filteredItems } =
|
|
81
|
-
const showText =
|
|
49
|
+
const { part: filteredItems } = take(filteredItemsRaw, maxDisplayItems);
|
|
50
|
+
const showText = p.texts?.totalItems?.(filteredItems.length, p.displayItems.length) ??
|
|
51
|
+
`Showing ${filteredItems.length} out of ${p.displayItems.length} total
|
|
82
52
|
items`;
|
|
83
|
-
return (
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
filteredItems.map((item, index) => (
|
|
87
|
-
searchText &&
|
|
53
|
+
return (React.createElement(Base, { className: p.className },
|
|
54
|
+
React.createElement(SearchBox, { ...p, searchText: searchText, setSearchText: setSearchText }),
|
|
55
|
+
React.createElement(Content, { "data-hasitems": !!filteredItems.length, "data-type": "content" },
|
|
56
|
+
filteredItems.map((item, index) => (React.createElement(Row, { key: p.getKeyF(item), onClick: () => resWrap(item) }, p.renderItem({ searchText, item, index })))),
|
|
57
|
+
searchText && React.createElement(Row, null, showText))));
|
|
88
58
|
};
|
|
89
|
-
exports.SearchBase = SearchBase;
|
|
@@ -1,34 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.SearchDialog = void 0;
|
|
16
|
-
const react_1 = __importDefault(require("react"));
|
|
17
|
-
const client_1 = require("react-dom/client");
|
|
18
|
-
const log_1 = require("../../../common/helpers/log");
|
|
19
|
-
const Modal_1 = require("./Modal");
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { error } from '../../../common/helpers/log';
|
|
4
|
+
import { SearchModal } from './Modal';
|
|
20
5
|
/**
|
|
21
6
|
* opens a searchmodal programatically, and resolves to either undefined, or the selected item
|
|
22
7
|
* @param p
|
|
23
8
|
* @returns
|
|
24
9
|
*/
|
|
25
|
-
const SearchDialog = (p) =>
|
|
10
|
+
export const SearchDialog = async (p) => {
|
|
26
11
|
const placeholderText = p.placeholderText || '';
|
|
27
12
|
let originalStyle;
|
|
28
13
|
return new Promise((res) => {
|
|
29
14
|
const idName = 'ag-search-dialog';
|
|
30
15
|
if (document.body.querySelectorAll('#' + idName).length !== 0) {
|
|
31
|
-
|
|
16
|
+
error('searchDialog already open');
|
|
32
17
|
res(undefined);
|
|
33
18
|
return;
|
|
34
19
|
}
|
|
@@ -38,8 +23,8 @@ const SearchDialog = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
38
23
|
originalStyle = window.getComputedStyle(document.body).overflow || '';
|
|
39
24
|
document.body.style.overflow = 'hidden';
|
|
40
25
|
}
|
|
41
|
-
const root =
|
|
42
|
-
root.render(
|
|
26
|
+
const root = createRoot(wrapper);
|
|
27
|
+
root.render(React.createElement(SearchModal, { ...p, placeholderText: placeholderText, onSelectItem: (f) => {
|
|
43
28
|
try {
|
|
44
29
|
document.body.style.overflow = originalStyle || '';
|
|
45
30
|
res(f);
|
|
@@ -48,7 +33,6 @@ const SearchDialog = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
48
33
|
root.unmount();
|
|
49
34
|
wrapper.remove();
|
|
50
35
|
}
|
|
51
|
-
} }))
|
|
36
|
+
} }));
|
|
52
37
|
});
|
|
53
|
-
}
|
|
54
|
-
exports.SearchDialog = SearchDialog;
|
|
38
|
+
};
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SearchInline = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const Base_1 = require("./Base");
|
|
9
|
-
const SearchInline = (p) => react_1.default.createElement(Base_1.SearchBase, Object.assign({}, p));
|
|
10
|
-
exports.SearchInline = SearchInline;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SearchBase } from './Base';
|
|
3
|
+
export const SearchInline = (p) => React.createElement(SearchBase, { ...p });
|