@object-ui/plugin-grid 0.5.0 → 2.0.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/index.js CHANGED
@@ -1,76 +1,76 @@
1
- import * as H from "react";
2
- import de, { useState as B, useEffect as Q, useCallback as ee, useRef as pe } from "react";
3
- import { ComponentRegistry as fe } from "@object-ui/core";
4
- import { useDataScope as be, SchemaRenderer as ve, useSchemaContext as Ee } from "@object-ui/react";
5
- import { getCellRenderer as ye } from "@object-ui/fields";
6
- import { DropdownMenu as xe, DropdownMenuTrigger as Se, Button as we, DropdownMenuContent as Oe, DropdownMenuItem as te } from "@object-ui/components";
7
- import { MoreVertical as _e, Edit as je, Trash2 as Ce } from "lucide-react";
8
- import { flushSync as Re } from "react-dom";
9
- var G = { exports: {} }, W = {};
10
- var ne;
11
- function Ae() {
12
- if (ne) return W;
13
- ne = 1;
14
- var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), a = /* @__PURE__ */ Symbol.for("react.fragment");
15
- function e(s, n, i) {
1
+ import * as le from "react";
2
+ import Se, { useState as ie, useEffect as ae, useCallback as Ce, useRef as _e } from "react";
3
+ import { ComponentRegistry as we } from "@object-ui/core";
4
+ import { useDataScope as Re, useNavigationOverlay as Ae, useAction as Te, SchemaRenderer as ce, useSchemaContext as Ne } from "@object-ui/react";
5
+ import { getCellRenderer as ue } from "@object-ui/fields";
6
+ import { DropdownMenu as ke, DropdownMenuTrigger as ze, Button as Me, DropdownMenuContent as Ie, DropdownMenuItem as de, NavigationOverlay as fe } from "@object-ui/components";
7
+ import { MoreVertical as De, Edit as Fe, Trash2 as Pe } from "lucide-react";
8
+ import { flushSync as $e } from "react-dom";
9
+ var oe = { exports: {} }, te = {};
10
+ var he;
11
+ function We() {
12
+ if (he) return te;
13
+ he = 1;
14
+ var n = /* @__PURE__ */ Symbol.for("react.transitional.element"), a = /* @__PURE__ */ Symbol.for("react.fragment");
15
+ function e(s, t, i) {
16
16
  var o = null;
17
- if (i !== void 0 && (o = "" + i), n.key !== void 0 && (o = "" + n.key), "key" in n) {
17
+ if (i !== void 0 && (o = "" + i), t.key !== void 0 && (o = "" + t.key), "key" in t) {
18
18
  i = {};
19
- for (var l in n)
20
- l !== "key" && (i[l] = n[l]);
21
- } else i = n;
22
- return n = i.ref, {
23
- $$typeof: t,
19
+ for (var l in t)
20
+ l !== "key" && (i[l] = t[l]);
21
+ } else i = t;
22
+ return t = i.ref, {
23
+ $$typeof: n,
24
24
  type: s,
25
25
  key: o,
26
- ref: n !== void 0 ? n : null,
26
+ ref: t !== void 0 ? t : null,
27
27
  props: i
28
28
  };
29
29
  }
30
- return W.Fragment = a, W.jsx = e, W.jsxs = e, W;
30
+ return te.Fragment = a, te.jsx = e, te.jsxs = e, te;
31
31
  }
32
- var L = {};
33
- var se;
34
- function Te() {
35
- return se || (se = 1, process.env.NODE_ENV !== "production" && (function() {
36
- function t(r) {
32
+ var ne = {};
33
+ var me;
34
+ function Le() {
35
+ return me || (me = 1, process.env.NODE_ENV !== "production" && (function() {
36
+ function n(r) {
37
37
  if (r == null) return null;
38
38
  if (typeof r == "function")
39
- return r.$$typeof === J ? null : r.displayName || r.name || null;
39
+ return r.$$typeof === V ? null : r.displayName || r.name || null;
40
40
  if (typeof r == "string") return r;
41
41
  switch (r) {
42
- case _:
42
+ case j:
43
43
  return "Fragment";
44
- case p:
44
+ case O:
45
45
  return "Profiler";
46
- case T:
46
+ case N:
47
47
  return "StrictMode";
48
- case V:
48
+ case L:
49
49
  return "Suspense";
50
- case z:
50
+ case F:
51
51
  return "SuspenseList";
52
- case P:
52
+ case U:
53
53
  return "Activity";
54
54
  }
55
55
  if (typeof r == "object")
56
56
  switch (typeof r.tag == "number" && console.error(
57
57
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
58
58
  ), r.$$typeof) {
59
- case g:
59
+ case v:
60
60
  return "Portal";
61
- case M:
61
+ case k:
62
62
  return r.displayName || "Context";
63
- case j:
63
+ case D:
64
64
  return (r._context.displayName || "Context") + ".Consumer";
65
- case N:
66
- var u = r.render;
67
- return r = r.displayName, r || (r = u.displayName || u.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
68
- case Y:
69
- return u = r.displayName || null, u !== null ? u : t(r.type) || "Memo";
70
- case F:
71
- u = r._payload, r = r._init;
65
+ case C:
66
+ var h = r.render;
67
+ return r = r.displayName, r || (r = h.displayName || h.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
68
+ case $:
69
+ return h = r.displayName || null, h !== null ? h : n(r.type) || "Memo";
70
+ case z:
71
+ h = r._payload, r = r._init;
72
72
  try {
73
- return t(r(u));
73
+ return n(r(h));
74
74
  } catch {
75
75
  }
76
76
  }
@@ -82,50 +82,50 @@ function Te() {
82
82
  function e(r) {
83
83
  try {
84
84
  a(r);
85
- var u = !1;
85
+ var h = !1;
86
86
  } catch {
87
- u = !0;
87
+ h = !0;
88
88
  }
89
- if (u) {
90
- u = console;
91
- var x = u.error, w = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
89
+ if (h) {
90
+ h = console;
91
+ var x = h.error, S = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
92
92
  return x.call(
93
- u,
93
+ h,
94
94
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
95
- w
95
+ S
96
96
  ), a(r);
97
97
  }
98
98
  }
99
99
  function s(r) {
100
- if (r === _) return "<>";
101
- if (typeof r == "object" && r !== null && r.$$typeof === F)
100
+ if (r === j) return "<>";
101
+ if (typeof r == "object" && r !== null && r.$$typeof === z)
102
102
  return "<...>";
103
103
  try {
104
- var u = t(r);
105
- return u ? "<" + u + ">" : "<...>";
104
+ var h = n(r);
105
+ return h ? "<" + h + ">" : "<...>";
106
106
  } catch {
107
107
  return "<...>";
108
108
  }
109
109
  }
110
- function n() {
111
- var r = $.A;
110
+ function t() {
111
+ var r = q.A;
112
112
  return r === null ? null : r.getOwner();
113
113
  }
114
114
  function i() {
115
115
  return Error("react-stack-top-frame");
116
116
  }
117
117
  function o(r) {
118
- if (U.call(r, "key")) {
119
- var u = Object.getOwnPropertyDescriptor(r, "key").get;
120
- if (u && u.isReactWarning) return !1;
118
+ if (J.call(r, "key")) {
119
+ var h = Object.getOwnPropertyDescriptor(r, "key").get;
120
+ if (h && h.isReactWarning) return !1;
121
121
  }
122
122
  return r.key !== void 0;
123
123
  }
124
- function l(r, u) {
124
+ function l(r, h) {
125
125
  function x() {
126
- A || (A = !0, console.error(
126
+ se || (se = !0, console.error(
127
127
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
128
- u
128
+ h
129
129
  ));
130
130
  }
131
131
  x.isReactWarning = !0, Object.defineProperty(r, "key", {
@@ -133,23 +133,23 @@ function Te() {
133
133
  configurable: !0
134
134
  });
135
135
  }
136
- function f() {
137
- var r = t(this.type);
138
- return R[r] || (R[r] = !0, console.error(
136
+ function p() {
137
+ var r = n(this.type);
138
+ return K[r] || (K[r] = !0, console.error(
139
139
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
140
140
  )), r = this.props.ref, r !== void 0 ? r : null;
141
141
  }
142
- function b(r, u, x, w, q, X) {
143
- var O = x.ref;
142
+ function g(r, h, x, S, Y, G) {
143
+ var f = x.ref;
144
144
  return r = {
145
- $$typeof: C,
145
+ $$typeof: _,
146
146
  type: r,
147
- key: u,
147
+ key: h,
148
148
  props: x,
149
- _owner: w
150
- }, (O !== void 0 ? O : null) !== null ? Object.defineProperty(r, "ref", {
149
+ _owner: S
150
+ }, (f !== void 0 ? f : null) !== null ? Object.defineProperty(r, "ref", {
151
151
  enumerable: !1,
152
- get: f
152
+ get: p
153
153
  }) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
154
154
  configurable: !1,
155
155
  enumerable: !1,
@@ -164,397 +164,478 @@ function Te() {
164
164
  configurable: !1,
165
165
  enumerable: !1,
166
166
  writable: !0,
167
- value: q
167
+ value: Y
168
168
  }), Object.defineProperty(r, "_debugTask", {
169
169
  configurable: !1,
170
170
  enumerable: !1,
171
171
  writable: !0,
172
- value: X
172
+ value: G
173
173
  }), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
174
174
  }
175
- function d(r, u, x, w, q, X) {
176
- var O = u.children;
177
- if (O !== void 0)
178
- if (w)
179
- if (K(O)) {
180
- for (w = 0; w < O.length; w++)
181
- S(O[w]);
182
- Object.freeze && Object.freeze(O);
175
+ function m(r, h, x, S, Y, G) {
176
+ var f = h.children;
177
+ if (f !== void 0)
178
+ if (S)
179
+ if (M(f)) {
180
+ for (S = 0; S < f.length; S++)
181
+ E(f[S]);
182
+ Object.freeze && Object.freeze(f);
183
183
  } else
184
184
  console.error(
185
185
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
186
186
  );
187
- else S(O);
188
- if (U.call(u, "key")) {
189
- O = t(r);
190
- var I = Object.keys(u).filter(function(ge) {
191
- return ge !== "key";
187
+ else E(f);
188
+ if (J.call(h, "key")) {
189
+ f = n(r);
190
+ var y = Object.keys(h).filter(function(w) {
191
+ return w !== "key";
192
192
  });
193
- w = 0 < I.length ? "{key: someKey, " + I.join(": ..., ") + ": ...}" : "{key: someKey}", k[O + w] || (I = 0 < I.length ? "{" + I.join(": ..., ") + ": ...}" : "{}", console.error(
193
+ S = 0 < y.length ? "{key: someKey, " + y.join(": ..., ") + ": ...}" : "{key: someKey}", re[f + S] || (y = 0 < y.length ? "{" + y.join(": ..., ") + ": ...}" : "{}", console.error(
194
194
  `A props object containing a "key" prop is being spread into JSX:
195
195
  let props = %s;
196
196
  <%s {...props} />
197
197
  React keys must be passed directly to JSX without using spread:
198
198
  let props = %s;
199
199
  <%s key={someKey} {...props} />`,
200
- w,
201
- O,
202
- I,
203
- O
204
- ), k[O + w] = !0);
200
+ S,
201
+ f,
202
+ y,
203
+ f
204
+ ), re[f + S] = !0);
205
205
  }
206
- if (O = null, x !== void 0 && (e(x), O = "" + x), o(u) && (e(u.key), O = "" + u.key), "key" in u) {
206
+ if (f = null, x !== void 0 && (e(x), f = "" + x), o(h) && (e(h.key), f = "" + h.key), "key" in h) {
207
207
  x = {};
208
- for (var Z in u)
209
- Z !== "key" && (x[Z] = u[Z]);
210
- } else x = u;
211
- return O && l(
208
+ for (var A in h)
209
+ A !== "key" && (x[A] = h[A]);
210
+ } else x = h;
211
+ return f && l(
212
212
  x,
213
213
  typeof r == "function" ? r.displayName || r.name || "Unknown" : r
214
- ), b(
214
+ ), g(
215
215
  r,
216
- O,
216
+ f,
217
217
  x,
218
- n(),
219
- q,
220
- X
218
+ t(),
219
+ Y,
220
+ G
221
221
  );
222
222
  }
223
- function S(r) {
224
- c(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === F && (r._payload.status === "fulfilled" ? c(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
223
+ function E(r) {
224
+ c(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === z && (r._payload.status === "fulfilled" ? c(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
225
225
  }
226
226
  function c(r) {
227
- return typeof r == "object" && r !== null && r.$$typeof === C;
227
+ return typeof r == "object" && r !== null && r.$$typeof === _;
228
228
  }
229
- var m = de, C = /* @__PURE__ */ Symbol.for("react.transitional.element"), g = /* @__PURE__ */ Symbol.for("react.portal"), _ = /* @__PURE__ */ Symbol.for("react.fragment"), T = /* @__PURE__ */ Symbol.for("react.strict_mode"), p = /* @__PURE__ */ Symbol.for("react.profiler"), j = /* @__PURE__ */ Symbol.for("react.consumer"), M = /* @__PURE__ */ Symbol.for("react.context"), N = /* @__PURE__ */ Symbol.for("react.forward_ref"), V = /* @__PURE__ */ Symbol.for("react.suspense"), z = /* @__PURE__ */ Symbol.for("react.suspense_list"), Y = /* @__PURE__ */ Symbol.for("react.memo"), F = /* @__PURE__ */ Symbol.for("react.lazy"), P = /* @__PURE__ */ Symbol.for("react.activity"), J = /* @__PURE__ */ Symbol.for("react.client.reference"), $ = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, U = Object.prototype.hasOwnProperty, K = Array.isArray, y = console.createTask ? console.createTask : function() {
229
+ var b = Se, _ = /* @__PURE__ */ Symbol.for("react.transitional.element"), v = /* @__PURE__ */ Symbol.for("react.portal"), j = /* @__PURE__ */ Symbol.for("react.fragment"), N = /* @__PURE__ */ Symbol.for("react.strict_mode"), O = /* @__PURE__ */ Symbol.for("react.profiler"), D = /* @__PURE__ */ Symbol.for("react.consumer"), k = /* @__PURE__ */ Symbol.for("react.context"), C = /* @__PURE__ */ Symbol.for("react.forward_ref"), L = /* @__PURE__ */ Symbol.for("react.suspense"), F = /* @__PURE__ */ Symbol.for("react.suspense_list"), $ = /* @__PURE__ */ Symbol.for("react.memo"), z = /* @__PURE__ */ Symbol.for("react.lazy"), U = /* @__PURE__ */ Symbol.for("react.activity"), V = /* @__PURE__ */ Symbol.for("react.client.reference"), q = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, M = Array.isArray, B = console.createTask ? console.createTask : function() {
230
230
  return null;
231
231
  };
232
- m = {
232
+ b = {
233
233
  react_stack_bottom_frame: function(r) {
234
234
  return r();
235
235
  }
236
236
  };
237
- var A, R = {}, E = m.react_stack_bottom_frame.bind(
238
- m,
237
+ var se, K = {}, W = b.react_stack_bottom_frame.bind(
238
+ b,
239
239
  i
240
- )(), h = y(s(i)), k = {};
241
- L.Fragment = _, L.jsx = function(r, u, x) {
242
- var w = 1e4 > $.recentlyCreatedOwnerStacks++;
243
- return d(
240
+ )(), X = B(s(i)), re = {};
241
+ ne.Fragment = j, ne.jsx = function(r, h, x) {
242
+ var S = 1e4 > q.recentlyCreatedOwnerStacks++;
243
+ return m(
244
244
  r,
245
- u,
245
+ h,
246
246
  x,
247
247
  !1,
248
- w ? Error("react-stack-top-frame") : E,
249
- w ? y(s(r)) : h
248
+ S ? Error("react-stack-top-frame") : W,
249
+ S ? B(s(r)) : X
250
250
  );
251
- }, L.jsxs = function(r, u, x) {
252
- var w = 1e4 > $.recentlyCreatedOwnerStacks++;
253
- return d(
251
+ }, ne.jsxs = function(r, h, x) {
252
+ var S = 1e4 > q.recentlyCreatedOwnerStacks++;
253
+ return m(
254
254
  r,
255
- u,
255
+ h,
256
256
  x,
257
257
  !0,
258
- w ? Error("react-stack-top-frame") : E,
259
- w ? y(s(r)) : h
258
+ S ? Error("react-stack-top-frame") : W,
259
+ S ? B(s(r)) : X
260
260
  );
261
261
  };
262
- })()), L;
262
+ })()), ne;
263
263
  }
264
- var re;
265
- function Me() {
266
- return re || (re = 1, process.env.NODE_ENV === "production" ? G.exports = Ae() : G.exports = Te()), G.exports;
264
+ var pe;
265
+ function Ve() {
266
+ return pe || (pe = 1, process.env.NODE_ENV === "production" ? oe.exports = We() : oe.exports = Le()), oe.exports;
267
267
  }
268
- var v = Me();
269
- function ze(t) {
270
- return t.data ? Array.isArray(t.data) ? {
268
+ var u = Ve();
269
+ function Ye(n) {
270
+ return n.data ? Array.isArray(n.data) ? {
271
271
  provider: "value",
272
- items: t.data
273
- } : t.data : t.staticData ? {
272
+ items: n.data
273
+ } : n.data : n.staticData ? {
274
274
  provider: "value",
275
- items: t.staticData
276
- } : t.objectName ? {
275
+ items: n.staticData
276
+ } : n.objectName ? {
277
277
  provider: "object",
278
- object: t.objectName
278
+ object: n.objectName
279
279
  } : null;
280
280
  }
281
- function ie(t) {
282
- if (!(!t || t.length === 0))
283
- return typeof t[0] == "object" && t[0] !== null, t;
281
+ function ge(n) {
282
+ if (!(!n || n.length === 0))
283
+ return typeof n[0] == "object" && n[0] !== null, n;
284
284
  }
285
- const ke = ({
286
- schema: t,
285
+ const Ue = ({
286
+ schema: n,
287
287
  dataSource: a,
288
288
  onEdit: e,
289
289
  onDelete: s,
290
- onRowSelect: n,
290
+ onRowSelect: t,
291
291
  onRowClick: i,
292
- ...o
292
+ onCellChange: o,
293
+ onRowSave: l,
294
+ onBatchSave: p,
295
+ ...g
293
296
  }) => {
294
- const [l, f] = B([]), [b, d] = B(!0), [S, c] = B(null), [m, C] = B(null), g = o.data, _ = be(t.bind), T = ze(t), p = de.useMemo(() => g && Array.isArray(g) ? {
297
+ const [m, E] = ie([]), [c, b] = ie(!0), [_, v] = ie(null), [j, N] = ie(null), O = g.data, D = Re(n.bind), k = Ye(n), C = Se.useMemo(() => O && Array.isArray(O) ? {
295
298
  provider: "value",
296
- items: g
297
- } : _ && Array.isArray(_) ? {
299
+ items: O
300
+ } : D && Array.isArray(D) ? {
298
301
  provider: "value",
299
- items: _
300
- } : T, [JSON.stringify(T), _, g]), j = p?.provider === "value";
301
- Q(() => {
302
- j && p?.provider === "value" && (f((y) => {
303
- const A = p.items;
304
- return JSON.stringify(y) !== JSON.stringify(A) ? A : y;
305
- }), d(!1));
306
- }, [j, p]), Q(() => {
307
- const y = async () => {
302
+ items: D
303
+ } : k, [JSON.stringify(k), D, O]), L = C?.provider === "value", F = C?.provider === "object" && C && "object" in C ? C.object : n.objectName, $ = n.fields, z = n.columns, U = n.filter, V = n.sort, q = n.pagination, J = n.pageSize;
304
+ ae(() => {
305
+ L && C?.provider === "value" && (E((f) => {
306
+ const y = C.items;
307
+ return JSON.stringify(f) !== JSON.stringify(y) ? y : f;
308
+ }), b(!1));
309
+ }, [L, C]), ae(() => {
310
+ if (L) return;
311
+ let f = !1;
312
+ return (async () => {
313
+ b(!0), v(null);
308
314
  try {
309
- if (!a)
310
- throw new Error("DataSource required");
311
- const R = p?.provider === "object" && "object" in p ? p.object : t.objectName;
312
- if (!R)
313
- throw new Error("Object name required for object provider");
314
- const E = await a.getObjectSchema(R);
315
- C(E);
316
- } catch (R) {
317
- c(R);
315
+ let A = null;
316
+ if ((ge(z) || $) && F)
317
+ A = { name: F, fields: {} };
318
+ else if (F && a) {
319
+ const d = await a.getObjectSchema(F);
320
+ if (f) return;
321
+ A = d;
322
+ } else throw F ? new Error("DataSource required") : new Error("Object name required for data fetching");
323
+ if (f || N(A), a && F) {
324
+ const T = {
325
+ $select: (() => {
326
+ if ($) return $;
327
+ if (z && Array.isArray(z))
328
+ return z.map((R) => typeof R == "string" ? R : R.field);
329
+ })(),
330
+ $top: q?.pageSize || J || 50
331
+ };
332
+ U && Array.isArray(U) ? T.$filter = U : n.defaultFilters && (T.$filter = n.defaultFilters), V ? typeof V == "string" ? T.$orderby = V : Array.isArray(V) && (T.$orderby = V.map((R) => `${R.field} ${R.order}`).join(", ")) : n.defaultSort && (T.$orderby = `${n.defaultSort.field} ${n.defaultSort.order}`);
333
+ const P = await a.find(F, T);
334
+ if (f) return;
335
+ E(P.data || []);
336
+ }
337
+ } catch (A) {
338
+ f || v(A);
339
+ } finally {
340
+ f || b(!1);
318
341
  }
319
- }, A = ie(t.columns) || t.fields;
320
- j && A ? C({ name: t.objectName, fields: {} }) : t.objectName && !j && a && y();
321
- }, [t.objectName, t.columns, t.fields, a, j, p]);
322
- const M = ee(() => {
323
- const y = ie(t.columns);
324
- if (y) {
325
- if (y.length > 0 && typeof y[0] == "object" && y[0] !== null) {
326
- const E = y[0];
327
- if ("accessorKey" in E)
328
- return y;
329
- if ("field" in E)
330
- return y.filter((h) => h?.field && typeof h.field == "string").map((h) => ({
331
- header: h.label || h.field.charAt(0).toUpperCase() + h.field.slice(1).replace(/_/g, " "),
332
- accessorKey: h.field,
333
- ...h.width && { width: h.width },
334
- ...h.align && { align: h.align },
335
- sortable: h.sortable !== !1
336
- }));
342
+ })(), () => {
343
+ f = !0;
344
+ };
345
+ }, [F, $, z, U, V, q, J, a, L, C]);
346
+ const M = Ae({
347
+ navigation: n.navigation,
348
+ objectName: n.objectName,
349
+ onNavigate: n.onNavigate,
350
+ onRowClick: i
351
+ }), { execute: B } = Te(), se = Ce(() => {
352
+ const f = ge(z);
353
+ if (f) {
354
+ if (f.length > 0 && typeof f[0] == "object" && f[0] !== null) {
355
+ const w = f[0];
356
+ if ("accessorKey" in w)
357
+ return f;
358
+ if ("field" in w)
359
+ return f.filter((d) => d?.field && typeof d.field == "string" && !d.hidden).map((d) => {
360
+ const T = d.label || d.field.charAt(0).toUpperCase() + d.field.slice(1).replace(/_/g, " ");
361
+ let P;
362
+ const R = d.type ? ue(d.type) : null;
363
+ return d.link && d.action ? P = (I, Z) => {
364
+ const Q = R ? /* @__PURE__ */ u.jsx(R, { value: I, field: { name: d.field, type: d.type || "text" } }) : String(I ?? "");
365
+ return /* @__PURE__ */ u.jsx(
366
+ "button",
367
+ {
368
+ type: "button",
369
+ className: "text-primary underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit",
370
+ onClick: (ee) => {
371
+ ee.stopPropagation(), M.handleClick(Z);
372
+ },
373
+ children: Q
374
+ }
375
+ );
376
+ } : d.link ? P = (I, Z) => {
377
+ const Q = R ? /* @__PURE__ */ u.jsx(R, { value: I, field: { name: d.field, type: d.type || "text" } }) : String(I ?? "");
378
+ return /* @__PURE__ */ u.jsx(
379
+ "button",
380
+ {
381
+ type: "button",
382
+ className: "text-primary underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit",
383
+ onClick: (ee) => {
384
+ ee.stopPropagation(), M.handleClick(Z);
385
+ },
386
+ children: Q
387
+ }
388
+ );
389
+ } : d.action ? P = (I, Z) => {
390
+ const Q = R ? /* @__PURE__ */ u.jsx(R, { value: I, field: { name: d.field, type: d.type || "text" } }) : String(I ?? "");
391
+ return /* @__PURE__ */ u.jsx(
392
+ "button",
393
+ {
394
+ type: "button",
395
+ className: "text-primary underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit",
396
+ onClick: (ee) => {
397
+ ee.stopPropagation(), B({
398
+ type: d.action,
399
+ params: { record: Z, field: d.field, value: I }
400
+ });
401
+ },
402
+ children: Q
403
+ }
404
+ );
405
+ } : R && (P = (I) => /* @__PURE__ */ u.jsx(R, { value: I, field: { name: d.field, type: d.type || "text" } })), {
406
+ header: T,
407
+ accessorKey: d.field,
408
+ ...d.width && { width: d.width },
409
+ ...d.align && { align: d.align },
410
+ sortable: d.sortable !== !1,
411
+ ...d.resizable !== void 0 && { resizable: d.resizable },
412
+ ...d.wrap !== void 0 && { wrap: d.wrap },
413
+ ...P && { cell: P }
414
+ };
415
+ });
337
416
  }
338
- return y.filter((E) => typeof E == "string" && E.trim().length > 0).map((E) => ({
339
- header: m?.fields?.[E]?.label || E.charAt(0).toUpperCase() + E.slice(1).replace(/_/g, " "),
340
- accessorKey: E
417
+ return f.filter((w) => typeof w == "string" && w.trim().length > 0).map((w) => ({
418
+ header: j?.fields?.[w]?.label || w.charAt(0).toUpperCase() + w.slice(1).replace(/_/g, " "),
419
+ accessorKey: w
341
420
  }));
342
421
  }
343
- if (j) {
344
- const E = p?.provider === "value" ? p.items : [];
345
- if (E.length > 0)
346
- return (t.fields || Object.keys(E[0])).map((k) => ({
347
- header: k.charAt(0).toUpperCase() + k.slice(1).replace(/_/g, " "),
348
- accessorKey: k
422
+ if (L) {
423
+ const w = C?.provider === "value" ? C.items : [];
424
+ if (w.length > 0)
425
+ return ($ || Object.keys(w[0])).map((T) => ({
426
+ header: T.charAt(0).toUpperCase() + T.slice(1).replace(/_/g, " "),
427
+ accessorKey: T
349
428
  }));
350
429
  }
351
- if (!m) return [];
352
- const A = [];
353
- return (t.fields || Object.keys(m.fields || {})).forEach((E) => {
354
- const h = m.fields?.[E];
355
- if (!h || h.permissions && h.permissions.read === !1) return;
356
- const k = ye(h.type);
357
- A.push({
358
- header: h.label || E,
359
- accessorKey: E,
360
- cell: (r) => /* @__PURE__ */ v.jsx(k, { value: r, field: h }),
361
- sortable: h.sortable !== !1
430
+ if (!j) return [];
431
+ const y = [];
432
+ return ($ || Object.keys(j.fields || {})).forEach((w) => {
433
+ const d = j.fields?.[w];
434
+ if (!d || d.permissions && d.permissions.read === !1) return;
435
+ const T = ue(d.type);
436
+ y.push({
437
+ header: d.label || w,
438
+ accessorKey: w,
439
+ cell: (P) => /* @__PURE__ */ u.jsx(T, { value: P, field: d }),
440
+ sortable: d.sortable !== !1
362
441
  });
363
- }), A;
364
- }, [m, t.fields, t.columns, p, j]), N = ee(async () => {
365
- if (!(j || !a)) {
366
- d(!0);
367
- try {
368
- const y = p?.provider === "object" && "object" in p ? p.object : t.objectName;
369
- if (!y)
370
- throw new Error("Object name required for data fetching");
371
- const R = {
372
- $select: (() => {
373
- if (t.fields) return t.fields;
374
- if (t.columns && Array.isArray(t.columns))
375
- return t.columns.map((h) => typeof h == "string" ? h : h.field);
376
- })(),
377
- $top: t.pagination?.pageSize || t.pageSize || 50
378
- };
379
- t.filter && Array.isArray(t.filter) ? R.$filter = t.filter : "defaultFilters" in t && t.defaultFilters && (R.$filter = t.defaultFilters), t.sort ? typeof t.sort == "string" ? R.$orderby = t.sort : Array.isArray(t.sort) && (R.$orderby = t.sort.map((h) => `${h.field} ${h.order}`).join(", ")) : "defaultSort" in t && t.defaultSort && (R.$orderby = `${t.defaultSort.field} ${t.defaultSort.order}`);
380
- const E = await a.find(y, R);
381
- f(E.data || []);
382
- } catch (y) {
383
- c(y);
384
- } finally {
385
- d(!1);
386
- }
387
- }
388
- }, [t, a, j, p]);
389
- if (Q(() => {
390
- (m || j) && N();
391
- }, [m, j, N]), S)
392
- return /* @__PURE__ */ v.jsxs("div", { className: "p-4 border border-red-300 bg-red-50 rounded-md", children: [
393
- /* @__PURE__ */ v.jsx("h3", { className: "text-red-800 font-semibold", children: "Error loading grid" }),
394
- /* @__PURE__ */ v.jsx("p", { className: "text-red-600 text-sm mt-1", children: S.message })
442
+ }), y;
443
+ }, [j, $, z, C, L, M.handleClick, B]);
444
+ if (_)
445
+ return /* @__PURE__ */ u.jsxs("div", { className: "p-4 border border-red-300 bg-red-50 rounded-md", children: [
446
+ /* @__PURE__ */ u.jsx("h3", { className: "text-red-800 font-semibold", children: "Error loading grid" }),
447
+ /* @__PURE__ */ u.jsx("p", { className: "text-red-600 text-sm mt-1", children: _.message })
395
448
  ] });
396
- if (b && l.length === 0)
397
- return /* @__PURE__ */ v.jsxs("div", { className: "p-8 text-center", children: [
398
- /* @__PURE__ */ v.jsx("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }),
399
- /* @__PURE__ */ v.jsx("p", { className: "mt-2 text-sm text-gray-600", children: "Loading grid..." })
449
+ if (c && m.length === 0)
450
+ return /* @__PURE__ */ u.jsxs("div", { className: "p-8 text-center", children: [
451
+ /* @__PURE__ */ u.jsx("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }),
452
+ /* @__PURE__ */ u.jsx("p", { className: "mt-2 text-sm text-gray-600", children: "Loading grid..." })
400
453
  ] });
401
- const V = M(), z = "operations" in t ? t.operations : void 0, Y = z && (z.update || z.delete), F = Y ? [
402
- ...V,
454
+ const K = se(), W = "operations" in n ? n.operations : void 0, X = W && (W.update || W.delete), re = X ? [
455
+ ...K,
403
456
  {
404
457
  header: "Actions",
405
458
  accessorKey: "_actions",
406
- cell: (y, A) => /* @__PURE__ */ v.jsxs(xe, { children: [
407
- /* @__PURE__ */ v.jsx(Se, { asChild: !0, children: /* @__PURE__ */ v.jsxs(we, { variant: "ghost", size: "icon", className: "h-8 w-8", children: [
408
- /* @__PURE__ */ v.jsx(_e, { className: "h-4 w-4" }),
409
- /* @__PURE__ */ v.jsx("span", { className: "sr-only", children: "Open menu" })
459
+ cell: (f, y) => /* @__PURE__ */ u.jsxs(ke, { children: [
460
+ /* @__PURE__ */ u.jsx(ze, { asChild: !0, children: /* @__PURE__ */ u.jsxs(Me, { variant: "ghost", size: "icon", className: "h-8 w-8", children: [
461
+ /* @__PURE__ */ u.jsx(De, { className: "h-4 w-4" }),
462
+ /* @__PURE__ */ u.jsx("span", { className: "sr-only", children: "Open menu" })
410
463
  ] }) }),
411
- /* @__PURE__ */ v.jsxs(Oe, { align: "end", children: [
412
- z?.update && e && /* @__PURE__ */ v.jsxs(te, { onClick: () => e(A), children: [
413
- /* @__PURE__ */ v.jsx(je, { className: "mr-2 h-4 w-4" }),
464
+ /* @__PURE__ */ u.jsxs(Ie, { align: "end", children: [
465
+ W?.update && e && /* @__PURE__ */ u.jsxs(de, { onClick: () => e(y), children: [
466
+ /* @__PURE__ */ u.jsx(Fe, { className: "mr-2 h-4 w-4" }),
414
467
  "Edit"
415
468
  ] }),
416
- z?.delete && s && /* @__PURE__ */ v.jsxs(te, { onClick: () => s(A), children: [
417
- /* @__PURE__ */ v.jsx(Ce, { className: "mr-2 h-4 w-4" }),
469
+ W?.delete && s && /* @__PURE__ */ u.jsxs(de, { onClick: () => s(y), children: [
470
+ /* @__PURE__ */ u.jsx(Pe, { className: "mr-2 h-4 w-4" }),
418
471
  "Delete"
419
472
  ] })
420
473
  ] })
421
474
  ] }),
422
475
  sortable: !1
423
476
  }
424
- ] : V;
425
- let P = !1;
426
- t.selection?.type ? P = t.selection.type === "none" ? !1 : t.selection.type : t.selectable !== void 0 && (P = t.selectable);
427
- const J = t.pagination !== void 0 ? !0 : t.showPagination !== void 0 ? t.showPagination : !0, $ = t.pagination?.pageSize || t.pageSize || 10, U = t.searchableFields !== void 0 ? t.searchableFields.length > 0 : t.showSearch !== void 0 ? t.showSearch : !0, K = {
477
+ ] : K;
478
+ let r = !1;
479
+ n.selection?.type ? r = n.selection.type === "none" ? !1 : n.selection.type : n.selectable !== void 0 && (r = n.selectable);
480
+ const h = n.pagination !== void 0 ? !0 : n.showPagination !== void 0 ? n.showPagination : !0, x = n.pagination?.pageSize || n.pageSize || 10, S = n.searchableFields !== void 0 ? n.searchableFields.length > 0 : n.showSearch !== void 0 ? n.showSearch : !0, Y = {
428
481
  type: "data-table",
429
- caption: t.label || t.title,
430
- columns: F,
431
- data: l,
432
- pagination: J,
433
- pageSize: $,
434
- searchable: U,
435
- selectable: P,
482
+ caption: n.label || n.title,
483
+ columns: re,
484
+ data: m,
485
+ pagination: h,
486
+ pageSize: x,
487
+ searchable: S,
488
+ selectable: r,
436
489
  sortable: !0,
437
- exportable: z?.export,
438
- rowActions: Y,
439
- resizableColumns: t.resizable ?? t.resizableColumns ?? !0,
440
- reorderableColumns: t.reorderableColumns ?? !1,
441
- className: t.className,
442
- onSelectionChange: n,
443
- onRowClick: i
444
- };
445
- return /* @__PURE__ */ v.jsx(ve, { schema: K });
490
+ exportable: W?.export,
491
+ rowActions: X,
492
+ resizableColumns: n.resizable ?? n.resizableColumns ?? !0,
493
+ reorderableColumns: n.reorderableColumns ?? !1,
494
+ editable: n.editable ?? !1,
495
+ className: n.className,
496
+ onSelectionChange: t,
497
+ onRowClick: M.handleClick,
498
+ onCellChange: o,
499
+ onRowSave: l,
500
+ onBatchSave: p
501
+ }, G = n.label ? `${n.label} Detail` : n.objectName ? `${n.objectName.charAt(0).toUpperCase() + n.objectName.slice(1)} Detail` : "Record Detail";
502
+ return M.isOverlay && M.mode === "split" ? /* @__PURE__ */ u.jsx(
503
+ fe,
504
+ {
505
+ ...M,
506
+ title: G,
507
+ mainContent: /* @__PURE__ */ u.jsx(ce, { schema: Y }),
508
+ children: (f) => /* @__PURE__ */ u.jsx("div", { className: "space-y-3", children: Object.entries(f).map(([y, A]) => /* @__PURE__ */ u.jsxs("div", { className: "flex flex-col", children: [
509
+ /* @__PURE__ */ u.jsx("span", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: y.replace(/_/g, " ") }),
510
+ /* @__PURE__ */ u.jsx("span", { className: "text-sm", children: String(A ?? "—") })
511
+ ] }, y)) })
512
+ }
513
+ ) : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
514
+ /* @__PURE__ */ u.jsx(ce, { schema: Y }),
515
+ M.isOverlay && /* @__PURE__ */ u.jsx(
516
+ fe,
517
+ {
518
+ ...M,
519
+ title: G,
520
+ children: (f) => /* @__PURE__ */ u.jsx("div", { className: "space-y-3", children: Object.entries(f).map(([y, A]) => /* @__PURE__ */ u.jsxs("div", { className: "flex flex-col", children: [
521
+ /* @__PURE__ */ u.jsx("span", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: y.replace(/_/g, " ") }),
522
+ /* @__PURE__ */ u.jsx("span", { className: "text-sm", children: String(A ?? "—") })
523
+ ] }, y)) })
524
+ }
525
+ )
526
+ ] });
446
527
  };
447
- function D(t, a, e) {
448
- let s = e.initialDeps ?? [], n, i = !0;
528
+ function H(n, a, e) {
529
+ let s = e.initialDeps ?? [], t, i = !0;
449
530
  function o() {
450
- var l, f, b;
451
- let d;
452
- e.key && ((l = e.debug) != null && l.call(e)) && (d = Date.now());
453
- const S = t();
454
- if (!(S.length !== s.length || S.some((C, g) => s[g] !== C)))
455
- return n;
456
- s = S;
531
+ var l, p, g;
457
532
  let m;
458
- if (e.key && ((f = e.debug) != null && f.call(e)) && (m = Date.now()), n = a(...S), e.key && ((b = e.debug) != null && b.call(e))) {
459
- const C = Math.round((Date.now() - d) * 100) / 100, g = Math.round((Date.now() - m) * 100) / 100, _ = g / 16, T = (p, j) => {
460
- for (p = String(p); p.length < j; )
461
- p = " " + p;
462
- return p;
533
+ e.key && ((l = e.debug) != null && l.call(e)) && (m = Date.now());
534
+ const E = n();
535
+ if (!(E.length !== s.length || E.some((_, v) => s[v] !== _)))
536
+ return t;
537
+ s = E;
538
+ let b;
539
+ if (e.key && ((p = e.debug) != null && p.call(e)) && (b = Date.now()), t = a(...E), e.key && ((g = e.debug) != null && g.call(e))) {
540
+ const _ = Math.round((Date.now() - m) * 100) / 100, v = Math.round((Date.now() - b) * 100) / 100, j = v / 16, N = (O, D) => {
541
+ for (O = String(O); O.length < D; )
542
+ O = " " + O;
543
+ return O;
463
544
  };
464
545
  console.info(
465
- `%c⏱ ${T(g, 5)} /${T(C, 5)} ms`,
546
+ `%c⏱ ${N(v, 5)} /${N(_, 5)} ms`,
466
547
  `
467
548
  font-size: .6rem;
468
549
  font-weight: bold;
469
550
  color: hsl(${Math.max(
470
551
  0,
471
- Math.min(120 - 120 * _, 120)
552
+ Math.min(120 - 120 * j, 120)
472
553
  )}deg 100% 31%);`,
473
554
  e?.key
474
555
  );
475
556
  }
476
- return e?.onChange && !(i && e.skipInitialOnChange) && e.onChange(n), i = !1, n;
557
+ return e?.onChange && !(i && e.skipInitialOnChange) && e.onChange(t), i = !1, t;
477
558
  }
478
559
  return o.updateDeps = (l) => {
479
560
  s = l;
480
561
  }, o;
481
562
  }
482
- function oe(t, a) {
483
- if (t === void 0)
563
+ function be(n, a) {
564
+ if (n === void 0)
484
565
  throw new Error("Unexpected undefined");
485
- return t;
566
+ return n;
486
567
  }
487
- const Ne = (t, a) => Math.abs(t - a) < 1.01, Ie = (t, a, e) => {
568
+ const qe = (n, a) => Math.abs(n - a) < 1.01, Be = (n, a, e) => {
488
569
  let s;
489
- return function(...n) {
490
- t.clearTimeout(s), s = t.setTimeout(() => a.apply(this, n), e);
570
+ return function(...t) {
571
+ n.clearTimeout(s), s = n.setTimeout(() => a.apply(this, t), e);
491
572
  };
492
- }, le = (t) => {
493
- const { offsetWidth: a, offsetHeight: e } = t;
573
+ }, ve = (n) => {
574
+ const { offsetWidth: a, offsetHeight: e } = n;
494
575
  return { width: a, height: e };
495
- }, De = (t) => t, Fe = (t) => {
496
- const a = Math.max(t.startIndex - t.overscan, 0), e = Math.min(t.endIndex + t.overscan, t.count - 1), s = [];
497
- for (let n = a; n <= e; n++)
498
- s.push(n);
576
+ }, Ge = (n) => n, He = (n) => {
577
+ const a = Math.max(n.startIndex - n.overscan, 0), e = Math.min(n.endIndex + n.overscan, n.count - 1), s = [];
578
+ for (let t = a; t <= e; t++)
579
+ s.push(t);
499
580
  return s;
500
- }, Pe = (t, a) => {
501
- const e = t.scrollElement;
581
+ }, Je = (n, a) => {
582
+ const e = n.scrollElement;
502
583
  if (!e)
503
584
  return;
504
- const s = t.targetWindow;
585
+ const s = n.targetWindow;
505
586
  if (!s)
506
587
  return;
507
- const n = (o) => {
508
- const { width: l, height: f } = o;
509
- a({ width: Math.round(l), height: Math.round(f) });
588
+ const t = (o) => {
589
+ const { width: l, height: p } = o;
590
+ a({ width: Math.round(l), height: Math.round(p) });
510
591
  };
511
- if (n(le(e)), !s.ResizeObserver)
592
+ if (t(ve(e)), !s.ResizeObserver)
512
593
  return () => {
513
594
  };
514
595
  const i = new s.ResizeObserver((o) => {
515
596
  const l = () => {
516
- const f = o[0];
517
- if (f?.borderBoxSize) {
518
- const b = f.borderBoxSize[0];
519
- if (b) {
520
- n({ width: b.inlineSize, height: b.blockSize });
597
+ const p = o[0];
598
+ if (p?.borderBoxSize) {
599
+ const g = p.borderBoxSize[0];
600
+ if (g) {
601
+ t({ width: g.inlineSize, height: g.blockSize });
521
602
  return;
522
603
  }
523
604
  }
524
- n(le(e));
605
+ t(ve(e));
525
606
  };
526
- t.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(l) : l();
607
+ n.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(l) : l();
527
608
  });
528
609
  return i.observe(e, { box: "border-box" }), () => {
529
610
  i.unobserve(e);
530
611
  };
531
- }, ae = {
612
+ }, xe = {
532
613
  passive: !0
533
- }, ce = typeof window > "u" ? !0 : "onscrollend" in window, $e = (t, a) => {
534
- const e = t.scrollElement;
614
+ }, ye = typeof window > "u" ? !0 : "onscrollend" in window, Ke = (n, a) => {
615
+ const e = n.scrollElement;
535
616
  if (!e)
536
617
  return;
537
- const s = t.targetWindow;
618
+ const s = n.targetWindow;
538
619
  if (!s)
539
620
  return;
540
- let n = 0;
541
- const i = t.options.useScrollendEvent && ce ? () => {
542
- } : Ie(
621
+ let t = 0;
622
+ const i = n.options.useScrollendEvent && ye ? () => {
623
+ } : Be(
543
624
  s,
544
625
  () => {
545
- a(n, !1);
626
+ a(t, !1);
546
627
  },
547
- t.options.isScrollingResetDelay
548
- ), o = (d) => () => {
549
- const { horizontal: S, isRtl: c } = t.options;
550
- n = S ? e.scrollLeft * (c && -1 || 1) : e.scrollTop, i(), a(n, d);
551
- }, l = o(!0), f = o(!1);
552
- e.addEventListener("scroll", l, ae);
553
- const b = t.options.useScrollendEvent && ce;
554
- return b && e.addEventListener("scrollend", f, ae), () => {
555
- e.removeEventListener("scroll", l), b && e.removeEventListener("scrollend", f);
628
+ n.options.isScrollingResetDelay
629
+ ), o = (m) => () => {
630
+ const { horizontal: E, isRtl: c } = n.options;
631
+ t = E ? e.scrollLeft * (c && -1 || 1) : e.scrollTop, i(), a(t, m);
632
+ }, l = o(!0), p = o(!1);
633
+ e.addEventListener("scroll", l, xe);
634
+ const g = n.options.useScrollendEvent && ye;
635
+ return g && e.addEventListener("scrollend", p, xe), () => {
636
+ e.removeEventListener("scroll", l), g && e.removeEventListener("scrollend", p);
556
637
  };
557
- }, We = (t, a, e) => {
638
+ }, Xe = (n, a, e) => {
558
639
  if (a?.borderBoxSize) {
559
640
  const s = a.borderBoxSize[0];
560
641
  if (s)
@@ -562,24 +643,24 @@ const Ne = (t, a) => Math.abs(t - a) < 1.01, Ie = (t, a, e) => {
562
643
  s[e.options.horizontal ? "inlineSize" : "blockSize"]
563
644
  );
564
645
  }
565
- return t[e.options.horizontal ? "offsetWidth" : "offsetHeight"];
566
- }, Le = (t, {
646
+ return n[e.options.horizontal ? "offsetWidth" : "offsetHeight"];
647
+ }, Ze = (n, {
567
648
  adjustments: a = 0,
568
649
  behavior: e
569
650
  }, s) => {
570
- var n, i;
571
- const o = t + a;
572
- (i = (n = s.scrollElement) == null ? void 0 : n.scrollTo) == null || i.call(n, {
651
+ var t, i;
652
+ const o = n + a;
653
+ (i = (t = s.scrollElement) == null ? void 0 : t.scrollTo) == null || i.call(t, {
573
654
  [s.options.horizontal ? "left" : "top"]: o,
574
655
  behavior: e
575
656
  });
576
657
  };
577
- class Ve {
658
+ class Qe {
578
659
  constructor(a) {
579
660
  this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.currentScrollToIndex = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
580
661
  let e = null;
581
- const s = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((n) => {
582
- n.forEach((i) => {
662
+ const s = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((t) => {
663
+ t.forEach((i) => {
583
664
  const o = () => {
584
665
  this._measureElement(i.target, i);
585
666
  };
@@ -588,21 +669,21 @@ class Ve {
588
669
  }));
589
670
  return {
590
671
  disconnect: () => {
591
- var n;
592
- (n = s()) == null || n.disconnect(), e = null;
672
+ var t;
673
+ (t = s()) == null || t.disconnect(), e = null;
593
674
  },
594
- observe: (n) => {
675
+ observe: (t) => {
595
676
  var i;
596
- return (i = s()) == null ? void 0 : i.observe(n, { box: "border-box" });
677
+ return (i = s()) == null ? void 0 : i.observe(t, { box: "border-box" });
597
678
  },
598
- unobserve: (n) => {
679
+ unobserve: (t) => {
599
680
  var i;
600
- return (i = s()) == null ? void 0 : i.unobserve(n);
681
+ return (i = s()) == null ? void 0 : i.unobserve(t);
601
682
  }
602
683
  };
603
684
  })(), this.range = null, this.setOptions = (e) => {
604
- Object.entries(e).forEach(([s, n]) => {
605
- typeof n > "u" && delete e[s];
685
+ Object.entries(e).forEach(([s, t]) => {
686
+ typeof t > "u" && delete e[s];
606
687
  }), this.options = {
607
688
  debug: !1,
608
689
  initialOffset: 0,
@@ -612,11 +693,11 @@ class Ve {
612
693
  scrollPaddingStart: 0,
613
694
  scrollPaddingEnd: 0,
614
695
  horizontal: !1,
615
- getItemKey: De,
616
- rangeExtractor: Fe,
696
+ getItemKey: Ge,
697
+ rangeExtractor: He,
617
698
  onChange: () => {
618
699
  },
619
- measureElement: We,
700
+ measureElement: Xe,
620
701
  initialRect: { width: 0, height: 0 },
621
702
  scrollMargin: 0,
622
703
  gap: 0,
@@ -631,9 +712,9 @@ class Ve {
631
712
  ...e
632
713
  };
633
714
  }, this.notify = (e) => {
634
- var s, n;
635
- (n = (s = this.options).onChange) == null || n.call(s, this, e);
636
- }, this.maybeNotify = D(
715
+ var s, t;
716
+ (t = (s = this.options).onChange) == null || t.call(s, this, e);
717
+ }, this.maybeNotify = H(
637
718
  () => (this.calculateRange(), [
638
719
  this.isScrolling,
639
720
  this.range ? this.range.startIndex : null,
@@ -663,15 +744,15 @@ class Ve {
663
744
  this.maybeNotify();
664
745
  return;
665
746
  }
666
- this.scrollElement = s, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((e = this.scrollElement) == null ? void 0 : e.window) ?? null, this.elementsCache.forEach((n) => {
667
- this.observer.observe(n);
747
+ this.scrollElement = s, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((e = this.scrollElement) == null ? void 0 : e.window) ?? null, this.elementsCache.forEach((t) => {
748
+ this.observer.observe(t);
668
749
  }), this.unsubs.push(
669
- this.options.observeElementRect(this, (n) => {
670
- this.scrollRect = n, this.maybeNotify();
750
+ this.options.observeElementRect(this, (t) => {
751
+ this.scrollRect = t, this.maybeNotify();
671
752
  })
672
753
  ), this.unsubs.push(
673
- this.options.observeElementOffset(this, (n, i) => {
674
- this.scrollAdjustments = 0, this.scrollDirection = i ? this.getScrollOffset() < n ? "forward" : "backward" : null, this.scrollOffset = n, this.isScrolling = i, this.maybeNotify();
754
+ this.options.observeElementOffset(this, (t, i) => {
755
+ this.scrollAdjustments = 0, this.scrollDirection = i ? this.getScrollOffset() < t ? "forward" : "backward" : null, this.scrollOffset = t, this.isScrolling = i, this.maybeNotify();
675
756
  })
676
757
  ), this._scrollToOffset(this.getScrollOffset(), {
677
758
  adjustments: void 0,
@@ -679,19 +760,19 @@ class Ve {
679
760
  });
680
761
  }
681
762
  }, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, s) => {
682
- const n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
763
+ const t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
683
764
  for (let o = s - 1; o >= 0; o--) {
684
765
  const l = e[o];
685
- if (n.has(l.lane))
766
+ if (t.has(l.lane))
686
767
  continue;
687
- const f = i.get(
768
+ const p = i.get(
688
769
  l.lane
689
770
  );
690
- if (f == null || l.end > f.end ? i.set(l.lane, l) : l.end < f.end && n.set(l.lane, !0), n.size === this.options.lanes)
771
+ if (p == null || l.end > p.end ? i.set(l.lane, l) : l.end < p.end && t.set(l.lane, !0), t.size === this.options.lanes)
691
772
  break;
692
773
  }
693
774
  return i.size === this.options.lanes ? Array.from(i.values()).sort((o, l) => o.end === l.end ? o.index - l.index : o.end - l.end)[0] : void 0;
694
- }, this.getMeasurementOptions = D(
775
+ }, this.getMeasurementOptions = H(
695
776
  () => [
696
777
  this.options.count,
697
778
  this.options.paddingStart,
@@ -700,10 +781,10 @@ class Ve {
700
781
  this.options.enabled,
701
782
  this.options.lanes
702
783
  ],
703
- (e, s, n, i, o, l) => (this.prevLanes !== void 0 && this.prevLanes !== l && (this.lanesChangedFlag = !0), this.prevLanes = l, this.pendingMeasuredCacheIndexes = [], {
784
+ (e, s, t, i, o, l) => (this.prevLanes !== void 0 && this.prevLanes !== l && (this.lanesChangedFlag = !0), this.prevLanes = l, this.pendingMeasuredCacheIndexes = [], {
704
785
  count: e,
705
786
  paddingStart: s,
706
- scrollMargin: n,
787
+ scrollMargin: t,
707
788
  getItemKey: i,
708
789
  enabled: o,
709
790
  lanes: l
@@ -711,9 +792,9 @@ class Ve {
711
792
  {
712
793
  key: !1
713
794
  }
714
- ), this.getMeasurements = D(
795
+ ), this.getMeasurements = H(
715
796
  () => [this.getMeasurementOptions(), this.itemSizeCache],
716
- ({ count: e, paddingStart: s, scrollMargin: n, getItemKey: i, enabled: o, lanes: l }, f) => {
797
+ ({ count: e, paddingStart: s, scrollMargin: t, getItemKey: i, enabled: o, lanes: l }, p) => {
717
798
  if (!o)
718
799
  return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
719
800
  if (this.laneAssignments.size > e)
@@ -722,64 +803,64 @@ class Ve {
722
803
  this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMeasuredCacheIndexes = []), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((c) => {
723
804
  this.itemSizeCache.set(c.key, c.size);
724
805
  }));
725
- const b = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
806
+ const g = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
726
807
  this.pendingMeasuredCacheIndexes = [], this.lanesSettling && this.measurementsCache.length === e && (this.lanesSettling = !1);
727
- const d = this.measurementsCache.slice(0, b), S = new Array(l).fill(
808
+ const m = this.measurementsCache.slice(0, g), E = new Array(l).fill(
728
809
  void 0
729
810
  );
730
- for (let c = 0; c < b; c++) {
731
- const m = d[c];
732
- m && (S[m.lane] = c);
811
+ for (let c = 0; c < g; c++) {
812
+ const b = m[c];
813
+ b && (E[b.lane] = c);
733
814
  }
734
- for (let c = b; c < e; c++) {
735
- const m = i(c), C = this.laneAssignments.get(c);
736
- let g, _;
737
- if (C !== void 0 && this.options.lanes > 1) {
738
- g = C;
739
- const M = S[g], N = M !== void 0 ? d[M] : void 0;
740
- _ = N ? N.end + this.options.gap : s + n;
815
+ for (let c = g; c < e; c++) {
816
+ const b = i(c), _ = this.laneAssignments.get(c);
817
+ let v, j;
818
+ if (_ !== void 0 && this.options.lanes > 1) {
819
+ v = _;
820
+ const k = E[v], C = k !== void 0 ? m[k] : void 0;
821
+ j = C ? C.end + this.options.gap : s + t;
741
822
  } else {
742
- const M = this.options.lanes === 1 ? d[c - 1] : this.getFurthestMeasurement(d, c);
743
- _ = M ? M.end + this.options.gap : s + n, g = M ? M.lane : c % this.options.lanes, this.options.lanes > 1 && this.laneAssignments.set(c, g);
823
+ const k = this.options.lanes === 1 ? m[c - 1] : this.getFurthestMeasurement(m, c);
824
+ j = k ? k.end + this.options.gap : s + t, v = k ? k.lane : c % this.options.lanes, this.options.lanes > 1 && this.laneAssignments.set(c, v);
744
825
  }
745
- const T = f.get(m), p = typeof T == "number" ? T : this.options.estimateSize(c), j = _ + p;
746
- d[c] = {
826
+ const N = p.get(b), O = typeof N == "number" ? N : this.options.estimateSize(c), D = j + O;
827
+ m[c] = {
747
828
  index: c,
748
- start: _,
749
- size: p,
750
- end: j,
751
- key: m,
752
- lane: g
753
- }, S[g] = c;
829
+ start: j,
830
+ size: O,
831
+ end: D,
832
+ key: b,
833
+ lane: v
834
+ }, E[v] = c;
754
835
  }
755
- return this.measurementsCache = d, d;
836
+ return this.measurementsCache = m, m;
756
837
  },
757
838
  {
758
839
  key: process.env.NODE_ENV !== "production" && "getMeasurements",
759
840
  debug: () => this.options.debug
760
841
  }
761
- ), this.calculateRange = D(
842
+ ), this.calculateRange = H(
762
843
  () => [
763
844
  this.getMeasurements(),
764
845
  this.getSize(),
765
846
  this.getScrollOffset(),
766
847
  this.options.lanes
767
848
  ],
768
- (e, s, n, i) => this.range = e.length > 0 && s > 0 ? Ye({
849
+ (e, s, t, i) => this.range = e.length > 0 && s > 0 ? et({
769
850
  measurements: e,
770
851
  outerSize: s,
771
- scrollOffset: n,
852
+ scrollOffset: t,
772
853
  lanes: i
773
854
  }) : null,
774
855
  {
775
856
  key: process.env.NODE_ENV !== "production" && "calculateRange",
776
857
  debug: () => this.options.debug
777
858
  }
778
- ), this.getVirtualIndexes = D(
859
+ ), this.getVirtualIndexes = H(
779
860
  () => {
780
861
  let e = null, s = null;
781
- const n = this.calculateRange();
782
- return n && (e = n.startIndex, s = n.endIndex), this.maybeNotify.updateDeps([this.isScrolling, e, s]), [
862
+ const t = this.calculateRange();
863
+ return t && (e = t.startIndex, s = t.endIndex), this.maybeNotify.updateDeps([this.isScrolling, e, s]), [
783
864
  this.options.rangeExtractor,
784
865
  this.options.overscan,
785
866
  this.options.count,
@@ -787,53 +868,53 @@ class Ve {
787
868
  s
788
869
  ];
789
870
  },
790
- (e, s, n, i, o) => i === null || o === null ? [] : e({
871
+ (e, s, t, i, o) => i === null || o === null ? [] : e({
791
872
  startIndex: i,
792
873
  endIndex: o,
793
874
  overscan: s,
794
- count: n
875
+ count: t
795
876
  }),
796
877
  {
797
878
  key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
798
879
  debug: () => this.options.debug
799
880
  }
800
881
  ), this.indexFromElement = (e) => {
801
- const s = this.options.indexAttribute, n = e.getAttribute(s);
802
- return n ? parseInt(n, 10) : (console.warn(
882
+ const s = this.options.indexAttribute, t = e.getAttribute(s);
883
+ return t ? parseInt(t, 10) : (console.warn(
803
884
  `Missing attribute name '${s}={index}' on measured element.`
804
885
  ), -1);
805
886
  }, this._measureElement = (e, s) => {
806
- const n = this.indexFromElement(e), i = this.measurementsCache[n];
887
+ const t = this.indexFromElement(e), i = this.measurementsCache[t];
807
888
  if (!i)
808
889
  return;
809
890
  const o = i.key, l = this.elementsCache.get(o);
810
- l !== e && (l && this.observer.unobserve(l), this.observer.observe(e), this.elementsCache.set(o, e)), e.isConnected && this.resizeItem(n, this.options.measureElement(e, s, this));
891
+ l !== e && (l && this.observer.unobserve(l), this.observer.observe(e), this.elementsCache.set(o, e)), e.isConnected && this.resizeItem(t, this.options.measureElement(e, s, this));
811
892
  }, this.resizeItem = (e, s) => {
812
- const n = this.measurementsCache[e];
813
- if (!n)
893
+ const t = this.measurementsCache[e];
894
+ if (!t)
814
895
  return;
815
- const i = this.itemSizeCache.get(n.key) ?? n.size, o = s - i;
816
- o !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(n, o, this) : n.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", o), this._scrollToOffset(this.getScrollOffset(), {
896
+ const i = this.itemSizeCache.get(t.key) ?? t.size, o = s - i;
897
+ o !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(t, o, this) : t.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", o), this._scrollToOffset(this.getScrollOffset(), {
817
898
  adjustments: this.scrollAdjustments += o,
818
899
  behavior: void 0
819
- })), this.pendingMeasuredCacheIndexes.push(n.index), this.itemSizeCache = new Map(this.itemSizeCache.set(n.key, s)), this.notify(!1));
900
+ })), this.pendingMeasuredCacheIndexes.push(t.index), this.itemSizeCache = new Map(this.itemSizeCache.set(t.key, s)), this.notify(!1));
820
901
  }, this.measureElement = (e) => {
821
902
  if (!e) {
822
- this.elementsCache.forEach((s, n) => {
823
- s.isConnected || (this.observer.unobserve(s), this.elementsCache.delete(n));
903
+ this.elementsCache.forEach((s, t) => {
904
+ s.isConnected || (this.observer.unobserve(s), this.elementsCache.delete(t));
824
905
  });
825
906
  return;
826
907
  }
827
908
  this._measureElement(e, void 0);
828
- }, this.getVirtualItems = D(
909
+ }, this.getVirtualItems = H(
829
910
  () => [this.getVirtualIndexes(), this.getMeasurements()],
830
911
  (e, s) => {
831
- const n = [];
912
+ const t = [];
832
913
  for (let i = 0, o = e.length; i < o; i++) {
833
- const l = e[i], f = s[l];
834
- n.push(f);
914
+ const l = e[i], p = s[l];
915
+ t.push(p);
835
916
  }
836
- return n;
917
+ return t;
837
918
  },
838
919
  {
839
920
  key: process.env.NODE_ENV !== "production" && "getVirtualItems",
@@ -842,11 +923,11 @@ class Ve {
842
923
  ), this.getVirtualItemForOffset = (e) => {
843
924
  const s = this.getMeasurements();
844
925
  if (s.length !== 0)
845
- return oe(
846
- s[he(
926
+ return be(
927
+ s[je(
847
928
  0,
848
929
  s.length - 1,
849
- (n) => oe(s[n]).start,
930
+ (t) => be(s[t]).start,
850
931
  e
851
932
  )]
852
933
  );
@@ -858,66 +939,66 @@ class Ve {
858
939
  const e = this.scrollElement.document.documentElement;
859
940
  return this.options.horizontal ? e.scrollWidth - this.scrollElement.innerWidth : e.scrollHeight - this.scrollElement.innerHeight;
860
941
  }
861
- }, this.getOffsetForAlignment = (e, s, n = 0) => {
942
+ }, this.getOffsetForAlignment = (e, s, t = 0) => {
862
943
  if (!this.scrollElement) return 0;
863
944
  const i = this.getSize(), o = this.getScrollOffset();
864
- s === "auto" && (s = e >= o + i ? "end" : "start"), s === "center" ? e += (n - i) / 2 : s === "end" && (e -= i);
945
+ s === "auto" && (s = e >= o + i ? "end" : "start"), s === "center" ? e += (t - i) / 2 : s === "end" && (e -= i);
865
946
  const l = this.getMaxScrollOffset();
866
947
  return Math.max(Math.min(l, e), 0);
867
948
  }, this.getOffsetForIndex = (e, s = "auto") => {
868
949
  e = Math.max(0, Math.min(e, this.options.count - 1));
869
- const n = this.measurementsCache[e];
870
- if (!n)
950
+ const t = this.measurementsCache[e];
951
+ if (!t)
871
952
  return;
872
953
  const i = this.getSize(), o = this.getScrollOffset();
873
954
  if (s === "auto")
874
- if (n.end >= o + i - this.options.scrollPaddingEnd)
955
+ if (t.end >= o + i - this.options.scrollPaddingEnd)
875
956
  s = "end";
876
- else if (n.start <= o + this.options.scrollPaddingStart)
957
+ else if (t.start <= o + this.options.scrollPaddingStart)
877
958
  s = "start";
878
959
  else
879
960
  return [o, s];
880
961
  if (s === "end" && e === this.options.count - 1)
881
962
  return [this.getMaxScrollOffset(), s];
882
- const l = s === "end" ? n.end + this.options.scrollPaddingEnd : n.start - this.options.scrollPaddingStart;
963
+ const l = s === "end" ? t.end + this.options.scrollPaddingEnd : t.start - this.options.scrollPaddingStart;
883
964
  return [
884
- this.getOffsetForAlignment(l, s, n.size),
965
+ this.getOffsetForAlignment(l, s, t.size),
885
966
  s
886
967
  ];
887
- }, this.isDynamicMode = () => this.elementsCache.size > 0, this.scrollToOffset = (e, { align: s = "start", behavior: n } = {}) => {
888
- n === "smooth" && this.isDynamicMode() && console.warn(
968
+ }, this.isDynamicMode = () => this.elementsCache.size > 0, this.scrollToOffset = (e, { align: s = "start", behavior: t } = {}) => {
969
+ t === "smooth" && this.isDynamicMode() && console.warn(
889
970
  "The `smooth` scroll behavior is not fully supported with dynamic size."
890
971
  ), this._scrollToOffset(this.getOffsetForAlignment(e, s), {
891
972
  adjustments: void 0,
892
- behavior: n
973
+ behavior: t
893
974
  });
894
- }, this.scrollToIndex = (e, { align: s = "auto", behavior: n } = {}) => {
895
- n === "smooth" && this.isDynamicMode() && console.warn(
975
+ }, this.scrollToIndex = (e, { align: s = "auto", behavior: t } = {}) => {
976
+ t === "smooth" && this.isDynamicMode() && console.warn(
896
977
  "The `smooth` scroll behavior is not fully supported with dynamic size."
897
978
  ), e = Math.max(0, Math.min(e, this.options.count - 1)), this.currentScrollToIndex = e;
898
979
  let i = 0;
899
- const o = 10, l = (b) => {
980
+ const o = 10, l = (g) => {
900
981
  if (!this.targetWindow) return;
901
- const d = this.getOffsetForIndex(e, b);
902
- if (!d) {
982
+ const m = this.getOffsetForIndex(e, g);
983
+ if (!m) {
903
984
  console.warn("Failed to get offset for index:", e);
904
985
  return;
905
986
  }
906
- const [S, c] = d;
907
- this._scrollToOffset(S, { adjustments: void 0, behavior: n }), this.targetWindow.requestAnimationFrame(() => {
908
- const m = () => {
987
+ const [E, c] = m;
988
+ this._scrollToOffset(E, { adjustments: void 0, behavior: t }), this.targetWindow.requestAnimationFrame(() => {
989
+ const b = () => {
909
990
  if (this.currentScrollToIndex !== e) return;
910
- const C = this.getScrollOffset(), g = this.getOffsetForIndex(e, c);
911
- if (!g) {
991
+ const _ = this.getScrollOffset(), v = this.getOffsetForIndex(e, c);
992
+ if (!v) {
912
993
  console.warn("Failed to get offset for index:", e);
913
994
  return;
914
995
  }
915
- Ne(g[0], C) || f(c);
996
+ qe(v[0], _) || p(c);
916
997
  };
917
- this.isDynamicMode() ? this.targetWindow.requestAnimationFrame(m) : m();
998
+ this.isDynamicMode() ? this.targetWindow.requestAnimationFrame(b) : b();
918
999
  });
919
- }, f = (b) => {
920
- this.targetWindow && this.currentScrollToIndex === e && (i++, i < o ? (process.env.NODE_ENV !== "production" && this.options.debug && console.info("Schedule retry", i, o), this.targetWindow.requestAnimationFrame(() => l(b))) : console.warn(
1000
+ }, p = (g) => {
1001
+ this.targetWindow && this.currentScrollToIndex === e && (i++, i < o ? (process.env.NODE_ENV !== "production" && this.options.debug && console.info("Schedule retry", i, o), this.targetWindow.requestAnimationFrame(() => l(g))) : console.warn(
921
1002
  `Failed to scroll to index ${e} after ${o} attempts.`
922
1003
  ));
923
1004
  };
@@ -932,11 +1013,11 @@ class Ve {
932
1013
  }, this.getTotalSize = () => {
933
1014
  var e;
934
1015
  const s = this.getMeasurements();
935
- let n;
1016
+ let t;
936
1017
  if (s.length === 0)
937
- n = this.options.paddingStart;
1018
+ t = this.options.paddingStart;
938
1019
  else if (this.options.lanes === 1)
939
- n = ((e = s[s.length - 1]) == null ? void 0 : e.end) ?? 0;
1020
+ t = ((e = s[s.length - 1]) == null ? void 0 : e.end) ?? 0;
940
1021
  else {
941
1022
  const i = Array(this.options.lanes).fill(null);
942
1023
  let o = s.length - 1;
@@ -944,152 +1025,152 @@ class Ve {
944
1025
  const l = s[o];
945
1026
  i[l.lane] === null && (i[l.lane] = l.end), o--;
946
1027
  }
947
- n = Math.max(...i.filter((l) => l !== null));
1028
+ t = Math.max(...i.filter((l) => l !== null));
948
1029
  }
949
1030
  return Math.max(
950
- n - this.options.scrollMargin + this.options.paddingEnd,
1031
+ t - this.options.scrollMargin + this.options.paddingEnd,
951
1032
  0
952
1033
  );
953
1034
  }, this._scrollToOffset = (e, {
954
1035
  adjustments: s,
955
- behavior: n
1036
+ behavior: t
956
1037
  }) => {
957
- this.options.scrollToFn(e, { behavior: n, adjustments: s }, this);
1038
+ this.options.scrollToFn(e, { behavior: t, adjustments: s }, this);
958
1039
  }, this.measure = () => {
959
1040
  this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.notify(!1);
960
1041
  }, this.setOptions(a);
961
1042
  }
962
1043
  }
963
- const he = (t, a, e, s) => {
964
- for (; t <= a; ) {
965
- const n = (t + a) / 2 | 0, i = e(n);
1044
+ const je = (n, a, e, s) => {
1045
+ for (; n <= a; ) {
1046
+ const t = (n + a) / 2 | 0, i = e(t);
966
1047
  if (i < s)
967
- t = n + 1;
1048
+ n = t + 1;
968
1049
  else if (i > s)
969
- a = n - 1;
1050
+ a = t - 1;
970
1051
  else
971
- return n;
1052
+ return t;
972
1053
  }
973
- return t > 0 ? t - 1 : 0;
1054
+ return n > 0 ? n - 1 : 0;
974
1055
  };
975
- function Ye({
976
- measurements: t,
1056
+ function et({
1057
+ measurements: n,
977
1058
  outerSize: a,
978
1059
  scrollOffset: e,
979
1060
  lanes: s
980
1061
  }) {
981
- const n = t.length - 1, i = (f) => t[f].start;
982
- if (t.length <= s)
1062
+ const t = n.length - 1, i = (p) => n[p].start;
1063
+ if (n.length <= s)
983
1064
  return {
984
1065
  startIndex: 0,
985
- endIndex: n
1066
+ endIndex: t
986
1067
  };
987
- let o = he(
1068
+ let o = je(
988
1069
  0,
989
- n,
1070
+ t,
990
1071
  i,
991
1072
  e
992
1073
  ), l = o;
993
1074
  if (s === 1)
994
- for (; l < n && t[l].end < e + a; )
1075
+ for (; l < t && n[l].end < e + a; )
995
1076
  l++;
996
1077
  else if (s > 1) {
997
- const f = Array(s).fill(0);
998
- for (; l < n && f.some((d) => d < e + a); ) {
999
- const d = t[l];
1000
- f[d.lane] = d.end, l++;
1078
+ const p = Array(s).fill(0);
1079
+ for (; l < t && p.some((m) => m < e + a); ) {
1080
+ const m = n[l];
1081
+ p[m.lane] = m.end, l++;
1001
1082
  }
1002
- const b = Array(s).fill(e + a);
1003
- for (; o >= 0 && b.some((d) => d >= e); ) {
1004
- const d = t[o];
1005
- b[d.lane] = d.start, o--;
1083
+ const g = Array(s).fill(e + a);
1084
+ for (; o >= 0 && g.some((m) => m >= e); ) {
1085
+ const m = n[o];
1086
+ g[m.lane] = m.start, o--;
1006
1087
  }
1007
- o = Math.max(0, o - o % s), l = Math.min(n, l + (s - 1 - l % s));
1088
+ o = Math.max(0, o - o % s), l = Math.min(t, l + (s - 1 - l % s));
1008
1089
  }
1009
1090
  return { startIndex: o, endIndex: l };
1010
1091
  }
1011
- const ue = typeof document < "u" ? H.useLayoutEffect : H.useEffect;
1012
- function Ue({
1013
- useFlushSync: t = !0,
1092
+ const Ee = typeof document < "u" ? le.useLayoutEffect : le.useEffect;
1093
+ function tt({
1094
+ useFlushSync: n = !0,
1014
1095
  ...a
1015
1096
  }) {
1016
- const e = H.useReducer(() => ({}), {})[1], s = {
1097
+ const e = le.useReducer(() => ({}), {})[1], s = {
1017
1098
  ...a,
1018
1099
  onChange: (i, o) => {
1019
1100
  var l;
1020
- t && o ? Re(e) : e(), (l = a.onChange) == null || l.call(a, i, o);
1101
+ n && o ? $e(e) : e(), (l = a.onChange) == null || l.call(a, i, o);
1021
1102
  }
1022
- }, [n] = H.useState(
1023
- () => new Ve(s)
1103
+ }, [t] = le.useState(
1104
+ () => new Qe(s)
1024
1105
  );
1025
- return n.setOptions(s), ue(() => n._didMount(), []), ue(() => n._willUpdate()), n;
1106
+ return t.setOptions(s), Ee(() => t._didMount(), []), Ee(() => t._willUpdate()), t;
1026
1107
  }
1027
- function qe(t) {
1028
- return Ue({
1029
- observeElementRect: Pe,
1030
- observeElementOffset: $e,
1031
- scrollToFn: Le,
1032
- ...t
1108
+ function nt(n) {
1109
+ return tt({
1110
+ observeElementRect: Je,
1111
+ observeElementOffset: Ke,
1112
+ scrollToFn: Ze,
1113
+ ...n
1033
1114
  });
1034
1115
  }
1035
- const Qe = ({
1036
- data: t,
1116
+ const ut = ({
1117
+ data: n,
1037
1118
  columns: a,
1038
1119
  rowHeight: e = 40,
1039
1120
  height: s = 600,
1040
- className: n = "",
1121
+ className: t = "",
1041
1122
  headerClassName: i = "",
1042
1123
  rowClassName: o,
1043
1124
  onRowClick: l,
1044
- overscan: f = 5
1125
+ overscan: p = 5
1045
1126
  }) => {
1046
- const b = pe(null), d = qe({
1047
- count: t.length,
1048
- getScrollElement: () => b.current,
1127
+ const g = _e(null), m = nt({
1128
+ count: n.length,
1129
+ getScrollElement: () => g.current,
1049
1130
  estimateSize: () => e,
1050
- overscan: f
1051
- }), S = d.getVirtualItems();
1052
- return /* @__PURE__ */ v.jsxs("div", { className: n, children: [
1053
- /* @__PURE__ */ v.jsx(
1131
+ overscan: p
1132
+ }), E = m.getVirtualItems();
1133
+ return /* @__PURE__ */ u.jsxs("div", { className: t, children: [
1134
+ /* @__PURE__ */ u.jsx(
1054
1135
  "div",
1055
1136
  {
1056
1137
  className: `grid border-b sticky top-0 bg-background z-10 ${i}`,
1057
1138
  style: {
1058
1139
  gridTemplateColumns: a.map((c) => c.width || "1fr").join(" ")
1059
1140
  },
1060
- children: a.map((c, m) => /* @__PURE__ */ v.jsx(
1141
+ children: a.map((c, b) => /* @__PURE__ */ u.jsx(
1061
1142
  "div",
1062
1143
  {
1063
1144
  className: `px-4 py-2 font-semibold text-sm ${c.align === "center" ? "text-center" : c.align === "right" ? "text-right" : "text-left"}`,
1064
1145
  children: c.header
1065
1146
  },
1066
- m
1147
+ b
1067
1148
  ))
1068
1149
  }
1069
1150
  ),
1070
- /* @__PURE__ */ v.jsx(
1151
+ /* @__PURE__ */ u.jsx(
1071
1152
  "div",
1072
1153
  {
1073
- ref: b,
1154
+ ref: g,
1074
1155
  className: "overflow-auto",
1075
1156
  style: {
1076
1157
  height: typeof s == "number" ? `${s}px` : s,
1077
1158
  contain: "strict"
1078
1159
  },
1079
- children: /* @__PURE__ */ v.jsx(
1160
+ children: /* @__PURE__ */ u.jsx(
1080
1161
  "div",
1081
1162
  {
1082
1163
  style: {
1083
- height: `${d.getTotalSize()}px`,
1164
+ height: `${m.getTotalSize()}px`,
1084
1165
  width: "100%",
1085
1166
  position: "relative"
1086
1167
  },
1087
- children: S.map((c) => {
1088
- const m = t[c.index], C = typeof o == "function" ? o(m, c.index) : o || "";
1089
- return /* @__PURE__ */ v.jsx(
1168
+ children: E.map((c) => {
1169
+ const b = n[c.index], _ = typeof o == "function" ? o(b, c.index) : o || "";
1170
+ return /* @__PURE__ */ u.jsx(
1090
1171
  "div",
1091
1172
  {
1092
- className: `grid border-b hover:bg-muted/50 cursor-pointer ${C}`,
1173
+ className: `grid border-b hover:bg-muted/50 cursor-pointer ${_}`,
1093
1174
  style: {
1094
1175
  position: "absolute",
1095
1176
  top: 0,
@@ -1097,18 +1178,18 @@ const Qe = ({
1097
1178
  width: "100%",
1098
1179
  height: `${c.size}px`,
1099
1180
  transform: `translateY(${c.start}px)`,
1100
- gridTemplateColumns: a.map((g) => g.width || "1fr").join(" ")
1181
+ gridTemplateColumns: a.map((v) => v.width || "1fr").join(" ")
1101
1182
  },
1102
- onClick: () => l?.(m, c.index),
1103
- children: a.map((g, _) => {
1104
- const T = m[g.accessorKey], p = g.cell ? g.cell(T, m) : T;
1105
- return /* @__PURE__ */ v.jsx(
1183
+ onClick: () => l?.(b, c.index),
1184
+ children: a.map((v, j) => {
1185
+ const N = b[v.accessorKey], O = v.cell ? v.cell(N, b) : N;
1186
+ return /* @__PURE__ */ u.jsx(
1106
1187
  "div",
1107
1188
  {
1108
- className: `px-4 py-2 text-sm flex items-center ${g.align === "center" ? "text-center justify-center" : g.align === "right" ? "text-right justify-end" : "text-left justify-start"}`,
1109
- children: p
1189
+ className: `px-4 py-2 text-sm flex items-center ${v.align === "center" ? "text-center justify-center" : v.align === "right" ? "text-right justify-end" : "text-left justify-start"}`,
1190
+ children: O
1110
1191
  },
1111
- _
1192
+ j
1112
1193
  );
1113
1194
  })
1114
1195
  },
@@ -1119,30 +1200,40 @@ const Qe = ({
1119
1200
  )
1120
1201
  }
1121
1202
  ),
1122
- /* @__PURE__ */ v.jsxs("div", { className: "px-4 py-2 text-xs text-muted-foreground border-t", children: [
1203
+ /* @__PURE__ */ u.jsxs("div", { className: "px-4 py-2 text-xs text-muted-foreground border-t", children: [
1123
1204
  "Showing ",
1124
- S.length,
1205
+ E.length,
1125
1206
  " of ",
1126
- t.length,
1207
+ n.length,
1127
1208
  " rows (virtual scrolling enabled)"
1128
1209
  ] })
1129
1210
  ] });
1130
- }, me = ({ schema: t, ...a }) => {
1131
- const { dataSource: e } = Ee() || {};
1132
- return /* @__PURE__ */ v.jsx(ke, { schema: t, dataSource: e, ...a });
1211
+ }, Oe = ({ schema: n, ...a }) => {
1212
+ const { dataSource: e } = Ne() || {};
1213
+ return /* @__PURE__ */ u.jsx(Ue, { schema: n, dataSource: e, ...a });
1133
1214
  };
1134
- fe.register("object-grid", me, {
1215
+ we.register("object-grid", Oe, {
1135
1216
  namespace: "plugin-grid",
1136
1217
  label: "Object Grid",
1137
- category: "plugin"
1218
+ category: "plugin",
1219
+ inputs: [
1220
+ { name: "objectName", type: "string", label: "Object Name", required: !0 },
1221
+ { name: "columns", type: "array", label: "Columns" },
1222
+ { name: "filters", type: "array", label: "Filters" }
1223
+ ]
1138
1224
  });
1139
- fe.register("grid", me, {
1225
+ we.register("grid", Oe, {
1140
1226
  namespace: "view",
1141
1227
  label: "Data Grid",
1142
- category: "view"
1228
+ category: "view",
1229
+ inputs: [
1230
+ { name: "objectName", type: "string", label: "Object Name", required: !0 },
1231
+ { name: "columns", type: "array", label: "Columns" },
1232
+ { name: "filters", type: "array", label: "Filters" }
1233
+ ]
1143
1234
  });
1144
1235
  export {
1145
- ke as ObjectGrid,
1146
- me as ObjectGridRenderer,
1147
- Qe as VirtualGrid
1236
+ Ue as ObjectGrid,
1237
+ Oe as ObjectGridRenderer,
1238
+ ut as VirtualGrid
1148
1239
  };