@oneflowui/ui 0.6.0 → 0.8.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.
Files changed (27) hide show
  1. package/dist/components/Dashboard/index.vue.d.ts +3 -1
  2. package/dist/components/Dashboard/index.vue.js +2 -2
  3. package/dist/components/Dashboard/index.vue2.js +59 -30
  4. package/dist/components/database/DatabaseView.vue.js +4 -4
  5. package/dist/components/database/DatabaseView.vue2.js +597 -442
  6. package/dist/components/detail/DetailLayout.vue.d.ts +12 -1
  7. package/dist/components/detail/DetailLayout.vue.js +2 -2
  8. package/dist/components/detail/DetailLayout.vue2.js +115 -68
  9. package/dist/components/gallery/GalleryView.vue.d.ts +3 -1
  10. package/dist/components/gallery/GalleryView.vue.js +2 -2
  11. package/dist/components/gallery/GalleryView.vue2.js +51 -27
  12. package/dist/components/overlay/Drawer.vue.d.ts +10 -0
  13. package/dist/components/overlay/Drawer.vue.js +1 -1
  14. package/dist/components/overlay/Drawer.vue2.js +74 -48
  15. package/dist/components/overlay/SidePanel.vue.d.ts +8 -0
  16. package/dist/components/overlay/SidePanel.vue.js +2 -2
  17. package/dist/components/overlay/SidePanel.vue2.js +97 -65
  18. package/dist/components/table/DataTable.vue.d.ts +32 -2
  19. package/dist/components/table/DataTable.vue.js +3 -3
  20. package/dist/components/table/DataTable.vue2.js +751 -609
  21. package/dist/components/table/FieldCell.vue.js +2 -2
  22. package/dist/components/table/FieldCell.vue2.js +26 -24
  23. package/dist/components/table/TableDataRow.vue.d.ts +19 -0
  24. package/dist/components/table/TableDataRow.vue.js +3 -3
  25. package/dist/components/table/TableDataRow.vue2.js +110 -73
  26. package/dist/style.css +1 -1
  27. package/package.json +1 -1
@@ -1,39 +1,47 @@
1
- import { defineComponent as Tt, ref as B, onMounted as Rt, onBeforeUnmount as Dt, computed as n, watch as F, openBlock as c, createElementBlock as w, mergeProps as Lt, createVNode as ae, unref as ie, createElementVNode as u, Fragment as le, createBlock as S, createCommentVNode as oe, withCtx as Et, toDisplayString as x, renderList as Ie } from "vue";
2
- import { Loader2 as Bt, AlertCircle as At, Database as Nt } from "lucide-vue-next";
3
- import Se from "../base/EmptyState.vue.js";
4
- import xt from "../table/FieldCell.vue.js";
5
- import Ut from "../table/DetailSheet.vue.js";
6
- import Kt from "../overlay/SidePanel.vue.js";
7
- import qt from "../table/TableToolbar.vue.js";
8
- import Gt from "../table/DataTable.vue.js";
9
- import Mt from "../kanban/KanbanBoard.vue.js";
10
- import Pt from "../gallery/GalleryView.vue.js";
11
- import Wt from "../timeline/GanttTimeline.vue.js";
12
- import { useMarkdown as Ot } from "../../composables/useMarkdown.js";
13
- import { useDatabaseView as $t } from "../../composables/useDatabaseView.js";
14
- import { buildGanttItems as zt } from "../../types/index.js";
15
- const jt = {
1
+ import { defineComponent as Mt, ref as C, onMounted as jt, onBeforeUnmount as Ht, computed as r, watch as F, openBlock as d, createElementBlock as v, mergeProps as Jt, createVNode as O, unref as fe, createElementVNode as c, Fragment as q, createBlock as V, createCommentVNode as te, withCtx as T, renderList as ae, toDisplayString as b, normalizeClass as $e } from "vue";
2
+ import { Loader2 as Xt, AlertCircle as Yt, Database as Zt } from "lucide-vue-next";
3
+ import ze from "../base/EmptyState.vue.js";
4
+ import Oe from "../table/FieldCell.vue.js";
5
+ import qe from "../detail/DetailLayout.vue.js";
6
+ import Qt from "../overlay/Drawer.vue.js";
7
+ import ea from "../overlay/SidePanel.vue.js";
8
+ import ta from "../table/TableToolbar.vue.js";
9
+ import aa from "../table/DataTable.vue.js";
10
+ import ia from "../kanban/KanbanBoard.vue.js";
11
+ import la from "../gallery/GalleryView.vue.js";
12
+ import oa from "../timeline/GanttTimeline.vue.js";
13
+ import { useDatabaseView as ra } from "../../composables/useDatabaseView.js";
14
+ import { buildGanttItems as sa } from "../../types/index.js";
15
+ const na = {
16
16
  key: 0,
17
17
  class: "of-database-view__state of-database-view__state--loading",
18
18
  "data-role": "loading-state"
19
- }, Ht = {
19
+ }, da = {
20
20
  key: 1,
21
21
  class: "of-database-view__state",
22
22
  "data-role": "error-state"
23
- }, Jt = {
23
+ }, ua = {
24
24
  key: 1,
25
25
  class: "of-database-view__state of-database-view__state--empty",
26
26
  "data-role": "empty-state"
27
- }, Xt = ["data-view"], Yt = {
27
+ }, ca = ["data-view"], va = {
28
28
  key: 4,
29
29
  class: "of-database-view__detail-anchor"
30
- }, Zt = ["data-record-id"], Qt = { class: "of-database-view__detail-workspace-header" }, ea = { class: "of-database-view__detail-workspace-heading" }, ta = { class: "of-database-view__detail-workspace-title" }, aa = { class: "of-database-view__detail-workspace-meta" }, ia = { class: "of-database-view__detail-workspace-id" }, la = { class: "of-database-view__detail-workspace-body" }, oa = { class: "of-database-view__detail-workspace-properties" }, ra = { class: "of-database-view__detail-workspace-label" }, na = { class: "of-database-view__detail-workspace-value" }, sa = {
30
+ }, fa = {
31
+ key: 0,
32
+ class: "of-database-view__workspace-modes",
33
+ "data-role": "workspace-mode-switch"
34
+ }, wa = ["data-mode", "onClick"], pa = { class: "of-database-view__workspace-chip" }, ma = { class: "of-database-view__workspace-chip" }, ba = { class: "of-database-view__workspace-chip" }, ha = ["data-record-id"], _a = { class: "of-database-view__detail-workspace-properties" }, ya = { class: "of-database-view__detail-workspace-label" }, ka = { class: "of-database-view__detail-workspace-value" }, ga = {
31
35
  key: 1,
32
36
  class: "of-database-view__detail-workspace-fallback"
33
- }, da = {
37
+ }, Ia = ["disabled"], Ca = {
34
38
  key: 0,
35
- class: "of-database-view__detail-workspace-content"
36
- }, ua = { class: "of-database-view__detail-workspace-content-label" }, ca = ["innerHTML"], va = { class: "of-database-view__detail-workspace-footer" }, fa = ["disabled"], k = "detail", wa = "(max-width: 768px)", Ra = /* @__PURE__ */ Tt({
39
+ class: "of-database-view__workspace-modes",
40
+ "data-role": "workspace-mode-switch"
41
+ }, Va = ["data-mode", "onClick"], Sa = { class: "of-database-view__workspace-chip" }, Fa = { class: "of-database-view__workspace-chip" }, Ta = { class: "of-database-view__workspace-chip" }, Ra = ["data-record-id"], Da = { class: "of-database-view__detail-workspace-properties" }, Ea = { class: "of-database-view__detail-workspace-label" }, La = { class: "of-database-view__detail-workspace-value" }, Aa = {
42
+ key: 1,
43
+ class: "of-database-view__detail-workspace-fallback"
44
+ }, Wa = ["disabled"], k = "detail", Pa = "(max-width: 768px)", Na = "oneui-database-workspace:", we = 720, pe = 900, Ua = 420, Ba = 1320, Qa = /* @__PURE__ */ Mt({
37
45
  name: "DatabaseView",
38
46
  inheritAttrs: !1,
39
47
  __name: "DatabaseView",
@@ -51,7 +59,7 @@ const jt = {
51
59
  initialViewId: { default: "" },
52
60
  selectedRecordId: { default: void 0 },
53
61
  initialSelectedRecordId: { default: void 0 },
54
- searchKeyword: { default: "" },
62
+ searchKeyword: { default: void 0 },
55
63
  loading: { type: Boolean, default: void 0 },
56
64
  error: { default: void 0 },
57
65
  viewTabs: { default: void 0 },
@@ -69,36 +77,61 @@ const jt = {
69
77
  autoLoad: { type: Boolean, default: !0 }
70
78
  },
71
79
  emits: ["update:currentViewId", "update:selectedRecordId", "update:searchKeyword", "update:columns", "update:filterLogic", "update:records", "cell-edit", "select-record", "schema-add-field", "schema-rename-field", "schema-change-field-type", "schema-hide-field", "schema-delete-field", "schema-duplicate-field", "row-click", "card-click", "add", "add-column", "record-change", "load-view", "save-view", "sort", "group", "refresh"],
72
- setup(T, { emit: Fe }) {
73
- var ge, Ce;
74
- const l = T, d = Fe, { renderMarkdown: Te } = Ot({ showCopyButton: !0 }), re = B(!1);
80
+ setup(R, { emit: Ge }) {
81
+ var xe, Ke;
82
+ const o = R, u = Ge, G = C(!1);
75
83
  let g = null;
76
- function O() {
77
- re.value = (g == null ? void 0 : g.matches) ?? !1;
84
+ function ie() {
85
+ G.value = (g == null ? void 0 : g.matches) ?? !1;
78
86
  }
79
- Rt(() => {
80
- typeof window > "u" || typeof window.matchMedia != "function" || (g = window.matchMedia(wa), O(), g.addEventListener("change", O));
81
- }), Dt(() => {
82
- g == null || g.removeEventListener("change", O), g = null;
87
+ jt(() => {
88
+ typeof window > "u" || typeof window.matchMedia != "function" || (g = window.matchMedia(Pa), ie(), g.addEventListener("change", ie));
89
+ }), Ht(() => {
90
+ g == null || g.removeEventListener("change", ie), g = null;
83
91
  });
84
- function ne(e) {
85
- var t, a, i, o;
92
+ function me(e) {
93
+ var t, a, i, l;
86
94
  return {
87
95
  ...e,
88
96
  visibleFields: [...e.visibleFields],
89
- sorts: (t = e.sorts) == null ? void 0 : t.map((r) => ({ ...r })),
90
- groups: (a = e.groups) == null ? void 0 : a.map((r) => ({ ...r })),
91
- filters: (i = e.filters) == null ? void 0 : i.map((r) => ({ ...r })),
92
- aggregations: (o = e.aggregations) == null ? void 0 : o.map((r) => ({ ...r })),
97
+ sorts: (t = e.sorts) == null ? void 0 : t.map((s) => ({ ...s })),
98
+ groups: (a = e.groups) == null ? void 0 : a.map((s) => ({ ...s })),
99
+ filters: (i = e.filters) == null ? void 0 : i.map((s) => ({ ...s })),
100
+ aggregations: (l = e.aggregations) == null ? void 0 : l.map((s) => ({ ...s })),
93
101
  fixedColumns: e.fixedColumns ? [...e.fixedColumns] : void 0,
94
102
  galleryCardFields: e.galleryCardFields ? [...e.galleryCardFields] : void 0
95
103
  };
96
104
  }
97
- function Re(e) {
105
+ function M(e, t) {
106
+ return Number.isFinite(e) ? Math.max(Ua, Math.min(Ba, e)) : t;
107
+ }
108
+ function be(e) {
109
+ const t = (e ?? "").trim();
110
+ return t ? `${Na}${t}` : null;
111
+ }
112
+ function Me(e) {
113
+ const t = be(e);
114
+ if (!t || typeof window > "u") return {};
115
+ try {
116
+ const a = window.localStorage.getItem(t);
117
+ return a ? JSON.parse(a) : {};
118
+ } catch {
119
+ return {};
120
+ }
121
+ }
122
+ function je(e, t) {
123
+ const a = be(e);
124
+ if (!(!a || typeof window > "u"))
125
+ try {
126
+ window.localStorage.setItem(a, JSON.stringify(t));
127
+ } catch {
128
+ }
129
+ }
130
+ function He(e) {
98
131
  const t = e[0];
99
132
  return t ? Object.keys(t.fields) : [];
100
133
  }
101
- function se(e) {
134
+ function he(e) {
102
135
  switch (e) {
103
136
  case "kanban":
104
137
  return "columns-3";
@@ -113,8 +146,8 @@ const jt = {
113
146
  return "table-2";
114
147
  }
115
148
  }
116
- function De(e, t = []) {
117
- const a = R(e, t);
149
+ function Je(e, t = []) {
150
+ const a = A(e, t);
118
151
  return {
119
152
  viewId: "table",
120
153
  viewType: "table",
@@ -126,8 +159,8 @@ const jt = {
126
159
  fixedColumns: []
127
160
  };
128
161
  }
129
- function Le(e, t = []) {
130
- const a = R(e, t);
162
+ function Xe(e, t = []) {
163
+ const a = A(e, t);
131
164
  return {
132
165
  viewId: k,
133
166
  viewType: "detail",
@@ -139,11 +172,11 @@ const jt = {
139
172
  fixedColumns: []
140
173
  };
141
174
  }
142
- function $(e, t) {
175
+ function le(e, t) {
143
176
  var a;
144
177
  return ((a = t == null ? void 0 : t.fields.find((i) => i.id === e)) == null ? void 0 : a.name) ?? e;
145
178
  }
146
- function de(e) {
179
+ function _e(e) {
147
180
  switch (e == null ? void 0 : e.type) {
148
181
  case "number":
149
182
  case "currency":
@@ -159,7 +192,7 @@ const jt = {
159
192
  return "string";
160
193
  }
161
194
  }
162
- function Ee(e) {
195
+ function Ye(e) {
163
196
  switch (e == null ? void 0 : e.type) {
164
197
  case "number":
165
198
  return "number";
@@ -202,79 +235,79 @@ const jt = {
202
235
  return "text";
203
236
  }
204
237
  }
205
- function Be(e, t, a = []) {
206
- var o;
207
- return ((((o = e.visibleFields) == null ? void 0 : o.length) ?? 0) > 0 ? e.visibleFields : R(t, a)).map((r) => {
208
- var I;
209
- const v = (I = t == null ? void 0 : t.fields) == null ? void 0 : I.find((p) => p.id === r);
238
+ function Ze(e, t, a = []) {
239
+ var l;
240
+ return ((((l = e.visibleFields) == null ? void 0 : l.length) ?? 0) > 0 ? e.visibleFields : A(t, a)).map((s) => {
241
+ var z;
242
+ const f = (z = t == null ? void 0 : t.fields) == null ? void 0 : z.find((Gt) => Gt.id === s);
210
243
  return {
211
- key: r,
212
- label: $(r, t),
213
- type: de(v),
214
- hidden: (v == null ? void 0 : v.hidden) ?? !1,
215
- width: v == null ? void 0 : v.width
244
+ key: s,
245
+ label: le(s, t),
246
+ type: _e(f),
247
+ hidden: (f == null ? void 0 : f.hidden) ?? !1,
248
+ width: f == null ? void 0 : f.width
216
249
  };
217
250
  });
218
251
  }
219
- function Ae(e, t = []) {
220
- return R(e, t).map((i) => {
221
- var r;
222
- const o = (r = e == null ? void 0 : e.fields) == null ? void 0 : r.find((v) => v.id === i);
252
+ function Qe(e, t = []) {
253
+ return A(e, t).map((i) => {
254
+ var s;
255
+ const l = (s = e == null ? void 0 : e.fields) == null ? void 0 : s.find((f) => f.id === i);
223
256
  return {
224
257
  key: i,
225
- label: $(i, e),
226
- type: de(o),
227
- hidden: (o == null ? void 0 : o.hidden) ?? !1,
228
- width: o == null ? void 0 : o.width
258
+ label: le(i, e),
259
+ type: _e(l),
260
+ hidden: (l == null ? void 0 : l.hidden) ?? !1,
261
+ width: l == null ? void 0 : l.width
229
262
  };
230
263
  });
231
264
  }
232
- function Ne(e, t = []) {
233
- return R(e, t).map((i) => {
234
- var r;
235
- const o = (r = e == null ? void 0 : e.fields) == null ? void 0 : r.find((v) => v.id === i);
265
+ function et(e, t = []) {
266
+ return A(e, t).map((i) => {
267
+ var s;
268
+ const l = (s = e == null ? void 0 : e.fields) == null ? void 0 : s.find((f) => f.id === i);
236
269
  return {
237
270
  id: i,
238
- type: Ee(o),
239
- label: $(i, e)
271
+ type: Ye(l),
272
+ label: le(i, e)
240
273
  };
241
274
  });
242
275
  }
243
- function U(e) {
276
+ function L(e) {
244
277
  return e == null ? "" : Array.isArray(e) ? e.map((t) => String(t)).join(", ") : String(e);
245
278
  }
246
- function A(e, t) {
279
+ function N(e, t) {
247
280
  if (e == null && t == null) return 0;
248
281
  if (e == null) return -1;
249
282
  if (t == null) return 1;
250
- const a = Number(e), i = Number(t), o = Number.isFinite(a) && `${e}`.trim() !== "", r = Number.isFinite(i) && `${t}`.trim() !== "";
251
- if (o && r) return a - i;
252
- const v = Date.parse(String(e)), I = Date.parse(String(t));
253
- return Number.isFinite(v) && Number.isFinite(I) ? v - I : U(e).localeCompare(U(t), "zh-Hans-CN");
283
+ const a = Number(e), i = Number(t), l = Number.isFinite(a) && `${e}`.trim() !== "", s = Number.isFinite(i) && `${t}`.trim() !== "";
284
+ if (l && s) return a - i;
285
+ const f = Date.parse(String(e)), z = Date.parse(String(t));
286
+ return Number.isFinite(f) && Number.isFinite(z) ? f - z : L(e).localeCompare(L(t), "zh-Hans-CN");
254
287
  }
255
- function xe(e, t) {
256
- const a = U(e).trim(), i = (t.value ?? "").trim(), o = a.toLowerCase(), r = i.toLowerCase();
288
+ function tt(e, t) {
289
+ const a = L(e).trim(), i = (t.value ?? "").trim(), l = a.toLowerCase(), s = i.toLowerCase();
257
290
  switch (t.operator) {
258
291
  case "equals":
259
- return o === r;
292
+ return l === s;
260
293
  case "not_equals":
261
- return o !== r;
294
+ return l !== s;
262
295
  case "contains":
263
- return o.includes(r);
296
+ return l.includes(s);
264
297
  case "not_contains":
265
- return !o.includes(r);
298
+ return !l.includes(s);
266
299
  case "starts_with":
267
- return o.startsWith(r);
300
+ return l.startsWith(s);
268
301
  case "ends_with":
269
- return o.endsWith(r);
302
+ return l.endsWith(s);
270
303
  case "gt":
271
- return A(e, i) > 0;
304
+ return N(e, i) > 0;
272
305
  case "gte":
273
- return A(e, i) >= 0;
306
+ return N(e, i) >= 0;
274
307
  case "lt":
275
- return A(e, i) < 0;
308
+ return N(e, i) < 0;
276
309
  case "lte":
277
- return A(e, i) <= 0;
310
+ return N(e, i) <= 0;
278
311
  case "is_empty":
279
312
  return a === "";
280
313
  case "is_not_empty":
@@ -283,7 +316,7 @@ const jt = {
283
316
  return !0;
284
317
  }
285
318
  }
286
- function Ue(e) {
319
+ function at(e) {
287
320
  return {
288
321
  id: `f_${Math.random().toString(36).slice(2, 8)}`,
289
322
  field: e,
@@ -291,7 +324,7 @@ const jt = {
291
324
  value: ""
292
325
  };
293
326
  }
294
- function Ke(e = []) {
327
+ function it(e = []) {
295
328
  return e.map((t, a) => ({
296
329
  id: `f_${t.fieldId}_${a}`,
297
330
  field: t.fieldId,
@@ -317,7 +350,7 @@ const jt = {
317
350
  value: t.value == null ? "" : String(t.value)
318
351
  }));
319
352
  }
320
- function qe(e) {
353
+ function lt(e) {
321
354
  return e.filter((t) => t.field).map((t) => {
322
355
  let a;
323
356
  switch (t.operator) {
@@ -356,564 +389,686 @@ const jt = {
356
389
  };
357
390
  });
358
391
  }
359
- function R(e, t = []) {
392
+ function A(e, t = []) {
360
393
  var i;
361
- const a = (i = e == null ? void 0 : e.fields) == null ? void 0 : i.filter((o) => !o.hidden).map((o) => o.id);
362
- return a != null && a.length ? a : Re(t);
394
+ const a = (i = e == null ? void 0 : e.fields) == null ? void 0 : i.filter((l) => !l.hidden).map((l) => l.id);
395
+ return a != null && a.length ? a : He(t);
363
396
  }
364
- function Ge(e) {
397
+ function ot(e) {
365
398
  return e ? {
366
399
  id: e.id,
367
400
  ...e.fields
368
401
  } : { id: "__detail-empty__" };
369
402
  }
370
- function Me(e) {
403
+ function rt(e) {
371
404
  if (e)
372
405
  return {
373
406
  label: "返回列表",
374
- onClick: () => he(e)
407
+ onClick: () => Le(e)
375
408
  };
376
409
  }
377
- const ue = n(() => l.schema ?? null), Pe = n(() => l.records ?? []), ce = n(() => {
378
- var i, o;
379
- const e = (l.views ?? []).map((r) => ne(r)), t = e.some((r) => r.viewType === "table") || (((i = l.schema) == null ? void 0 : i.views) ?? []).some((r) => r.viewType === "table"), a = e.some((r) => r.viewType === "detail") || (((o = l.schema) == null ? void 0 : o.views) ?? []).some((r) => r.viewType === "detail");
380
- return t || e.unshift(De(l.schema, l.records ?? [])), a || e.push(Le(l.schema, l.records ?? [])), e;
381
- }), s = $t({
382
- tableId: l.tableId,
383
- mode: l.mode,
384
- schema: ue,
385
- records: Pe,
386
- views: ce,
387
- provider: l.provider,
388
- defaultView: l.defaultView,
389
- initialViewId: l.currentViewId || l.initialViewId || ((ge = l.defaultView) == null ? void 0 : ge.viewId) || ((Ce = ce.value[0]) == null ? void 0 : Ce.viewId) || "",
390
- initialSelectedRecordId: l.selectedRecordId ?? l.initialSelectedRecordId,
391
- pageSize: l.pageSize,
392
- autoLoad: l.autoLoad,
410
+ const U = Me(o.tableId), ye = r(() => o.schema ?? null), st = r(() => o.records ?? []), ke = r(() => {
411
+ var i, l;
412
+ const e = (o.views ?? []).map((s) => me(s)), t = e.some((s) => s.viewType === "table") || (((i = o.schema) == null ? void 0 : i.views) ?? []).some((s) => s.viewType === "table"), a = e.some((s) => s.viewType === "detail") || (((l = o.schema) == null ? void 0 : l.views) ?? []).some((s) => s.viewType === "detail");
413
+ return t || e.unshift(Je(o.schema, o.records ?? [])), a || e.push(Xe(o.schema, o.records ?? [])), e;
414
+ }), n = ra({
415
+ tableId: o.tableId,
416
+ mode: o.mode,
417
+ schema: ye,
418
+ records: st,
419
+ views: ke,
420
+ provider: o.provider,
421
+ defaultView: o.defaultView,
422
+ initialViewId: o.currentViewId || o.initialViewId || U.activeViewId || ((xe = o.defaultView) == null ? void 0 : xe.viewId) || ((Ke = ke.value[0]) == null ? void 0 : Ke.viewId) || "",
423
+ initialSelectedRecordId: o.selectedRecordId ?? o.initialSelectedRecordId,
424
+ pageSize: o.pageSize,
425
+ autoLoad: o.autoLoad,
393
426
  actions: {
394
427
  onCellEdit: async (e) => {
395
428
  var t, a;
396
- d("cell-edit", e), await ((a = (t = l.actions) == null ? void 0 : t.onCellEdit) == null ? void 0 : a.call(t, e));
429
+ u("cell-edit", e), await ((a = (t = o.actions) == null ? void 0 : t.onCellEdit) == null ? void 0 : a.call(t, e));
397
430
  },
398
431
  onSelectRecord: async (e) => {
399
432
  var t, a;
400
- await ((a = (t = l.actions) == null ? void 0 : t.onSelectRecord) == null ? void 0 : a.call(t, e));
433
+ await ((a = (t = o.actions) == null ? void 0 : t.onSelectRecord) == null ? void 0 : a.call(t, e));
401
434
  },
402
435
  onSchemaEvent: async (e) => {
403
436
  var t, a;
404
437
  switch (e.type) {
405
438
  case "schema-add-field":
406
- d("schema-add-field", e.fieldType);
439
+ u("schema-add-field", e.fieldType);
407
440
  break;
408
441
  case "schema-rename-field":
409
- d("schema-rename-field", { fieldId: e.fieldId, newName: e.newName });
442
+ u("schema-rename-field", { fieldId: e.fieldId, newName: e.newName });
410
443
  break;
411
444
  case "schema-change-field-type":
412
- d("schema-change-field-type", { fieldId: e.fieldId, newType: e.newType });
445
+ u("schema-change-field-type", { fieldId: e.fieldId, newType: e.newType });
413
446
  break;
414
447
  case "schema-hide-field":
415
- d("schema-hide-field", e.fieldId);
448
+ u("schema-hide-field", e.fieldId);
416
449
  break;
417
450
  case "schema-delete-field":
418
- d("schema-delete-field", e.fieldId);
451
+ u("schema-delete-field", e.fieldId);
419
452
  break;
420
453
  case "schema-duplicate-field":
421
- d("schema-duplicate-field", e.fieldId);
454
+ u("schema-duplicate-field", e.fieldId);
422
455
  break;
423
456
  }
424
- await ((a = (t = l.actions) == null ? void 0 : t.onSchemaEvent) == null ? void 0 : a.call(t, e));
457
+ await ((a = (t = o.actions) == null ? void 0 : t.onSchemaEvent) == null ? void 0 : a.call(t, e));
425
458
  },
426
459
  onSaveView: async (e) => {
427
460
  var t, a;
428
- d("save-view", e.name), await ((a = (t = l.actions) == null ? void 0 : t.onViewSave) == null ? void 0 : a.call(t, { tableId: l.tableId, viewId: e.viewId, name: e.name }));
461
+ u("save-view", e.name), await ((a = (t = o.actions) == null ? void 0 : t.onViewSave) == null ? void 0 : a.call(t, { tableId: o.tableId, viewId: e.viewId, name: e.name }));
429
462
  },
430
463
  onRefresh: async () => {
431
464
  var e, t;
432
- d("refresh"), await ((t = (e = l.actions) == null ? void 0 : e.onRefresh) == null ? void 0 : t.call(e));
465
+ u("refresh"), await ((t = (e = o.actions) == null ? void 0 : e.onRefresh) == null ? void 0 : t.call(e));
433
466
  }
434
467
  }
435
- }), b = n(() => s.activeView.value), z = n(() => s.activeViewId.value), h = n(() => s.selectedRecord.value), We = n(() => s.selectedRecordId.value), V = n(() => s.schema.value ?? ue.value), C = n(() => [...s.records.value]), m = n(() => b.value.viewType || "table"), f = B({}), D = B(l.searchKeyword ?? ""), j = B("and"), y = B([]), _ = B(
436
- l.currentViewId === k || l.initialViewId === k || l.selectedRecordId != null || l.initialSelectedRecordId != null
468
+ }), h = r(() => n.activeView.value), j = r(() => n.activeViewId.value), w = r(() => n.selectedRecord.value), nt = r(() => n.selectedRecordId.value), S = r(() => n.schema.value ?? ye.value), I = r(() => [...n.records.value]), p = r(() => h.value.viewType || "table"), m = C({}), B = C(
469
+ U.detailPresentation ?? null
470
+ ), oe = C(
471
+ M(U.sidePanelWidth ?? we, we)
472
+ ), re = C(
473
+ M(U.drawerWidth ?? pe, pe)
474
+ ), D = C(o.searchKeyword || U.searchKeyword || ""), se = C("and"), _ = C([]), y = C(
475
+ o.currentViewId === k || o.initialViewId === k || o.selectedRecordId != null || o.initialSelectedRecordId != null
437
476
  );
438
477
  F(
439
- () => l.searchKeyword,
478
+ () => o.searchKeyword,
440
479
  (e) => {
441
- D.value = e ?? "";
480
+ e !== void 0 && (D.value = e);
442
481
  },
443
482
  { immediate: !0 }
444
483
  ), F(D, (e) => {
445
- d("update:searchKeyword", e);
484
+ u("update:searchKeyword", e);
446
485
  }), F(
447
- b,
486
+ [j, D, B, oe, re],
487
+ ([e, t, a, i, l]) => {
488
+ je(o.tableId, {
489
+ activeViewId: e,
490
+ searchKeyword: t,
491
+ detailPresentation: a ?? void 0,
492
+ sidePanelWidth: i,
493
+ drawerWidth: l
494
+ });
495
+ },
496
+ { immediate: !0 }
497
+ ), F(
498
+ h,
448
499
  (e) => {
449
- y.value = Ke(e.filters ?? []);
500
+ _.value = it(e.filters ?? []);
450
501
  },
451
502
  { immediate: !0 }
452
503
  ), F(
453
- () => l.currentViewId,
504
+ () => o.currentViewId,
454
505
  (e) => {
455
- !e || e === z.value || (s.setActiveViewId(e), e === k && (_.value = !0));
506
+ !e || e === j.value || (n.setActiveViewId(e), e === k && (y.value = !0));
456
507
  },
457
508
  { immediate: !0 }
458
509
  ), F(
459
- () => l.selectedRecordId,
510
+ () => o.selectedRecordId,
460
511
  (e) => {
461
512
  if (e !== void 0) {
462
513
  if (!e) {
463
- _.value = !1, f.value = {}, s.clearSelectedRecord();
514
+ y.value = !1, m.value = {}, n.clearSelectedRecord();
464
515
  return;
465
516
  }
466
- _.value = !0, f.value = {}, s.setSelectedRecord(e);
517
+ y.value = !0, m.value = {}, n.setSelectedRecord(e);
467
518
  }
468
519
  },
469
520
  { immediate: !0 }
470
521
  ), F(
471
- z,
522
+ j,
472
523
  (e, t) => {
473
524
  var a, i;
474
- d("update:currentViewId", e), e === k && (_.value = !0), t !== void 0 && e !== t && ((i = (a = l.actions) == null ? void 0 : a.onViewChange) == null || i.call(a, { tableId: l.tableId, view: ne(b.value) }));
525
+ u("update:currentViewId", e), e === k && (y.value = !0), t !== void 0 && e !== t && ((i = (a = o.actions) == null ? void 0 : a.onViewChange) == null || i.call(a, { tableId: o.tableId, view: me(h.value) }));
475
526
  },
476
527
  { immediate: !0 }
477
528
  ), F(
478
- We,
529
+ nt,
479
530
  (e, t) => {
480
- d("update:selectedRecordId", e), t !== void 0 && e !== t && d("select-record", h.value ?? null);
531
+ u("update:selectedRecordId", e), t !== void 0 && e !== t && u("select-record", w.value ?? null);
481
532
  },
482
533
  { immediate: !0 }
483
534
  );
484
- const H = n(() => {
485
- const e = l.viewTabs && l.viewTabs.length > 0 ? l.viewTabs.map((i) => ({ ...i })) : s.viewList.value.map((i) => ({
535
+ const ne = r(() => {
536
+ const e = o.viewTabs && o.viewTabs.length > 0 ? o.viewTabs.map((i) => ({ ...i })) : n.viewList.value.map((i) => ({
486
537
  value: i.id,
487
538
  label: i.name,
488
- icon: se(i.type)
539
+ icon: he(i.type)
489
540
  })), t = [], a = /* @__PURE__ */ new Set();
490
541
  for (const i of e)
491
542
  a.has(i.value) || (a.add(i.value), t.push(i));
492
- return a.has(k) || t.push({ value: k, label: "详情", icon: se("detail") }), t;
493
- }), Oe = n(
494
- () => s.viewList.value.map((e) => ({
543
+ return a.has(k) || t.push({ value: k, label: "详情", icon: he("detail") }), t;
544
+ }), dt = r(
545
+ () => n.viewList.value.map((e) => ({
495
546
  id: e.id,
496
547
  name: e.name
497
548
  }))
498
- ), J = n(() => Be(b.value, V.value, C.value)), X = n(() => Ae(V.value, C.value)), K = n(() => Ne(V.value, C.value)), Y = n(() => Ge(h.value)), ve = n(() => ({
499
- ...Y.value,
500
- ...f.value
501
- })), fe = n(
502
- () => new Set(K.value.filter((e) => e.type === "richtext").map((e) => e.id))
503
- ), $e = n(
504
- () => X.value.filter((e) => !fe.value.has(e.key))
505
- ), we = n(
506
- () => X.value.filter((e) => fe.value.has(e.key))
507
- ), ze = n(() => Object.keys(f.value).length > 0), je = n(() => R(V.value, C.value)), me = n(() => {
549
+ ), de = r(() => Ze(h.value, S.value, I.value)), ge = r(() => Qe(S.value, I.value)), H = r(() => et(S.value, I.value)), Ie = r(() => ot(w.value)), J = r(() => ({
550
+ ...Ie.value,
551
+ ...m.value
552
+ })), X = r(
553
+ () => {
554
+ var e, t, a, i, l, s, f;
555
+ return L(
556
+ ((t = (e = w.value) == null ? void 0 : e.fields) == null ? void 0 : t.title) ?? ((i = (a = w.value) == null ? void 0 : a.fields) == null ? void 0 : i.name) ?? ((s = (l = w.value) == null ? void 0 : l.fields) == null ? void 0 : s.subject) ?? ((f = w.value) == null ? void 0 : f.id) ?? "记录详情"
557
+ ) || "记录详情";
558
+ }
559
+ ), Ce = r(
560
+ () => new Set(H.value.filter((e) => e.type === "richtext").map((e) => e.id))
561
+ ), Ve = r(
562
+ () => ge.value.filter((e) => !Ce.value.has(e.key))
563
+ ), ut = r(
564
+ () => ge.value.filter((e) => Ce.value.has(e.key))
565
+ ), Se = r(() => ut.value.map((t) => {
566
+ const a = $(t.key), i = L(a).trim();
567
+ return i ? `## ${t.label}
568
+
569
+ ${i}` : "";
570
+ }).filter((t) => t.length > 0).join(`
571
+
572
+ `)), Fe = r(() => Object.keys(m.value).length > 0), ct = r(() => A(S.value, I.value)), Te = r(() => {
508
573
  var t;
509
- const e = (t = b.value.sorts) == null ? void 0 : t[0];
574
+ const e = (t = h.value.sorts) == null ? void 0 : t[0];
510
575
  return {
511
576
  field: (e == null ? void 0 : e.fieldId) ?? null,
512
577
  order: (e == null ? void 0 : e.direction) ?? null
513
578
  };
514
- }), He = n(() => {
579
+ }), vt = r(() => {
515
580
  var e, t;
516
- return ((t = (e = b.value.groups) == null ? void 0 : e[0]) == null ? void 0 : t.fieldId) ?? void 0;
517
- }), q = n(() => y.value), Je = n(() => q.value.length > 0), Xe = n(() => l.showToolbar !== !1), Ye = n(() => l.showViewSwitch !== !1 && H.value.length > 1), Ze = n(() => l.showFilter !== !1), Qe = n(() => l.showSort !== !1), et = n(() => l.showGroup !== !1), tt = n(() => l.showColumns !== !1), at = n(() => l.showSearch !== !1), N = n(() => _.value && !!h.value), pe = n(() => l.detailPresentation !== "auto" ? l.detailPresentation : re.value ? "sheet" : "side-panel"), it = n(() => l.loading ?? s.loading.value), G = n(() => l.error ?? s.error.value), L = n(() => {
518
- let e = [...C.value];
581
+ return ((t = (e = h.value.groups) == null ? void 0 : e[0]) == null ? void 0 : t.fieldId) ?? void 0;
582
+ }), Y = r(() => _.value), ft = r(() => Y.value.length > 0), wt = r(() => o.showToolbar !== !1), pt = r(() => o.showViewSwitch !== !1 && ne.value.length > 1), mt = r(() => o.showFilter !== !1), bt = r(() => o.showSort !== !1), ht = r(() => o.showGroup !== !1), _t = r(() => o.showColumns !== !1), yt = r(() => o.showSearch !== !1), x = r(() => y.value && !!w.value), E = r(() => o.detailPresentation !== "auto" ? o.detailPresentation : B.value ? B.value === "side-panel" && G.value ? "sheet" : B.value : G.value ? "sheet" : "side-panel"), Re = r(() => {
583
+ const e = [];
584
+ return G.value || e.push({ value: "side-panel", label: "侧栏" }), e.push({ value: "sheet", label: "抽屉" }), e.push({ value: "full-page", label: "全屏" }), e;
585
+ }), ue = r(() => o.detailPresentation === "auto"), kt = r(() => o.loading ?? n.loading.value), Z = r(() => o.error ?? n.error.value), W = r(() => {
586
+ let e = [...I.value];
519
587
  if (D.value.trim()) {
520
588
  const a = D.value.trim().toLowerCase();
521
589
  e = e.filter(
522
- (i) => je.value.some(
523
- (o) => U(i.fields[o]).toLowerCase().includes(a)
590
+ (i) => ct.value.some(
591
+ (l) => L(i.fields[l]).toLowerCase().includes(a)
524
592
  )
525
593
  );
526
594
  }
527
- q.value.length > 0 && (e = e.filter((a) => {
528
- const i = q.value.map((o) => {
529
- const r = a.fields[o.field];
530
- return xe(r, o);
595
+ Y.value.length > 0 && (e = e.filter((a) => {
596
+ const i = Y.value.map((l) => {
597
+ const s = a.fields[l.field];
598
+ return tt(s, l);
531
599
  });
532
- return j.value === "and" ? i.every(Boolean) : i.some(Boolean);
600
+ return se.value === "and" ? i.every(Boolean) : i.some(Boolean);
533
601
  }));
534
- const t = me.value;
602
+ const t = Te.value;
535
603
  return t.field && t.order && e.sort((a, i) => {
536
- const o = A(
604
+ const l = N(
537
605
  a.fields[t.field],
538
606
  i.fields[t.field]
539
607
  );
540
- return t.order === "desc" ? -o : o;
608
+ return t.order === "desc" ? -l : l;
541
609
  }), e;
542
- }), lt = n(
543
- () => zt(L.value, {
544
- startFieldId: m.value === "timeline" ? "startDate" : void 0,
545
- endFieldId: m.value === "timeline" ? "endDate" : void 0,
610
+ }), gt = r(
611
+ () => sa(W.value, {
612
+ startFieldId: p.value === "timeline" ? "startDate" : void 0,
613
+ endFieldId: p.value === "timeline" ? "endDate" : void 0,
546
614
  labelFieldId: "title"
547
615
  })
548
- ), Z = n(() => it.value ? "loading" : G.value ? "error" : m.value === "detail" ? N.value ? "normal" : "empty" : m.value === "timeline" ? lt.value.length > 0 ? "normal" : "empty" : L.value.length > 0 ? "normal" : "empty"), ot = n(() => {
616
+ ), ce = r(() => kt.value ? "loading" : Z.value ? "error" : p.value === "detail" ? x.value ? "normal" : "empty" : p.value === "timeline" ? gt.value.length > 0 ? "normal" : "empty" : W.value.length > 0 ? "normal" : "empty"), It = r(() => {
549
617
  var a;
550
- if (m.value !== "detail") return;
551
- const e = C.value[0];
618
+ if (p.value !== "detail") return;
619
+ const e = I.value[0];
552
620
  if (e)
553
621
  return {
554
622
  label: "打开第一条记录",
555
- onClick: () => M(e)
623
+ onClick: () => Q(e)
556
624
  };
557
- const t = ((a = H.value.find((i) => i.value !== k)) == null ? void 0 : a.value) ?? null;
558
- return Me(t);
625
+ const t = ((a = ne.value.find((i) => i.value !== k)) == null ? void 0 : a.value) ?? null;
626
+ return rt(t);
559
627
  });
628
+ function ve(e) {
629
+ n.setRecords(e), u("update:records", e);
630
+ }
560
631
  function Q(e) {
561
- s.setRecords(e), d("update:records", e);
632
+ e && (y.value = !0, m.value = {}, n.setSelectedRecord(e));
562
633
  }
563
- function M(e) {
564
- e && (_.value = !0, f.value = {}, s.setSelectedRecord(e));
634
+ function De(e) {
635
+ ue.value && (B.value = e);
565
636
  }
566
- function be(e) {
567
- return e ? C.value.find((t) => t.id === e) ?? null : null;
637
+ function Ee(e) {
638
+ return e ? I.value.find((t) => t.id === e) ?? null : null;
568
639
  }
569
- function he(e) {
570
- s.viewList.value.some((t) => t.id === e) && (e === k && (_.value = !0), s.switchView(e));
640
+ function Le(e) {
641
+ n.viewList.value.some((t) => t.id === e) && (e === k && (y.value = !0), n.switchView(e));
571
642
  }
572
- function rt(e) {
573
- he(e);
643
+ function Ct(e) {
644
+ Le(e);
574
645
  }
575
- function nt(e) {
646
+ function Vt(e) {
576
647
  var t, a;
577
- s.viewList.value.some((i) => i.id === e) && (e === k && (_.value = !0), s.switchView(e), d("load-view", e), (a = (t = l.actions) == null ? void 0 : t.onViewLoad) == null || a.call(t, { tableId: l.tableId, viewId: e }));
648
+ n.viewList.value.some((i) => i.id === e) && (e === k && (y.value = !0), n.switchView(e), u("load-view", e), (a = (t = o.actions) == null ? void 0 : t.onViewLoad) == null || a.call(t, { tableId: o.tableId, viewId: e }));
578
649
  }
579
- function st(e) {
580
- s.saveView({ name: e });
650
+ function St(e) {
651
+ n.saveView({ name: e });
581
652
  }
582
- function P() {
583
- s.updateActiveView({
584
- filters: qe(y.value)
653
+ function ee() {
654
+ n.updateActiveView({
655
+ filters: lt(_.value)
585
656
  });
586
657
  }
587
- function dt() {
658
+ function Ft() {
588
659
  var t;
589
- const e = ((t = J.value.find((a) => !a.hidden)) == null ? void 0 : t.key) ?? "";
590
- e && (y.value = [...y.value, Ue(e)], P());
660
+ const e = ((t = de.value.find((a) => !a.hidden)) == null ? void 0 : t.key) ?? "";
661
+ e && (_.value = [..._.value, at(e)], ee());
591
662
  }
592
- function ut(e) {
593
- y.value = y.value.filter((t) => t.id !== e), P();
663
+ function Tt(e) {
664
+ _.value = _.value.filter((t) => t.id !== e), ee();
594
665
  }
595
- function ct(e, t) {
596
- y.value = y.value.map(
666
+ function Rt(e, t) {
667
+ _.value = _.value.map(
597
668
  (a) => a.id === e ? { ...a, ...t } : a
598
- ), P();
669
+ ), ee();
599
670
  }
600
- function vt() {
601
- y.value = [], P();
671
+ function Dt() {
672
+ _.value = [], ee();
602
673
  }
603
- function ft(e) {
604
- j.value = e, d("update:filterLogic", e);
674
+ function Et(e) {
675
+ se.value = e, u("update:filterLogic", e);
605
676
  }
606
- function wt(e) {
607
- d("update:columns", e), s.updateActiveView({
677
+ function Lt(e) {
678
+ u("update:columns", e), n.updateActiveView({
608
679
  visibleFields: e.filter((t) => !t.hidden).map((t) => t.key)
609
680
  });
610
681
  }
611
- function mt(e) {
682
+ function At(e) {
612
683
  var i;
613
684
  if (!e) {
614
- s.updateActiveView({ sorts: [] }), d("sort", e);
685
+ n.updateActiveView({ sorts: [] }), u("sort", e);
615
686
  return;
616
687
  }
617
- const t = (i = b.value.sorts) == null ? void 0 : i[0], a = (t == null ? void 0 : t.fieldId) === e && t.direction === "asc" ? "desc" : "asc";
618
- s.updateActiveView({
688
+ const t = (i = h.value.sorts) == null ? void 0 : i[0], a = (t == null ? void 0 : t.fieldId) === e && t.direction === "asc" ? "desc" : "asc";
689
+ n.updateActiveView({
619
690
  sorts: [{ fieldId: e, direction: a }]
620
- }), d("sort", e);
691
+ }), u("sort", e);
621
692
  }
622
- function pt(e) {
623
- s.updateActiveView({
693
+ function Wt(e) {
694
+ n.updateActiveView({
624
695
  groups: e ? [{ fieldId: e }] : []
625
- }), d("group", e);
696
+ }), u("group", e);
626
697
  }
627
- function bt(e) {
628
- D.value = e, d("update:searchKeyword", e);
698
+ function Pt(e) {
699
+ D.value = e, u("update:searchKeyword", e);
629
700
  }
630
- function E(e) {
631
- s.emitSchemaEvent(e);
701
+ function P(e) {
702
+ n.emitSchemaEvent(e);
632
703
  }
633
- function ht(e, t, a) {
634
- const i = C.value.map((o) => o.id !== e ? o : {
635
- ...o,
704
+ function Nt(e, t, a) {
705
+ const i = I.value.map((l) => l.id !== e ? l : {
706
+ ...l,
636
707
  fields: {
637
- ...o.fields,
708
+ ...l.fields,
638
709
  [t]: a
639
710
  }
640
711
  });
641
- Q(i);
712
+ ve(i);
642
713
  }
643
- function ee(e) {
644
- ht(e.rowId, e.fieldId, e.value), s.emitCellEdit(e);
714
+ function Ae(e) {
715
+ Nt(e.rowId, e.fieldId, e.value), n.emitCellEdit(e);
645
716
  }
646
- function yt(e) {
717
+ function Ut(e) {
647
718
  var t, a;
648
- d("record-change", e), (a = (t = l.actions) == null ? void 0 : t.onRecordChange) == null || a.call(t, { tableId: l.tableId, ...e });
719
+ u("record-change", e), (a = (t = o.actions) == null ? void 0 : t.onRecordChange) == null || a.call(t, { tableId: o.tableId, ...e });
649
720
  }
650
- function _t(e) {
651
- Q(e);
721
+ function Bt(e) {
722
+ ve(e);
652
723
  }
653
- function kt(e) {
654
- M(e);
724
+ function xt(e) {
725
+ Q(e);
655
726
  }
656
- function gt(e) {
657
- d("row-click", e);
727
+ function Kt(e) {
728
+ u("row-click", e);
658
729
  }
659
- function ye(e) {
660
- d("card-click", e), M(be(e.id));
730
+ function We(e) {
731
+ u("card-click", e), Q(Ee(e.id));
661
732
  }
662
- function Ct(e) {
663
- d("row-click", e), M(be(e.sourceRecordId ?? e.id));
733
+ function $t(e) {
734
+ u("row-click", e), Q(Ee(e.sourceRecordId ?? e.id));
664
735
  }
665
- function W() {
666
- _.value = !1, f.value = {}, s.clearSelectedRecord();
736
+ function K() {
737
+ y.value = !1, m.value = {}, n.clearSelectedRecord();
667
738
  }
668
- function _e(e) {
739
+ function zt(e) {
669
740
  for (const [t, a] of Object.entries(e.fields))
670
- ee({ rowId: e.rowId, fieldId: t, value: a });
671
- f.value = {}, W();
741
+ Ae({ rowId: e.rowId, fieldId: t, value: a });
742
+ m.value = {}, K();
672
743
  }
673
- function ke(e) {
674
- const t = C.value.filter((a) => a.id !== e);
675
- Q(t), _.value = !1, f.value = {}, s.clearSelectedRecord();
744
+ function Pe(e) {
745
+ const t = I.value.filter((a) => a.id !== e);
746
+ ve(t), y.value = !1, m.value = {}, n.clearSelectedRecord();
676
747
  }
677
- function Vt(e) {
678
- return K.value.find((t) => t.id === e) ?? {
748
+ function Ne(e) {
749
+ return H.value.find((t) => t.id === e) ?? {
679
750
  id: e,
680
751
  type: "text",
681
752
  label: e
682
753
  };
683
754
  }
684
- function te(e) {
685
- return Object.prototype.hasOwnProperty.call(f.value, e) ? f.value[e] : Y.value[e];
755
+ function $(e) {
756
+ return Object.prototype.hasOwnProperty.call(m.value, e) ? m.value[e] : Ie.value[e];
686
757
  }
687
- function It(e) {
688
- const t = te(e);
689
- return typeof t != "string" || !t ? "" : Te(t);
690
- }
691
- function St(e, t, a) {
692
- f.value = {
693
- ...f.value,
758
+ function Ue(e, t, a) {
759
+ m.value = {
760
+ ...m.value,
694
761
  [t]: a
695
762
  };
696
763
  }
697
- function Ft() {
698
- h.value && _e({
699
- rowId: h.value.id,
700
- fields: { ...f.value }
764
+ function Be() {
765
+ w.value && zt({
766
+ rowId: w.value.id,
767
+ fields: { ...m.value }
701
768
  });
702
769
  }
770
+ function Ot(e) {
771
+ oe.value = M(e, we);
772
+ }
773
+ function qt(e) {
774
+ re.value = M(e, pe);
775
+ }
703
776
  return (e, t) => {
704
777
  var a;
705
- return c(), w("section", Lt({
778
+ return d(), v("section", Jt({
706
779
  class: "of-database-view",
707
780
  "data-role": "database-view"
708
781
  }, e.$attrs), [
709
- Z.value === "loading" ? (c(), w("div", jt, [
710
- ae(ie(Bt), {
782
+ ce.value === "loading" ? (d(), v("div", na, [
783
+ O(fe(Xt), {
711
784
  class: "of-database-view__spinner",
712
785
  size: 20
713
786
  }),
714
- t[10] || (t[10] = u("div", { class: "of-database-view__state-text" }, [
715
- u("div", { class: "of-database-view__state-title" }, "正在加载数据视图"),
716
- u("div", { class: "of-database-view__state-description" }, "请稍候,页面级编排器正在准备当前视图。")
787
+ t[11] || (t[11] = c("div", { class: "of-database-view__state-text" }, [
788
+ c("div", { class: "of-database-view__state-title" }, "正在加载数据视图"),
789
+ c("div", { class: "of-database-view__state-description" }, "请稍候,页面级编排器正在准备当前视图。")
717
790
  ], -1))
718
- ])) : Z.value === "error" ? (c(), w("div", Ht, [
719
- ae(Se, {
720
- icon: ie(At),
791
+ ])) : ce.value === "error" ? (d(), v("div", da, [
792
+ O(ze, {
793
+ icon: fe(Yt),
721
794
  title: "数据视图加载失败",
722
- description: G.value instanceof Error ? G.value.message : String(G.value)
795
+ description: Z.value instanceof Error ? Z.value.message : String(Z.value)
723
796
  }, null, 8, ["icon", "description"])
724
- ])) : (c(), w(le, { key: 2 }, [
725
- Xe.value ? (c(), S(qt, {
797
+ ])) : (d(), v(q, { key: 2 }, [
798
+ wt.value ? (d(), V(ta, {
726
799
  key: 0,
727
800
  class: "of-database-view__toolbar",
728
- "current-view": z.value,
729
- "view-tabs": H.value,
730
- columns: J.value,
731
- "filter-conditions": q.value,
732
- "filter-logic": j.value,
733
- "filter-active": Je.value,
734
- "current-sort": me.value,
735
- "current-group": He.value,
801
+ "current-view": j.value,
802
+ "view-tabs": ne.value,
803
+ columns: de.value,
804
+ "filter-conditions": Y.value,
805
+ "filter-logic": se.value,
806
+ "filter-active": ft.value,
807
+ "current-sort": Te.value,
808
+ "current-group": vt.value,
736
809
  "search-keyword": D.value,
737
- "show-view-switch": Ye.value,
738
- "show-filter": Ze.value,
739
- "show-sort": Qe.value,
740
- "show-group": et.value,
741
- "show-columns": tt.value,
742
- "show-search": at.value,
743
- "saved-views": Oe.value,
744
- "onUpdate:currentView": rt,
745
- "onUpdate:columns": wt,
746
- "onUpdate:searchKeyword": bt,
747
- onAddFilter: dt,
748
- onRemoveFilter: ut,
749
- onUpdateFilter: ct,
750
- onClearFilters: vt,
751
- "onUpdate:filterLogic": ft,
752
- onSort: mt,
753
- onGroup: pt,
754
- onSaveView: st,
755
- onLoadView: nt
756
- }, null, 8, ["current-view", "view-tabs", "columns", "filter-conditions", "filter-logic", "filter-active", "current-sort", "current-group", "search-keyword", "show-view-switch", "show-filter", "show-sort", "show-group", "show-columns", "show-search", "saved-views"])) : oe("", !0),
757
- Z.value === "empty" ? (c(), w("div", Jt, [
758
- ae(Se, {
759
- icon: ie(Nt),
810
+ "show-view-switch": pt.value,
811
+ "show-filter": mt.value,
812
+ "show-sort": bt.value,
813
+ "show-group": ht.value,
814
+ "show-columns": _t.value,
815
+ "show-search": yt.value,
816
+ "saved-views": dt.value,
817
+ "onUpdate:currentView": Ct,
818
+ "onUpdate:columns": Lt,
819
+ "onUpdate:searchKeyword": Pt,
820
+ onAddFilter: Ft,
821
+ onRemoveFilter: Tt,
822
+ onUpdateFilter: Rt,
823
+ onClearFilters: Dt,
824
+ "onUpdate:filterLogic": Et,
825
+ onSort: At,
826
+ onGroup: Wt,
827
+ onSaveView: St,
828
+ onLoadView: Vt
829
+ }, null, 8, ["current-view", "view-tabs", "columns", "filter-conditions", "filter-logic", "filter-active", "current-sort", "current-group", "search-keyword", "show-view-switch", "show-filter", "show-sort", "show-group", "show-columns", "show-search", "saved-views"])) : te("", !0),
830
+ ce.value === "empty" ? (d(), v("div", ua, [
831
+ O(ze, {
832
+ icon: fe(Zt),
760
833
  title: "暂无记录",
761
- description: m.value === "detail" ? "请选择一条记录,详情工作区会在这里打开。" : m.value === "timeline" ? "当前时间线没有可渲染的起止日期。" : "当前视图没有匹配的数据,或者被筛选条件过滤为空。",
762
- action: ot.value
834
+ description: p.value === "detail" ? "请选择一条记录,详情工作区会在这里打开。" : p.value === "timeline" ? "当前时间线没有可渲染的起止日期。" : "当前视图没有匹配的数据,或者被筛选条件过滤为空。",
835
+ action: It.value
763
836
  }, null, 8, ["icon", "description", "action"])
764
- ])) : (c(), w("div", {
837
+ ])) : (d(), v("div", {
765
838
  key: 2,
766
839
  class: "of-database-view__content",
767
- "data-view": m.value
840
+ "data-view": p.value
768
841
  }, [
769
- m.value === "table" ? (c(), S(Gt, {
842
+ p.value === "table" ? (d(), V(aa, {
770
843
  key: 0,
771
844
  class: "of-database-view__view of-database-view__view--table",
772
- records: L.value,
773
- schema: V.value ?? void 0,
774
- view: b.value,
775
- columns: J.value,
776
- readonly: T.readonly,
777
- "enable-field-management": ((a = T.ui) == null ? void 0 : a.enableFieldManagement) ?? !1,
778
- onCellEdit: ee,
779
- onSchemaAddField: t[0] || (t[0] = (i) => E({ type: "schema-add-field", fieldType: i })),
780
- onSchemaRenameField: t[1] || (t[1] = ({ fieldId: i, newName: o }) => E({ type: "schema-rename-field", fieldId: i, newName: o })),
781
- onSchemaChangeFieldType: t[2] || (t[2] = ({ fieldId: i, newType: o }) => E({ type: "schema-change-field-type", fieldId: i, newType: o })),
782
- onSchemaHideField: t[3] || (t[3] = (i) => E({ type: "schema-hide-field", fieldId: i })),
783
- onSchemaDeleteField: t[4] || (t[4] = (i) => E({ type: "schema-delete-field", fieldId: i })),
784
- onSchemaDuplicateField: t[5] || (t[5] = (i) => E({ type: "schema-duplicate-field", fieldId: i })),
785
- onRowClick: gt,
786
- onRowClickRecord: kt
787
- }, null, 8, ["records", "schema", "view", "columns", "readonly", "enable-field-management"])) : m.value === "kanban" ? (c(), S(Mt, {
845
+ records: W.value,
846
+ schema: S.value ?? void 0,
847
+ view: h.value,
848
+ columns: de.value,
849
+ readonly: R.readonly,
850
+ "enable-field-management": ((a = R.ui) == null ? void 0 : a.enableFieldManagement) ?? !1,
851
+ onCellEdit: Ae,
852
+ onSchemaAddField: t[0] || (t[0] = (i) => P({ type: "schema-add-field", fieldType: i })),
853
+ onSchemaRenameField: t[1] || (t[1] = ({ fieldId: i, newName: l }) => P({ type: "schema-rename-field", fieldId: i, newName: l })),
854
+ onSchemaChangeFieldType: t[2] || (t[2] = ({ fieldId: i, newType: l }) => P({ type: "schema-change-field-type", fieldId: i, newType: l })),
855
+ onSchemaHideField: t[3] || (t[3] = (i) => P({ type: "schema-hide-field", fieldId: i })),
856
+ onSchemaDeleteField: t[4] || (t[4] = (i) => P({ type: "schema-delete-field", fieldId: i })),
857
+ onSchemaDuplicateField: t[5] || (t[5] = (i) => P({ type: "schema-duplicate-field", fieldId: i })),
858
+ onRowClick: Kt,
859
+ onRowClickRecord: xt
860
+ }, null, 8, ["records", "schema", "view", "columns", "readonly", "enable-field-management"])) : p.value === "kanban" ? (d(), V(ia, {
788
861
  key: 1,
789
862
  class: "of-database-view__view of-database-view__view--kanban",
790
- records: L.value,
791
- schema: V.value ?? void 0,
792
- view: b.value,
793
- onCardClick: ye,
863
+ records: W.value,
864
+ schema: S.value ?? void 0,
865
+ view: h.value,
866
+ onCardClick: We,
794
867
  "onUpdate:columns": t[6] || (t[6] = () => {
795
868
  }),
796
- onAddColumn: t[7] || (t[7] = () => d("add-column"))
797
- }, null, 8, ["records", "schema", "view"])) : m.value === "gallery" ? (c(), S(Pt, {
869
+ onAddColumn: t[7] || (t[7] = () => u("add-column"))
870
+ }, null, 8, ["records", "schema", "view"])) : p.value === "gallery" ? (d(), V(la, {
798
871
  key: 2,
799
872
  class: "of-database-view__view of-database-view__view--gallery",
800
- records: L.value,
801
- schema: V.value ?? void 0,
802
- view: b.value,
803
- onCardClick: ye,
804
- onAdd: t[8] || (t[8] = () => d("add"))
805
- }, null, 8, ["records", "schema", "view"])) : m.value === "timeline" ? (c(), S(Wt, {
873
+ records: W.value,
874
+ schema: S.value ?? void 0,
875
+ view: h.value,
876
+ onCardClick: We,
877
+ onAdd: t[8] || (t[8] = () => u("add"))
878
+ }, null, 8, ["records", "schema", "view"])) : p.value === "timeline" ? (d(), V(oa, {
806
879
  key: 3,
807
880
  class: "of-database-view__view of-database-view__view--timeline",
808
- records: L.value,
809
- schema: V.value ?? void 0,
810
- "view-config": b.value,
811
- onRowClick: Ct,
812
- onRecordChange: yt,
813
- "onUpdate:records": _t
814
- }, null, 8, ["records", "schema", "view-config"])) : (c(), w("div", Yt))
815
- ], 8, Xt))
881
+ records: W.value,
882
+ schema: S.value ?? void 0,
883
+ "view-config": h.value,
884
+ onRowClick: $t,
885
+ onRecordChange: Ut,
886
+ "onUpdate:records": Bt
887
+ }, null, 8, ["records", "schema", "view-config"])) : (d(), v("div", va))
888
+ ], 8, ca))
816
889
  ], 64)),
817
- N.value && pe.value === "side-panel" ? (c(), S(Kt, {
890
+ x.value && E.value === "side-panel" ? (d(), V(ea, {
818
891
  key: 3,
819
- "model-value": N.value,
820
- title: "记录详情",
821
- width: 640,
892
+ "model-value": x.value,
893
+ title: X.value,
894
+ width: oe.value,
895
+ resizable: !0,
822
896
  mode: "persistent",
823
- "onUpdate:modelValue": W
897
+ "onUpdate:width": Ot,
898
+ "onUpdate:modelValue": K
824
899
  }, {
825
- default: Et(() => {
826
- var i, o, r, v, I;
827
- return [
828
- u("div", {
829
- class: "of-database-view__detail-workspace",
830
- "data-record-id": ((i = h.value) == null ? void 0 : i.id) ?? ""
831
- }, [
832
- u("div", Qt, [
833
- u("div", ea, [
834
- t[11] || (t[11] = u("div", { class: "of-database-view__detail-workspace-kicker" }, "右侧工作区", -1)),
835
- u("h3", ta, x(((r = (o = h.value) == null ? void 0 : o.fields) == null ? void 0 : r.title) ?? ((v = h.value) == null ? void 0 : v.id) ?? "记录详情"), 1)
836
- ]),
837
- u("div", aa, [
838
- u("span", ia, x((I = h.value) == null ? void 0 : I.id), 1),
839
- t[12] || (t[12] = u("span", { class: "of-database-view__detail-workspace-mode" }, "side-panel", -1))
840
- ])
841
- ]),
842
- u("div", la, [
843
- u("section", oa, [
844
- (c(!0), w(le, null, Ie($e.value, (p) => (c(), w("div", {
845
- key: p.key,
846
- class: "of-database-view__detail-workspace-field"
847
- }, [
848
- u("span", ra, x(p.label), 1),
849
- u("div", na, [
850
- K.value.length > 0 ? (c(), S(xt, {
851
- key: 0,
852
- "row-id": ve.value.id,
853
- field: Vt(p.key),
854
- value: te(p.key),
855
- readonly: T.readonly,
856
- onCommit: St
857
- }, null, 8, ["row-id", "field", "value", "readonly"])) : (c(), w("span", sa, x(te(p.key) ?? "—"), 1))
858
- ])
859
- ]))), 128))
860
- ]),
861
- we.value.length > 0 ? (c(), w("section", da, [
862
- (c(!0), w(le, null, Ie(we.value, (p) => (c(), w("div", {
863
- key: p.key,
864
- class: "of-database-view__detail-workspace-content-block"
865
- }, [
866
- u("span", ua, x(p.label), 1),
867
- u("div", {
868
- class: "of-database-view__detail-workspace-markdown of-markdown",
869
- innerHTML: It(p.key)
870
- }, null, 8, ca)
871
- ]))), 128))
872
- ])) : oe("", !0)
873
- ]),
874
- u("div", va, [
875
- u("button", {
876
- class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--delete",
877
- type: "button",
878
- onClick: t[9] || (t[9] = (p) => {
879
- var Ve;
880
- return ke(((Ve = h.value) == null ? void 0 : Ve.id) ?? ve.value.id);
881
- })
882
- }, " 删除 "),
883
- t[13] || (t[13] = u("div", { class: "of-database-view__detail-workspace-footer-spacer" }, null, -1)),
884
- u("button", {
885
- class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--cancel",
886
- type: "button",
887
- onClick: W
888
- }, " 取消 "),
889
- u("button", {
890
- class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--save",
891
- type: "button",
892
- disabled: T.readonly || !ze.value,
893
- onClick: Ft
894
- }, " 保存 ", 8, fa)
895
- ])
896
- ], 8, Zt)
897
- ];
898
- }),
900
+ default: T(() => [
901
+ O(qe, {
902
+ title: X.value,
903
+ comments: [],
904
+ "description-content": Se.value,
905
+ "description-editable": !1
906
+ }, {
907
+ meta: T(() => {
908
+ var i;
909
+ return [
910
+ ue.value ? (d(), v("div", fa, [
911
+ (d(!0), v(q, null, ae(Re.value, (l) => (d(), v("button", {
912
+ key: l.value,
913
+ type: "button",
914
+ class: $e(["of-database-view__workspace-mode-btn", { "of-database-view__workspace-mode-btn--active": E.value === l.value }]),
915
+ "data-mode": l.value,
916
+ onClick: (s) => De(l.value)
917
+ }, b(l.label), 11, wa))), 128))
918
+ ])) : te("", !0),
919
+ c("span", pa, b(((i = w.value) == null ? void 0 : i.id) ?? "record"), 1),
920
+ c("span", ma, b(p.value), 1),
921
+ c("span", ba, b(E.value), 1)
922
+ ];
923
+ }),
924
+ props: T(() => {
925
+ var i;
926
+ return [
927
+ c("div", {
928
+ class: "of-database-view__detail-workspace",
929
+ "data-record-id": ((i = w.value) == null ? void 0 : i.id) ?? ""
930
+ }, [
931
+ c("section", _a, [
932
+ (d(!0), v(q, null, ae(Ve.value, (l) => (d(), v("div", {
933
+ key: l.key,
934
+ class: "of-database-view__detail-workspace-field"
935
+ }, [
936
+ c("span", ya, b(l.label), 1),
937
+ c("div", ka, [
938
+ H.value.length > 0 ? (d(), V(Oe, {
939
+ key: 0,
940
+ "row-id": J.value.id,
941
+ field: Ne(l.key),
942
+ value: $(l.key),
943
+ readonly: R.readonly,
944
+ onCommit: Ue
945
+ }, null, 8, ["row-id", "field", "value", "readonly"])) : (d(), v("span", ga, b($(l.key) ?? "—"), 1))
946
+ ])
947
+ ]))), 128))
948
+ ])
949
+ ], 8, ha)
950
+ ];
951
+ }),
952
+ footer: T(() => [
953
+ c("button", {
954
+ class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--delete",
955
+ type: "button",
956
+ onClick: t[9] || (t[9] = (i) => {
957
+ var l;
958
+ return Pe(((l = w.value) == null ? void 0 : l.id) ?? J.value.id);
959
+ })
960
+ }, " 删除 "),
961
+ t[12] || (t[12] = c("div", { class: "of-database-view__detail-workspace-footer-spacer" }, null, -1)),
962
+ c("button", {
963
+ class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--cancel",
964
+ type: "button",
965
+ onClick: K
966
+ }, " 取消 "),
967
+ c("button", {
968
+ class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--save",
969
+ type: "button",
970
+ disabled: R.readonly || !Fe.value,
971
+ onClick: Be
972
+ }, " 保存 ", 8, Ia)
973
+ ]),
974
+ _: 1
975
+ }, 8, ["title", "description-content"])
976
+ ]),
899
977
  _: 1
900
- }, 8, ["model-value"])) : N.value ? (c(), S(Ut, {
978
+ }, 8, ["model-value", "title", "width"])) : x.value ? (d(), V(Qt, {
901
979
  key: 4,
902
- visible: N.value,
903
- row: Y.value,
904
- columns: X.value,
905
- "field-defs": K.value,
906
- "full-page": pe.value === "full-page",
907
- readonly: T.readonly,
908
- onClose: W,
909
- onSave: _e,
910
- onDelete: ke,
911
- onCellEdit: ee
912
- }, null, 8, ["visible", "row", "columns", "field-defs", "full-page", "readonly"])) : oe("", !0)
980
+ "model-value": x.value,
981
+ title: X.value,
982
+ width: re.value,
983
+ resizable: E.value !== "full-page",
984
+ fullscreen: E.value === "full-page",
985
+ "mask-closable": !0,
986
+ "onUpdate:width": qt,
987
+ "onUpdate:modelValue": K
988
+ }, {
989
+ default: T(() => [
990
+ O(qe, {
991
+ title: X.value,
992
+ comments: [],
993
+ "description-content": Se.value,
994
+ "description-editable": !1
995
+ }, {
996
+ meta: T(() => {
997
+ var i;
998
+ return [
999
+ ue.value ? (d(), v("div", Ca, [
1000
+ (d(!0), v(q, null, ae(Re.value, (l) => (d(), v("button", {
1001
+ key: l.value,
1002
+ type: "button",
1003
+ class: $e(["of-database-view__workspace-mode-btn", { "of-database-view__workspace-mode-btn--active": E.value === l.value }]),
1004
+ "data-mode": l.value,
1005
+ onClick: (s) => De(l.value)
1006
+ }, b(l.label), 11, Va))), 128))
1007
+ ])) : te("", !0),
1008
+ c("span", Sa, b(((i = w.value) == null ? void 0 : i.id) ?? "record"), 1),
1009
+ c("span", Fa, b(p.value), 1),
1010
+ c("span", Ta, b(E.value), 1)
1011
+ ];
1012
+ }),
1013
+ props: T(() => {
1014
+ var i;
1015
+ return [
1016
+ c("div", {
1017
+ class: "of-database-view__detail-workspace",
1018
+ "data-record-id": ((i = w.value) == null ? void 0 : i.id) ?? ""
1019
+ }, [
1020
+ c("section", Da, [
1021
+ (d(!0), v(q, null, ae(Ve.value, (l) => (d(), v("div", {
1022
+ key: l.key,
1023
+ class: "of-database-view__detail-workspace-field"
1024
+ }, [
1025
+ c("span", Ea, b(l.label), 1),
1026
+ c("div", La, [
1027
+ H.value.length > 0 ? (d(), V(Oe, {
1028
+ key: 0,
1029
+ "row-id": J.value.id,
1030
+ field: Ne(l.key),
1031
+ value: $(l.key),
1032
+ readonly: R.readonly,
1033
+ onCommit: Ue
1034
+ }, null, 8, ["row-id", "field", "value", "readonly"])) : (d(), v("span", Aa, b($(l.key) ?? "—"), 1))
1035
+ ])
1036
+ ]))), 128))
1037
+ ])
1038
+ ], 8, Ra)
1039
+ ];
1040
+ }),
1041
+ footer: T(() => [
1042
+ c("button", {
1043
+ class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--delete",
1044
+ type: "button",
1045
+ onClick: t[10] || (t[10] = (i) => {
1046
+ var l;
1047
+ return Pe(((l = w.value) == null ? void 0 : l.id) ?? J.value.id);
1048
+ })
1049
+ }, " 删除 "),
1050
+ t[13] || (t[13] = c("div", { class: "of-database-view__detail-workspace-footer-spacer" }, null, -1)),
1051
+ c("button", {
1052
+ class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--cancel",
1053
+ type: "button",
1054
+ onClick: K
1055
+ }, " 取消 "),
1056
+ c("button", {
1057
+ class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--save",
1058
+ type: "button",
1059
+ disabled: R.readonly || !Fe.value,
1060
+ onClick: Be
1061
+ }, " 保存 ", 8, Wa)
1062
+ ]),
1063
+ _: 1
1064
+ }, 8, ["title", "description-content"])
1065
+ ]),
1066
+ _: 1
1067
+ }, 8, ["model-value", "title", "width", "resizable", "fullscreen"])) : te("", !0)
913
1068
  ], 16);
914
1069
  };
915
1070
  }
916
1071
  });
917
1072
  export {
918
- Ra as default
1073
+ Qa as default
919
1074
  };