lkd-web-kit 0.7.31 → 0.8.1
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/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/components/EmptyState/index.cjs +38 -52
- package/dist/components/EmptyState/index.js +37 -48
- package/dist/components/Icon.cjs +46 -50
- package/dist/components/Icon.js +44 -46
- package/dist/components/InfinityLoadMoreButton/index.cjs +30 -42
- package/dist/components/InfinityLoadMoreButton/index.js +28 -38
- package/dist/components/InfinitySelect/index.cjs +126 -168
- package/dist/components/InfinitySelect/index.js +125 -164
- package/dist/components/MyCheckboxGroup/index.cjs +14 -22
- package/dist/components/MyCheckboxGroup/index.js +13 -18
- package/dist/components/MyDateInput/index.cjs +12 -18
- package/dist/components/MyDateInput/index.js +11 -14
- package/dist/components/MyDatePickerInput/CalendarIcon.cjs +45 -64
- package/dist/components/MyDatePickerInput/CalendarIcon.js +43 -61
- package/dist/components/MyDatePickerInput/index.cjs +12 -18
- package/dist/components/MyDatePickerInput/index.js +11 -14
- package/dist/components/MyDateTimePicker/index.cjs +12 -18
- package/dist/components/MyDateTimePicker/index.js +11 -14
- package/dist/components/MyMonthPickerInput/index.cjs +12 -18
- package/dist/components/MyMonthPickerInput/index.js +11 -14
- package/dist/components/MyMultiSelect/index.cjs +9 -9
- package/dist/components/MyMultiSelect/index.js +8 -5
- package/dist/components/MyNotifications/index.cjs +11 -16
- package/dist/components/MyNotifications/index.js +10 -12
- package/dist/components/MyNumberInput/index.cjs +9 -15
- package/dist/components/MyNumberInput/index.js +8 -11
- package/dist/components/MyRadioGroup/index.cjs +14 -22
- package/dist/components/MyRadioGroup/index.js +13 -18
- package/dist/components/MySelect/index.cjs +9 -15
- package/dist/components/MySelect/index.js +8 -11
- package/dist/components/MyTextInput/index.cjs +9 -15
- package/dist/components/MyTextInput/index.js +8 -11
- package/dist/components/MyTextarea/index.cjs +9 -15
- package/dist/components/MyTextarea/index.js +8 -11
- package/dist/components/MyTimeInput/index.cjs +9 -15
- package/dist/components/MyTimeInput/index.js +8 -11
- package/dist/components/NavItems.cjs +28 -38
- package/dist/components/NavItems.js +26 -34
- package/dist/consts/http-status.cjs +66 -69
- package/dist/consts/http-status.js +66 -65
- package/dist/consts/revalidate.cjs +10 -13
- package/dist/consts/revalidate.js +10 -9
- package/dist/contexts/NavigationHistoryContext/hook.cjs +41 -42
- package/dist/contexts/NavigationHistoryContext/hook.js +40 -38
- package/dist/contexts/NavigationHistoryContext/index.cjs +31 -28
- package/dist/contexts/NavigationHistoryContext/index.js +30 -24
- package/dist/contexts/PageDataContext/index.cjs +15 -18
- package/dist/contexts/PageDataContext/index.js +14 -14
- package/dist/form/Form.cjs +19 -28
- package/dist/form/Form.js +18 -24
- package/dist/form/FormSubmitButton.cjs +15 -27
- package/dist/form/FormSubmitButton.js +14 -23
- package/dist/form/base/FormCheckbox.cjs +15 -23
- package/dist/form/base/FormCheckbox.js +14 -19
- package/dist/form/base/FormCheckboxGroup.cjs +10 -16
- package/dist/form/base/FormCheckboxGroup.js +9 -12
- package/dist/form/base/FormDateInput.cjs +10 -16
- package/dist/form/base/FormDateInput.js +9 -12
- package/dist/form/base/FormDatePickerInput.cjs +10 -16
- package/dist/form/base/FormDatePickerInput.js +9 -12
- package/dist/form/base/FormDateTimePicker.cjs +10 -16
- package/dist/form/base/FormDateTimePicker.js +9 -12
- package/dist/form/base/FormMonthPickerInput.cjs +10 -16
- package/dist/form/base/FormMonthPickerInput.js +9 -12
- package/dist/form/base/FormMultiSelect.cjs +10 -16
- package/dist/form/base/FormMultiSelect.js +9 -12
- package/dist/form/base/FormNumberInput.cjs +12 -16
- package/dist/form/base/FormNumberInput.js +10 -12
- package/dist/form/base/FormRadioGroup.cjs +10 -16
- package/dist/form/base/FormRadioGroup.js +9 -12
- package/dist/form/base/FormSelect.cjs +10 -16
- package/dist/form/base/FormSelect.js +9 -12
- package/dist/form/base/FormSelectInfinity.cjs +15 -21
- package/dist/form/base/FormSelectInfinity.js +14 -17
- package/dist/form/base/FormTextInput.cjs +10 -16
- package/dist/form/base/FormTextInput.js +9 -12
- package/dist/form/base/FormTextarea.cjs +10 -10
- package/dist/form/base/FormTextarea.js +9 -6
- package/dist/form/base/FormTimeInput.cjs +18 -24
- package/dist/form/base/FormTimeInput.js +17 -20
- package/dist/form/utils/nullable-but-required.cjs +14 -17
- package/dist/form/utils/nullable-but-required.js +13 -13
- package/dist/form/utils/optional-but-required.cjs +14 -17
- package/dist/form/utils/optional-but-required.js +13 -13
- package/dist/form/utils/zodValidator.cjs +9 -13
- package/dist/form/utils/zodValidator.js +9 -9
- package/dist/hocs/withController.cjs +43 -54
- package/dist/hocs/withController.js +42 -50
- package/dist/hocs/withModalManager.cjs +29 -35
- package/dist/hocs/withModalManager.js +28 -31
- package/dist/hooks/useBreakpoint.cjs +8 -12
- package/dist/hooks/useBreakpoint.js +7 -8
- package/dist/hooks/useFetchNextPageOnScroll.cjs +13 -21
- package/dist/hooks/useFetchNextPageOnScroll.js +13 -17
- package/dist/hooks/useOnScrollProgress.cjs +33 -37
- package/dist/hooks/useOnScrollProgress.js +32 -33
- package/dist/hooks/useUpdateSearchParams.cjs +22 -22
- package/dist/hooks/useUpdateSearchParams.js +21 -18
- package/dist/hooks/useZodConfig.cjs +14 -19
- package/dist/hooks/useZodConfig.js +12 -15
- package/dist/index.cjs +130 -136
- package/dist/index.d.ts +14 -16
- package/dist/index.js +62 -61
- package/dist/mantine/breakpoints-with-px.cjs +9 -12
- package/dist/mantine/breakpoints-with-px.js +9 -8
- package/dist/mantine/my-default-theme.cjs +23 -41
- package/dist/mantine/my-default-theme.js +22 -37
- package/dist/mantine/to-tailwind-colors.cjs +9 -18
- package/dist/mantine/to-tailwind-colors.js +9 -14
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.cjs +35 -70
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +34 -42
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.cjs +700 -811
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +701 -804
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.cjs +44 -64
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +44 -60
- package/dist/utils/array/groupBy.cjs +30 -40
- package/dist/utils/array/groupBy.js +30 -36
- package/dist/utils/array/shuffleArray.cjs +11 -17
- package/dist/utils/array/shuffleArray.js +11 -13
- package/dist/utils/formatBytes.cjs +12 -11
- package/dist/utils/formatBytes.js +12 -7
- package/dist/utils/isInfinityEmpty.cjs +3 -6
- package/dist/utils/isInfinityEmpty.js +3 -2
- package/dist/utils/ky/addBodyJsonHook.cjs +9 -10
- package/dist/utils/ky/addBodyJsonHook.js +8 -6
- package/dist/utils/ky/parseJson.cjs +6 -9
- package/dist/utils/ky/parseJson.js +6 -5
- package/dist/utils/new-route.cjs +30 -39
- package/dist/utils/new-route.js +30 -35
- package/dist/utils/query-stringify.cjs +5 -8
- package/dist/utils/query-stringify.js +5 -4
- package/dist/utils/virtual-styles.cjs +21 -26
- package/dist/utils/virtual-styles.js +21 -22
- package/package.json +67 -65
|
@@ -1,74 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
|
|
1
|
+
//#region node_modules/@tanstack/virtual-core/dist/esm/utils.js
|
|
5
2
|
function memo(getDeps, fn, opts) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
str = " " + str;
|
|
30
|
-
}
|
|
31
|
-
return str;
|
|
32
|
-
};
|
|
33
|
-
console.info(
|
|
34
|
-
`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
|
|
35
|
-
`
|
|
3
|
+
let deps = opts.initialDeps ?? [];
|
|
4
|
+
let result;
|
|
5
|
+
let isInitial = true;
|
|
6
|
+
function memoizedFunction() {
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
let depTime;
|
|
9
|
+
if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts))) depTime = Date.now();
|
|
10
|
+
const newDeps = getDeps();
|
|
11
|
+
if (!(newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep))) return result;
|
|
12
|
+
deps = newDeps;
|
|
13
|
+
let resultTime;
|
|
14
|
+
if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts))) resultTime = Date.now();
|
|
15
|
+
result = fn(...newDeps);
|
|
16
|
+
if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
|
|
17
|
+
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
|
18
|
+
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
|
|
19
|
+
const resultFpsPercentage = resultEndTime / 16;
|
|
20
|
+
const pad = (str, num) => {
|
|
21
|
+
str = String(str);
|
|
22
|
+
while (str.length < num) str = " " + str;
|
|
23
|
+
return str;
|
|
24
|
+
};
|
|
25
|
+
console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, `
|
|
36
26
|
font-size: .6rem;
|
|
37
27
|
font-weight: bold;
|
|
38
|
-
color: hsl(${Math.max(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
isInitial = false;
|
|
49
|
-
return result;
|
|
50
|
-
}
|
|
51
|
-
memoizedFunction.updateDeps = (newDeps) => {
|
|
52
|
-
deps = newDeps;
|
|
53
|
-
};
|
|
54
|
-
return memoizedFunction;
|
|
28
|
+
color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key);
|
|
29
|
+
}
|
|
30
|
+
if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) opts.onChange(result);
|
|
31
|
+
isInitial = false;
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
memoizedFunction.updateDeps = (newDeps) => {
|
|
35
|
+
deps = newDeps;
|
|
36
|
+
};
|
|
37
|
+
return memoizedFunction;
|
|
55
38
|
}
|
|
56
39
|
function notUndefined(value, msg) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
} else {
|
|
60
|
-
return value;
|
|
61
|
-
}
|
|
40
|
+
if (value === void 0) throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
|
|
41
|
+
else return value;
|
|
62
42
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
43
|
+
var approxEqual = (a, b) => Math.abs(a - b) < 1.01;
|
|
44
|
+
var debounce = (targetWindow, fn, ms) => {
|
|
45
|
+
let timeoutId;
|
|
46
|
+
return function(...args) {
|
|
47
|
+
targetWindow.clearTimeout(timeoutId);
|
|
48
|
+
timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
|
|
49
|
+
};
|
|
70
50
|
};
|
|
71
|
-
|
|
51
|
+
//#endregion
|
|
72
52
|
exports.approxEqual = approxEqual;
|
|
73
53
|
exports.debounce = debounce;
|
|
74
54
|
exports.memo = memo;
|
|
@@ -1,68 +1,52 @@
|
|
|
1
|
+
//#region node_modules/@tanstack/virtual-core/dist/esm/utils.js
|
|
1
2
|
function memo(getDeps, fn, opts) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
str = " " + str;
|
|
26
|
-
}
|
|
27
|
-
return str;
|
|
28
|
-
};
|
|
29
|
-
console.info(
|
|
30
|
-
`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
|
|
31
|
-
`
|
|
3
|
+
let deps = opts.initialDeps ?? [];
|
|
4
|
+
let result;
|
|
5
|
+
let isInitial = true;
|
|
6
|
+
function memoizedFunction() {
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
let depTime;
|
|
9
|
+
if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts))) depTime = Date.now();
|
|
10
|
+
const newDeps = getDeps();
|
|
11
|
+
if (!(newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep))) return result;
|
|
12
|
+
deps = newDeps;
|
|
13
|
+
let resultTime;
|
|
14
|
+
if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts))) resultTime = Date.now();
|
|
15
|
+
result = fn(...newDeps);
|
|
16
|
+
if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
|
|
17
|
+
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
|
18
|
+
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
|
|
19
|
+
const resultFpsPercentage = resultEndTime / 16;
|
|
20
|
+
const pad = (str, num) => {
|
|
21
|
+
str = String(str);
|
|
22
|
+
while (str.length < num) str = " " + str;
|
|
23
|
+
return str;
|
|
24
|
+
};
|
|
25
|
+
console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, `
|
|
32
26
|
font-size: .6rem;
|
|
33
27
|
font-weight: bold;
|
|
34
|
-
color: hsl(${Math.max(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
isInitial = false;
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
memoizedFunction.updateDeps = (newDeps) => {
|
|
48
|
-
deps = newDeps;
|
|
49
|
-
};
|
|
50
|
-
return memoizedFunction;
|
|
28
|
+
color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key);
|
|
29
|
+
}
|
|
30
|
+
if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) opts.onChange(result);
|
|
31
|
+
isInitial = false;
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
memoizedFunction.updateDeps = (newDeps) => {
|
|
35
|
+
deps = newDeps;
|
|
36
|
+
};
|
|
37
|
+
return memoizedFunction;
|
|
51
38
|
}
|
|
52
39
|
function notUndefined(value, msg) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} else {
|
|
56
|
-
return value;
|
|
57
|
-
}
|
|
40
|
+
if (value === void 0) throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
|
|
41
|
+
else return value;
|
|
58
42
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
43
|
+
var approxEqual = (a, b) => Math.abs(a - b) < 1.01;
|
|
44
|
+
var debounce = (targetWindow, fn, ms) => {
|
|
45
|
+
let timeoutId;
|
|
46
|
+
return function(...args) {
|
|
47
|
+
targetWindow.clearTimeout(timeoutId);
|
|
48
|
+
timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
|
|
49
|
+
};
|
|
66
50
|
};
|
|
67
|
-
|
|
51
|
+
//#endregion
|
|
68
52
|
export { approxEqual, debounce, memo, notUndefined };
|
|
@@ -1,45 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
|
|
1
|
+
//#region src/utils/array/groupBy.ts
|
|
5
2
|
function indexBy(arr, getKey, getValue) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const key = getKey(item);
|
|
19
|
-
if (key === void 0) return acc;
|
|
20
|
-
acc[key] = item;
|
|
21
|
-
return acc;
|
|
22
|
-
},
|
|
23
|
-
{}
|
|
24
|
-
);
|
|
3
|
+
if (getValue) return arr.reduce((acc, item) => {
|
|
4
|
+
const key = getKey(item);
|
|
5
|
+
if (key === void 0) return acc;
|
|
6
|
+
acc[key] = getValue(item);
|
|
7
|
+
return acc;
|
|
8
|
+
}, {});
|
|
9
|
+
return arr.reduce((acc, item) => {
|
|
10
|
+
const key = getKey(item);
|
|
11
|
+
if (key === void 0) return acc;
|
|
12
|
+
acc[key] = item;
|
|
13
|
+
return acc;
|
|
14
|
+
}, {});
|
|
25
15
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
16
|
+
var groupBy = (arr, getKey) => {
|
|
17
|
+
const groups = {};
|
|
18
|
+
arr?.forEach((item) => {
|
|
19
|
+
const key = getKey(item);
|
|
20
|
+
if (key === null) return;
|
|
21
|
+
if (Array.isArray(key)) {
|
|
22
|
+
key.forEach((k) => {
|
|
23
|
+
if (!groups[k]) groups[k] = [];
|
|
24
|
+
groups[k]?.push(item);
|
|
25
|
+
});
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (!groups[key]) groups[key] = [];
|
|
29
|
+
groups[key]?.push(item);
|
|
30
|
+
});
|
|
31
|
+
return groups;
|
|
42
32
|
};
|
|
43
|
-
|
|
33
|
+
//#endregion
|
|
44
34
|
exports.groupBy = groupBy;
|
|
45
35
|
exports.indexBy = indexBy;
|
|
@@ -1,40 +1,34 @@
|
|
|
1
|
+
//#region src/utils/array/groupBy.ts
|
|
1
2
|
function indexBy(arr, getKey, getValue) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const key = getKey(item);
|
|
15
|
-
if (key === void 0) return acc;
|
|
16
|
-
acc[key] = item;
|
|
17
|
-
return acc;
|
|
18
|
-
},
|
|
19
|
-
{}
|
|
20
|
-
);
|
|
3
|
+
if (getValue) return arr.reduce((acc, item) => {
|
|
4
|
+
const key = getKey(item);
|
|
5
|
+
if (key === void 0) return acc;
|
|
6
|
+
acc[key] = getValue(item);
|
|
7
|
+
return acc;
|
|
8
|
+
}, {});
|
|
9
|
+
return arr.reduce((acc, item) => {
|
|
10
|
+
const key = getKey(item);
|
|
11
|
+
if (key === void 0) return acc;
|
|
12
|
+
acc[key] = item;
|
|
13
|
+
return acc;
|
|
14
|
+
}, {});
|
|
21
15
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
16
|
+
var groupBy = (arr, getKey) => {
|
|
17
|
+
const groups = {};
|
|
18
|
+
arr?.forEach((item) => {
|
|
19
|
+
const key = getKey(item);
|
|
20
|
+
if (key === null) return;
|
|
21
|
+
if (Array.isArray(key)) {
|
|
22
|
+
key.forEach((k) => {
|
|
23
|
+
if (!groups[k]) groups[k] = [];
|
|
24
|
+
groups[k]?.push(item);
|
|
25
|
+
});
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (!groups[key]) groups[key] = [];
|
|
29
|
+
groups[key]?.push(item);
|
|
30
|
+
});
|
|
31
|
+
return groups;
|
|
38
32
|
};
|
|
39
|
-
|
|
33
|
+
//#endregion
|
|
40
34
|
export { groupBy, indexBy };
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[shuffledArray[currentIndex], shuffledArray[randomIndex]] = [
|
|
12
|
-
shuffledArray[randomIndex],
|
|
13
|
-
shuffledArray[currentIndex]
|
|
14
|
-
];
|
|
15
|
-
}
|
|
16
|
-
return shuffledArray;
|
|
1
|
+
//#region src/utils/array/shuffleArray.ts
|
|
2
|
+
var shuffleArray = (array) => {
|
|
3
|
+
const shuffledArray = [...array];
|
|
4
|
+
let currentIndex = shuffledArray.length, randomIndex;
|
|
5
|
+
while (currentIndex > 0) {
|
|
6
|
+
randomIndex = Math.floor(Math.random() * currentIndex);
|
|
7
|
+
currentIndex--;
|
|
8
|
+
[shuffledArray[currentIndex], shuffledArray[randomIndex]] = [shuffledArray[randomIndex], shuffledArray[currentIndex]];
|
|
9
|
+
}
|
|
10
|
+
return shuffledArray;
|
|
17
11
|
};
|
|
18
|
-
|
|
12
|
+
//#endregion
|
|
19
13
|
exports.shuffleArray = shuffleArray;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
return shuffledArray;
|
|
1
|
+
//#region src/utils/array/shuffleArray.ts
|
|
2
|
+
var shuffleArray = (array) => {
|
|
3
|
+
const shuffledArray = [...array];
|
|
4
|
+
let currentIndex = shuffledArray.length, randomIndex;
|
|
5
|
+
while (currentIndex > 0) {
|
|
6
|
+
randomIndex = Math.floor(Math.random() * currentIndex);
|
|
7
|
+
currentIndex--;
|
|
8
|
+
[shuffledArray[currentIndex], shuffledArray[randomIndex]] = [shuffledArray[randomIndex], shuffledArray[currentIndex]];
|
|
9
|
+
}
|
|
10
|
+
return shuffledArray;
|
|
13
11
|
};
|
|
14
|
-
|
|
12
|
+
//#endregion
|
|
15
13
|
export { shuffleArray };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
|
|
1
|
+
//#region src/utils/formatBytes.ts
|
|
5
2
|
function formatBytes(bytes, decimals = 2) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
if (!+bytes) return "0 Bytes";
|
|
4
|
+
const k = 1024;
|
|
5
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
6
|
+
const sizes = [
|
|
7
|
+
"Bytes",
|
|
8
|
+
"KB",
|
|
9
|
+
"MB"
|
|
10
|
+
];
|
|
11
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
12
|
+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
//#endregion
|
|
14
15
|
exports.formatBytes = formatBytes;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
//#region src/utils/formatBytes.ts
|
|
1
2
|
function formatBytes(bytes, decimals = 2) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
if (!+bytes) return "0 Bytes";
|
|
4
|
+
const k = 1024;
|
|
5
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
6
|
+
const sizes = [
|
|
7
|
+
"Bytes",
|
|
8
|
+
"KB",
|
|
9
|
+
"MB"
|
|
10
|
+
];
|
|
11
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
12
|
+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
8
13
|
}
|
|
9
|
-
|
|
14
|
+
//#endregion
|
|
10
15
|
export { formatBytes };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const isInfinityEmpty = (data) => data?.pages[0].data.length === 0;
|
|
6
|
-
|
|
1
|
+
//#region src/utils/isInfinityEmpty.ts
|
|
2
|
+
var isInfinityEmpty = (data) => data?.pages[0].data.length === 0;
|
|
3
|
+
//#endregion
|
|
7
4
|
exports.isInfinityEmpty = isInfinityEmpty;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return error;
|
|
1
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let ky = require("ky");
|
|
3
|
+
//#region src/utils/ky/addBodyJsonHook.ts
|
|
4
|
+
var addBodyJsonHook = async ({ error }) => {
|
|
5
|
+
if (!(0, ky.isHTTPError)(error)) return error;
|
|
6
|
+
const bodyJson = error.data ?? {};
|
|
7
|
+
error.response.bodyJson = bodyJson;
|
|
8
|
+
return error;
|
|
10
9
|
};
|
|
11
|
-
|
|
10
|
+
//#endregion
|
|
12
11
|
exports.addBodyJsonHook = addBodyJsonHook;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { isHTTPError } from "ky";
|
|
2
|
+
//#region src/utils/ky/addBodyJsonHook.ts
|
|
3
|
+
var addBodyJsonHook = async ({ error }) => {
|
|
4
|
+
if (!isHTTPError(error)) return error;
|
|
5
|
+
const bodyJson = error.data ?? {};
|
|
6
|
+
error.response.bodyJson = bodyJson;
|
|
7
|
+
return error;
|
|
6
8
|
};
|
|
7
|
-
|
|
9
|
+
//#endregion
|
|
8
10
|
export { addBodyJsonHook };
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return response.text().then(function(text) {
|
|
7
|
-
return text ? JSON.parse(text) : {};
|
|
8
|
-
});
|
|
1
|
+
//#region src/utils/ky/parseJson.ts
|
|
2
|
+
var parseJSON = async (response) => {
|
|
3
|
+
return response.text().then(function(text) {
|
|
4
|
+
return text ? JSON.parse(text) : {};
|
|
5
|
+
});
|
|
9
6
|
};
|
|
10
|
-
|
|
7
|
+
//#endregion
|
|
11
8
|
exports.parseJSON = parseJSON;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region src/utils/ky/parseJson.ts
|
|
2
|
+
var parseJSON = async (response) => {
|
|
3
|
+
return response.text().then(function(text) {
|
|
4
|
+
return text ? JSON.parse(text) : {};
|
|
5
|
+
});
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
+
//#endregion
|
|
7
8
|
export { parseJSON };
|