@noxickon/onyx 6.4.0 → 6.5.0
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/components/DataTable/DataTable.d.ts +7 -5
- package/dist/components/DataTable/DataTable.js +546 -367
- package/dist/components/DataTable/DataTable.styles.d.ts +21 -3
- package/dist/components/DataTable/DataTable.styles.js +13 -2
- package/dist/components/DataTable/DataTable.types.d.ts +29 -1
- package/dist/components/DataTable/index.d.ts +4 -2
- package/dist/components/DataTable/index.js +10 -8
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useQuery/index.d.ts +2 -0
- package/dist/hooks/useQuery/useQuery.d.ts +3 -0
- package/dist/hooks/useQuery/useQuery.js +53 -0
- package/dist/hooks/useQuery/useQuery.types.d.ts +12 -0
- package/dist/hooks.js +12 -11
- package/dist/index.js +21 -21
- package/dist/rest/executors/OxRestError.d.ts +5 -0
- package/dist/rest/executors/OxRestError.js +10 -0
- package/dist/rest/executors/restExecutor.js +91 -83
- package/dist/rest/index.d.ts +1 -0
- package/dist/rest.js +3 -2
- package/package.json +1 -1
|
@@ -31,7 +31,9 @@ export declare const dataTableVariants: import('tailwind-variants').TVReturnType
|
|
|
31
31
|
toolbar: string;
|
|
32
32
|
toolbarGroup: string;
|
|
33
33
|
divider: string;
|
|
34
|
-
|
|
34
|
+
collapse: string[];
|
|
35
|
+
collapseClip: string;
|
|
36
|
+
filterChipsRow: string;
|
|
35
37
|
selectionActions: string;
|
|
36
38
|
scroll: string;
|
|
37
39
|
selectCol: string;
|
|
@@ -59,6 +61,10 @@ export declare const dataTableVariants: import('tailwind-variants').TVReturnType
|
|
|
59
61
|
configLabel: string;
|
|
60
62
|
configActions: string;
|
|
61
63
|
configSeparator: string;
|
|
64
|
+
filterMenuItem: string;
|
|
65
|
+
skeleton: string;
|
|
66
|
+
skeletonToolbar: string;
|
|
67
|
+
skeletonBody: string;
|
|
62
68
|
}, undefined, {
|
|
63
69
|
density: {
|
|
64
70
|
comfortable: {};
|
|
@@ -91,7 +97,9 @@ export declare const dataTableVariants: import('tailwind-variants').TVReturnType
|
|
|
91
97
|
toolbar: string;
|
|
92
98
|
toolbarGroup: string;
|
|
93
99
|
divider: string;
|
|
94
|
-
|
|
100
|
+
collapse: string[];
|
|
101
|
+
collapseClip: string;
|
|
102
|
+
filterChipsRow: string;
|
|
95
103
|
selectionActions: string;
|
|
96
104
|
scroll: string;
|
|
97
105
|
selectCol: string;
|
|
@@ -119,6 +127,10 @@ export declare const dataTableVariants: import('tailwind-variants').TVReturnType
|
|
|
119
127
|
configLabel: string;
|
|
120
128
|
configActions: string;
|
|
121
129
|
configSeparator: string;
|
|
130
|
+
filterMenuItem: string;
|
|
131
|
+
skeleton: string;
|
|
132
|
+
skeletonToolbar: string;
|
|
133
|
+
skeletonBody: string;
|
|
122
134
|
}, import('tailwind-variants').TVReturnType<{
|
|
123
135
|
density: {
|
|
124
136
|
comfortable: {};
|
|
@@ -151,7 +163,9 @@ export declare const dataTableVariants: import('tailwind-variants').TVReturnType
|
|
|
151
163
|
toolbar: string;
|
|
152
164
|
toolbarGroup: string;
|
|
153
165
|
divider: string;
|
|
154
|
-
|
|
166
|
+
collapse: string[];
|
|
167
|
+
collapseClip: string;
|
|
168
|
+
filterChipsRow: string;
|
|
155
169
|
selectionActions: string;
|
|
156
170
|
scroll: string;
|
|
157
171
|
selectCol: string;
|
|
@@ -179,5 +193,9 @@ export declare const dataTableVariants: import('tailwind-variants').TVReturnType
|
|
|
179
193
|
configLabel: string;
|
|
180
194
|
configActions: string;
|
|
181
195
|
configSeparator: string;
|
|
196
|
+
filterMenuItem: string;
|
|
197
|
+
skeleton: string;
|
|
198
|
+
skeletonToolbar: string;
|
|
199
|
+
skeletonBody: string;
|
|
182
200
|
}, undefined, unknown, unknown, undefined>>;
|
|
183
201
|
export type DataTableVariants = VariantProps<typeof dataTableVariants>;
|
|
@@ -6,7 +6,14 @@ var t = e({
|
|
|
6
6
|
toolbar: "flex min-h-13 items-center justify-between gap-3 border-b border-line px-3 py-2.25 pointer-coarse:flex-col pointer-coarse:items-stretch pointer-coarse:gap-2.5",
|
|
7
7
|
toolbarGroup: "flex min-w-0 items-center gap-2",
|
|
8
8
|
divider: "mx-1 h-6 w-px shrink-0 bg-line",
|
|
9
|
-
|
|
9
|
+
collapse: [
|
|
10
|
+
"grid grid-rows-[1fr] transition-[grid-template-rows,opacity] duration-300 ease-spring",
|
|
11
|
+
"starting:grid-rows-[0fr] starting:opacity-0",
|
|
12
|
+
"data-collapsed:grid-rows-[0fr] data-collapsed:opacity-0",
|
|
13
|
+
"motion-reduce:transition-none"
|
|
14
|
+
],
|
|
15
|
+
collapseClip: "overflow-hidden",
|
|
16
|
+
filterChipsRow: "flex min-h-[calc(var(--control-h-md)+1.25rem+1px)] flex-wrap items-center gap-2 border-b border-line px-3.5 py-2.5",
|
|
10
17
|
selectionActions: "flex min-w-0 items-center gap-3",
|
|
11
18
|
scroll: "relative w-full overflow-auto [-webkit-overflow-scrolling:touch]",
|
|
12
19
|
selectCol: "pointer-coarse:w-11",
|
|
@@ -46,7 +53,11 @@ var t = e({
|
|
|
46
53
|
configHandleLocked: "shrink-0 text-fg-subtle opacity-30",
|
|
47
54
|
configLabel: "flex-1 truncate text-body",
|
|
48
55
|
configActions: "flex justify-end gap-2 p-2",
|
|
49
|
-
configSeparator: "h-px bg-line"
|
|
56
|
+
configSeparator: "h-px bg-line",
|
|
57
|
+
filterMenuItem: "flex cursor-pointer items-center gap-2.5 rounded-control px-2 py-1.5 select-none ox-interactive:hover:bg-fg/8",
|
|
58
|
+
skeleton: "w-full overflow-hidden rounded-card border border-line bg-card shadow-[var(--shadow-card)]",
|
|
59
|
+
skeletonToolbar: "flex items-center justify-between border-b border-line px-3 py-2.25",
|
|
60
|
+
skeletonBody: "flex flex-col gap-3.5 p-4"
|
|
50
61
|
},
|
|
51
62
|
variants: {
|
|
52
63
|
density: {
|
|
@@ -81,12 +81,39 @@ interface OxDataTableToolbarGroupProps {
|
|
|
81
81
|
interface OxDataTableFilterChipsProps {
|
|
82
82
|
children?: ReactNode;
|
|
83
83
|
className?: string;
|
|
84
|
+
clearLabel?: ReactNode;
|
|
85
|
+
onClearAll?: () => void;
|
|
84
86
|
}
|
|
87
|
+
interface OxDataTableFilterMenuOption {
|
|
88
|
+
label: ReactNode;
|
|
89
|
+
value: string;
|
|
90
|
+
}
|
|
91
|
+
interface OxDataTableFilterMenuGroup {
|
|
92
|
+
id?: string;
|
|
93
|
+
label: ReactNode;
|
|
94
|
+
onToggle: (value: string) => void;
|
|
95
|
+
options: readonly OxDataTableFilterMenuOption[];
|
|
96
|
+
selected: ReadonlySet<string>;
|
|
97
|
+
}
|
|
98
|
+
interface OxDataTableFilterMenuProps {
|
|
99
|
+
className?: string;
|
|
100
|
+
groups: readonly OxDataTableFilterMenuGroup[];
|
|
101
|
+
trigger?: ReactNode;
|
|
102
|
+
triggerLabel?: string;
|
|
103
|
+
}
|
|
104
|
+
interface OxDataTableSkeletonProps {
|
|
105
|
+
className?: string;
|
|
106
|
+
rows?: number;
|
|
107
|
+
toolbar?: boolean;
|
|
108
|
+
}
|
|
109
|
+
type DataTablePaginationVariant = 'simple' | 'numbered';
|
|
85
110
|
interface OxDataTablePaginationProps {
|
|
86
111
|
className?: string;
|
|
87
112
|
layout?: DataTablePaginationLayout;
|
|
88
113
|
nextLabel?: string;
|
|
89
114
|
previousLabel?: string;
|
|
115
|
+
summary?: ReactNode;
|
|
116
|
+
variant?: DataTablePaginationVariant;
|
|
90
117
|
}
|
|
91
118
|
interface OxDataTableFooterProps {
|
|
92
119
|
children?: ReactNode;
|
|
@@ -94,6 +121,7 @@ interface OxDataTableFooterProps {
|
|
|
94
121
|
}
|
|
95
122
|
interface OxDataTableSelectionActionsProps<TRow> {
|
|
96
123
|
children: (context: OxDataTableSelectionContext<TRow>) => ReactNode;
|
|
124
|
+
count?: number;
|
|
97
125
|
fallback?: ReactNode;
|
|
98
126
|
}
|
|
99
127
|
interface OxDataTableColumnConfigProps {
|
|
@@ -103,4 +131,4 @@ interface OxDataTableColumnConfigProps {
|
|
|
103
131
|
title?: ReactNode;
|
|
104
132
|
trigger?: ReactNode;
|
|
105
133
|
}
|
|
106
|
-
export type { ColumnAccessor, DataTableAlign, DataTableDensity, DataTablePaginationLayout, DataTablePaginationMode, OxDataTableColumn, OxDataTableColumnConfigProps, OxDataTableFilterChipsProps, OxDataTableFooterProps, OxDataTablePaginationProps, OxDataTableProps, OxDataTableSelectionActionsProps, OxDataTableSelectionContext, OxDataTableSortState, OxDataTableToolbarGroupProps, OxDataTableToolbarProps, SortDirection, };
|
|
134
|
+
export type { ColumnAccessor, DataTableAlign, DataTableDensity, DataTablePaginationLayout, DataTablePaginationMode, DataTablePaginationVariant, OxDataTableColumn, OxDataTableColumnConfigProps, OxDataTableFilterChipsProps, OxDataTableFilterMenuGroup, OxDataTableFilterMenuOption, OxDataTableFilterMenuProps, OxDataTableFooterProps, OxDataTablePaginationProps, OxDataTableProps, OxDataTableSelectionActionsProps, OxDataTableSelectionContext, OxDataTableSkeletonProps, OxDataTableSortState, OxDataTableToolbarGroupProps, OxDataTableToolbarProps, SortDirection, };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { OxDataTableColumnConfig, OxDataTableDivider, OxDataTableFilterChips, OxDataTableFooter, OxDataTablePagination, OxDataTableRoot, OxDataTableSelectionActions, OxDataTableToolbar, OxDataTableToolbarGroup } from './DataTable';
|
|
1
|
+
import { OxDataTableColumnConfig, OxDataTableDivider, OxDataTableFilterChips, OxDataTableFilterMenu, OxDataTableFooter, OxDataTablePagination, OxDataTableRoot, OxDataTableSelectionActions, OxDataTableSkeleton, OxDataTableToolbar, OxDataTableToolbarGroup } from './DataTable';
|
|
2
2
|
declare const OxDataTable: typeof OxDataTableRoot & {
|
|
3
3
|
ColumnConfig: typeof OxDataTableColumnConfig;
|
|
4
4
|
Divider: typeof OxDataTableDivider;
|
|
5
5
|
FilterChips: typeof OxDataTableFilterChips;
|
|
6
|
+
FilterMenu: typeof OxDataTableFilterMenu;
|
|
6
7
|
Footer: typeof OxDataTableFooter;
|
|
7
8
|
Pagination: typeof OxDataTablePagination;
|
|
8
9
|
SelectionActions: typeof OxDataTableSelectionActions;
|
|
10
|
+
Skeleton: typeof OxDataTableSkeleton;
|
|
9
11
|
Toolbar: typeof OxDataTableToolbar;
|
|
10
12
|
ToolbarGroup: typeof OxDataTableToolbarGroup;
|
|
11
13
|
};
|
|
12
14
|
export { OxDataTable };
|
|
13
|
-
export type { ColumnAccessor, DataTableAlign, DataTableDensity, DataTablePaginationLayout, DataTablePaginationMode, OxDataTableColumn, OxDataTableColumnConfigProps, OxDataTableFilterChipsProps, OxDataTableFooterProps, OxDataTablePaginationProps, OxDataTableProps, OxDataTableSelectionActionsProps, OxDataTableSelectionContext, OxDataTableSortState, OxDataTableToolbarGroupProps, OxDataTableToolbarProps, SortDirection, } from './DataTable.types';
|
|
15
|
+
export type { ColumnAccessor, DataTableAlign, DataTableDensity, DataTablePaginationLayout, DataTablePaginationMode, DataTablePaginationVariant, OxDataTableColumn, OxDataTableColumnConfigProps, OxDataTableFilterChipsProps, OxDataTableFilterMenuGroup, OxDataTableFilterMenuOption, OxDataTableFilterMenuProps, OxDataTableFooterProps, OxDataTablePaginationProps, OxDataTableProps, OxDataTableSelectionActionsProps, OxDataTableSelectionContext, OxDataTableSkeletonProps, OxDataTableSortState, OxDataTableToolbarGroupProps, OxDataTableToolbarProps, SortDirection, } from './DataTable.types';
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { OxDataTableColumnConfig as e, OxDataTableDivider as t, OxDataTableFilterChips as n,
|
|
1
|
+
import { OxDataTableColumnConfig as e, OxDataTableDivider as t, OxDataTableFilterChips as n, OxDataTableFilterMenu as r, OxDataTableFooter as i, OxDataTablePagination as a, OxDataTableRoot as o, OxDataTableSelectionActions as s, OxDataTableSkeleton as c, OxDataTableToolbar as l, OxDataTableToolbarGroup as u } from "./DataTable.js";
|
|
2
2
|
//#region src/components/DataTable/index.ts
|
|
3
|
-
var
|
|
3
|
+
var d = Object.assign(o, {
|
|
4
4
|
ColumnConfig: e,
|
|
5
5
|
Divider: t,
|
|
6
6
|
FilterChips: n,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
FilterMenu: r,
|
|
8
|
+
Footer: i,
|
|
9
|
+
Pagination: a,
|
|
10
|
+
SelectionActions: s,
|
|
11
|
+
Skeleton: c,
|
|
12
|
+
Toolbar: l,
|
|
13
|
+
ToolbarGroup: u
|
|
12
14
|
});
|
|
13
15
|
//#endregion
|
|
14
|
-
export {
|
|
16
|
+
export { d as OxDataTable };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { c as e } from "react/compiler-runtime";
|
|
2
|
+
import { useEffect as t, useRef as n, useState as r } from "react";
|
|
3
|
+
//#region src/hooks/useQuery/useQuery.ts
|
|
4
|
+
function i(i, o) {
|
|
5
|
+
let s = e(14), [c, l] = r(void 0), [u, d] = r(void 0), [f, p] = r(!0), [m, h] = r(void 0), [g, _] = r(0), v = n(i), y;
|
|
6
|
+
s[0] === i ? y = s[1] : (y = () => {
|
|
7
|
+
v.current = i;
|
|
8
|
+
}, s[0] = i, s[1] = y), t(y);
|
|
9
|
+
let b;
|
|
10
|
+
s[2] !== o || s[3] !== g ? (b = JSON.stringify([...o, g]), s[2] = o, s[3] = g, s[4] = b) : b = s[4];
|
|
11
|
+
let x = b, [S, C] = r(x);
|
|
12
|
+
x !== S && (C(x), p(!0), h(void 0), d((e) => c ?? e), l(void 0));
|
|
13
|
+
let w;
|
|
14
|
+
s[5] === Symbol.for("react.memo_cache_sentinel") ? (w = () => {
|
|
15
|
+
let e = new AbortController(), t = !1;
|
|
16
|
+
return (async () => {
|
|
17
|
+
try {
|
|
18
|
+
let n = await v.current(e.signal);
|
|
19
|
+
if (t) return;
|
|
20
|
+
if (p(!1), n.error !== void 0) {
|
|
21
|
+
h(n.error);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
l(n.data);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
let n = e;
|
|
27
|
+
if (t || n instanceof DOMException && n.name === "AbortError") return;
|
|
28
|
+
p(!1), h(n instanceof Error ? n : Error(String(n)));
|
|
29
|
+
}
|
|
30
|
+
})(), () => {
|
|
31
|
+
t = !0, e.abort();
|
|
32
|
+
};
|
|
33
|
+
}, s[5] = w) : w = s[5];
|
|
34
|
+
let T;
|
|
35
|
+
s[6] === x ? T = s[7] : (T = [x], s[6] = x, s[7] = T), t(w, T);
|
|
36
|
+
let E;
|
|
37
|
+
s[8] === Symbol.for("react.memo_cache_sentinel") ? (E = () => {
|
|
38
|
+
_(a);
|
|
39
|
+
}, s[8] = E) : E = s[8];
|
|
40
|
+
let D = E, O;
|
|
41
|
+
return s[9] !== c || s[10] !== m || s[11] !== f || s[12] !== u ? (O = {
|
|
42
|
+
data: c,
|
|
43
|
+
error: m,
|
|
44
|
+
loading: f,
|
|
45
|
+
previousData: u,
|
|
46
|
+
refetch: D
|
|
47
|
+
}, s[9] = c, s[10] = m, s[11] = f, s[12] = u, s[13] = O) : O = s[13], O;
|
|
48
|
+
}
|
|
49
|
+
function a(e) {
|
|
50
|
+
return e + 1;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { i as useOxQuery };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface OxQueryFetcherResult<TData, TError = unknown> {
|
|
2
|
+
data?: TData;
|
|
3
|
+
error?: TError;
|
|
4
|
+
}
|
|
5
|
+
export type OxQueryFetcher<TData, TError = unknown> = (signal: AbortSignal) => Promise<OxQueryFetcherResult<TData, TError>>;
|
|
6
|
+
export interface OxQueryResult<TData, TError = unknown> {
|
|
7
|
+
data: TData | undefined;
|
|
8
|
+
error: Error | TError | undefined;
|
|
9
|
+
loading: boolean;
|
|
10
|
+
previousData: TData | undefined;
|
|
11
|
+
refetch: () => void;
|
|
12
|
+
}
|
package/dist/hooks.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { useOxMediaQuery as e } from "./hooks/useMediaQuery/useMediaQuery.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
2
|
+
import { useOxPagination as t } from "./hooks/usePagination/usePagination.js";
|
|
3
|
+
import { oxBreakpoints as n, useOxBreakpoint as r, useOxBreakpointDown as i, useOxBreakpointUp as a } from "./hooks/useBreakpoint/useBreakpoint.js";
|
|
4
|
+
import { useOxVirtualizer as o } from "./hooks/useVirtualizer/useVirtualizer.js";
|
|
5
|
+
import { useOxCommandShortcut as s } from "./hooks/useCommandShortcut/useCommandShortcut.js";
|
|
6
|
+
import { useOxDebounce as c, useOxDebouncedValue as l } from "./hooks/useDebounce/useDebounce.js";
|
|
7
|
+
import { OxFormErrors as u, formErrors as d, useOxForm as f } from "./hooks/useForm/useForm.js";
|
|
8
|
+
import { standardSchemaResolver as p } from "./hooks/useForm/standardSchemaResolver.js";
|
|
9
|
+
import { useOxFilter as m } from "./hooks/useFilter/useFilter.js";
|
|
10
10
|
import { useOxPoll as h } from "./hooks/usePoll/usePoll.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
11
|
+
import { useOxQuery as g } from "./hooks/useQuery/useQuery.js";
|
|
12
|
+
import { oxHistoryStateAdapter as _, oxLocalStorageAdapter as v, oxSessionStorageAdapter as y } from "./hooks/useRemember/useRemember.adapters.js";
|
|
13
|
+
import { useOxRemember as b } from "./hooks/useRemember/useRemember.js";
|
|
14
|
+
export { u as OxFormErrors, d as formErrors, n as oxBreakpoints, _ as oxHistoryStateAdapter, v as oxLocalStorageAdapter, y as oxSessionStorageAdapter, p as standardSchemaResolver, r as useOxBreakpoint, i as useOxBreakpointDown, a as useOxBreakpointUp, s as useOxCommandShortcut, c as useOxDebounce, l as useOxDebouncedValue, m as useOxFilter, f as useOxForm, e as useOxMediaQuery, t as useOxPagination, h as useOxPoll, g as useOxQuery, b as useOxRemember, o as useOxVirtualizer };
|
package/dist/index.js
CHANGED
|
@@ -22,26 +22,26 @@ import { OxContextMenu as T } from "./components/ContextMenu/index.js";
|
|
|
22
22
|
import { OxCopyButton as E } from "./components/CopyButton/CopyButton.js";
|
|
23
23
|
import { OxInput as D } from "./components/Input/index.js";
|
|
24
24
|
import { OxCopyInput as O } from "./components/CopyInput/CopyInput.js";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
25
|
+
import { OxPagination as k } from "./components/Pagination/index.js";
|
|
26
|
+
import { OxPopover as A } from "./components/Popover/index.js";
|
|
27
|
+
import { OxSkeleton as j } from "./components/Skeleton/Skeleton2.js";
|
|
28
|
+
import { OxTable as M } from "./components/Table/index.js";
|
|
29
|
+
import { OxDataTable as N } from "./components/DataTable/index.js";
|
|
30
|
+
import { OxDescriptionList as P } from "./components/DescriptionList/index.js";
|
|
31
|
+
import { OxDialog as F } from "./components/Dialog/index.js";
|
|
32
|
+
import { OxDrawer as I } from "./components/Drawer/index.js";
|
|
33
|
+
import { OxField as L } from "./components/Field/index.js";
|
|
34
|
+
import { OxFieldset as R } from "./components/Fieldset/index.js";
|
|
35
|
+
import { OxFooter as z } from "./components/Footer/index.js";
|
|
36
|
+
import { OxHeader as B } from "./components/Header/index.js";
|
|
37
|
+
import { OxHoldToDelete as V } from "./components/HoldToDelete/HoldToDelete2.js";
|
|
38
|
+
import { OxKbd as H } from "./components/Kbd/Kbd.js";
|
|
39
|
+
import { OxMain as U } from "./components/Main/Main.js";
|
|
40
|
+
import { OxMeter as W } from "./components/Meter/index.js";
|
|
41
|
+
import { OxNavigationMenu as G } from "./components/NavigationMenu/index.js";
|
|
42
|
+
import { OxNumberInput as K } from "./components/NumberInput/index.js";
|
|
43
|
+
import { OxOtpField as q } from "./components/OtpField/OtpField.js";
|
|
44
|
+
import { OxPageProgress as J } from "./components/PageProgress/PageProgress.js";
|
|
45
45
|
import { OxProgress as Y } from "./components/Progress/index.js";
|
|
46
46
|
import { OxRadio as X, OxRadioGroup as Z } from "./components/Radio/Radio.js";
|
|
47
47
|
import { OxResponsiveOverlay as Q } from "./components/ResponsiveOverlay/index.js";
|
|
@@ -63,4 +63,4 @@ import { OxToast as ge } from "./components/Toast/index.js";
|
|
|
63
63
|
import { OxToggle as _e } from "./components/Toggle/index.js";
|
|
64
64
|
import { OxTypewriter as ve } from "./components/Typewriter/index.js";
|
|
65
65
|
import { OxVirtualList as ye } from "./components/VirtualList/VirtualList.js";
|
|
66
|
-
export { e as OxAccordion, t as OxAlert, r as OxAlertDialog, i as OxAnimatedGradientText, a as OxAppLayout, s as OxAutocomplete, u as OxAvatar, d as OxAvatarGroup, f as OxBadge, m as OxBlurSwitch, g as OxBreadcrumb, p as OxButton, _ as OxCard, C as OxCheckbox, w as OxCheckboxGroup, de as OxChip, v as OxCollapsible, y as OxCombobox, S as OxCommand, T as OxContextMenu, E as OxCopyButton, O as OxCopyInput,
|
|
66
|
+
export { e as OxAccordion, t as OxAlert, r as OxAlertDialog, i as OxAnimatedGradientText, a as OxAppLayout, s as OxAutocomplete, u as OxAvatar, d as OxAvatarGroup, f as OxBadge, m as OxBlurSwitch, g as OxBreadcrumb, p as OxButton, _ as OxCard, C as OxCheckbox, w as OxCheckboxGroup, de as OxChip, v as OxCollapsible, y as OxCombobox, S as OxCommand, T as OxContextMenu, E as OxCopyButton, O as OxCopyInput, N as OxDataTable, P as OxDescriptionList, F as OxDialog, I as OxDrawer, h as OxDropdown, L as OxField, R as OxFieldset, z as OxFooter, B as OxHeader, V as OxHoldToDelete, n as OxIconTile, D as OxInput, H as OxKbd, U as OxMain, W as OxMeter, G as OxNavigationMenu, K as OxNumberInput, q as OxOtpField, J as OxPageProgress, k as OxPagination, A as OxPopover, Y as OxProgress, X as OxRadio, Z as OxRadioGroup, Q as OxResponsiveOverlay, ee as OxScrollArea, $ as OxSelect, te as OxSeparator, ne as OxSidebar, ae as OxSidebarRail, j as OxSkeleton, le as OxSlider, o as OxSpinner, ue as OxStatusDisplay, oe as OxSwitch, se as OxTabBar, M as OxTable, ce as OxTabs, fe as OxTextarea, ge as OxToast, _e as OxToggle, re as OxTooltip, ie as OxTooltipProvider, ve as OxTypewriter, ye as OxVirtualList, pe as createOxToastManager, me as oxToast, c as useOxAutocompleteFilter, l as useOxAutocompleteFilteredItems, b as useOxComboboxFilter, x as useOxComboboxFilteredItems, he as useOxToast };
|
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
import { formErrors as e } from "../../hooks/useForm/useForm.js";
|
|
2
|
+
import { OxRestError as t } from "./OxRestError.js";
|
|
2
3
|
//#region src/rest/executors/restExecutor.ts
|
|
3
|
-
var
|
|
4
|
-
function
|
|
5
|
-
return
|
|
4
|
+
var n = (e) => typeof Blob < "u" && e instanceof Blob, r = (e) => typeof FileList < "u" && e instanceof FileList;
|
|
5
|
+
function i(e) {
|
|
6
|
+
return n(e) || r(e) ? !0 : Array.isArray(e) ? e.some((e) => i(e)) : typeof e == "object" && e ? Object.values(e).some((e) => i(e)) : !1;
|
|
6
7
|
}
|
|
7
|
-
function
|
|
8
|
-
if (
|
|
9
|
-
if (
|
|
10
|
-
e.append(
|
|
8
|
+
function a(e, t, i) {
|
|
9
|
+
if (i !== void 0) {
|
|
10
|
+
if (i === null) {
|
|
11
|
+
e.append(t, "");
|
|
11
12
|
return;
|
|
12
13
|
}
|
|
13
|
-
if (
|
|
14
|
-
e.append(
|
|
14
|
+
if (n(i)) {
|
|
15
|
+
e.append(t, i);
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
|
-
if (
|
|
18
|
-
[...
|
|
18
|
+
if (r(i)) {
|
|
19
|
+
[...i].forEach((n, r) => a(e, `${t}[${r}]`, n));
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
|
-
if (Array.isArray(
|
|
22
|
-
|
|
22
|
+
if (Array.isArray(i)) {
|
|
23
|
+
i.forEach((n, r) => a(e, `${t}[${r}]`, n));
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
|
-
if (
|
|
26
|
-
e.append(
|
|
26
|
+
if (i instanceof Date) {
|
|
27
|
+
e.append(t, i.toISOString());
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
|
-
if (typeof
|
|
30
|
-
for (let [
|
|
30
|
+
if (typeof i == "object") {
|
|
31
|
+
for (let [n, r] of Object.entries(i)) a(e, `${t}[${n}]`, r);
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
|
-
if (typeof
|
|
34
|
-
e.append(
|
|
34
|
+
if (typeof i == "boolean") {
|
|
35
|
+
e.append(t, i ? "1" : "0");
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
|
-
e.append(
|
|
38
|
+
e.append(t, String(i));
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
+
function o(e) {
|
|
41
42
|
let t = new FormData();
|
|
42
|
-
for (let [n, r] of Object.entries(e))
|
|
43
|
+
for (let [n, r] of Object.entries(e)) a(t, n, r);
|
|
43
44
|
return t;
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
+
function s(e) {
|
|
46
47
|
let t = new URLSearchParams(), n = (e, r) => {
|
|
47
48
|
if (!(r == null || r === "")) {
|
|
48
49
|
if (Array.isArray(r)) {
|
|
@@ -60,94 +61,101 @@ function o(e) {
|
|
|
60
61
|
for (let [t, r] of Object.entries(e)) n(t, r);
|
|
61
62
|
return t.toString();
|
|
62
63
|
}
|
|
63
|
-
var
|
|
64
|
-
function
|
|
65
|
-
let
|
|
66
|
-
if (
|
|
67
|
-
return e(
|
|
64
|
+
var c = (e, t) => e !== 422 || typeof t != "object" || !t ? null : t.errors ?? t;
|
|
65
|
+
function l(n, r, i) {
|
|
66
|
+
let a = i(n, r);
|
|
67
|
+
if (a === null) throw new t(n, r);
|
|
68
|
+
return e(a);
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
var u = (e) => e?.includes("application/json") === !0 || e?.includes("application/problem+json") === !0;
|
|
71
|
+
function d(e, t) {
|
|
72
|
+
if (t.length === 0) return null;
|
|
73
|
+
if (u(e)) return JSON.parse(t);
|
|
74
|
+
try {
|
|
75
|
+
return JSON.parse(t);
|
|
76
|
+
} catch {
|
|
77
|
+
return t;
|
|
78
|
+
}
|
|
71
79
|
}
|
|
72
|
-
function
|
|
73
|
-
let { onProgress: u, signal:
|
|
74
|
-
return new Promise((
|
|
75
|
-
if (
|
|
76
|
-
|
|
80
|
+
function f(e, n, r, i, a, s, c) {
|
|
81
|
+
let { onProgress: u, signal: f } = c;
|
|
82
|
+
return new Promise((c, p) => {
|
|
83
|
+
if (f.aborted) {
|
|
84
|
+
p(new DOMException("Aborted", "AbortError"));
|
|
77
85
|
return;
|
|
78
86
|
}
|
|
79
|
-
let
|
|
80
|
-
|
|
81
|
-
for (let [e, t] of Object.entries(
|
|
82
|
-
let
|
|
83
|
-
|
|
87
|
+
let m = new XMLHttpRequest();
|
|
88
|
+
m.open(e, n), m.withCredentials = a;
|
|
89
|
+
for (let [e, t] of Object.entries(i)) m.setRequestHeader(e, t);
|
|
90
|
+
let h = () => m.abort();
|
|
91
|
+
f.addEventListener("abort", h), m.upload.addEventListener("progress", (e) => {
|
|
84
92
|
let t = {
|
|
85
93
|
loaded: e.loaded,
|
|
86
94
|
total: e.lengthComputable ? e.total : void 0,
|
|
87
95
|
percentage: e.lengthComputable ? Math.round(e.loaded * 100 / e.total) : void 0
|
|
88
96
|
};
|
|
89
97
|
u?.(t);
|
|
90
|
-
}),
|
|
91
|
-
|
|
92
|
-
}),
|
|
93
|
-
|
|
94
|
-
}),
|
|
95
|
-
|
|
98
|
+
}), m.addEventListener("abort", () => {
|
|
99
|
+
f.removeEventListener("abort", h), p(new DOMException("Aborted", "AbortError"));
|
|
100
|
+
}), m.addEventListener("error", () => {
|
|
101
|
+
f.removeEventListener("abort", h), p(/* @__PURE__ */ Error("Network request failed"));
|
|
102
|
+
}), m.addEventListener("load", () => {
|
|
103
|
+
f.removeEventListener("abort", h);
|
|
96
104
|
let e;
|
|
97
105
|
try {
|
|
98
|
-
e =
|
|
106
|
+
e = d(m.getResponseHeader("Content-Type"), m.responseText);
|
|
99
107
|
} catch (e) {
|
|
100
|
-
|
|
108
|
+
p(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to parse response"));
|
|
101
109
|
return;
|
|
102
110
|
}
|
|
103
|
-
if (
|
|
111
|
+
if (m.status === 422) {
|
|
104
112
|
try {
|
|
105
|
-
|
|
113
|
+
c(l(422, e, s));
|
|
106
114
|
} catch (e) {
|
|
107
|
-
|
|
115
|
+
p(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to map validation error"));
|
|
108
116
|
}
|
|
109
117
|
return;
|
|
110
118
|
}
|
|
111
|
-
if (
|
|
112
|
-
|
|
119
|
+
if (m.status < 200 || m.status >= 300) {
|
|
120
|
+
p(new t(m.status, e));
|
|
113
121
|
return;
|
|
114
122
|
}
|
|
115
|
-
|
|
116
|
-
}),
|
|
123
|
+
c(e);
|
|
124
|
+
}), m.send(o(r));
|
|
117
125
|
});
|
|
118
126
|
}
|
|
119
|
-
function
|
|
120
|
-
let { credentials:
|
|
121
|
-
return async (
|
|
122
|
-
let { method:
|
|
123
|
-
if (!
|
|
124
|
-
let
|
|
125
|
-
if (!
|
|
126
|
-
if (
|
|
127
|
-
let e =
|
|
128
|
-
method:
|
|
129
|
-
headers:
|
|
130
|
-
credentials:
|
|
131
|
-
signal:
|
|
132
|
-
}),
|
|
133
|
-
if (
|
|
134
|
-
if (!
|
|
135
|
-
return
|
|
127
|
+
function p(e, n = {}) {
|
|
128
|
+
let { credentials: r = "same-origin", forceFormData: a = !1, headers: o, parseErrors: u } = n, p = u ?? c;
|
|
129
|
+
return async (n) => {
|
|
130
|
+
let { method: c = "post", payload: u, signal: m, url: h } = n, g = h ?? e;
|
|
131
|
+
if (!g) throw Error("restExecutor: no url provided (pass it to restExecutor or to the method)");
|
|
132
|
+
let _ = c.toUpperCase(), v = _ === "GET" || _ === "HEAD", y = typeof o == "function" ? o(u) : o ?? {};
|
|
133
|
+
if (!v && (a || i(u))) return f(_, g, u, y, r === "include", p, n);
|
|
134
|
+
if (v) {
|
|
135
|
+
let e = s(u), n = await fetch(e ? `${g}?${e}` : g, {
|
|
136
|
+
method: _,
|
|
137
|
+
headers: y,
|
|
138
|
+
credentials: r,
|
|
139
|
+
signal: m
|
|
140
|
+
}), i = d(n.headers.get("Content-Type"), await n.text());
|
|
141
|
+
if (n.status === 422) return l(422, i, p);
|
|
142
|
+
if (!n.ok) throw new t(n.status, i);
|
|
143
|
+
return i;
|
|
136
144
|
}
|
|
137
|
-
let
|
|
138
|
-
method:
|
|
145
|
+
let b = await fetch(g, {
|
|
146
|
+
method: _,
|
|
139
147
|
headers: {
|
|
140
148
|
"Content-Type": "application/json",
|
|
141
|
-
...
|
|
149
|
+
...y
|
|
142
150
|
},
|
|
143
|
-
body: JSON.stringify(
|
|
144
|
-
credentials:
|
|
145
|
-
signal:
|
|
146
|
-
}),
|
|
147
|
-
if (
|
|
148
|
-
if (!
|
|
149
|
-
return
|
|
151
|
+
body: JSON.stringify(u),
|
|
152
|
+
credentials: r,
|
|
153
|
+
signal: m
|
|
154
|
+
}), x = d(b.headers.get("Content-Type"), await b.text());
|
|
155
|
+
if (b.status === 422) return l(422, x, p);
|
|
156
|
+
if (!b.ok) throw new t(b.status, x);
|
|
157
|
+
return x;
|
|
150
158
|
};
|
|
151
159
|
}
|
|
152
160
|
//#endregion
|
|
153
|
-
export {
|
|
161
|
+
export { p as restExecutor };
|
package/dist/rest/index.d.ts
CHANGED
package/dist/rest.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { OxRestError as e } from "./rest/executors/OxRestError.js";
|
|
2
|
+
import { restExecutor as t } from "./rest/executors/restExecutor.js";
|
|
3
|
+
export { e as OxRestError, t as restExecutor };
|