ag-common 0.0.728 → 0.0.730
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 +0 -6
- package/dist/api/helpers/dynamo.d.ts +1 -1
- package/dist/api/helpers/dynamo.js +11 -12
- package/dist/api/helpers/enforceDynamoProvisionCap.js +0 -1
- package/dist/api/helpers/openApiHelpers.js +1 -2
- package/dist/api/helpers/s3.d.ts +0 -1
- package/dist/api/helpers/s3.js +11 -11
- package/dist/api/helpers/ses.d.ts +1 -1
- package/dist/api/helpers/sts.js +2 -2
- package/dist/api/helpers/validateOpenApi.js +1 -4
- package/dist/api/helpers/validations.js +3 -5
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +0 -1
- package/dist/api/openapi-postfix.js +0 -3
- package/dist/api/openapi-prefix.js +0 -6
- package/dist/api/types/index.d.ts +1 -1
- package/dist/api/types/index.js +0 -15
- package/dist/common/helpers/array.d.ts +1 -1
- package/dist/common/helpers/array.js +3 -4
- package/dist/common/helpers/async.js +2 -3
- package/dist/common/helpers/binary.d.ts +3 -4
- package/dist/common/helpers/binary.js +4 -4
- package/dist/common/helpers/csv.js +1 -3
- package/dist/common/helpers/date.js +0 -1
- package/dist/common/helpers/func.js +1 -2
- package/dist/common/helpers/generator.js +1 -3
- package/dist/common/helpers/groupBy.js +3 -4
- package/dist/common/helpers/hashCode.js +0 -1
- package/dist/common/helpers/log.js +0 -2
- package/dist/common/helpers/math.js +6 -8
- package/dist/common/helpers/memo.js +1 -4
- package/dist/common/helpers/object.js +9 -14
- package/dist/common/helpers/random.js +3 -3
- package/dist/common/helpers/stream.js +3 -3
- package/dist/common/helpers/string/contains.js +3 -3
- package/dist/common/helpers/string/json.js +0 -1
- package/dist/common/helpers/string/object.js +1 -2
- package/dist/common/helpers/string/redact.js +3 -3
- package/dist/common/helpers/string/trim.js +2 -3
- package/dist/common/helpers/string/truncate.js +1 -2
- package/dist/common/helpers/string/url.js +3 -2
- package/dist/common/helpers/xml.js +0 -1
- package/dist/node/helpers/fetch.js +2 -2
- package/dist/node/helpers/fs.js +2 -3
- package/dist/ui/components/Accordion/index.js +17 -7
- package/dist/ui/components/BarChart/index.d.ts +1 -1
- package/dist/ui/components/BarChart/index.js +0 -1
- package/dist/ui/components/Button/index.d.ts +2 -3
- package/dist/ui/components/Button/index.js +1 -4
- package/dist/ui/components/Confirm/Dialog.js +1 -0
- package/dist/ui/components/Confirm/index.d.ts +1 -1
- package/dist/ui/components/Confirm/index.js +0 -1
- package/dist/ui/components/DarkMode/Base.d.ts +3 -4
- package/dist/ui/components/DarkMode/Base.js +18 -7
- package/dist/ui/components/DropdownList/Base.d.ts +2 -2
- package/dist/ui/components/DropdownList/Base.js +19 -10
- package/dist/ui/components/DropdownList/Dialog.d.ts +1 -1
- package/dist/ui/components/DropdownList/Dialog.js +2 -0
- package/dist/ui/components/DropdownList/types.d.ts +1 -1
- package/dist/ui/components/HorizontalScrollBar/index.js +18 -7
- package/dist/ui/components/Icon/index.d.ts +2 -2
- package/dist/ui/components/Image/index.js +17 -7
- package/dist/ui/components/InfiniteScroll/index.js +17 -8
- package/dist/ui/components/LineChart/index.d.ts +1 -1
- package/dist/ui/components/LineChart/index.js +0 -1
- package/dist/ui/components/Loader/index.js +17 -7
- package/dist/ui/components/Markdown/index.d.ts +2 -2
- package/dist/ui/components/MinSidebar/index.js +17 -7
- package/dist/ui/components/Modal/Dialog.js +1 -0
- package/dist/ui/components/Modal/Modal.d.ts +2 -2
- package/dist/ui/components/Modal/Modal.js +18 -7
- package/dist/ui/components/Modal/index.d.ts +1 -1
- package/dist/ui/components/Modal/index.js +0 -1
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/body.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/security.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/curl/index.d.ts +2 -2
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/call.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/req.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/helpers/common.d.ts +4 -5
- package/dist/ui/components/OpenApiCodeBlock/helpers/common.js +0 -1
- package/dist/ui/components/OpenApiCodeBlock/helpers/joinJsx.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/index.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/index.js +0 -1
- package/dist/ui/components/OpenApiCodeBlock/types.d.ts +1 -1
- package/dist/ui/components/ProgressBar/index.js +17 -7
- package/dist/ui/components/Prompt/Modal.js +18 -7
- package/dist/ui/components/Prompt/index.d.ts +1 -1
- package/dist/ui/components/Prompt/index.js +0 -1
- package/dist/ui/components/RadioGroup/index.d.ts +2 -2
- package/dist/ui/components/RadioGroup/index.js +17 -8
- package/dist/ui/components/Search/AutoHideSearchBox.js +17 -7
- package/dist/ui/components/Search/Dialog.js +1 -0
- package/dist/ui/components/Search/Inline.js +17 -8
- package/dist/ui/components/Search/SearchBox.d.ts +1 -1
- package/dist/ui/components/Search/SearchBox.js +17 -7
- package/dist/ui/components/Search/index.d.ts +1 -1
- package/dist/ui/components/Search/index.js +0 -1
- package/dist/ui/components/Search/types.d.ts +2 -2
- package/dist/ui/components/Sidebar/index.js +17 -7
- package/dist/ui/components/TabBar/index.d.ts +2 -2
- package/dist/ui/components/TabBar/index.js +17 -7
- package/dist/ui/components/Table/index.d.ts +2 -2
- package/dist/ui/components/TextEdit/CheckboxEdit.js +17 -7
- package/dist/ui/components/TextEdit/ColourEdit.js +17 -7
- package/dist/ui/components/TextEdit/ListboxEdit.js +20 -18
- package/dist/ui/components/TextEdit/TextEdit.d.ts +2 -2
- package/dist/ui/components/TextEdit/TextEdit.js +20 -18
- package/dist/ui/components/TextEdit/common.d.ts +6 -7
- package/dist/ui/components/TextEdit/index.d.ts +1 -1
- package/dist/ui/components/TextEdit/index.js +0 -1
- package/dist/ui/components/TextEdit/types.d.ts +1 -0
- package/dist/ui/components/TextWithButton/index.js +17 -7
- package/dist/ui/components/Toast/base.js +18 -7
- package/dist/ui/components/Toast/index.d.ts +1 -1
- package/dist/ui/components/Toast/index.js +0 -1
- package/dist/ui/components/Toast/types.d.ts +1 -1
- package/dist/ui/components/TreeChart/base.js +17 -7
- package/dist/ui/components/TreeChart/index.d.ts +1 -1
- package/dist/ui/components/TreeChart/index.js +0 -1
- package/dist/ui/components/UserImage/index.js +17 -7
- package/dist/ui/helpers/axiosHelper.d.ts +1 -1
- package/dist/ui/helpers/axiosHelper.js +0 -2
- package/dist/ui/helpers/callOpenApi/direct.js +2 -7
- package/dist/ui/helpers/callOpenApi/helpers.js +1 -2
- package/dist/ui/helpers/callOpenApi/hook.d.ts +0 -1
- package/dist/ui/helpers/callOpenApi/index.d.ts +1 -1
- package/dist/ui/helpers/callOpenApi/index.js +0 -1
- package/dist/ui/helpers/cookie/get.js +3 -3
- package/dist/ui/helpers/cookie/raw.js +4 -4
- package/dist/ui/helpers/cookie/set.js +2 -2
- package/dist/ui/helpers/cookie/use.js +2 -2
- package/dist/ui/helpers/debounce.js +2 -3
- package/dist/ui/helpers/dom.js +0 -2
- package/dist/ui/helpers/extractAttributes.js +0 -1
- package/dist/ui/helpers/index.d.ts +2 -2
- package/dist/ui/helpers/index.js +0 -2
- package/dist/ui/helpers/plural.js +1 -2
- package/dist/ui/helpers/routes.d.ts +2 -2
- package/dist/ui/helpers/serviceWorker.js +1 -2
- package/dist/ui/helpers/useContextMenu.d.ts +1 -1
- package/dist/ui/helpers/useContextMenu.js +2 -3
- package/dist/ui/helpers/useElementAttribute.js +3 -2
- package/dist/ui/helpers/useGranularHook.js +1 -1
- package/dist/ui/helpers/useInterval.js +2 -2
- package/dist/ui/helpers/useIsInViewport.js +1 -2
- package/dist/ui/helpers/useLocalStorage.js +2 -2
- package/dist/ui/helpers/useLockBodyScroll.js +1 -2
- package/dist/ui/helpers/useOnClickOutside.d.ts +1 -1
- package/dist/ui/helpers/useOnClickOutside.js +3 -3
- package/dist/ui/helpers/useOnScroll.js +6 -7
- package/dist/ui/helpers/useOverloadPageSearch.js +2 -0
- package/dist/ui/helpers/useQueryString.js +1 -1
- package/dist/ui/helpers/useResize.js +2 -2
- package/dist/ui/helpers/useTimeout.js +1 -2
- package/dist/ui/helpers/useTooltip.d.ts +1 -0
- package/dist/ui/helpers/useTooltip.js +18 -7
- package/dist/ui/icons/Cog.d.ts +7 -1
- package/dist/ui/icons/Cog.js +1 -1
- package/dist/ui/icons/House.d.ts +7 -1
- package/dist/ui/icons/House.js +1 -1
- package/dist/ui/icons/index.d.ts +37 -30
- package/dist/ui/styles/common.d.ts +2 -2
- package/dist/ui/styles/standaloneStyles.d.ts +12 -13
- package/package.json +36 -33
|
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.callOpenApi =
|
|
12
|
+
exports.callOpenApi = void 0;
|
|
13
|
+
exports.getIdTokenAuthHeaderRaw = getIdTokenAuthHeaderRaw;
|
|
13
14
|
const const_1 = require("../../../common/const");
|
|
14
15
|
const array_1 = require("../../../common/helpers/array");
|
|
15
16
|
const log_1 = require("../../../common/helpers/log");
|
|
@@ -40,7 +41,6 @@ function getIdTokenAuthHeaderRaw({ overrideAuth, }) {
|
|
|
40
41
|
}
|
|
41
42
|
return idToken;
|
|
42
43
|
}
|
|
43
|
-
exports.getIdTokenAuthHeaderRaw = getIdTokenAuthHeaderRaw;
|
|
44
44
|
/**
|
|
45
45
|
* get id_token, and then refresh
|
|
46
46
|
*/
|
|
@@ -61,7 +61,6 @@ function getIdTokenAuthHeader(_a) {
|
|
|
61
61
|
const callOpenApi = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
62
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
63
63
|
const { func, apiUrl, logout, newDefaultApi, headers } = p;
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
64
|
let error;
|
|
66
65
|
let data = undefined;
|
|
67
66
|
const config = {
|
|
@@ -80,7 +79,6 @@ const callOpenApi = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
80
79
|
if (config.baseOptions.headers.authorization) {
|
|
81
80
|
config.middleware = [
|
|
82
81
|
{
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
84
82
|
pre: (oldFetchParams) => {
|
|
85
83
|
var _a, _b, _c;
|
|
86
84
|
const url = (_a = oldFetchParams === null || oldFetchParams === void 0 ? void 0 : oldFetchParams.url) !== null && _a !== void 0 ? _a : '(url)';
|
|
@@ -97,7 +95,6 @@ const callOpenApi = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
97
95
|
while (errorCount <= errorMax) {
|
|
98
96
|
errorCount += 1;
|
|
99
97
|
try {
|
|
100
|
-
// eslint-disable-next-line no-await-in-loop
|
|
101
98
|
const response = yield func(cl);
|
|
102
99
|
if (response.status < 400) {
|
|
103
100
|
data = response.data;
|
|
@@ -106,12 +103,10 @@ const callOpenApi = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
106
103
|
throw { response };
|
|
107
104
|
}
|
|
108
105
|
catch (e) {
|
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
106
|
const ae = e;
|
|
111
107
|
const status = Number((_c = (_a = ae.code) !== null && _a !== void 0 ? _a : (_b = ae.response) === null || _b === void 0 ? void 0 : _b.status) !== null && _c !== void 0 ? _c : 500);
|
|
112
108
|
const errorMessage = [
|
|
113
109
|
(_d = ae.status) !== null && _d !== void 0 ? _d : '',
|
|
114
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
115
110
|
(_g = (_f = (_e = ae.response) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.toString()) !== null && _g !== void 0 ? _g : '',
|
|
116
111
|
(_j = (_h = ae.response) === null || _h === void 0 ? void 0 : _h.statusText.toString()) !== null && _j !== void 0 ? _j : '',
|
|
117
112
|
(_l = (_k = ae.response) === null || _k === void 0 ? void 0 : _k.status.toString()) !== null && _l !== void 0 ? _l : '',
|
|
@@ -26,7 +26,6 @@ const apiResponseToAxiosResponse = (p) => __awaiter(void 0, void 0, void 0, func
|
|
|
26
26
|
statusText: r.raw.statusText,
|
|
27
27
|
data: yield r.value(),
|
|
28
28
|
headers: (0, array_1.arrayToObject)(Object.entries(r.raw.headers), (s) => s[0], (s) => s[1]),
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
29
|
config: {},
|
|
31
30
|
};
|
|
32
31
|
return r1;
|
|
@@ -39,6 +38,7 @@ const apiResponseToAxiosResponse = (p) => __awaiter(void 0, void 0, void 0, func
|
|
|
39
38
|
try {
|
|
40
39
|
const st = yield (0, stream_1.getStringFromStream)(er.body);
|
|
41
40
|
statusText = st;
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
42
42
|
}
|
|
43
43
|
catch (e) {
|
|
44
44
|
//
|
|
@@ -52,7 +52,6 @@ const apiResponseToAxiosResponse = (p) => __awaiter(void 0, void 0, void 0, func
|
|
|
52
52
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
53
53
|
er.headers &&
|
|
54
54
|
(0, array_1.arrayToObject)(Object.entries(er.headers), (s) => s[0], (s) => s[1]),
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
56
55
|
config: {},
|
|
57
56
|
};
|
|
58
57
|
return ret;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCookieString =
|
|
3
|
+
exports.getCookieString = void 0;
|
|
4
|
+
exports.getCookieRawWrapper = getCookieRawWrapper;
|
|
4
5
|
const log_1 = require("../../../common/helpers/log");
|
|
5
6
|
const base64_1 = require("../../../common/helpers/string/base64");
|
|
6
7
|
const raw_1 = require("./raw");
|
|
@@ -22,7 +23,7 @@ function getCookieRawWrapper({ name, cookieDocument, defaultValue, parse: parseR
|
|
|
22
23
|
};
|
|
23
24
|
let raw = '';
|
|
24
25
|
let currentCount = 0;
|
|
25
|
-
// eslint-disable-next-line
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
26
27
|
while (true) {
|
|
27
28
|
const newv = (0, raw_1.getCookie)({
|
|
28
29
|
name: name + currentCount,
|
|
@@ -46,6 +47,5 @@ function getCookieRawWrapper({ name, cookieDocument, defaultValue, parse: parseR
|
|
|
46
47
|
return defaultValue;
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
|
-
exports.getCookieRawWrapper = getCookieRawWrapper;
|
|
50
50
|
const getCookieString = (p) => getCookieRawWrapper(Object.assign(Object.assign({}, p), { parse: (s) => s, defaultValue: p.defaultValue || '' }));
|
|
51
51
|
exports.getCookieString = getCookieString;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getCookie = exports.getAllCookies = void 0;
|
|
4
|
+
exports.setCookie = setCookie;
|
|
5
|
+
exports.wipeCookies = wipeCookies;
|
|
4
6
|
const log_1 = require("../../../common/helpers/log");
|
|
5
7
|
const const_1 = require("./const");
|
|
6
8
|
/**
|
|
@@ -39,7 +41,6 @@ function setCookie({ name, value, expiryDays = 1, }) {
|
|
|
39
41
|
const expires = `expires=${!value || expiryDays < 0 ? const_1.expireDate : d.toUTCString()}`;
|
|
40
42
|
document.cookie = `${name}=${!value ? '' : value};${expires};path=/; SameSite=Strict; Secure`;
|
|
41
43
|
}
|
|
42
|
-
exports.setCookie = setCookie;
|
|
43
44
|
/** delete all non httponly cookies */
|
|
44
45
|
function wipeCookies(name) {
|
|
45
46
|
if (typeof window === 'undefined') {
|
|
@@ -47,7 +48,7 @@ function wipeCookies(name) {
|
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
let currentCount = 0;
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
51
52
|
while (true) {
|
|
52
53
|
if ((0, exports.getCookie)({
|
|
53
54
|
name: name + currentCount,
|
|
@@ -61,4 +62,3 @@ function wipeCookies(name) {
|
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
|
-
exports.wipeCookies = wipeCookies;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setCookieString =
|
|
3
|
+
exports.setCookieString = void 0;
|
|
4
|
+
exports.setCookieRawWrapper = setCookieRawWrapper;
|
|
4
5
|
const base64_1 = require("../../../common/helpers/string/base64");
|
|
5
6
|
const chunk_1 = require("../../../common/helpers/string/chunk");
|
|
6
7
|
const const_1 = require("./const");
|
|
@@ -28,6 +29,5 @@ function setCookieRawWrapper(p) {
|
|
|
28
29
|
(0, raw_1.setCookie)(Object.assign(Object.assign({}, p), { name: p.name + index1, value: chunk }));
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
exports.setCookieRawWrapper = setCookieRawWrapper;
|
|
32
32
|
const setCookieString = (p) => setCookieRawWrapper(Object.assign(Object.assign({}, p), { stringify: (s) => s }));
|
|
33
33
|
exports.setCookieString = setCookieString;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useCookieBoolean = exports.useCookieNumber = exports.useCookieString =
|
|
3
|
+
exports.useCookieBoolean = exports.useCookieNumber = exports.useCookieString = void 0;
|
|
4
|
+
exports.useCookie = useCookie;
|
|
4
5
|
const react_1 = require("react");
|
|
5
6
|
const get_1 = require("./get");
|
|
6
7
|
const set_1 = require("./set");
|
|
@@ -29,7 +30,6 @@ function useCookie(p) {
|
|
|
29
30
|
};
|
|
30
31
|
return [cookie, setState];
|
|
31
32
|
}
|
|
32
|
-
exports.useCookie = useCookie;
|
|
33
33
|
const useCookieString = (p) => {
|
|
34
34
|
var _a;
|
|
35
35
|
return useCookie(Object.assign(Object.assign({}, p), { parse: (s) => s !== null && s !== void 0 ? s : '', stringify: (s) => s, defaultValue: (_a = p.defaultValue) !== null && _a !== void 0 ? _a : '' }));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.useDebounce = useDebounce;
|
|
5
|
+
exports.debounce = debounce;
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
function useDebounce(value, delay) {
|
|
7
8
|
const [debouncedValue, setDebouncedValue] = (0, react_1.useState)(value);
|
|
@@ -15,7 +16,6 @@ function useDebounce(value, delay) {
|
|
|
15
16
|
}, [delay, value]);
|
|
16
17
|
return debouncedValue;
|
|
17
18
|
}
|
|
18
|
-
exports.useDebounce = useDebounce;
|
|
19
19
|
const hashMap = {};
|
|
20
20
|
function debounce(callback, { key, time, }) {
|
|
21
21
|
clearTimeout(hashMap[key]);
|
|
@@ -24,4 +24,3 @@ function debounce(callback, { key, time, }) {
|
|
|
24
24
|
callback();
|
|
25
25
|
}, time);
|
|
26
26
|
}
|
|
27
|
-
exports.debounce = debounce;
|
package/dist/ui/helpers/dom.js
CHANGED
|
@@ -22,7 +22,6 @@ exports.convertRemToPixels = convertRemToPixels;
|
|
|
22
22
|
* @param p
|
|
23
23
|
* @returns
|
|
24
24
|
*/
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
25
|
const filterDataProps = (p) => {
|
|
27
26
|
const x = Object.entries(p)
|
|
28
27
|
.filter((r) => r[0].startsWith('data-'))
|
|
@@ -38,7 +37,6 @@ const isRightClick = (event) => {
|
|
|
38
37
|
isRightMB = event.which == 3;
|
|
39
38
|
else if ('button' in event)
|
|
40
39
|
// IE, Opera
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
40
|
isRightMB = event.button == 2;
|
|
43
41
|
return isRightMB;
|
|
44
42
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export * from './axiosHelper';
|
|
2
2
|
export * from './callOpenApi';
|
|
3
|
-
export * from './cognito';
|
|
3
|
+
export type * from './cognito';
|
|
4
4
|
export * from './cookie';
|
|
5
5
|
export * from './date';
|
|
6
6
|
export * from './debounce';
|
|
7
7
|
export * from './dom';
|
|
8
8
|
export * from './extractAttributes';
|
|
9
|
-
export * from './jwt';
|
|
9
|
+
export type * from './jwt';
|
|
10
10
|
export * from './plural';
|
|
11
11
|
export * from './routes';
|
|
12
12
|
export * from './serviceWorker';
|
package/dist/ui/helpers/index.js
CHANGED
|
@@ -16,13 +16,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./axiosHelper"), exports);
|
|
18
18
|
__exportStar(require("./callOpenApi"), exports);
|
|
19
|
-
__exportStar(require("./cognito"), exports);
|
|
20
19
|
__exportStar(require("./cookie"), exports);
|
|
21
20
|
__exportStar(require("./date"), exports);
|
|
22
21
|
__exportStar(require("./debounce"), exports);
|
|
23
22
|
__exportStar(require("./dom"), exports);
|
|
24
23
|
__exportStar(require("./extractAttributes"), exports);
|
|
25
|
-
__exportStar(require("./jwt"), exports);
|
|
26
24
|
__exportStar(require("./plural"), exports);
|
|
27
25
|
__exportStar(require("./routes"), exports);
|
|
28
26
|
__exportStar(require("./serviceWorker"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.plural =
|
|
3
|
+
exports.plural = plural;
|
|
4
4
|
function plural(word, count) {
|
|
5
5
|
if (!word || !count) {
|
|
6
6
|
return word;
|
|
@@ -10,4 +10,3 @@ function plural(word, count) {
|
|
|
10
10
|
}
|
|
11
11
|
return word;
|
|
12
12
|
}
|
|
13
|
-
exports.plural = plural;
|
|
@@ -60,8 +60,8 @@ export declare const getServerReq: ({ pathname, query, headers, }: {
|
|
|
60
60
|
*/
|
|
61
61
|
headers: {
|
|
62
62
|
host?: string;
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
"user-agent"?: string;
|
|
64
|
+
"x-forwarded-proto"?: "http" | "https";
|
|
65
65
|
};
|
|
66
66
|
/**
|
|
67
67
|
* eg ctx.asPath || '/'
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.uninstallServiceWorkers =
|
|
12
|
+
exports.uninstallServiceWorkers = uninstallServiceWorkers;
|
|
13
13
|
const async_1 = require("../../common/helpers/async");
|
|
14
14
|
function uninstallServiceWorkers() {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -21,4 +21,3 @@ function uninstallServiceWorkers() {
|
|
|
21
21
|
.then((registrations) => __awaiter(this, void 0, void 0, function* () { return (0, async_1.asyncForEach)([...registrations], (r) => r.unregister()); }));
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
exports.uninstallServiceWorkers = uninstallServiceWorkers;
|
|
@@ -7,9 +7,7 @@ const useContextMenu = ({ ref, }) => {
|
|
|
7
7
|
const [xPos, setXPos] = (0, react_1.useState)('0px');
|
|
8
8
|
const [yPos, setYPos] = (0, react_1.useState)('0px');
|
|
9
9
|
const [showMenu, setShowMenu] = (0, react_1.useState)(false);
|
|
10
|
-
const handleContextMenu = (0, react_1.useCallback)(
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
(e) => {
|
|
10
|
+
const handleContextMenu = (0, react_1.useCallback)((e) => {
|
|
13
11
|
var _a;
|
|
14
12
|
if (!((_a = ref.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
15
13
|
return;
|
|
@@ -32,6 +30,7 @@ const useContextMenu = ({ ref, }) => {
|
|
|
32
30
|
try {
|
|
33
31
|
document.addEventListener('click', handleClick);
|
|
34
32
|
document.removeEventListener('contextmenu', handleContextMenu);
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
35
34
|
}
|
|
36
35
|
catch (e) {
|
|
37
36
|
//
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useElementAttribute =
|
|
4
|
+
exports.useElementAttribute = useElementAttribute;
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
/**
|
|
7
7
|
* add and remove an attribute on an element
|
|
@@ -19,6 +19,7 @@ function useElementAttribute({ enabled, key, value, element, }) {
|
|
|
19
19
|
else {
|
|
20
20
|
element.removeAttribute(key);
|
|
21
21
|
}
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
23
|
}
|
|
23
24
|
catch (e) {
|
|
24
25
|
//
|
|
@@ -26,6 +27,7 @@ function useElementAttribute({ enabled, key, value, element, }) {
|
|
|
26
27
|
return () => {
|
|
27
28
|
try {
|
|
28
29
|
element.removeAttribute(key);
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
31
|
}
|
|
30
32
|
catch (e) {
|
|
31
33
|
//
|
|
@@ -33,4 +35,3 @@ function useElementAttribute({ enabled, key, value, element, }) {
|
|
|
33
35
|
};
|
|
34
36
|
}, [element, enabled, key, value]);
|
|
35
37
|
}
|
|
36
|
-
exports.useElementAttribute = useElementAttribute;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.useGranularEffect = exports.useGranularHook = void 0;
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const useGranularHook = (hook, callback, primaryDeps, secondaryDeps) => {
|
|
7
|
-
const ref = (0, react_1.useRef)();
|
|
7
|
+
const ref = (0, react_1.useRef)(null);
|
|
8
8
|
if (!ref.current ||
|
|
9
9
|
!primaryDeps.every((w, i) => { var _a; return Object.is(w, (_a = ref.current) === null || _a === void 0 ? void 0 : _a[i]); }))
|
|
10
10
|
ref.current = [...primaryDeps, ...secondaryDeps];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.useIsomorphicLayoutEffect = void 0;
|
|
5
|
+
exports.useInterval = useInterval;
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
exports.useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react_1.useLayoutEffect : react_1.useEffect;
|
|
7
8
|
exports.default = exports.useIsomorphicLayoutEffect;
|
|
@@ -34,4 +35,3 @@ delay, opt) {
|
|
|
34
35
|
};
|
|
35
36
|
}, [opt, delay]);
|
|
36
37
|
}
|
|
37
|
-
exports.useInterval = useInterval;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useIsInViewport =
|
|
3
|
+
exports.useIsInViewport = useIsInViewport;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
function useIsInViewport(ref) {
|
|
6
6
|
const [isInViewport, setIsInViewport] = (0, react_1.useState)(false);
|
|
@@ -17,4 +17,3 @@ function useIsInViewport(ref) {
|
|
|
17
17
|
}, [ref]);
|
|
18
18
|
return isInViewport;
|
|
19
19
|
}
|
|
20
|
-
exports.useIsInViewport = useIsInViewport;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getLocalStorageItem = exports.setLocalStorageItem = exports.clearAllLocalStorage = exports.clearLocalStorageItem = void 0;
|
|
4
|
+
exports.UseLocalStorage = UseLocalStorage;
|
|
4
5
|
const react_1 = require("react");
|
|
5
6
|
const date_1 = require("../../common/helpers/date");
|
|
6
7
|
const log_1 = require("../../common/helpers/log");
|
|
@@ -83,4 +84,3 @@ function UseLocalStorage(key, initialValue, ttl) {
|
|
|
83
84
|
};
|
|
84
85
|
return [storedValue, setValue];
|
|
85
86
|
}
|
|
86
|
-
exports.UseLocalStorage = UseLocalStorage;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useLockBodyScroll =
|
|
3
|
+
exports.useLockBodyScroll = useLockBodyScroll;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
function useLockBodyScroll(enabled) {
|
|
6
6
|
(0, react_1.useLayoutEffect)(() => {
|
|
@@ -16,4 +16,3 @@ function useLockBodyScroll(enabled) {
|
|
|
16
16
|
};
|
|
17
17
|
}, [enabled]);
|
|
18
18
|
}
|
|
19
|
-
exports.useLockBodyScroll = useLockBodyScroll;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
2
|
type Event = MouseEvent | TouchEvent;
|
|
3
3
|
export declare function useOnClickOutside<T extends HTMLElement = HTMLElement>(p: {
|
|
4
|
-
ref: RefObject<T>;
|
|
4
|
+
ref: RefObject<T | null>;
|
|
5
5
|
/** can either be a boolean, or a callback */
|
|
6
6
|
disabled?: boolean | (() => boolean);
|
|
7
7
|
/** if true, will also consider moving mouse outside div. default false */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useOnClickOutside =
|
|
4
|
+
exports.useOnClickOutside = useOnClickOutside;
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const dom_1 = require("./dom");
|
|
7
7
|
function useOnClickOutside(p, handler) {
|
|
@@ -9,7 +9,7 @@ function useOnClickOutside(p, handler) {
|
|
|
9
9
|
const listener = (event) => {
|
|
10
10
|
var _a;
|
|
11
11
|
const disabled = !p.disabled || typeof p.disabled === 'boolean'
|
|
12
|
-
? (_a = p.disabled) !== null && _a !== void 0 ? _a : false
|
|
12
|
+
? ((_a = p.disabled) !== null && _a !== void 0 ? _a : false)
|
|
13
13
|
: p.disabled();
|
|
14
14
|
if (disabled) {
|
|
15
15
|
return;
|
|
@@ -48,6 +48,7 @@ function useOnClickOutside(p, handler) {
|
|
|
48
48
|
document.removeEventListener(`mousedown`, listener);
|
|
49
49
|
document.removeEventListener(`touchstart`, listener);
|
|
50
50
|
document.removeEventListener(`mousemove`, listener);
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
51
52
|
}
|
|
52
53
|
catch (e) {
|
|
53
54
|
//
|
|
@@ -56,4 +57,3 @@ function useOnClickOutside(p, handler) {
|
|
|
56
57
|
// Reload only if ref or handler changes
|
|
57
58
|
}, [p, handler]);
|
|
58
59
|
}
|
|
59
|
-
exports.useOnClickOutside = useOnClickOutside;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useOnScroll =
|
|
4
|
+
exports.useOnScroll = useOnScroll;
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const debounce_1 = require("./debounce");
|
|
7
7
|
const useGranularHook_1 = require("./useGranularHook");
|
|
@@ -18,9 +18,9 @@ function useOnScroll({ onScroll, element, } = {}) {
|
|
|
18
18
|
(0, useGranularHook_1.useGranularEffect)(() => {
|
|
19
19
|
var _a;
|
|
20
20
|
const listener = (e) => {
|
|
21
|
-
var _a, _b
|
|
22
|
-
const y = (
|
|
23
|
-
const x = (
|
|
21
|
+
var _a, _b;
|
|
22
|
+
const y = (_a = element === null || element === void 0 ? void 0 : element.current.scrollTop) !== null && _a !== void 0 ? _a : window.scrollY;
|
|
23
|
+
const x = (_b = element === null || element === void 0 ? void 0 : element.current.scrollLeft) !== null && _b !== void 0 ? _b : window.scrollX;
|
|
24
24
|
const r = {
|
|
25
25
|
y,
|
|
26
26
|
x,
|
|
@@ -46,6 +46,7 @@ function useOnScroll({ onScroll, element, } = {}) {
|
|
|
46
46
|
var _a;
|
|
47
47
|
try {
|
|
48
48
|
((_a = element === null || element === void 0 ? void 0 : element.current) !== null && _a !== void 0 ? _a : document).removeEventListener(`scroll`, listenDebounce);
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
49
50
|
}
|
|
50
51
|
catch (e) {
|
|
51
52
|
//
|
|
@@ -53,11 +54,9 @@ function useOnScroll({ onScroll, element, } = {}) {
|
|
|
53
54
|
};
|
|
54
55
|
}, [element], [element, onScroll, startScrollTopY]);
|
|
55
56
|
(0, react_1.useEffect)(() => {
|
|
56
|
-
|
|
57
|
-
if (startScrollTopY === -1 && ((_a = element === null || element === void 0 ? void 0 : element.current) === null || _a === void 0 ? void 0 : _a.scrollTop)) {
|
|
57
|
+
if (startScrollTopY === -1 && (element === null || element === void 0 ? void 0 : element.current.scrollTop)) {
|
|
58
58
|
setStartScrollTopY(element.current.scrollTop);
|
|
59
59
|
}
|
|
60
60
|
}, [element, startScrollTopY]);
|
|
61
61
|
return state;
|
|
62
62
|
}
|
|
63
|
-
exports.useOnScroll = useOnScroll;
|
|
@@ -18,6 +18,7 @@ const useOverloadPageSearch = ({ disabled = false, onTrigger, }) => {
|
|
|
18
18
|
if (!disabled) {
|
|
19
19
|
window.addEventListener('keydown', ctrlF);
|
|
20
20
|
}
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
21
22
|
}
|
|
22
23
|
catch (e) {
|
|
23
24
|
//
|
|
@@ -25,6 +26,7 @@ const useOverloadPageSearch = ({ disabled = false, onTrigger, }) => {
|
|
|
25
26
|
return () => {
|
|
26
27
|
try {
|
|
27
28
|
window.removeEventListener('keydown', ctrlF);
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28
30
|
}
|
|
29
31
|
catch (e) {
|
|
30
32
|
//
|
|
@@ -13,7 +13,7 @@ exports.isServer = typeof window === 'undefined';
|
|
|
13
13
|
*/
|
|
14
14
|
const useQueryStringRaw = ({ name, queryValues, defaultValue, stringify, parse, }) => {
|
|
15
15
|
const qv = exports.isServer
|
|
16
|
-
? queryValues !== null && queryValues !== void 0 ? queryValues : {}
|
|
16
|
+
? (queryValues !== null && queryValues !== void 0 ? queryValues : {})
|
|
17
17
|
: (0, object_1.paramsToObject)(new URLSearchParams(window.location.search));
|
|
18
18
|
const qsv = parse(qv[name]) || defaultValue;
|
|
19
19
|
const [state, setStateRaw] = (0, react_1.useState)(qsv);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useResize =
|
|
4
|
+
exports.useResize = useResize;
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const media_1 = require("../styles/media");
|
|
7
7
|
function getWindowDimensions() {
|
|
@@ -33,6 +33,7 @@ function useResize() {
|
|
|
33
33
|
return () => {
|
|
34
34
|
try {
|
|
35
35
|
window.removeEventListener('resize', handleResize);
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
36
37
|
}
|
|
37
38
|
catch (e) {
|
|
38
39
|
//
|
|
@@ -41,4 +42,3 @@ function useResize() {
|
|
|
41
42
|
}, [windowDimensions]);
|
|
42
43
|
return windowDimensions;
|
|
43
44
|
}
|
|
44
|
-
exports.useResize = useResize;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useTimeout =
|
|
4
|
+
exports.useTimeout = useTimeout;
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
function useTimeout(callback,
|
|
7
7
|
/** if null wont trigger */
|
|
@@ -33,4 +33,3 @@ delay) {
|
|
|
33
33
|
}
|
|
34
34
|
}, [delay]);
|
|
35
35
|
}
|
|
36
|
-
exports.useTimeout = useTimeout;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -114,6 +124,7 @@ const useTooltip = (p) => {
|
|
|
114
124
|
var _a;
|
|
115
125
|
try {
|
|
116
126
|
(_a = document.querySelector(`#${portalId}`)) === null || _a === void 0 ? void 0 : _a.remove();
|
|
127
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
117
128
|
}
|
|
118
129
|
catch (e) {
|
|
119
130
|
//
|
package/dist/ui/icons/Cog.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
export declare const Cog: (
|
|
3
|
+
export declare const Cog: ({ style, }: {
|
|
4
|
+
style?: {
|
|
5
|
+
/** change the colour of the icon. default black */
|
|
6
|
+
fill?: string;
|
|
7
|
+
} & CSSProperties;
|
|
8
|
+
}) => React.JSX.Element;
|