@declarion/react 0.432.0 → 0.443.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-lib/api/data.js +45 -43
- package/dist-lib/api/entities.js +39 -32
- package/dist-lib/components/detail-layout/widgets/monacoBootstrap.js +6 -5
- package/dist-lib/components/fields/RefField.js +30 -37
- package/dist-lib/components/fields/cells/factories/refLink.js +23 -27
- package/dist-lib/components/list/PeekFieldCell.js +53 -51
- package/dist-lib/components/list/QuickPeek.js +99 -96
- package/dist-lib/components/pages/SmartListPage.impl.js +3 -0
- package/dist-lib/components/pages/list/useListQuery.js +101 -100
- package/dist-lib/hooks/useCursorEntityData.js +49 -48
- package/dist-lib/hooks/useRefRecords.js +2 -0
- package/dist-lib/index.d.ts +4 -2
- package/dist-lib/lib/reference.js +53 -0
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/types/schema.js +1 -1
- package/dist-lib/{useResponsiveMode-Yo2rIWFA.d.ts → useResponsiveMode-3hOLBkey.d.ts} +13 -1
- package/package.json +1 -1
|
@@ -3,80 +3,81 @@ import { Btn as t } from "../primitives/Btn.js";
|
|
|
3
3
|
import { Icon as n } from "../primitives/Icons.js";
|
|
4
4
|
import { IconBtn as r } from "../primitives/IconBtn.js";
|
|
5
5
|
import { Kbd as i } from "../primitives/Kbd.js";
|
|
6
|
-
import { renderSchemaField as
|
|
7
|
-
import { useActionRunner as
|
|
6
|
+
import { renderSchemaField as a } from "../file-widgets/host.js";
|
|
7
|
+
import { useActionRunner as ee } from "../actions/ActionRunner.js";
|
|
8
8
|
import { PeekFieldCell as o } from "./PeekFieldCell.js";
|
|
9
9
|
import { applyRowState as s, defaultFlatForSlot as c, filterLayoutForSlot as l } from "../../lib/actions.js";
|
|
10
10
|
import { ResponsiveActionBar as u } from "../actions/ResponsiveActionBar.js";
|
|
11
11
|
import { effectiveScreenForRecord as d, variantActionCodesForRecord as f } from "../../lib/variants.js";
|
|
12
|
-
import { useText as
|
|
13
|
-
import { useRowTenant as
|
|
14
|
-
import { useUnsavedInput as
|
|
15
|
-
import { textWithNodes as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
12
|
+
import { useText as te } from "../../hooks/useText.js";
|
|
13
|
+
import { useRowTenant as p } from "../../hooks/useRowTenant.js";
|
|
14
|
+
import { useUnsavedInput as m } from "../../hooks/useUnsavedInput.js";
|
|
15
|
+
import { textWithNodes as ne } from "../../lib/language.js";
|
|
16
|
+
import { inheritRowReferences as h } from "../../lib/reference.js";
|
|
17
|
+
import { useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
|
|
18
|
+
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
18
19
|
// src/components/list/QuickPeek.tsx
|
|
19
|
-
var
|
|
20
|
+
var C = {
|
|
20
21
|
tab: "Tab",
|
|
21
22
|
esc: "Esc"
|
|
22
23
|
};
|
|
23
|
-
function
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, [
|
|
30
|
-
|
|
24
|
+
function w({ entity: w, entityCode: E, record: D, title: O, recordId: k, avatarName: A, fields: j, refs: M, entities: re, screens: N, screen: P, actions: F, screenActionLayout: I, entityActionLayout: L, executeAction: R, onClose: z, onOpen: B, onSave: V }) {
|
|
25
|
+
let H = te(), U = p(w), [W, G] = y(() => h(D, { ...D })), [K, q] = y(!1);
|
|
26
|
+
m(K);
|
|
27
|
+
let J = v(null), { run: Y } = ee(), X = d(w, P, W);
|
|
28
|
+
g(() => {
|
|
29
|
+
G(h(D, { ...D })), q(!1);
|
|
30
|
+
}, [D]), g(() => {
|
|
31
|
+
J.current?.focus();
|
|
31
32
|
}, []);
|
|
32
|
-
let
|
|
33
|
-
let e =
|
|
34
|
-
return s(
|
|
33
|
+
let Z = _(() => {
|
|
34
|
+
let e = X?.action_layout ?? I ?? L ?? c(F, "quick_peek"), t = l(e, F, void 0, "quick_peek");
|
|
35
|
+
return s(H, t, F, void 0, W, [], U, f(w, W));
|
|
35
36
|
}, [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
F,
|
|
37
|
+
H,
|
|
38
|
+
X?.action_layout,
|
|
39
39
|
I,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
L,
|
|
41
|
+
F,
|
|
42
|
+
W,
|
|
43
|
+
w,
|
|
44
|
+
U
|
|
45
|
+
]), ie = ({ code: e, action: t }) => {
|
|
46
|
+
Y({
|
|
46
47
|
action: t,
|
|
47
|
-
title:
|
|
48
|
-
row:
|
|
49
|
-
execute: (n) =>
|
|
48
|
+
title: H(t.display?.name) || e,
|
|
49
|
+
row: W,
|
|
50
|
+
execute: (n) => R(e, t, n)
|
|
50
51
|
});
|
|
51
52
|
}, Q = (e, t) => {
|
|
52
|
-
let n = {
|
|
53
|
-
...
|
|
53
|
+
let n = h(D, {
|
|
54
|
+
...W,
|
|
54
55
|
[e]: t
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
onClick:
|
|
56
|
+
});
|
|
57
|
+
G(n), q(!0), V?.(n);
|
|
58
|
+
}, ae = X?.quick_peek?.width ?? 480, $ = j.some((e) => !e.readOnly && (e.kind !== "field" || !e.field.ref?.entity_field));
|
|
59
|
+
return /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x("div", {
|
|
60
|
+
onClick: z,
|
|
60
61
|
style: {
|
|
61
62
|
position: "fixed",
|
|
62
63
|
inset: 0,
|
|
63
64
|
background: "var(--scrim-lite)",
|
|
64
65
|
zIndex: 40
|
|
65
66
|
}
|
|
66
|
-
}), /* @__PURE__ */
|
|
67
|
-
ref:
|
|
67
|
+
}), /* @__PURE__ */ S("aside", {
|
|
68
|
+
ref: J,
|
|
68
69
|
role: "dialog",
|
|
69
|
-
"aria-label":
|
|
70
|
+
"aria-label": H("list.peek.dialog", "Quick peek"),
|
|
70
71
|
tabIndex: -1,
|
|
71
72
|
onKeyDown: (e) => {
|
|
72
|
-
e.key === "Escape" &&
|
|
73
|
+
e.key === "Escape" && z();
|
|
73
74
|
},
|
|
74
75
|
style: {
|
|
75
76
|
position: "fixed",
|
|
76
77
|
top: "var(--topbar-h)",
|
|
77
78
|
right: 0,
|
|
78
79
|
bottom: "var(--tabbar-h)",
|
|
79
|
-
width:
|
|
80
|
+
width: ae,
|
|
80
81
|
background: "var(--surface)",
|
|
81
82
|
borderLeft: "1px solid var(--border)",
|
|
82
83
|
zIndex: 41,
|
|
@@ -85,7 +86,7 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
|
|
|
85
86
|
boxShadow: "var(--shadow-lg)"
|
|
86
87
|
},
|
|
87
88
|
children: [
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ S("div", {
|
|
89
90
|
style: {
|
|
90
91
|
display: "flex",
|
|
91
92
|
alignItems: "center",
|
|
@@ -94,16 +95,16 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
|
|
|
94
95
|
gap: 10
|
|
95
96
|
},
|
|
96
97
|
children: [
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
name:
|
|
98
|
+
/* @__PURE__ */ x(e, {
|
|
99
|
+
name: A || O,
|
|
99
100
|
size: 28
|
|
100
101
|
}),
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ S("div", {
|
|
102
103
|
style: {
|
|
103
104
|
flex: 1,
|
|
104
105
|
minWidth: 0
|
|
105
106
|
},
|
|
106
|
-
children: [/* @__PURE__ */
|
|
107
|
+
children: [/* @__PURE__ */ x("div", {
|
|
107
108
|
style: {
|
|
108
109
|
fontSize: 14,
|
|
109
110
|
fontWeight: 600,
|
|
@@ -112,29 +113,29 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
|
|
|
112
113
|
textOverflow: "ellipsis",
|
|
113
114
|
whiteSpace: "nowrap"
|
|
114
115
|
},
|
|
115
|
-
children:
|
|
116
|
-
}),
|
|
116
|
+
children: O
|
|
117
|
+
}), k && /* @__PURE__ */ x("div", {
|
|
117
118
|
className: "mono",
|
|
118
119
|
style: {
|
|
119
120
|
fontSize: 11,
|
|
120
121
|
color: "var(--text-4)"
|
|
121
122
|
},
|
|
122
|
-
children:
|
|
123
|
+
children: k
|
|
123
124
|
})]
|
|
124
125
|
}),
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
icon: /* @__PURE__ */
|
|
127
|
-
title:
|
|
128
|
-
onClick: () =>
|
|
126
|
+
/* @__PURE__ */ x(r, {
|
|
127
|
+
icon: /* @__PURE__ */ x(n.external, { size: 13 }),
|
|
128
|
+
title: K ? H("list.peek.open_in_tab_dirty", "Open in tab (keeps unsaved changes)") : H("list.peek.open_in_tab", "Open in tab"),
|
|
129
|
+
onClick: () => B(K ? W : null)
|
|
129
130
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
icon: /* @__PURE__ */
|
|
132
|
-
title:
|
|
133
|
-
onClick:
|
|
131
|
+
/* @__PURE__ */ x(r, {
|
|
132
|
+
icon: /* @__PURE__ */ x(n.x, { size: 14 }),
|
|
133
|
+
title: H("list.peek.close", "Close"),
|
|
134
|
+
onClick: z
|
|
134
135
|
})
|
|
135
136
|
]
|
|
136
137
|
}),
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ S("div", {
|
|
138
139
|
style: {
|
|
139
140
|
flex: 1,
|
|
140
141
|
overflowY: "auto",
|
|
@@ -143,7 +144,7 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
|
|
|
143
144
|
flexDirection: "column",
|
|
144
145
|
gap: 10
|
|
145
146
|
},
|
|
146
|
-
children: [/* @__PURE__ */
|
|
147
|
+
children: [/* @__PURE__ */ S("div", {
|
|
147
148
|
style: {
|
|
148
149
|
padding: "8px 10px",
|
|
149
150
|
background: "var(--accent-soft)",
|
|
@@ -154,35 +155,37 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
|
|
|
154
155
|
alignItems: "center",
|
|
155
156
|
gap: 6
|
|
156
157
|
},
|
|
157
|
-
children: [$ && /* @__PURE__ */
|
|
158
|
-
tab: /* @__PURE__ */
|
|
159
|
-
esc: /* @__PURE__ */
|
|
158
|
+
children: [$ && /* @__PURE__ */ x(n.sparkle, { size: 12 }), /* @__PURE__ */ S("span", { children: [$ && /* @__PURE__ */ S(b, { children: [H("list.peek.hint", "Inline quick-edit — click any field to change."), " "] }), ne(H("list.peek.keys_hint", "{tab} to move, {esc} to close."), {
|
|
159
|
+
tab: /* @__PURE__ */ x(i, { children: C.tab }),
|
|
160
|
+
esc: /* @__PURE__ */ x(i, { children: C.esc })
|
|
160
161
|
})] })]
|
|
161
|
-
}),
|
|
162
|
+
}), j.map((e) => /* @__PURE__ */ x(T, {
|
|
162
163
|
label: e.label,
|
|
163
|
-
children: e.kind === "file" ?
|
|
164
|
-
entity:
|
|
165
|
-
entityCode:
|
|
164
|
+
children: e.kind === "file" ? a({
|
|
165
|
+
entity: w,
|
|
166
|
+
entityCode: E,
|
|
166
167
|
fieldName: e.key,
|
|
167
|
-
record:
|
|
168
|
+
record: W,
|
|
168
169
|
mode: e.readOnly ? "display" : "edit",
|
|
169
170
|
onChange: (t) => Q(e.key, t),
|
|
170
|
-
refs:
|
|
171
|
+
refs: M,
|
|
171
172
|
disabled: e.readOnly,
|
|
172
|
-
t:
|
|
173
|
-
}) : /* @__PURE__ */
|
|
173
|
+
t: H
|
|
174
|
+
}) : /* @__PURE__ */ x(o, {
|
|
174
175
|
field: e.field,
|
|
175
176
|
fieldName: e.key,
|
|
176
177
|
label: e.label,
|
|
177
|
-
value:
|
|
178
|
-
record:
|
|
179
|
-
refs:
|
|
178
|
+
value: W[e.key],
|
|
179
|
+
record: W,
|
|
180
|
+
refs: M,
|
|
181
|
+
entities: re,
|
|
182
|
+
screens: N,
|
|
180
183
|
readOnly: e.readOnly,
|
|
181
184
|
onCommit: (t) => Q(e.key, t)
|
|
182
185
|
})
|
|
183
186
|
}, e.key))]
|
|
184
187
|
}),
|
|
185
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ S("div", {
|
|
186
189
|
style: {
|
|
187
190
|
display: "flex",
|
|
188
191
|
padding: "10px 14px",
|
|
@@ -191,7 +194,7 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
|
|
|
191
194
|
alignItems: "center"
|
|
192
195
|
},
|
|
193
196
|
children: [
|
|
194
|
-
|
|
197
|
+
K && /* @__PURE__ */ S("span", {
|
|
195
198
|
style: {
|
|
196
199
|
fontSize: 11,
|
|
197
200
|
color: "var(--warn)",
|
|
@@ -199,46 +202,46 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
|
|
|
199
202
|
alignItems: "center",
|
|
200
203
|
gap: 4
|
|
201
204
|
},
|
|
202
|
-
children: [/* @__PURE__ */
|
|
205
|
+
children: [/* @__PURE__ */ x("span", { style: {
|
|
203
206
|
width: 6,
|
|
204
207
|
height: 6,
|
|
205
208
|
borderRadius: 999,
|
|
206
209
|
background: "var(--warn)"
|
|
207
|
-
} }),
|
|
210
|
+
} }), H("list.peek.unsaved", "Unsaved")]
|
|
208
211
|
}),
|
|
209
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ x("div", {
|
|
210
213
|
style: {
|
|
211
214
|
flex: 1,
|
|
212
215
|
minWidth: 0,
|
|
213
216
|
display: "flex",
|
|
214
217
|
justifyContent: "flex-end"
|
|
215
218
|
},
|
|
216
|
-
children:
|
|
217
|
-
layout:
|
|
218
|
-
row:
|
|
219
|
-
onRun: (e, t) =>
|
|
219
|
+
children: Z.length > 0 && /* @__PURE__ */ x(u, {
|
|
220
|
+
layout: Z,
|
|
221
|
+
row: W,
|
|
222
|
+
onRun: (e, t) => ie({
|
|
220
223
|
code: e,
|
|
221
224
|
action: t
|
|
222
225
|
}),
|
|
223
226
|
kind: "toolbar",
|
|
224
|
-
entityActions:
|
|
227
|
+
entityActions: F,
|
|
225
228
|
align: "trailing",
|
|
226
|
-
ariaLabel:
|
|
229
|
+
ariaLabel: H("list.peek.actions", "Quick peek actions")
|
|
227
230
|
})
|
|
228
231
|
}),
|
|
229
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ x(t, {
|
|
230
233
|
kind: "primary",
|
|
231
|
-
icon: /* @__PURE__ */
|
|
232
|
-
onClick: () =>
|
|
233
|
-
children:
|
|
234
|
+
icon: /* @__PURE__ */ x(n.edit, { size: 13 }),
|
|
235
|
+
onClick: () => B(K ? W : null),
|
|
236
|
+
children: H("list.peek.open_full", "Open full")
|
|
234
237
|
})
|
|
235
238
|
]
|
|
236
239
|
})
|
|
237
240
|
]
|
|
238
241
|
})] });
|
|
239
242
|
}
|
|
240
|
-
function
|
|
241
|
-
return /* @__PURE__ */
|
|
243
|
+
function T({ label: e, children: t }) {
|
|
244
|
+
return /* @__PURE__ */ S("div", {
|
|
242
245
|
style: {
|
|
243
246
|
display: "grid",
|
|
244
247
|
gridTemplateColumns: "120px 1fr",
|
|
@@ -246,14 +249,14 @@ function E({ label: e, children: t }) {
|
|
|
246
249
|
padding: "4px 0",
|
|
247
250
|
borderBottom: "1px solid var(--divider)"
|
|
248
251
|
},
|
|
249
|
-
children: [/* @__PURE__ */
|
|
252
|
+
children: [/* @__PURE__ */ x("div", {
|
|
250
253
|
style: {
|
|
251
254
|
fontSize: 11.5,
|
|
252
255
|
color: "var(--text-3)",
|
|
253
256
|
fontWeight: 500
|
|
254
257
|
},
|
|
255
258
|
children: e
|
|
256
|
-
}), /* @__PURE__ */
|
|
259
|
+
}), /* @__PURE__ */ x("div", { children: t })]
|
|
257
260
|
});
|
|
258
261
|
}
|
|
259
|
-
export {
|
|
262
|
+
export { T as QEField, w as QuickPeek };
|
|
@@ -659,6 +659,9 @@ function m({ screenCode: s }) {
|
|
|
659
659
|
return e && S.fields.get(e)?.type !== "uuid" ? we(G[e]) : void 0;
|
|
660
660
|
})(),
|
|
661
661
|
fields: Yn,
|
|
662
|
+
refs: H.current,
|
|
663
|
+
entities: _?.entities,
|
|
664
|
+
screens: _?.screens,
|
|
662
665
|
screen: Ce(S, x, G),
|
|
663
666
|
actions: Xn,
|
|
664
667
|
screenActionLayout: Ce(S, x, G)?.action_layout,
|
|
@@ -2,139 +2,140 @@ import { entityCountQueryKey as e, entityDataQueryKey as t, entityDataQueryOptio
|
|
|
2
2
|
import { cursorEntityDataQueryKey as a, useCursorEntityData as o } from "../../../hooks/useCursorEntityData.js";
|
|
3
3
|
import { useRegisterRetainedQuery as s } from "../../../hooks/usePageStateRuntime.js";
|
|
4
4
|
import { correctEstimateAgainstWindow as c } from "../../../lib/format-count.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { bindRowReferences as l } from "../../../lib/reference.js";
|
|
6
|
+
import { useCallback as u, useEffect as d, useMemo as f, useState as p } from "react";
|
|
7
|
+
import { useQueryClient as m } from "@tanstack/react-query";
|
|
7
8
|
// src/components/pages/list/useListQuery.ts
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
let
|
|
11
|
-
page:
|
|
12
|
-
per_page:
|
|
13
|
-
sort:
|
|
14
|
-
search:
|
|
15
|
-
filters:
|
|
16
|
-
include_deleted:
|
|
17
|
-
expand:
|
|
18
|
-
select:
|
|
9
|
+
var h = 1e4, g = [];
|
|
10
|
+
function _(p) {
|
|
11
|
+
let h = m(), { entity: _, entityCode: y, screen: b, screenCode: x, page: S, perPage: C, sortForRequest: w, debouncedSearch: T, filters: E, isHeld: D, prefetchWhileHeld: O, retryHeld: k, includeDeleted: A, expand: j, select: M, runCountQuery: N, urlKey: P } = p, F = E.length > 0 ? E : void 0, I = b?.fixed_filters ? x : void 0, L = f(() => ({
|
|
12
|
+
page: S,
|
|
13
|
+
per_page: C,
|
|
14
|
+
sort: w,
|
|
15
|
+
search: T || void 0,
|
|
16
|
+
filters: F,
|
|
17
|
+
include_deleted: A || void 0,
|
|
18
|
+
expand: j,
|
|
19
|
+
select: M,
|
|
19
20
|
preview: !0,
|
|
20
|
-
screen:
|
|
21
|
+
screen: I
|
|
21
22
|
}), [
|
|
22
|
-
x,
|
|
23
23
|
S,
|
|
24
24
|
C,
|
|
25
25
|
w,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
T,
|
|
27
|
+
F,
|
|
28
28
|
A,
|
|
29
29
|
j,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
M,
|
|
31
|
+
I
|
|
32
|
+
]), R = {
|
|
33
|
+
sort: w,
|
|
34
|
+
filters: F,
|
|
35
|
+
search: T || void 0,
|
|
36
|
+
select: M,
|
|
37
|
+
expand: j,
|
|
38
|
+
includeDeleted: A || void 0,
|
|
39
|
+
screen: b?.fixed_filters ? x : void 0,
|
|
39
40
|
preview: !0,
|
|
40
|
-
limit:
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
limit: C
|
|
42
|
+
}, z = _?.list_pagination === "cursor";
|
|
43
|
+
d(() => {
|
|
44
|
+
D && O && !z && y && h.prefetchQuery(n(y, L));
|
|
44
45
|
}, [
|
|
45
|
-
E,
|
|
46
46
|
D,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
O,
|
|
48
|
+
z,
|
|
49
|
+
y,
|
|
50
|
+
L,
|
|
51
|
+
h
|
|
51
52
|
]);
|
|
52
|
-
let
|
|
53
|
-
s(t(
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
]),
|
|
60
|
-
let e =
|
|
61
|
-
return e === void 0 || !t || !
|
|
53
|
+
let B = i(y, L, !z && !D), V = r(y, L, N && !z && !D), H = o(y, R, z && !D);
|
|
54
|
+
s(t(y, L), !z && !D), s(a(y, R), z && !D);
|
|
55
|
+
let U = D || (z ? H.isLoading : B.isLoading), W = f(() => D ? g : z ? H.rows : l(B.data?.data ?? [], B.data?.$refs), [
|
|
56
|
+
D,
|
|
57
|
+
z,
|
|
58
|
+
H.rows,
|
|
59
|
+
B.data
|
|
60
|
+
]), G = f(() => {
|
|
61
|
+
let e = V.data?.meta?.total, t = V.data?.meta?.count_mode, n = B.data?.meta;
|
|
62
|
+
return e === void 0 || !t || !B.data || B.isPlaceholderData || n?.has_more === void 0 ? {
|
|
62
63
|
total: e,
|
|
63
64
|
mode: t
|
|
64
65
|
} : c(e, t, {
|
|
65
|
-
page:
|
|
66
|
-
perPage:
|
|
67
|
-
rows:
|
|
66
|
+
page: S,
|
|
67
|
+
perPage: C,
|
|
68
|
+
rows: B.data.data?.length ?? 0,
|
|
68
69
|
hasMore: n.has_more
|
|
69
70
|
});
|
|
70
71
|
}, [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
]),
|
|
78
|
-
if (!(
|
|
72
|
+
V.data?.meta?.total,
|
|
73
|
+
V.data?.meta?.count_mode,
|
|
74
|
+
B.data,
|
|
75
|
+
B.isPlaceholderData,
|
|
76
|
+
S,
|
|
77
|
+
C
|
|
78
|
+
]), K = z ? H.total : G.total, q = f(() => {
|
|
79
|
+
if (!(z || K === void 0 || C <= 0)) return Math.max(1, Math.ceil(K / C));
|
|
79
80
|
}, [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
]),
|
|
84
|
-
|
|
85
|
-
queryKey: J,
|
|
86
|
-
exact: !0
|
|
87
|
-
}), X ? m.cancelQueries({
|
|
81
|
+
z,
|
|
82
|
+
K,
|
|
83
|
+
C
|
|
84
|
+
]), J = v(U, P), Y = z ? a(y, R) : t(y, L), X = e(y, L), Z = N && !z, Q = u(async () => {
|
|
85
|
+
D ? k() : y && (await Promise.all([h.cancelQueries({
|
|
88
86
|
queryKey: Y,
|
|
89
87
|
exact: !0
|
|
90
|
-
})
|
|
88
|
+
}), Z ? h.cancelQueries({
|
|
89
|
+
queryKey: X,
|
|
90
|
+
exact: !0
|
|
91
|
+
}) : void 0]), await Promise.all([z ? H.refetch() : B.refetch(), Z ? V.refetch() : void 0]));
|
|
91
92
|
}, [
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
J,
|
|
93
|
+
D,
|
|
94
|
+
k,
|
|
95
|
+
y,
|
|
96
|
+
h,
|
|
97
97
|
Y,
|
|
98
98
|
X,
|
|
99
|
-
|
|
100
|
-
V,
|
|
99
|
+
Z,
|
|
101
100
|
z,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
V
|
|
105
|
-
|
|
101
|
+
H,
|
|
102
|
+
B,
|
|
103
|
+
V
|
|
104
|
+
]), $ = u(() => {
|
|
105
|
+
H.fetchNextPage();
|
|
106
|
+
}, [H]);
|
|
106
107
|
return {
|
|
107
|
-
rows:
|
|
108
|
-
meta:
|
|
109
|
-
refs:
|
|
110
|
-
isLoading:
|
|
111
|
-
isFetching:
|
|
112
|
-
isShowingPreviousRows: !
|
|
113
|
-
isError:
|
|
114
|
-
error:
|
|
115
|
-
isLoadingStale:
|
|
116
|
-
retry:
|
|
117
|
-
countTotal:
|
|
118
|
-
countStrategy:
|
|
119
|
-
countLoading:
|
|
120
|
-
countError: !
|
|
121
|
-
totalPages:
|
|
122
|
-
hasMorePages:
|
|
123
|
-
isCursor:
|
|
124
|
-
fetchNextPage:
|
|
125
|
-
isFetchingNextPage:
|
|
108
|
+
rows: W,
|
|
109
|
+
meta: D ? void 0 : B.data?.meta,
|
|
110
|
+
refs: D ? void 0 : z ? H.refs : B.data?.$refs,
|
|
111
|
+
isLoading: U,
|
|
112
|
+
isFetching: D || (z ? H.isFetching : B.isFetching),
|
|
113
|
+
isShowingPreviousRows: !D && (z ? H.isPlaceholderData : B.isPlaceholderData),
|
|
114
|
+
isError: D ? !1 : z ? H.isError : B.isError,
|
|
115
|
+
error: D ? void 0 : z ? H.error : B.error,
|
|
116
|
+
isLoadingStale: J,
|
|
117
|
+
retry: Q,
|
|
118
|
+
countTotal: D ? void 0 : K,
|
|
119
|
+
countStrategy: D ? void 0 : z ? H.countMode : G.mode,
|
|
120
|
+
countLoading: D || (z ? H.isLoading : V.isLoading),
|
|
121
|
+
countError: !D && !z && V.isError,
|
|
122
|
+
totalPages: q,
|
|
123
|
+
hasMorePages: z ? H.hasMore : B.data?.meta?.has_more ?? (q !== void 0 && S < q),
|
|
124
|
+
isCursor: z,
|
|
125
|
+
fetchNextPage: $,
|
|
126
|
+
isFetchingNextPage: H.isFetchingNextPage
|
|
126
127
|
};
|
|
127
128
|
}
|
|
128
|
-
function
|
|
129
|
-
let [n, r] =
|
|
130
|
-
return
|
|
129
|
+
function v(e, t) {
|
|
130
|
+
let [n, r] = p(!1);
|
|
131
|
+
return d(() => {
|
|
131
132
|
if (!e) {
|
|
132
133
|
r(!1);
|
|
133
134
|
return;
|
|
134
135
|
}
|
|
135
136
|
r(!1);
|
|
136
|
-
let t = window.setTimeout(() => r(!0),
|
|
137
|
+
let t = window.setTimeout(() => r(!0), h);
|
|
137
138
|
return () => window.clearTimeout(t);
|
|
138
139
|
}, [e, t]), n;
|
|
139
140
|
}
|
|
140
|
-
export {
|
|
141
|
+
export { _ as useListQuery };
|