@object-ui/plugin-view 0.3.0 → 0.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.
@@ -0,0 +1,21 @@
1
+
2
+ > @object-ui/plugin-view@0.5.0 build /home/runner/work/objectui/objectui/packages/plugin-view
3
+ > vite build
4
+
5
+ vite v7.3.1 building client environment for production...
6
+ transforming...
7
+ ✓ 11 modules transformed.
8
+ rendering chunks...
9
+ 
10
+ [vite:dts] Start generate declaration files...
11
+ computing gzip size...
12
+ dist/index.js 17.10 kB │ gzip: 5.03 kB
13
+ [vite:dts] Declaration files built in 4664ms.
14
+ 
15
+ No name was provided for external module "@object-ui/core" in "output.globals" – guessing "core".
16
+ No name was provided for external module "@object-ui/plugin-grid" in "output.globals" – guessing "pluginGrid".
17
+ No name was provided for external module "@object-ui/plugin-form" in "output.globals" – guessing "pluginForm".
18
+ No name was provided for external module "@object-ui/components" in "output.globals" – guessing "components".
19
+ No name was provided for external module "lucide-react" in "output.globals" – guessing "lucideReact".
20
+ dist/index.umd.cjs 11.73 kB │ gzip: 4.45 kB
21
+ ✓ built in 5.31s
package/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # @object-ui/plugin-view
2
+
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Maintenance release - Documentation and build improvements
8
+ - Updated dependencies
9
+ - @object-ui/types@0.3.1
10
+ - @object-ui/core@0.3.1
11
+ - @object-ui/react@0.3.1
12
+ - @object-ui/components@0.3.1
13
+ - @object-ui/plugin-grid@0.3.1
14
+ - @object-ui/plugin-form@0.3.1
package/dist/index.js CHANGED
@@ -1,35 +1,35 @@
1
- import ne, { useState as E, useEffect as ae, useCallback as v } from "react";
2
- import { ComponentRegistry as le } from "@object-ui/core";
1
+ import ae, { useState as g, useEffect as le, useCallback as x } from "react";
2
+ import { ComponentRegistry as oe } from "@object-ui/core";
3
3
  import { ObjectGrid as se } from "@object-ui/plugin-grid";
4
4
  import { ObjectForm as K } from "@object-ui/plugin-form";
5
- import { Input as ie, Button as Z, Drawer as ce, DrawerContent as ue, DrawerHeader as fe, DrawerTitle as de, DrawerDescription as me, Dialog as be, DialogContent as pe, DialogHeader as ve, DialogTitle as xe, DialogDescription as je } from "@object-ui/components";
6
- import { Search as we, Filter as _e, X as Re, RefreshCw as Ee, Plus as ge } from "lucide-react";
5
+ import { Input as ie, Button as Z, Drawer as ce, DrawerContent as ue, DrawerHeader as fe, DrawerTitle as de, DrawerDescription as me, Dialog as pe, DialogContent as be, DialogHeader as ve, DialogTitle as we, DialogDescription as xe } from "@object-ui/components";
6
+ import { Search as je, Filter as Re, X as _e, RefreshCw as ge, Plus as Ee } from "lucide-react";
7
7
  var z = { exports: {} }, C = {};
8
8
  var ee;
9
- function he() {
9
+ function Ne() {
10
10
  if (ee) return C;
11
11
  ee = 1;
12
- var r = /* @__PURE__ */ Symbol.for("react.transitional.element"), d = /* @__PURE__ */ Symbol.for("react.fragment");
13
- function R(x, c, u) {
14
- var f = null;
15
- if (u !== void 0 && (f = "" + u), c.key !== void 0 && (f = "" + c.key), "key" in c) {
16
- u = {};
17
- for (var b in c)
18
- b !== "key" && (u[b] = c[b]);
19
- } else u = c;
20
- return c = u.ref, {
12
+ var r = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.fragment");
13
+ function b(m, c, f) {
14
+ var d = null;
15
+ if (f !== void 0 && (d = "" + f), c.key !== void 0 && (d = "" + c.key), "key" in c) {
16
+ f = {};
17
+ for (var v in c)
18
+ v !== "key" && (f[v] = c[v]);
19
+ } else f = c;
20
+ return c = f.ref, {
21
21
  $$typeof: r,
22
- type: x,
23
- key: f,
22
+ type: m,
23
+ key: d,
24
24
  ref: c !== void 0 ? c : null,
25
- props: u
25
+ props: f
26
26
  };
27
27
  }
28
- return C.Fragment = d, C.jsx = R, C.jsxs = R, C;
28
+ return C.Fragment = u, C.jsx = b, C.jsxs = b, C;
29
29
  }
30
30
  var A = {};
31
31
  var re;
32
- function Ne() {
32
+ function Te() {
33
33
  return re || (re = 1, process.env.NODE_ENV !== "production" && (function() {
34
34
  function r(e) {
35
35
  if (e == null) return null;
@@ -39,9 +39,9 @@ function Ne() {
39
39
  switch (e) {
40
40
  case _:
41
41
  return "Fragment";
42
- case p:
42
+ case w:
43
43
  return "Profiler";
44
- case m:
44
+ case p:
45
45
  return "StrictMode";
46
46
  case U:
47
47
  return "Suspense";
@@ -65,7 +65,7 @@ function Ne() {
65
65
  return e = e.displayName, e || (e = t.displayName || t.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
66
66
  case J:
67
67
  return t = e.displayName || null, t !== null ? t : r(e.type) || "Memo";
68
- case T:
68
+ case h:
69
69
  t = e._payload, e = e._init;
70
70
  try {
71
71
  return r(e(t));
@@ -74,12 +74,12 @@ function Ne() {
74
74
  }
75
75
  return null;
76
76
  }
77
- function d(e) {
77
+ function u(e) {
78
78
  return "" + e;
79
79
  }
80
- function R(e) {
80
+ function b(e) {
81
81
  try {
82
- d(e);
82
+ u(e);
83
83
  var t = !1;
84
84
  } catch {
85
85
  t = !0;
@@ -91,12 +91,12 @@ function Ne() {
91
91
  t,
92
92
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
93
93
  l
94
- ), d(e);
94
+ ), u(e);
95
95
  }
96
96
  }
97
- function x(e) {
97
+ function m(e) {
98
98
  if (e === _) return "<>";
99
- if (typeof e == "object" && e !== null && e.$$typeof === T)
99
+ if (typeof e == "object" && e !== null && e.$$typeof === h)
100
100
  return "<...>";
101
101
  try {
102
102
  var t = r(e);
@@ -109,17 +109,17 @@ function Ne() {
109
109
  var e = y.A;
110
110
  return e === null ? null : e.getOwner();
111
111
  }
112
- function u() {
112
+ function f() {
113
113
  return Error("react-stack-top-frame");
114
114
  }
115
- function f(e) {
115
+ function d(e) {
116
116
  if (S.call(e, "key")) {
117
117
  var t = Object.getOwnPropertyDescriptor(e, "key").get;
118
118
  if (t && t.isReactWarning) return !1;
119
119
  }
120
120
  return e.key !== void 0;
121
121
  }
122
- function b(e, t) {
122
+ function v(e, t) {
123
123
  function a() {
124
124
  Y || (Y = !0, console.error(
125
125
  "%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)",
@@ -131,13 +131,13 @@ function Ne() {
131
131
  configurable: !0
132
132
  });
133
133
  }
134
- function h() {
134
+ function N() {
135
135
  var e = r(this.type);
136
- return M[e] || (M[e] = !0, console.error(
136
+ return V[e] || (V[e] = !0, console.error(
137
137
  "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."
138
138
  )), e = this.props.ref, e !== void 0 ? e : null;
139
139
  }
140
- function N(e, t, a, l, V, H) {
140
+ function T(e, t, a, l, M, H) {
141
141
  var s = a.ref;
142
142
  return e = {
143
143
  $$typeof: D,
@@ -147,7 +147,7 @@ function Ne() {
147
147
  _owner: l
148
148
  }, (s !== void 0 ? s : null) !== null ? Object.defineProperty(e, "ref", {
149
149
  enumerable: !1,
150
- get: h
150
+ get: N
151
151
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
152
152
  configurable: !1,
153
153
  enumerable: !1,
@@ -162,7 +162,7 @@ function Ne() {
162
162
  configurable: !1,
163
163
  enumerable: !1,
164
164
  writable: !0,
165
- value: V
165
+ value: M
166
166
  }), Object.defineProperty(e, "_debugTask", {
167
167
  configurable: !1,
168
168
  enumerable: !1,
@@ -170,7 +170,7 @@ function Ne() {
170
170
  value: H
171
171
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
172
172
  }
173
- function j(e, t, a, l, V, H) {
173
+ function j(e, t, a, l, M, H) {
174
174
  var s = t.children;
175
175
  if (s !== void 0)
176
176
  if (l)
@@ -185,10 +185,10 @@ function Ne() {
185
185
  else P(s);
186
186
  if (S.call(t, "key")) {
187
187
  s = r(e);
188
- var g = Object.keys(t).filter(function(oe) {
189
- return oe !== "key";
188
+ var E = Object.keys(t).filter(function(ne) {
189
+ return ne !== "key";
190
190
  });
191
- l = 0 < g.length ? "{key: someKey, " + g.join(": ..., ") + ": ...}" : "{key: someKey}", O[s + l] || (g = 0 < g.length ? "{" + g.join(": ..., ") + ": ...}" : "{}", console.error(
191
+ l = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", O[s + l] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
192
192
  `A props object containing a "key" prop is being spread into JSX:
193
193
  let props = %s;
194
194
  <%s {...props} />
@@ -197,45 +197,45 @@ React keys must be passed directly to JSX without using spread:
197
197
  <%s key={someKey} {...props} />`,
198
198
  l,
199
199
  s,
200
- g,
200
+ E,
201
201
  s
202
202
  ), O[s + l] = !0);
203
203
  }
204
- if (s = null, a !== void 0 && (R(a), s = "" + a), f(t) && (R(t.key), s = "" + t.key), "key" in t) {
204
+ if (s = null, a !== void 0 && (b(a), s = "" + a), d(t) && (b(t.key), s = "" + t.key), "key" in t) {
205
205
  a = {};
206
206
  for (var Q in t)
207
207
  Q !== "key" && (a[Q] = t[Q]);
208
208
  } else a = t;
209
- return s && b(
209
+ return s && v(
210
210
  a,
211
211
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
212
- ), N(
212
+ ), T(
213
213
  e,
214
214
  s,
215
215
  a,
216
216
  c(),
217
- V,
217
+ M,
218
218
  H
219
219
  );
220
220
  }
221
221
  function P(e) {
222
- F(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === T && (e._payload.status === "fulfilled" ? F(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
222
+ F(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === h && (e._payload.status === "fulfilled" ? F(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
223
223
  }
224
224
  function F(e) {
225
225
  return typeof e == "object" && e !== null && e.$$typeof === D;
226
226
  }
227
- var w = ne, D = /* @__PURE__ */ Symbol.for("react.transitional.element"), L = /* @__PURE__ */ Symbol.for("react.portal"), _ = /* @__PURE__ */ Symbol.for("react.fragment"), m = /* @__PURE__ */ Symbol.for("react.strict_mode"), p = /* @__PURE__ */ Symbol.for("react.profiler"), W = /* @__PURE__ */ Symbol.for("react.consumer"), B = /* @__PURE__ */ Symbol.for("react.context"), $ = /* @__PURE__ */ Symbol.for("react.forward_ref"), U = /* @__PURE__ */ Symbol.for("react.suspense"), q = /* @__PURE__ */ Symbol.for("react.suspense_list"), J = /* @__PURE__ */ Symbol.for("react.memo"), T = /* @__PURE__ */ Symbol.for("react.lazy"), G = /* @__PURE__ */ Symbol.for("react.activity"), X = /* @__PURE__ */ Symbol.for("react.client.reference"), y = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, S = Object.prototype.hasOwnProperty, I = Array.isArray, k = console.createTask ? console.createTask : function() {
227
+ var R = ae, D = /* @__PURE__ */ Symbol.for("react.transitional.element"), L = /* @__PURE__ */ Symbol.for("react.portal"), _ = /* @__PURE__ */ Symbol.for("react.fragment"), p = /* @__PURE__ */ Symbol.for("react.strict_mode"), w = /* @__PURE__ */ Symbol.for("react.profiler"), W = /* @__PURE__ */ Symbol.for("react.consumer"), B = /* @__PURE__ */ Symbol.for("react.context"), $ = /* @__PURE__ */ Symbol.for("react.forward_ref"), U = /* @__PURE__ */ Symbol.for("react.suspense"), q = /* @__PURE__ */ Symbol.for("react.suspense_list"), J = /* @__PURE__ */ Symbol.for("react.memo"), h = /* @__PURE__ */ Symbol.for("react.lazy"), G = /* @__PURE__ */ Symbol.for("react.activity"), X = /* @__PURE__ */ Symbol.for("react.client.reference"), y = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, S = Object.prototype.hasOwnProperty, I = Array.isArray, k = console.createTask ? console.createTask : function() {
228
228
  return null;
229
229
  };
230
- w = {
230
+ R = {
231
231
  react_stack_bottom_frame: function(e) {
232
232
  return e();
233
233
  }
234
234
  };
235
- var Y, M = {}, n = w.react_stack_bottom_frame.bind(
236
- w,
237
- u
238
- )(), i = k(x(u)), O = {};
235
+ var Y, V = {}, n = R.react_stack_bottom_frame.bind(
236
+ R,
237
+ f
238
+ )(), i = k(m(f)), O = {};
239
239
  A.Fragment = _, A.jsx = function(e, t, a) {
240
240
  var l = 1e4 > y.recentlyCreatedOwnerStacks++;
241
241
  return j(
@@ -244,7 +244,7 @@ React keys must be passed directly to JSX without using spread:
244
244
  a,
245
245
  !1,
246
246
  l ? Error("react-stack-top-frame") : n,
247
- l ? k(x(e)) : i
247
+ l ? k(m(e)) : i
248
248
  );
249
249
  }, A.jsxs = function(e, t, a) {
250
250
  var l = 1e4 > y.recentlyCreatedOwnerStacks++;
@@ -254,63 +254,63 @@ React keys must be passed directly to JSX without using spread:
254
254
  a,
255
255
  !0,
256
256
  l ? Error("react-stack-top-frame") : n,
257
- l ? k(x(e)) : i
257
+ l ? k(m(e)) : i
258
258
  );
259
259
  };
260
260
  })()), A;
261
261
  }
262
262
  var te;
263
- function Te() {
264
- return te || (te = 1, process.env.NODE_ENV === "production" ? z.exports = he() : z.exports = Ne()), z.exports;
263
+ function he() {
264
+ return te || (te = 1, process.env.NODE_ENV === "production" ? z.exports = Ne() : z.exports = Te()), z.exports;
265
265
  }
266
- var o = Te();
266
+ var o = he();
267
267
  const ye = ({
268
268
  schema: r,
269
- dataSource: d,
270
- className: R
269
+ dataSource: u,
270
+ className: b
271
271
  }) => {
272
- const [x, c] = E(null), [u, f] = E(!1), [b, h] = E("create"), [N, j] = E(null), [P, F] = E(""), [w, D] = E(!1), [L, _] = E(0);
273
- ae(() => {
272
+ const [m, c] = g(null), [f, d] = g(!1), [v, N] = g("create"), [T, j] = g(null), [P, F] = g(""), [R, D] = g(!1), [L, _] = g(0);
273
+ le(() => {
274
274
  const n = async () => {
275
275
  try {
276
- const i = await d.getObjectSchema(r.objectName);
276
+ const i = await u.getObjectSchema(r.objectName);
277
277
  c(i);
278
278
  } catch (i) {
279
279
  console.error("Failed to fetch object schema:", i);
280
280
  }
281
281
  };
282
- r.objectName && d && n();
283
- }, [r.objectName, d]);
284
- const m = r.layout || "drawer", p = r.operations || r.table?.operations || {
282
+ r.objectName && u && n();
283
+ }, [r.objectName, u]);
284
+ const p = r.layout || "drawer", w = r.operations || r.table?.operations || {
285
285
  create: !0,
286
286
  read: !0,
287
287
  update: !0,
288
288
  delete: !0
289
- }, W = v(() => {
290
- m === "page" && r.onNavigate ? r.onNavigate("new", "edit") : (h("create"), j(null), f(!0));
291
- }, [m, r]), B = v((n) => {
292
- if (m === "page" && r.onNavigate) {
289
+ }, W = x(() => {
290
+ p === "page" && r.onNavigate ? r.onNavigate("new", "edit") : (N("create"), j(null), d(!0));
291
+ }, [p, r]), B = x((n) => {
292
+ if (p === "page" && r.onNavigate) {
293
293
  const i = n._id || n.id;
294
294
  r.onNavigate(i, "edit");
295
295
  } else
296
- h("edit"), j(n), f(!0);
297
- }, [m, r]), $ = v((n) => {
298
- if (m === "page" && r.onNavigate) {
296
+ N("edit"), j(n), d(!0);
297
+ }, [p, r]), $ = x((n) => {
298
+ if (p === "page" && r.onNavigate) {
299
299
  const i = n._id || n.id;
300
300
  r.onNavigate(i, "view");
301
301
  } else
302
- h("view"), j(n), f(!0);
303
- }, [m, r]), U = v((n) => {
304
- p.read !== !1 && $(n);
305
- }, [p.read, $]), q = v((n) => {
302
+ N("view"), j(n), d(!0);
303
+ }, [p, r]), U = x((n) => {
304
+ w.read !== !1 && $(n);
305
+ }, [w.read, $]), q = x((n) => {
306
306
  _((i) => i + 1);
307
- }, []), J = v((n) => {
307
+ }, []), J = x((n) => {
308
308
  _((i) => i + 1);
309
- }, []), T = v(() => {
310
- f(!1), j(null), _((n) => n + 1);
311
- }, []), G = v(() => {
312
- f(!1), j(null);
313
- }, []), X = v(() => {
309
+ }, []), h = x(() => {
310
+ d(!1), j(null), _((n) => n + 1);
311
+ }, []), G = x(() => {
312
+ d(!1), j(null);
313
+ }, []), X = x(() => {
314
314
  _((n) => n + 1);
315
315
  }, []), y = {
316
316
  type: "object-grid",
@@ -320,7 +320,7 @@ const ye = ({
320
320
  fields: r.table?.fields,
321
321
  columns: r.table?.columns,
322
322
  operations: {
323
- ...p,
323
+ ...w,
324
324
  create: !1
325
325
  // Create is handled by the view's create button
326
326
  },
@@ -330,11 +330,11 @@ const ye = ({
330
330
  selectable: r.table?.selectable,
331
331
  className: r.table?.className
332
332
  }, S = () => {
333
- const n = N ? N._id || N.id : void 0;
333
+ const n = T ? T._id || T.id : void 0;
334
334
  return {
335
335
  type: "object-form",
336
336
  objectName: r.objectName,
337
- mode: b,
337
+ mode: v,
338
338
  recordId: n,
339
339
  title: r.form?.title,
340
340
  description: r.form?.description,
@@ -349,15 +349,15 @@ const ye = ({
349
349
  cancelText: r.form?.cancelText,
350
350
  showReset: r.form?.showReset,
351
351
  initialValues: r.form?.initialValues,
352
- readOnly: r.form?.readOnly || b === "view",
352
+ readOnly: r.form?.readOnly || v === "view",
353
353
  className: r.form?.className,
354
- onSuccess: T,
354
+ onSuccess: h,
355
355
  onCancel: G
356
356
  };
357
357
  }, I = () => {
358
358
  if (r.form?.title) return r.form.title;
359
- const n = x?.label || r.objectName;
360
- switch (b) {
359
+ const n = m?.label || r.objectName;
360
+ switch (v) {
361
361
  case "create":
362
362
  return `Create ${n}`;
363
363
  case "edit":
@@ -367,7 +367,7 @@ const ye = ({
367
367
  default:
368
368
  return n;
369
369
  }
370
- }, k = () => /* @__PURE__ */ o.jsx(ce, { open: u, onOpenChange: f, direction: "right", children: /* @__PURE__ */ o.jsxs(ue, { className: "w-full sm:max-w-2xl", children: [
370
+ }, k = () => /* @__PURE__ */ o.jsx(ce, { open: f, onOpenChange: d, direction: "right", children: /* @__PURE__ */ o.jsxs(ue, { className: "w-full sm:max-w-2xl", children: [
371
371
  /* @__PURE__ */ o.jsxs(fe, { children: [
372
372
  /* @__PURE__ */ o.jsx(de, { children: I() }),
373
373
  r.form?.description && /* @__PURE__ */ o.jsx(me, { children: r.form.description })
@@ -376,32 +376,32 @@ const ye = ({
376
376
  K,
377
377
  {
378
378
  schema: S(),
379
- dataSource: d
379
+ dataSource: u
380
380
  }
381
381
  ) })
382
- ] }) }), Y = () => /* @__PURE__ */ o.jsx(be, { open: u, onOpenChange: f, children: /* @__PURE__ */ o.jsxs(pe, { className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [
382
+ ] }) }), Y = () => /* @__PURE__ */ o.jsx(pe, { open: f, onOpenChange: d, children: /* @__PURE__ */ o.jsxs(be, { className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [
383
383
  /* @__PURE__ */ o.jsxs(ve, { children: [
384
- /* @__PURE__ */ o.jsx(xe, { children: I() }),
385
- r.form?.description && /* @__PURE__ */ o.jsx(je, { children: r.form.description })
384
+ /* @__PURE__ */ o.jsx(we, { children: I() }),
385
+ r.form?.description && /* @__PURE__ */ o.jsx(xe, { children: r.form.description })
386
386
  ] }),
387
387
  /* @__PURE__ */ o.jsx(
388
388
  K,
389
389
  {
390
390
  schema: S(),
391
- dataSource: d
391
+ dataSource: u
392
392
  }
393
393
  )
394
- ] }) }), M = () => {
395
- const n = r.showSearch !== !1, i = r.showFilters !== !1, O = r.showCreate !== !1 && p.create !== !1, e = r.showRefresh !== !1;
394
+ ] }) }), V = () => {
395
+ const n = r.showSearch !== !1, i = r.showFilters !== !1, O = r.showCreate !== !1 && w.create !== !1, e = r.showRefresh !== !1;
396
396
  return !n && !i && !O && !e ? null : /* @__PURE__ */ o.jsxs("div", { className: "flex flex-col gap-4 mb-4", children: [
397
397
  /* @__PURE__ */ o.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
398
398
  /* @__PURE__ */ o.jsx("div", { className: "flex-1 max-w-md", children: n && /* @__PURE__ */ o.jsxs("div", { className: "relative", children: [
399
- /* @__PURE__ */ o.jsx(we, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
399
+ /* @__PURE__ */ o.jsx(je, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
400
400
  /* @__PURE__ */ o.jsx(
401
401
  ie,
402
402
  {
403
403
  type: "search",
404
- placeholder: `Search ${x?.label || r.objectName}...`,
404
+ placeholder: `Search ${m?.label || r.objectName}...`,
405
405
  value: P,
406
406
  onChange: (t) => F(t.target.value),
407
407
  className: "pl-9"
@@ -414,11 +414,11 @@ const ye = ({
414
414
  {
415
415
  variant: "outline",
416
416
  size: "sm",
417
- onClick: () => D(!w),
417
+ onClick: () => D(!R),
418
418
  children: [
419
- /* @__PURE__ */ o.jsx(_e, { className: "h-4 w-4" }),
419
+ /* @__PURE__ */ o.jsx(Re, { className: "h-4 w-4" }),
420
420
  "Filters",
421
- w && /* @__PURE__ */ o.jsx(Re, { className: "h-3 w-3 ml-1" })
421
+ R && /* @__PURE__ */ o.jsx(_e, { className: "h-3 w-3 ml-1" })
422
422
  ]
423
423
  }
424
424
  ),
@@ -428,7 +428,7 @@ const ye = ({
428
428
  variant: "outline",
429
429
  size: "sm",
430
430
  onClick: X,
431
- children: /* @__PURE__ */ o.jsx(Ee, { className: "h-4 w-4" })
431
+ children: /* @__PURE__ */ o.jsx(ge, { className: "h-4 w-4" })
432
432
  }
433
433
  ),
434
434
  O && /* @__PURE__ */ o.jsxs(
@@ -437,39 +437,58 @@ const ye = ({
437
437
  size: "sm",
438
438
  onClick: W,
439
439
  children: [
440
- /* @__PURE__ */ o.jsx(ge, { className: "h-4 w-4" }),
440
+ /* @__PURE__ */ o.jsx(Ee, { className: "h-4 w-4" }),
441
441
  "Create"
442
442
  ]
443
443
  }
444
444
  )
445
445
  ] })
446
446
  ] }),
447
- w && /* @__PURE__ */ o.jsx("div", { className: "p-4 border rounded-md bg-muted/50", children: /* @__PURE__ */ o.jsx("p", { className: "text-sm text-muted-foreground", children: "Filter functionality will be integrated with FilterBuilder component" }) })
447
+ R && /* @__PURE__ */ o.jsx("div", { className: "p-4 border rounded-md bg-muted/50", children: /* @__PURE__ */ o.jsx("p", { className: "text-sm text-muted-foreground", children: "Filter functionality will be integrated with FilterBuilder component" }) })
448
448
  ] });
449
449
  };
450
- return /* @__PURE__ */ o.jsxs("div", { className: R, children: [
450
+ return /* @__PURE__ */ o.jsxs("div", { className: b, children: [
451
451
  (r.title || r.description) && /* @__PURE__ */ o.jsxs("div", { className: "mb-6", children: [
452
452
  r.title && /* @__PURE__ */ o.jsx("h2", { className: "text-2xl font-bold tracking-tight", children: r.title }),
453
453
  r.description && /* @__PURE__ */ o.jsx("p", { className: "text-muted-foreground mt-1", children: r.description })
454
454
  ] }),
455
- M(),
455
+ V(),
456
456
  /* @__PURE__ */ o.jsx(
457
457
  se,
458
458
  {
459
459
  schema: y,
460
- dataSource: d,
460
+ dataSource: u,
461
461
  onRowClick: U,
462
- onEdit: p.update !== !1 ? B : void 0,
463
- onDelete: p.delete !== !1 ? q : void 0,
464
- onBulkDelete: p.delete !== !1 ? J : void 0
462
+ onEdit: w.update !== !1 ? B : void 0,
463
+ onDelete: w.delete !== !1 ? q : void 0,
464
+ onBulkDelete: w.delete !== !1 ? J : void 0
465
465
  },
466
466
  L
467
467
  ),
468
- m === "drawer" && k(),
469
- m === "modal" && Y()
468
+ p === "drawer" && k(),
469
+ p === "modal" && Y()
470
470
  ] });
471
471
  }, Se = ({ schema: r }) => /* @__PURE__ */ o.jsx(ye, { schema: r, dataSource: null });
472
- le.register("object-view", Se);
472
+ oe.register("object-view", Se, {
473
+ namespace: "plugin-view"
474
+ });
475
+ const ke = ({ schema: r, className: u, children: b, ...m }) => {
476
+ const c = r.props?.columns ? { display: "grid", gridTemplateColumns: `repeat(${r.props.columns}, 1fr)`, gap: "1rem" } : void 0;
477
+ return /* @__PURE__ */ o.jsx(
478
+ "div",
479
+ {
480
+ className: u,
481
+ style: c,
482
+ ...m,
483
+ children: b
484
+ }
485
+ );
486
+ };
487
+ oe.register("view:simple", ke, {
488
+ namespace: "plugin-view",
489
+ label: "Simple View",
490
+ category: "view"
491
+ });
473
492
  export {
474
493
  ye as ObjectView
475
494
  };
@@ -1,6 +1,6 @@
1
- (function(m,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react"),require("@object-ui/core"),require("@object-ui/plugin-grid"),require("@object-ui/plugin-form"),require("@object-ui/components"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react","@object-ui/core","@object-ui/plugin-grid","@object-ui/plugin-form","@object-ui/components","lucide-react"],a):(m=typeof globalThis<"u"?globalThis:m||self,a(m.ObjectUIPluginView={},m.React,m.core,m.pluginGrid,m.pluginForm,m.components,m.lucideReact))})(this,(function(m,a,ae,le,ee,u,T){"use strict";var D={exports:{}},N={};var te;function se(){if(te)return N;te=1;var t=Symbol.for("react.transitional.element"),p=Symbol.for("react.fragment");function g(w,f,d){var b=null;if(d!==void 0&&(b=""+d),f.key!==void 0&&(b=""+f.key),"key"in f){d={};for(var v in f)v!=="key"&&(d[v]=f[v])}else d=f;return f=d.ref,{$$typeof:t,type:w,key:b,ref:f!==void 0?f:null,props:d}}return N.Fragment=p,N.jsx=g,N.jsxs=g,N}var S={};var re;function ie(){return re||(re=1,process.env.NODE_ENV!=="production"&&(function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===K?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case R:return"Fragment";case x:return"Profiler";case j:return"StrictMode";case X:return"Suspense";case H:return"SuspenseList";case Z:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case W:return"Portal";case J:return e.displayName||"Context";case G:return(e._context.displayName||"Context")+".Consumer";case M:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Q:return r=e.displayName||null,r!==null?r:t(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return t(e(r))}catch{}}return null}function p(e){return""+e}function g(e){try{p(e);var r=!1}catch{r=!0}if(r){r=console;var l=r.error,s=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return l.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",s),p(e)}}function w(e){if(e===R)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===O)return"<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function f(){var e=C.A;return e===null?null:e.getOwner()}function d(){return Error("react-stack-top-frame")}function b(e){if(P.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function v(e,r){function l(){B||(B=!0,console.error("%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)",r))}l.isReactWarning=!0,Object.defineProperty(e,"key",{get:l,configurable:!0})}function k(){var e=t(this.type);return L[e]||(L[e]=!0,console.error("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.")),e=this.props.ref,e!==void 0?e:null}function y(e,r,l,s,U,q){var i=l.ref;return e={$$typeof:V,type:e,key:r,props:l,_owner:s},(i!==void 0?i:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:k}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function _(e,r,l,s,U,q){var i=r.children;if(i!==void 0)if(s)if(z(i)){for(s=0;s<i.length;s++)I(i[s]);Object.freeze&&Object.freeze(i)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else I(i);if(P.call(r,"key")){i=t(e);var h=Object.keys(r).filter(function(fe){return fe!=="key"});s=0<h.length?"{key: someKey, "+h.join(": ..., ")+": ...}":"{key: someKey}",F[i+s]||(h=0<h.length?"{"+h.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(p,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react"),require("@object-ui/core"),require("@object-ui/plugin-grid"),require("@object-ui/plugin-form"),require("@object-ui/components"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react","@object-ui/core","@object-ui/plugin-grid","@object-ui/plugin-form","@object-ui/components","lucide-react"],a):(p=typeof globalThis<"u"?globalThis:p||self,a(p.ObjectUIPluginView={},p.React,p.core,p.pluginGrid,p.pluginForm,p.components,p.lucideReact))})(this,(function(p,a,ee,le,te,d,h){"use strict";var D={exports:{}},N={};var re;function se(){if(re)return N;re=1;var t=Symbol.for("react.transitional.element"),f=Symbol.for("react.fragment");function w(j,u,m){var b=null;if(m!==void 0&&(b=""+m),u.key!==void 0&&(b=""+u.key),"key"in u){m={};for(var x in u)x!=="key"&&(m[x]=u[x])}else m=u;return u=m.ref,{$$typeof:t,type:j,key:b,ref:u!==void 0?u:null,props:m}}return N.Fragment=f,N.jsx=w,N.jsxs=w,N}var S={};var oe;function ie(){return oe||(oe=1,process.env.NODE_ENV!=="production"&&(function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===K?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case g:return"Profiler";case v:return"StrictMode";case X:return"Suspense";case H:return"SuspenseList";case Z:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case W:return"Portal";case J:return e.displayName||"Context";case G:return(e._context.displayName||"Context")+".Consumer";case M:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Q:return r=e.displayName||null,r!==null?r:t(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return t(e(r))}catch{}}return null}function f(e){return""+e}function w(e){try{f(e);var r=!1}catch{r=!0}if(r){r=console;var l=r.error,s=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return l.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",s),f(e)}}function j(e){if(e===E)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===O)return"<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function u(){var e=C.A;return e===null?null:e.getOwner()}function m(){return Error("react-stack-top-frame")}function b(e){if(P.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function x(e,r){function l(){B||(B=!0,console.error("%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)",r))}l.isReactWarning=!0,Object.defineProperty(e,"key",{get:l,configurable:!0})}function y(){var e=t(this.type);return L[e]||(L[e]=!0,console.error("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.")),e=this.props.ref,e!==void 0?e:null}function k(e,r,l,s,U,q){var i=l.ref;return e={$$typeof:V,type:e,key:r,props:l,_owner:s},(i!==void 0?i:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:y}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function _(e,r,l,s,U,q){var i=r.children;if(i!==void 0)if(s)if(z(i)){for(s=0;s<i.length;s++)I(i[s]);Object.freeze&&Object.freeze(i)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else I(i);if(P.call(r,"key")){i=t(e);var T=Object.keys(r).filter(function(fe){return fe!=="key"});s=0<T.length?"{key: someKey, "+T.join(": ..., ")+": ...}":"{key: someKey}",F[i+s]||(T=0<T.length?"{"+T.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,s,i,h,i),F[i+s]=!0)}if(i=null,l!==void 0&&(g(l),i=""+l),b(r)&&(g(r.key),i=""+r.key),"key"in r){l={};for(var $ in r)$!=="key"&&(l[$]=r[$])}else l=r;return i&&v(l,typeof e=="function"?e.displayName||e.name||"Unknown":e),y(e,i,l,f(),U,q)}function I(e){Y(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===O&&(e._payload.status==="fulfilled"?Y(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function Y(e){return typeof e=="object"&&e!==null&&e.$$typeof===V}var E=a,V=Symbol.for("react.transitional.element"),W=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),G=Symbol.for("react.consumer"),J=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),K=Symbol.for("react.client.reference"),C=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=Object.prototype.hasOwnProperty,z=Array.isArray,A=console.createTask?console.createTask:function(){return null};E={react_stack_bottom_frame:function(e){return e()}};var B,L={},n=E.react_stack_bottom_frame.bind(E,d)(),c=A(w(d)),F={};S.Fragment=R,S.jsx=function(e,r,l){var s=1e4>C.recentlyCreatedOwnerStacks++;return _(e,r,l,!1,s?Error("react-stack-top-frame"):n,s?A(w(e)):c)},S.jsxs=function(e,r,l){var s=1e4>C.recentlyCreatedOwnerStacks++;return _(e,r,l,!0,s?Error("react-stack-top-frame"):n,s?A(w(e)):c)}})()),S}var oe;function ce(){return oe||(oe=1,process.env.NODE_ENV==="production"?D.exports=se():D.exports=ie()),D.exports}var o=ce();const ne=({schema:t,dataSource:p,className:g})=>{const[w,f]=a.useState(null),[d,b]=a.useState(!1),[v,k]=a.useState("create"),[y,_]=a.useState(null),[I,Y]=a.useState(""),[E,V]=a.useState(!1),[W,R]=a.useState(0);a.useEffect(()=>{const n=async()=>{try{const c=await p.getObjectSchema(t.objectName);f(c)}catch(c){console.error("Failed to fetch object schema:",c)}};t.objectName&&p&&n()},[t.objectName,p]);const j=t.layout||"drawer",x=t.operations||t.table?.operations||{create:!0,read:!0,update:!0,delete:!0},G=a.useCallback(()=>{j==="page"&&t.onNavigate?t.onNavigate("new","edit"):(k("create"),_(null),b(!0))},[j,t]),J=a.useCallback(n=>{if(j==="page"&&t.onNavigate){const c=n._id||n.id;t.onNavigate(c,"edit")}else k("edit"),_(n),b(!0)},[j,t]),M=a.useCallback(n=>{if(j==="page"&&t.onNavigate){const c=n._id||n.id;t.onNavigate(c,"view")}else k("view"),_(n),b(!0)},[j,t]),X=a.useCallback(n=>{x.read!==!1&&M(n)},[x.read,M]),H=a.useCallback(n=>{R(c=>c+1)},[]),Q=a.useCallback(n=>{R(c=>c+1)},[]),O=a.useCallback(()=>{b(!1),_(null),R(n=>n+1)},[]),Z=a.useCallback(()=>{b(!1),_(null)},[]),K=a.useCallback(()=>{R(n=>n+1)},[]),C={type:"object-grid",objectName:t.objectName,title:t.table?.title,description:t.table?.description,fields:t.table?.fields,columns:t.table?.columns,operations:{...x,create:!1},defaultFilters:t.table?.defaultFilters,defaultSort:t.table?.defaultSort,pageSize:t.table?.pageSize,selectable:t.table?.selectable,className:t.table?.className},P=()=>{const n=y?y._id||y.id:void 0;return{type:"object-form",objectName:t.objectName,mode:v,recordId:n,title:t.form?.title,description:t.form?.description,fields:t.form?.fields,customFields:t.form?.customFields,groups:t.form?.groups,layout:t.form?.layout,columns:t.form?.columns,showSubmit:t.form?.showSubmit,submitText:t.form?.submitText,showCancel:t.form?.showCancel,cancelText:t.form?.cancelText,showReset:t.form?.showReset,initialValues:t.form?.initialValues,readOnly:t.form?.readOnly||v==="view",className:t.form?.className,onSuccess:O,onCancel:Z}},z=()=>{if(t.form?.title)return t.form.title;const n=w?.label||t.objectName;switch(v){case"create":return`Create ${n}`;case"edit":return`Edit ${n}`;case"view":return`View ${n}`;default:return n}},A=()=>o.jsx(u.Drawer,{open:d,onOpenChange:b,direction:"right",children:o.jsxs(u.DrawerContent,{className:"w-full sm:max-w-2xl",children:[o.jsxs(u.DrawerHeader,{children:[o.jsx(u.DrawerTitle,{children:z()}),t.form?.description&&o.jsx(u.DrawerDescription,{children:t.form.description})]}),o.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:o.jsx(ee.ObjectForm,{schema:P(),dataSource:p})})]})}),B=()=>o.jsx(u.Dialog,{open:d,onOpenChange:b,children:o.jsxs(u.DialogContent,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[o.jsxs(u.DialogHeader,{children:[o.jsx(u.DialogTitle,{children:z()}),t.form?.description&&o.jsx(u.DialogDescription,{children:t.form.description})]}),o.jsx(ee.ObjectForm,{schema:P(),dataSource:p})]})}),L=()=>{const n=t.showSearch!==!1,c=t.showFilters!==!1,F=t.showCreate!==!1&&x.create!==!1,e=t.showRefresh!==!1;return!n&&!c&&!F&&!e?null:o.jsxs("div",{className:"flex flex-col gap-4 mb-4",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx("div",{className:"flex-1 max-w-md",children:n&&o.jsxs("div",{className:"relative",children:[o.jsx(T.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(u.Input,{type:"search",placeholder:`Search ${w?.label||t.objectName}...`,value:I,onChange:r=>Y(r.target.value),className:"pl-9"})]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[c&&o.jsxs(u.Button,{variant:"outline",size:"sm",onClick:()=>V(!E),children:[o.jsx(T.Filter,{className:"h-4 w-4"}),"Filters",E&&o.jsx(T.X,{className:"h-3 w-3 ml-1"})]}),e&&o.jsx(u.Button,{variant:"outline",size:"sm",onClick:K,children:o.jsx(T.RefreshCw,{className:"h-4 w-4"})}),F&&o.jsxs(u.Button,{size:"sm",onClick:G,children:[o.jsx(T.Plus,{className:"h-4 w-4"}),"Create"]})]})]}),E&&o.jsx("div",{className:"p-4 border rounded-md bg-muted/50",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"Filter functionality will be integrated with FilterBuilder component"})})]})};return o.jsxs("div",{className:g,children:[(t.title||t.description)&&o.jsxs("div",{className:"mb-6",children:[t.title&&o.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:t.title}),t.description&&o.jsx("p",{className:"text-muted-foreground mt-1",children:t.description})]}),L(),o.jsx(le.ObjectGrid,{schema:C,dataSource:p,onRowClick:X,onEdit:x.update!==!1?J:void 0,onDelete:x.delete!==!1?H:void 0,onBulkDelete:x.delete!==!1?Q:void 0},W),j==="drawer"&&A(),j==="modal"&&B()]})},ue=({schema:t})=>o.jsx(ne,{schema:t,dataSource:null});ae.ComponentRegistry.register("object-view",ue),m.ObjectView=ne,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
6
+ <%s key={someKey} {...props} />`,s,i,T,i),F[i+s]=!0)}if(i=null,l!==void 0&&(w(l),i=""+l),b(r)&&(w(r.key),i=""+r.key),"key"in r){l={};for(var $ in r)$!=="key"&&(l[$]=r[$])}else l=r;return i&&x(l,typeof e=="function"?e.displayName||e.name||"Unknown":e),k(e,i,l,u(),U,q)}function I(e){Y(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===O&&(e._payload.status==="fulfilled"?Y(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function Y(e){return typeof e=="object"&&e!==null&&e.$$typeof===V}var R=a,V=Symbol.for("react.transitional.element"),W=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),G=Symbol.for("react.consumer"),J=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),K=Symbol.for("react.client.reference"),C=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=Object.prototype.hasOwnProperty,z=Array.isArray,A=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(e){return e()}};var B,L={},n=R.react_stack_bottom_frame.bind(R,m)(),c=A(j(m)),F={};S.Fragment=E,S.jsx=function(e,r,l){var s=1e4>C.recentlyCreatedOwnerStacks++;return _(e,r,l,!1,s?Error("react-stack-top-frame"):n,s?A(j(e)):c)},S.jsxs=function(e,r,l){var s=1e4>C.recentlyCreatedOwnerStacks++;return _(e,r,l,!0,s?Error("react-stack-top-frame"):n,s?A(j(e)):c)}})()),S}var ne;function ce(){return ne||(ne=1,process.env.NODE_ENV==="production"?D.exports=se():D.exports=ie()),D.exports}var o=ce();const ae=({schema:t,dataSource:f,className:w})=>{const[j,u]=a.useState(null),[m,b]=a.useState(!1),[x,y]=a.useState("create"),[k,_]=a.useState(null),[I,Y]=a.useState(""),[R,V]=a.useState(!1),[W,E]=a.useState(0);a.useEffect(()=>{const n=async()=>{try{const c=await f.getObjectSchema(t.objectName);u(c)}catch(c){console.error("Failed to fetch object schema:",c)}};t.objectName&&f&&n()},[t.objectName,f]);const v=t.layout||"drawer",g=t.operations||t.table?.operations||{create:!0,read:!0,update:!0,delete:!0},G=a.useCallback(()=>{v==="page"&&t.onNavigate?t.onNavigate("new","edit"):(y("create"),_(null),b(!0))},[v,t]),J=a.useCallback(n=>{if(v==="page"&&t.onNavigate){const c=n._id||n.id;t.onNavigate(c,"edit")}else y("edit"),_(n),b(!0)},[v,t]),M=a.useCallback(n=>{if(v==="page"&&t.onNavigate){const c=n._id||n.id;t.onNavigate(c,"view")}else y("view"),_(n),b(!0)},[v,t]),X=a.useCallback(n=>{g.read!==!1&&M(n)},[g.read,M]),H=a.useCallback(n=>{E(c=>c+1)},[]),Q=a.useCallback(n=>{E(c=>c+1)},[]),O=a.useCallback(()=>{b(!1),_(null),E(n=>n+1)},[]),Z=a.useCallback(()=>{b(!1),_(null)},[]),K=a.useCallback(()=>{E(n=>n+1)},[]),C={type:"object-grid",objectName:t.objectName,title:t.table?.title,description:t.table?.description,fields:t.table?.fields,columns:t.table?.columns,operations:{...g,create:!1},defaultFilters:t.table?.defaultFilters,defaultSort:t.table?.defaultSort,pageSize:t.table?.pageSize,selectable:t.table?.selectable,className:t.table?.className},P=()=>{const n=k?k._id||k.id:void 0;return{type:"object-form",objectName:t.objectName,mode:x,recordId:n,title:t.form?.title,description:t.form?.description,fields:t.form?.fields,customFields:t.form?.customFields,groups:t.form?.groups,layout:t.form?.layout,columns:t.form?.columns,showSubmit:t.form?.showSubmit,submitText:t.form?.submitText,showCancel:t.form?.showCancel,cancelText:t.form?.cancelText,showReset:t.form?.showReset,initialValues:t.form?.initialValues,readOnly:t.form?.readOnly||x==="view",className:t.form?.className,onSuccess:O,onCancel:Z}},z=()=>{if(t.form?.title)return t.form.title;const n=j?.label||t.objectName;switch(x){case"create":return`Create ${n}`;case"edit":return`Edit ${n}`;case"view":return`View ${n}`;default:return n}},A=()=>o.jsx(d.Drawer,{open:m,onOpenChange:b,direction:"right",children:o.jsxs(d.DrawerContent,{className:"w-full sm:max-w-2xl",children:[o.jsxs(d.DrawerHeader,{children:[o.jsx(d.DrawerTitle,{children:z()}),t.form?.description&&o.jsx(d.DrawerDescription,{children:t.form.description})]}),o.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:o.jsx(te.ObjectForm,{schema:P(),dataSource:f})})]})}),B=()=>o.jsx(d.Dialog,{open:m,onOpenChange:b,children:o.jsxs(d.DialogContent,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[o.jsxs(d.DialogHeader,{children:[o.jsx(d.DialogTitle,{children:z()}),t.form?.description&&o.jsx(d.DialogDescription,{children:t.form.description})]}),o.jsx(te.ObjectForm,{schema:P(),dataSource:f})]})}),L=()=>{const n=t.showSearch!==!1,c=t.showFilters!==!1,F=t.showCreate!==!1&&g.create!==!1,e=t.showRefresh!==!1;return!n&&!c&&!F&&!e?null:o.jsxs("div",{className:"flex flex-col gap-4 mb-4",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx("div",{className:"flex-1 max-w-md",children:n&&o.jsxs("div",{className:"relative",children:[o.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(d.Input,{type:"search",placeholder:`Search ${j?.label||t.objectName}...`,value:I,onChange:r=>Y(r.target.value),className:"pl-9"})]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[c&&o.jsxs(d.Button,{variant:"outline",size:"sm",onClick:()=>V(!R),children:[o.jsx(h.Filter,{className:"h-4 w-4"}),"Filters",R&&o.jsx(h.X,{className:"h-3 w-3 ml-1"})]}),e&&o.jsx(d.Button,{variant:"outline",size:"sm",onClick:K,children:o.jsx(h.RefreshCw,{className:"h-4 w-4"})}),F&&o.jsxs(d.Button,{size:"sm",onClick:G,children:[o.jsx(h.Plus,{className:"h-4 w-4"}),"Create"]})]})]}),R&&o.jsx("div",{className:"p-4 border rounded-md bg-muted/50",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"Filter functionality will be integrated with FilterBuilder component"})})]})};return o.jsxs("div",{className:w,children:[(t.title||t.description)&&o.jsxs("div",{className:"mb-6",children:[t.title&&o.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:t.title}),t.description&&o.jsx("p",{className:"text-muted-foreground mt-1",children:t.description})]}),L(),o.jsx(le.ObjectGrid,{schema:C,dataSource:f,onRowClick:X,onEdit:g.update!==!1?J:void 0,onDelete:g.delete!==!1?H:void 0,onBulkDelete:g.delete!==!1?Q:void 0},W),v==="drawer"&&A(),v==="modal"&&B()]})},ue=({schema:t})=>o.jsx(ae,{schema:t,dataSource:null});ee.ComponentRegistry.register("object-view",ue,{namespace:"plugin-view"});const de=({schema:t,className:f,children:w,...j})=>{const u=t.props?.columns?{display:"grid",gridTemplateColumns:`repeat(${t.props.columns}, 1fr)`,gap:"1rem"}:void 0;return o.jsx("div",{className:f,style:u,...j,children:w})};ee.ComponentRegistry.register("view:simple",de,{namespace:"plugin-view",label:"Simple View",category:"view"}),p.ObjectView=ae,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-view",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Object View plugin for Object UI",
@@ -16,19 +16,19 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "lucide-react": "^0.563.0",
19
- "@object-ui/components": "0.3.0",
20
- "@object-ui/plugin-form": "0.3.0",
21
- "@object-ui/core": "0.3.0",
22
- "@object-ui/plugin-grid": "0.3.0",
23
- "@object-ui/react": "0.3.0",
24
- "@object-ui/types": "0.3.0"
19
+ "@object-ui/components": "0.5.0",
20
+ "@object-ui/core": "0.5.0",
21
+ "@object-ui/plugin-grid": "0.5.0",
22
+ "@object-ui/react": "0.5.0",
23
+ "@object-ui/types": "0.5.0",
24
+ "@object-ui/plugin-form": "0.5.0"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "react": "^18.0.0 || ^19.0.0",
28
28
  "react-dom": "^18.0.0 || ^19.0.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@vitejs/plugin-react": "^4.2.1",
31
+ "@vitejs/plugin-react": "^5.1.3",
32
32
  "typescript": "^5.9.3",
33
33
  "vite": "^7.3.1",
34
34
  "vite-plugin-dts": "^4.5.4"
package/src/index.tsx CHANGED
@@ -18,4 +18,30 @@ const ObjectViewRenderer: React.FC<{ schema: any }> = ({ schema }) => {
18
18
  return <ObjectView schema={schema} dataSource={null as any} />;
19
19
  };
20
20
 
21
- ComponentRegistry.register('object-view', ObjectViewRenderer);
21
+ ComponentRegistry.register('object-view', ObjectViewRenderer, {
22
+ namespace: 'plugin-view'
23
+ });
24
+
25
+ // Simple View Renderer (Container)
26
+ const SimpleViewRenderer: React.FC<any> = ({ schema, className, children, ...props }) => {
27
+ // If columns prop is present, use grid layout
28
+ const style = schema.props?.columns
29
+ ? { display: 'grid', gridTemplateColumns: `repeat(${schema.props.columns}, 1fr)`, gap: '1rem' }
30
+ : undefined;
31
+
32
+ return (
33
+ <div
34
+ className={className}
35
+ style={style}
36
+ {...props}
37
+ >
38
+ {children}
39
+ </div>
40
+ );
41
+ };
42
+
43
+ ComponentRegistry.register('view:simple', SimpleViewRenderer, {
44
+ namespace: 'plugin-view',
45
+ label: 'Simple View',
46
+ category: 'view'
47
+ });
package/vite.config.ts CHANGED
@@ -37,4 +37,7 @@ export default defineConfig({
37
37
  },
38
38
  },
39
39
  },
40
+ test: {
41
+ passWithNoTests: true,
42
+ },
40
43
  });