ag-common 0.0.419 → 0.0.421
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 +35 -34
- package/dist/api/helpers/aws.js +13 -9
- package/dist/api/helpers/cloudfront.js +24 -7
- package/dist/api/helpers/dynamo.js +134 -85
- package/dist/api/helpers/dynamoInfra.js +19 -14
- package/dist/api/helpers/enforceDynamoProvisionCap.js +18 -14
- package/dist/api/helpers/index.js +30 -14
- package/dist/api/helpers/openApiHelpers.js +37 -34
- package/dist/api/helpers/s3.js +126 -81
- package/dist/api/helpers/ses.js +28 -9
- package/dist/api/helpers/sqs.js +26 -9
- package/dist/api/helpers/ssm.js +14 -8
- package/dist/api/helpers/sts.js +34 -16
- package/dist/api/helpers/validateOpenApi.js +103 -92
- package/dist/api/helpers/validations.js +46 -29
- package/dist/api/index.js +18 -2
- package/dist/api/openapi-prefix.js +38 -25
- package/dist/api/types/aws.js +2 -1
- package/dist/api/types/index.js +17 -1
- package/dist/common/const.js +5 -2
- package/dist/common/helpers/array.js +19 -8
- package/dist/common/helpers/async.js +28 -10
- package/dist/common/helpers/binary.js +10 -5
- package/dist/common/helpers/date.js +25 -14
- package/dist/common/helpers/email.js +11 -5
- package/dist/common/helpers/func.js +7 -3
- package/dist/common/helpers/generator.js +24 -9
- package/dist/common/helpers/groupBy.js +9 -3
- package/dist/common/helpers/hashCode.js +9 -3
- package/dist/common/helpers/i18n.js +17 -9
- package/dist/common/helpers/index.js +34 -18
- package/dist/common/helpers/log.js +28 -16
- package/dist/common/helpers/math.js +21 -9
- package/dist/common/helpers/memo.js +7 -3
- package/dist/common/helpers/object.js +35 -20
- package/dist/common/helpers/random.js +10 -4
- package/dist/common/helpers/secondsInNearest.js +7 -2
- package/dist/common/helpers/sleep.js +5 -1
- package/dist/common/helpers/string/base64.js +7 -2
- package/dist/common/helpers/string/chunk.js +5 -1
- package/dist/common/helpers/string/contains.js +7 -2
- package/dist/common/helpers/string/getExtendedStringSegment.js +9 -5
- package/dist/common/helpers/string/index.js +26 -10
- package/dist/common/helpers/string/json.js +5 -1
- package/dist/common/helpers/string/object.js +5 -1
- package/dist/common/helpers/string/surround.js +5 -1
- package/dist/common/helpers/string/trim.js +7 -2
- package/dist/common/helpers/string/truncate.js +5 -1
- package/dist/common/helpers/string/url.js +9 -4
- package/dist/common/index.js +18 -2
- package/dist/index.js +19 -3
- package/dist/ui/components/BorderGradient/index.js +25 -18
- package/dist/ui/components/Button/index.js +25 -17
- package/dist/ui/components/Chevron/index.js +16 -9
- package/dist/ui/components/Close/index.js +13 -6
- package/dist/ui/components/Confirm/Dialog.js +25 -9
- package/dist/ui/components/Confirm/Modal.js +27 -20
- package/dist/ui/components/Confirm/index.js +19 -3
- package/dist/ui/components/Confirm/types.js +2 -1
- package/dist/ui/components/DropdownList/Base.js +64 -33
- package/dist/ui/components/DropdownList/Dialog.js +24 -8
- package/dist/ui/components/DropdownList/index.js +18 -2
- package/dist/ui/components/DropdownList/types.js +2 -1
- package/dist/ui/components/FlexColumn/index.js +14 -4
- package/dist/ui/components/FlexRow/index.js +14 -4
- package/dist/ui/components/HeadersRaw/index.js +27 -20
- package/dist/ui/components/HorizontalScrollBar/index.js +34 -6
- package/dist/ui/components/Icon/index.js +16 -9
- package/dist/ui/components/Image/index.js +28 -10
- package/dist/ui/components/InfiniteScroll/index.js +50 -18
- package/dist/ui/components/KebabDots/index.js +13 -6
- package/dist/ui/components/Loader/index.js +39 -9
- package/dist/ui/components/Modal/Dialog.js +23 -7
- package/dist/ui/components/Modal/Modal.js +49 -19
- package/dist/ui/components/Modal/index.js +19 -3
- package/dist/ui/components/Modal/types.js +2 -1
- package/dist/ui/components/OpenApiCodeBlock/OpenApiCodeBlock.js +34 -26
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/body.js +19 -12
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/getCurlLines.js +11 -6
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/security.js +15 -8
- package/dist/ui/components/OpenApiCodeBlock/curl/index.js +21 -14
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/call.js +15 -8
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/getFetchLines.js +8 -3
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/req.js +34 -27
- package/dist/ui/components/OpenApiCodeBlock/fetch/index.js +18 -11
- package/dist/ui/components/OpenApiCodeBlock/helpers/common.js +17 -7
- package/dist/ui/components/OpenApiCodeBlock/helpers/joinJsx.js +15 -6
- package/dist/ui/components/OpenApiCodeBlock/index.js +18 -2
- package/dist/ui/components/OpenApiCodeBlock/types.js +2 -1
- package/dist/ui/components/PieChart/index.js +18 -11
- package/dist/ui/components/ProgressBar/index.js +45 -15
- package/dist/ui/components/Prompt/Dialog.js +23 -7
- package/dist/ui/components/Prompt/Modal.js +55 -25
- package/dist/ui/components/Prompt/index.js +18 -2
- package/dist/ui/components/RowOrColumn/index.js +17 -7
- package/dist/ui/components/Search/AutoHideSearchBox.js +56 -24
- package/dist/ui/components/Search/Base.js +52 -21
- package/dist/ui/components/Search/Dialog.js +26 -10
- package/dist/ui/components/Search/Inline.js +10 -3
- package/dist/ui/components/Search/Modal.js +17 -10
- package/dist/ui/components/Search/SearchBox.js +58 -26
- package/dist/ui/components/Search/index.js +23 -7
- package/dist/ui/components/Search/types.js +2 -1
- package/dist/ui/components/Sidebar/index.js +25 -18
- package/dist/ui/components/SparkLine/index.js +27 -17
- package/dist/ui/components/Table/index.js +22 -15
- package/dist/ui/components/TextEdit/CheckboxEdit.js +51 -21
- package/dist/ui/components/TextEdit/ColourEdit.js +44 -17
- package/dist/ui/components/TextEdit/LengthBox.js +12 -5
- package/dist/ui/components/TextEdit/ListboxEdit.js +42 -15
- package/dist/ui/components/TextEdit/RadioGroup.js +43 -13
- package/dist/ui/components/TextEdit/TextEdit.js +78 -48
- package/dist/ui/components/TextEdit/common.js +17 -11
- package/dist/ui/components/TextEdit/index.js +22 -6
- package/dist/ui/components/TextEdit/types.js +2 -1
- package/dist/ui/components/TextWithButton/index.js +40 -10
- package/dist/ui/components/TimelineChart/index.js +24 -14
- package/dist/ui/components/Toast/Cross.js +16 -9
- package/dist/ui/components/Toast/Tick.js +11 -4
- package/dist/ui/components/Toast/Warning.js +15 -8
- package/dist/ui/components/Toast/base.js +65 -33
- package/dist/ui/components/Toast/index.js +18 -2
- package/dist/ui/components/Toast/types.js +2 -1
- package/dist/ui/components/UserImage/index.js +48 -17
- package/dist/ui/components/index.js +46 -30
- package/dist/ui/helpers/axiosHelper.js +39 -25
- package/dist/ui/helpers/browserHelpers.js +22 -7
- package/dist/ui/helpers/callOpenApi/cached.js +37 -18
- package/dist/ui/helpers/callOpenApi/direct.js +59 -46
- package/dist/ui/helpers/callOpenApi/helpers.js +40 -25
- package/dist/ui/helpers/callOpenApi/hook.js +36 -47
- package/dist/ui/helpers/callOpenApi/index.js +21 -5
- package/dist/ui/helpers/callOpenApi/types.js +2 -1
- package/dist/ui/helpers/cognito.js +2 -1
- package/dist/ui/helpers/cookie/const.js +5 -2
- package/dist/ui/helpers/cookie/get.js +14 -13
- package/dist/ui/helpers/cookie/index.js +21 -5
- package/dist/ui/helpers/cookie/raw.js +16 -9
- package/dist/ui/helpers/cookie/set.js +15 -10
- package/dist/ui/helpers/cookie/use.js +16 -23
- package/dist/ui/helpers/date.js +15 -10
- package/dist/ui/helpers/debounce.js +10 -5
- package/dist/ui/helpers/dom.js +13 -6
- package/dist/ui/helpers/extractAttributes.js +7 -2
- package/dist/ui/helpers/index.js +41 -25
- package/dist/ui/helpers/jwt.js +2 -1
- package/dist/ui/helpers/plural.js +5 -1
- package/dist/ui/helpers/routes.js +24 -17
- package/dist/ui/helpers/serviceWorker.js +23 -8
- package/dist/ui/helpers/useContextMenu.js +14 -9
- package/dist/ui/helpers/useElementAttribute.js +7 -3
- package/dist/ui/helpers/useGranularHook.js +10 -5
- package/dist/ui/helpers/useInterval.js +12 -8
- package/dist/ui/helpers/useLocalStorage.js +32 -24
- package/dist/ui/helpers/useLockBodyScroll.js +7 -3
- package/dist/ui/helpers/useOnClickOutside.js +12 -7
- package/dist/ui/helpers/useOnScroll.js +21 -15
- package/dist/ui/helpers/useOverloadPageSearch.js +7 -3
- package/dist/ui/helpers/useQueryString.js +20 -14
- package/dist/ui/helpers/useResize.js +19 -17
- package/dist/ui/helpers/useTimeout.js +9 -5
- package/dist/ui/icons/ChevronRight.js +9 -3
- package/dist/ui/icons/CrossIcon.js +12 -5
- package/dist/ui/icons/Door.js +10 -4
- package/dist/ui/icons/HorizontalDots.js +9 -3
- package/dist/ui/icons/Magnify.js +10 -3
- package/dist/ui/icons/Pencil.js +12 -5
- package/dist/ui/icons/Save.js +11 -4
- package/dist/ui/icons/Undo.js +12 -5
- package/dist/ui/icons/UserOutline.js +9 -3
- package/dist/ui/icons/index.js +25 -9
- package/dist/ui/index.js +20 -4
- package/dist/ui/styles/colours.js +12 -7
- package/dist/ui/styles/common.js +22 -14
- package/dist/ui/styles/index.js +20 -4
- package/dist/ui/styles/media.js +10 -7
- package/dist/ui/styles/standaloneStyles.js +16 -10
- package/package.json +2 -2
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.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 `
|
|
5
34
|
position: relative;
|
|
6
35
|
min-width: 5rem;
|
|
7
36
|
width: 100%;
|
|
@@ -9,13 +38,13 @@ const Base = styled.div `
|
|
|
9
38
|
border-radius: 1rem;
|
|
10
39
|
overflow: hidden;
|
|
11
40
|
`;
|
|
12
|
-
const Bar =
|
|
41
|
+
const Bar = styled_1.default.div `
|
|
13
42
|
position: absolute;
|
|
14
43
|
top: 0;
|
|
15
44
|
bottom: 0;
|
|
16
45
|
left: 0;
|
|
17
46
|
`;
|
|
18
|
-
const Dot =
|
|
47
|
+
const Dot = styled_1.default.div `
|
|
19
48
|
position: absolute;
|
|
20
49
|
top: calc(50% - 0.25rem);
|
|
21
50
|
width: 0.5rem;
|
|
@@ -27,29 +56,30 @@ const Dot = styled.div `
|
|
|
27
56
|
background-color: #333;
|
|
28
57
|
}
|
|
29
58
|
`;
|
|
30
|
-
|
|
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(() => {
|
|
59
|
+
const ProgressBar = (p) => {
|
|
60
|
+
const { transitionToMs = 200, frontColour = styles_1.colours.notificationBlue, backColour = '#eee', dotPercentages = [25, 50, 75], } = p;
|
|
61
|
+
const [barWidth, setBarWidth] = (0, react_1.useState)((p.min / p.max) * 100);
|
|
62
|
+
(0, react_1.useEffect)(() => {
|
|
34
63
|
const newbw = (p.min / p.max) * 100;
|
|
35
64
|
if (barWidth !== newbw) {
|
|
36
65
|
setBarWidth(newbw);
|
|
37
66
|
}
|
|
38
67
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
39
68
|
}, [p.min, p.max]);
|
|
40
|
-
useEffect(() => {
|
|
69
|
+
(0, react_1.useEffect)(() => {
|
|
41
70
|
if (transitionToMs) {
|
|
42
71
|
setBarWidth(p.max);
|
|
43
72
|
}
|
|
44
73
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
74
|
}, []);
|
|
46
|
-
return (
|
|
75
|
+
return (react_1.default.createElement(Base, { style: {
|
|
47
76
|
backgroundColor: backColour,
|
|
48
77
|
}, className: p.className },
|
|
49
|
-
|
|
78
|
+
react_1.default.createElement(Bar, { style: {
|
|
50
79
|
width: `${barWidth}%`,
|
|
51
80
|
backgroundColor: frontColour,
|
|
52
81
|
transition: `width ${transitionToMs}ms linear`,
|
|
53
|
-
} }),
|
|
54
|
-
dotPercentages
|
|
82
|
+
} }), dotPercentages === null || dotPercentages === void 0 ? void 0 :
|
|
83
|
+
dotPercentages.map((v) => (react_1.default.createElement(Dot, { key: v, style: { left: `calc(${v}% - 0.25rem)` }, "data-invert": v > barWidth })))));
|
|
55
84
|
};
|
|
85
|
+
exports.ProgressBar = ProgressBar;
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
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* () {
|
|
5
20
|
return new Promise((res) => {
|
|
6
21
|
const wrapper = document.body.appendChild(document.createElement('div'));
|
|
7
|
-
const root = createRoot(wrapper);
|
|
8
|
-
root.render(
|
|
22
|
+
const root = (0, client_1.createRoot)(wrapper);
|
|
23
|
+
root.render(react_1.default.createElement(Modal_1.PromptModal, Object.assign({}, p, { res: res, root: root, wrapper: wrapper })));
|
|
9
24
|
});
|
|
10
|
-
};
|
|
25
|
+
});
|
|
26
|
+
exports.PromptDialog = PromptDialog;
|
|
@@ -1,55 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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.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 `
|
|
9
38
|
width: 95vw;
|
|
10
39
|
max-width: 30rem;
|
|
11
40
|
height: 50vh;
|
|
12
41
|
max-height: 15rem;
|
|
13
42
|
padding: 1rem;
|
|
14
43
|
`;
|
|
15
|
-
const Content =
|
|
44
|
+
const Content = (0, styled_1.default)(FlexColumn_1.FlexColumn) `
|
|
16
45
|
height: 100%;
|
|
17
46
|
`;
|
|
18
|
-
const TopText =
|
|
47
|
+
const TopText = styled_1.default.div `
|
|
19
48
|
font-weight: bold;
|
|
20
49
|
border-bottom: solid 1px #ccc;
|
|
21
50
|
padding-bottom: 0.25rem;
|
|
22
51
|
font-size: 1.5rem;
|
|
23
52
|
margin-bottom: 1rem;
|
|
24
53
|
`;
|
|
25
|
-
const BottomText =
|
|
54
|
+
const BottomText = styled_1.default.div `
|
|
26
55
|
padding-bottom: 0.25rem;
|
|
27
56
|
font-size: 1.1rem;
|
|
28
57
|
`;
|
|
29
|
-
const Bottom =
|
|
58
|
+
const Bottom = (0, styled_1.default)(FlexRow_1.FlexRow) `
|
|
30
59
|
margin-top: auto;
|
|
31
60
|
justify-content: flex-end;
|
|
32
61
|
> button:first-of-type {
|
|
33
62
|
margin-right: 1rem;
|
|
34
63
|
}
|
|
35
64
|
`;
|
|
36
|
-
|
|
37
|
-
const [text, setText] = useState(defaultValue || '');
|
|
65
|
+
const PromptModal = ({ root, wrapper, res, bottomText, topText, okText = 'OK', cancelText = 'Cancel', defaultValue, placeholder, }) => {
|
|
66
|
+
const [text, setText] = (0, react_1.useState)(defaultValue || '');
|
|
38
67
|
const ret = (v) => {
|
|
39
68
|
try {
|
|
40
69
|
res(v);
|
|
41
70
|
}
|
|
42
71
|
finally {
|
|
43
|
-
root
|
|
44
|
-
wrapper
|
|
72
|
+
root === null || root === void 0 ? void 0 : root.unmount();
|
|
73
|
+
wrapper === null || wrapper === void 0 ? void 0 : wrapper.remove();
|
|
45
74
|
}
|
|
46
75
|
};
|
|
47
|
-
return (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
topText &&
|
|
51
|
-
|
|
52
|
-
|
|
76
|
+
return (react_1.default.createElement(Modal_1.Modal, { position: "center", topPosition: "center", open: true, setOpen: () => ret(undefined), showCloseButton: false, closeOnClickOutside: false },
|
|
77
|
+
react_1.default.createElement(Base, null,
|
|
78
|
+
react_1.default.createElement(Content, null,
|
|
79
|
+
topText && react_1.default.createElement(TopText, null, topText),
|
|
80
|
+
react_1.default.createElement(BottomText, null, bottomText),
|
|
81
|
+
react_1.default.createElement(TextEdit_1.TextEdit, { defaultValue: text, onSubmit: (c, enter) => {
|
|
53
82
|
if (enter) {
|
|
54
83
|
ret(c);
|
|
55
84
|
}
|
|
@@ -57,7 +86,8 @@ export const PromptModal = ({ root, wrapper, res, bottomText, topText, okText =
|
|
|
57
86
|
setText(c);
|
|
58
87
|
}
|
|
59
88
|
}, placeholder: placeholder, defaultEditing: { focus: true }, singleLine: true, noGrow: true, allowUndo: false }),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
89
|
+
react_1.default.createElement(Bottom, { noGrow: true },
|
|
90
|
+
react_1.default.createElement(Button_1.Button, { onClick: () => ret(text) }, okText),
|
|
91
|
+
react_1.default.createElement(Button_1.Button, { invert: true, onClick: () => ret(undefined) }, cancelText))))));
|
|
63
92
|
};
|
|
93
|
+
exports.PromptModal = PromptModal;
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 __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,18 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
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.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 `
|
|
5
11
|
display: flex;
|
|
6
12
|
flex-flow: row wrap;
|
|
7
13
|
flex-grow: 1;
|
|
8
14
|
width: 100%;
|
|
9
|
-
@media ${bigScreen} {
|
|
15
|
+
@media ${media_1.bigScreen} {
|
|
10
16
|
&[data-nowrap='true'] {
|
|
11
17
|
flex-flow: row;
|
|
12
18
|
}
|
|
13
19
|
}
|
|
14
20
|
|
|
15
|
-
@media ${smallScreen} {
|
|
21
|
+
@media ${media_1.smallScreen} {
|
|
16
22
|
flex-flow: column;
|
|
17
23
|
overflow: unset;
|
|
18
24
|
}
|
|
@@ -29,4 +35,8 @@ const Base = styled.div `
|
|
|
29
35
|
overflow: visible;
|
|
30
36
|
}
|
|
31
37
|
`;
|
|
32
|
-
|
|
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;
|
|
@@ -1,20 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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.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 `
|
|
8
37
|
display: flex;
|
|
9
38
|
flex-flow: row;
|
|
10
39
|
align-items: center;
|
|
11
40
|
margin-left: 1rem;
|
|
12
41
|
|
|
13
|
-
@media ${bigScreen} {
|
|
42
|
+
@media ${styles_1.bigScreen} {
|
|
14
43
|
width: 20rem;
|
|
15
44
|
}
|
|
16
45
|
`;
|
|
17
|
-
const Icon =
|
|
46
|
+
const Icon = styled_1.default.div `
|
|
18
47
|
display: flex;
|
|
19
48
|
margin-right: 0.5rem;
|
|
20
49
|
> svg {
|
|
@@ -23,7 +52,7 @@ const Icon = styled.div `
|
|
|
23
52
|
fill: white;
|
|
24
53
|
}
|
|
25
54
|
`;
|
|
26
|
-
const SearchBoxStyled =
|
|
55
|
+
const SearchBoxStyled = (0, styled_1.default)(SearchBox_1.SearchBox) `
|
|
27
56
|
transition: width 200ms ease-in-out;
|
|
28
57
|
|
|
29
58
|
overflow: hidden;
|
|
@@ -32,34 +61,36 @@ const SearchBoxStyled = styled(SearchBox) `
|
|
|
32
61
|
width: 0;
|
|
33
62
|
padding: 0;
|
|
34
63
|
}
|
|
35
|
-
@media ${smallScreen} {
|
|
64
|
+
@media ${styles_1.smallScreen} {
|
|
36
65
|
padding: 0;
|
|
37
66
|
}
|
|
38
67
|
`;
|
|
39
|
-
|
|
40
|
-
const [open, setOpen] = useState(!!p.searchText);
|
|
41
|
-
const textEditRef = createRef();
|
|
42
|
-
useGranularEffect(() => {
|
|
68
|
+
const AutoHideSearchBox = (p) => {
|
|
69
|
+
const [open, setOpen] = (0, react_1.useState)(!!p.searchText);
|
|
70
|
+
const textEditRef = (0, react_1.createRef)();
|
|
71
|
+
(0, useGranularHook_1.useGranularEffect)(() => {
|
|
72
|
+
var _a;
|
|
43
73
|
const newOpen = !!p.searchText;
|
|
44
74
|
if (newOpen !== open) {
|
|
45
75
|
setOpen(!open);
|
|
46
|
-
p.onOpenToggle
|
|
76
|
+
(_a = p.onOpenToggle) === null || _a === void 0 ? void 0 : _a.call(p, !open);
|
|
47
77
|
}
|
|
48
78
|
}, [p.searchText], [open]);
|
|
49
|
-
return (
|
|
50
|
-
|
|
79
|
+
return (react_1.default.createElement(Base, { className: p.className, "data-open": open },
|
|
80
|
+
react_1.default.createElement(Icon, { style: { cursor: 'pointer' }, onClick: () => {
|
|
81
|
+
var _a, _b;
|
|
51
82
|
if (open) {
|
|
52
83
|
p.setSearchText('', false);
|
|
53
84
|
}
|
|
54
85
|
setOpen(!open);
|
|
55
|
-
p.onOpenToggle
|
|
86
|
+
(_a = p.onOpenToggle) === null || _a === void 0 ? void 0 : _a.call(p, !open);
|
|
56
87
|
if (!open) {
|
|
57
|
-
textEditRef.current
|
|
88
|
+
(_b = textEditRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
58
89
|
}
|
|
59
90
|
} },
|
|
60
|
-
open &&
|
|
61
|
-
!open &&
|
|
62
|
-
|
|
91
|
+
open && react_1.default.createElement(icons_1.CrossIcon, null),
|
|
92
|
+
!open && react_1.default.createElement(icons_1.Magnify, { colour: "white" })),
|
|
93
|
+
react_1.default.createElement(SearchBoxStyled, Object.assign({ ref: textEditRef }, p, { className: "", "data-open": open, defaultValue: p.searchText, setSearchText: (val, enter) => {
|
|
63
94
|
//we dont want empty enters to do anything
|
|
64
95
|
if (val === '' && enter) {
|
|
65
96
|
p.setSearchText(val, false);
|
|
@@ -67,5 +98,6 @@ export const AutoHideSearchBox = (p) => {
|
|
|
67
98
|
else {
|
|
68
99
|
p.setSearchText(val, enter);
|
|
69
100
|
}
|
|
70
|
-
} })));
|
|
101
|
+
} }))));
|
|
71
102
|
};
|
|
103
|
+
exports.AutoHideSearchBox = AutoHideSearchBox;
|
|
@@ -1,15 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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.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 `
|
|
7
36
|
display: flex;
|
|
8
37
|
flex-flow: column;
|
|
9
38
|
flex-grow: 1;
|
|
10
39
|
width: 100%;
|
|
11
40
|
`;
|
|
12
|
-
const Content =
|
|
41
|
+
const Content = styled_1.default.div `
|
|
13
42
|
width: calc(100% - 2rem);
|
|
14
43
|
margin: auto;
|
|
15
44
|
display: flex;
|
|
@@ -24,35 +53,37 @@ const Content = styled.div `
|
|
|
24
53
|
&[data-hasitems='true'] {
|
|
25
54
|
padding-bottom: 0.5rem;
|
|
26
55
|
}
|
|
27
|
-
@media ${smallScreen} {
|
|
56
|
+
@media ${styles_1.smallScreen} {
|
|
28
57
|
margin: 0;
|
|
29
58
|
width: 100%;
|
|
30
59
|
margin-top: 1rem;
|
|
31
60
|
}
|
|
32
61
|
`;
|
|
33
|
-
const Row =
|
|
62
|
+
const Row = styled_1.default.div `
|
|
34
63
|
width: 100%;
|
|
35
64
|
cursor: pointer;
|
|
36
65
|
`;
|
|
37
|
-
|
|
66
|
+
const SearchBase = (p) => {
|
|
67
|
+
var _a, _b, _c, _d;
|
|
38
68
|
const { maxDisplayItems = 20 } = p;
|
|
39
|
-
const [searchText, setSearchText] = useState(p.defaultValue
|
|
69
|
+
const [searchText, setSearchText] = (0, react_1.useState)((_a = p.defaultValue) !== null && _a !== void 0 ? _a : '');
|
|
40
70
|
const resWrap = (foundItem) => {
|
|
71
|
+
var _a, _b;
|
|
41
72
|
if (!foundItem) {
|
|
42
|
-
p.onSelectItem
|
|
73
|
+
(_a = p.onSelectItem) === null || _a === void 0 ? void 0 : _a.call(p, undefined);
|
|
43
74
|
}
|
|
44
75
|
else {
|
|
45
|
-
p.onSelectItem
|
|
76
|
+
(_b = p.onSelectItem) === null || _b === void 0 ? void 0 : _b.call(p, { foundItem, searchText });
|
|
46
77
|
}
|
|
47
78
|
};
|
|
48
79
|
const filteredItemsRaw = p.displayItems.filter((i) => p.willDisplayItem(searchText, i));
|
|
49
|
-
const { part: filteredItems } = take(filteredItemsRaw, maxDisplayItems);
|
|
50
|
-
const showText = p.texts
|
|
51
|
-
`Showing ${filteredItems.length} out of ${p.displayItems.length} total
|
|
80
|
+
const { part: filteredItems } = (0, array_1.take)(filteredItemsRaw, maxDisplayItems);
|
|
81
|
+
const showText = (_d = (_c = (_b = p.texts) === null || _b === void 0 ? void 0 : _b.totalItems) === null || _c === void 0 ? void 0 : _c.call(_b, filteredItems.length, p.displayItems.length)) !== null && _d !== void 0 ? _d : `Showing ${filteredItems.length} out of ${p.displayItems.length} total
|
|
52
82
|
items`;
|
|
53
|
-
return (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
filteredItems.map((item, index) => (
|
|
57
|
-
searchText &&
|
|
83
|
+
return (react_1.default.createElement(Base, { className: p.className },
|
|
84
|
+
react_1.default.createElement(SearchBox_1.SearchBox, Object.assign({}, p, { searchText: searchText, setSearchText: setSearchText })),
|
|
85
|
+
react_1.default.createElement(Content, { "data-hasitems": !!filteredItems.length, "data-type": "content" },
|
|
86
|
+
filteredItems.map((item, index) => (react_1.default.createElement(Row, { key: p.getKeyF(item), onClick: () => resWrap(item) }, p.renderItem({ searchText, item, index })))),
|
|
87
|
+
searchText && react_1.default.createElement(Row, null, showText))));
|
|
58
88
|
};
|
|
89
|
+
exports.SearchBase = SearchBase;
|
|
@@ -1,19 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
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");
|
|
5
20
|
/**
|
|
6
21
|
* opens a searchmodal programatically, and resolves to either undefined, or the selected item
|
|
7
22
|
* @param p
|
|
8
23
|
* @returns
|
|
9
24
|
*/
|
|
10
|
-
|
|
25
|
+
const SearchDialog = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
26
|
const placeholderText = p.placeholderText || '';
|
|
12
27
|
let originalStyle;
|
|
13
28
|
return new Promise((res) => {
|
|
14
29
|
const idName = 'ag-search-dialog';
|
|
15
30
|
if (document.body.querySelectorAll('#' + idName).length !== 0) {
|
|
16
|
-
error('searchDialog already open');
|
|
31
|
+
(0, log_1.error)('searchDialog already open');
|
|
17
32
|
res(undefined);
|
|
18
33
|
return;
|
|
19
34
|
}
|
|
@@ -23,8 +38,8 @@ export const SearchDialog = async (p) => {
|
|
|
23
38
|
originalStyle = window.getComputedStyle(document.body).overflow || '';
|
|
24
39
|
document.body.style.overflow = 'hidden';
|
|
25
40
|
}
|
|
26
|
-
const root = createRoot(wrapper);
|
|
27
|
-
root.render(
|
|
41
|
+
const root = (0, client_1.createRoot)(wrapper);
|
|
42
|
+
root.render(react_1.default.createElement(Modal_1.SearchModal, Object.assign({}, p, { placeholderText: placeholderText, onSelectItem: (f) => {
|
|
28
43
|
try {
|
|
29
44
|
document.body.style.overflow = originalStyle || '';
|
|
30
45
|
res(f);
|
|
@@ -33,6 +48,7 @@ export const SearchDialog = async (p) => {
|
|
|
33
48
|
root.unmount();
|
|
34
49
|
wrapper.remove();
|
|
35
50
|
}
|
|
36
|
-
} }));
|
|
51
|
+
} })));
|
|
37
52
|
});
|
|
38
|
-
};
|
|
53
|
+
});
|
|
54
|
+
exports.SearchDialog = SearchDialog;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
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.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;
|