@oneflowui/ui 0.8.0 → 0.8.1
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./DatabaseView.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-b3e687eb"]]);
|
|
5
5
|
export {
|
|
6
6
|
m as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as jt, ref as C, onMounted as Ht, onBeforeUnmount as Jt, computed as r, watch as F, openBlock as d, createElementBlock as v, mergeProps as Mt, 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
2
|
import { Loader2 as Xt, AlertCircle as Yt, Database as Zt } from "lucide-vue-next";
|
|
3
3
|
import ze from "../base/EmptyState.vue.js";
|
|
4
4
|
import Oe from "../table/FieldCell.vue.js";
|
|
@@ -11,8 +11,8 @@ import ia from "../kanban/KanbanBoard.vue.js";
|
|
|
11
11
|
import la from "../gallery/GalleryView.vue.js";
|
|
12
12
|
import oa from "../timeline/GanttTimeline.vue.js";
|
|
13
13
|
import { useDatabaseView as ra } from "../../composables/useDatabaseView.js";
|
|
14
|
-
import { buildGanttItems as
|
|
15
|
-
const
|
|
14
|
+
import { buildGanttItems as na } from "../../types/index.js";
|
|
15
|
+
const sa = {
|
|
16
16
|
key: 0,
|
|
17
17
|
class: "of-database-view__state of-database-view__state--loading",
|
|
18
18
|
"data-role": "loading-state"
|
|
@@ -41,7 +41,7 @@ const na = {
|
|
|
41
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
42
|
key: 1,
|
|
43
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__ */
|
|
44
|
+
}, Wa = ["disabled"], k = "detail", Pa = "(max-width: 768px)", Na = "oneui-database-workspace:", we = 720, pe = 900, Ua = 420, Ba = 1320, Qa = /* @__PURE__ */ jt({
|
|
45
45
|
name: "DatabaseView",
|
|
46
46
|
inheritAttrs: !1,
|
|
47
47
|
__name: "DatabaseView",
|
|
@@ -84,9 +84,9 @@ const na = {
|
|
|
84
84
|
function ie() {
|
|
85
85
|
G.value = (g == null ? void 0 : g.matches) ?? !1;
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
Ht(() => {
|
|
88
88
|
typeof window > "u" || typeof window.matchMedia != "function" || (g = window.matchMedia(Pa), ie(), g.addEventListener("change", ie));
|
|
89
|
-
}),
|
|
89
|
+
}), Jt(() => {
|
|
90
90
|
g == null || g.removeEventListener("change", ie), g = null;
|
|
91
91
|
});
|
|
92
92
|
function me(e) {
|
|
@@ -94,22 +94,22 @@ const na = {
|
|
|
94
94
|
return {
|
|
95
95
|
...e,
|
|
96
96
|
visibleFields: [...e.visibleFields],
|
|
97
|
-
sorts: (t = e.sorts) == null ? void 0 : t.map((
|
|
98
|
-
groups: (a = e.groups) == null ? void 0 : a.map((
|
|
99
|
-
filters: (i = e.filters) == null ? void 0 : i.map((
|
|
100
|
-
aggregations: (l = e.aggregations) == null ? void 0 : l.map((
|
|
97
|
+
sorts: (t = e.sorts) == null ? void 0 : t.map((n) => ({ ...n })),
|
|
98
|
+
groups: (a = e.groups) == null ? void 0 : a.map((n) => ({ ...n })),
|
|
99
|
+
filters: (i = e.filters) == null ? void 0 : i.map((n) => ({ ...n })),
|
|
100
|
+
aggregations: (l = e.aggregations) == null ? void 0 : l.map((n) => ({ ...n })),
|
|
101
101
|
fixedColumns: e.fixedColumns ? [...e.fixedColumns] : void 0,
|
|
102
102
|
galleryCardFields: e.galleryCardFields ? [...e.galleryCardFields] : void 0
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function j(e, t) {
|
|
106
106
|
return Number.isFinite(e) ? Math.max(Ua, Math.min(Ba, e)) : t;
|
|
107
107
|
}
|
|
108
108
|
function be(e) {
|
|
109
109
|
const t = (e ?? "").trim();
|
|
110
110
|
return t ? `${Na}${t}` : null;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function je(e) {
|
|
113
113
|
const t = be(e);
|
|
114
114
|
if (!t || typeof window > "u") return {};
|
|
115
115
|
try {
|
|
@@ -119,7 +119,7 @@ const na = {
|
|
|
119
119
|
return {};
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function He(e, t) {
|
|
123
123
|
const a = be(e);
|
|
124
124
|
if (!(!a || typeof window > "u"))
|
|
125
125
|
try {
|
|
@@ -127,7 +127,7 @@ const na = {
|
|
|
127
127
|
} catch {
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function Je(e) {
|
|
131
131
|
const t = e[0];
|
|
132
132
|
return t ? Object.keys(t.fields) : [];
|
|
133
133
|
}
|
|
@@ -146,7 +146,7 @@ const na = {
|
|
|
146
146
|
return "table-2";
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function Me(e, t = []) {
|
|
150
150
|
const a = A(e, t);
|
|
151
151
|
return {
|
|
152
152
|
viewId: "table",
|
|
@@ -237,12 +237,12 @@ const na = {
|
|
|
237
237
|
}
|
|
238
238
|
function Ze(e, t, a = []) {
|
|
239
239
|
var l;
|
|
240
|
-
return ((((l = e.visibleFields) == null ? void 0 : l.length) ?? 0) > 0 ? e.visibleFields : A(t, a)).map((
|
|
240
|
+
return ((((l = e.visibleFields) == null ? void 0 : l.length) ?? 0) > 0 ? e.visibleFields : A(t, a)).map((n) => {
|
|
241
241
|
var z;
|
|
242
|
-
const f = (z = t == null ? void 0 : t.fields) == null ? void 0 : z.find((Gt) => Gt.id ===
|
|
242
|
+
const f = (z = t == null ? void 0 : t.fields) == null ? void 0 : z.find((Gt) => Gt.id === n);
|
|
243
243
|
return {
|
|
244
|
-
key:
|
|
245
|
-
label: le(
|
|
244
|
+
key: n,
|
|
245
|
+
label: le(n, t),
|
|
246
246
|
type: _e(f),
|
|
247
247
|
hidden: (f == null ? void 0 : f.hidden) ?? !1,
|
|
248
248
|
width: f == null ? void 0 : f.width
|
|
@@ -251,8 +251,8 @@ const na = {
|
|
|
251
251
|
}
|
|
252
252
|
function Qe(e, t = []) {
|
|
253
253
|
return A(e, t).map((i) => {
|
|
254
|
-
var
|
|
255
|
-
const l = (
|
|
254
|
+
var n;
|
|
255
|
+
const l = (n = e == null ? void 0 : e.fields) == null ? void 0 : n.find((f) => f.id === i);
|
|
256
256
|
return {
|
|
257
257
|
key: i,
|
|
258
258
|
label: le(i, e),
|
|
@@ -264,8 +264,8 @@ const na = {
|
|
|
264
264
|
}
|
|
265
265
|
function et(e, t = []) {
|
|
266
266
|
return A(e, t).map((i) => {
|
|
267
|
-
var
|
|
268
|
-
const l = (
|
|
267
|
+
var n;
|
|
268
|
+
const l = (n = e == null ? void 0 : e.fields) == null ? void 0 : n.find((f) => f.id === i);
|
|
269
269
|
return {
|
|
270
270
|
id: i,
|
|
271
271
|
type: Ye(l),
|
|
@@ -280,26 +280,26 @@ const na = {
|
|
|
280
280
|
if (e == null && t == null) return 0;
|
|
281
281
|
if (e == null) return -1;
|
|
282
282
|
if (t == null) return 1;
|
|
283
|
-
const a = Number(e), i = Number(t), l = Number.isFinite(a) && `${e}`.trim() !== "",
|
|
284
|
-
if (l &&
|
|
283
|
+
const a = Number(e), i = Number(t), l = Number.isFinite(a) && `${e}`.trim() !== "", n = Number.isFinite(i) && `${t}`.trim() !== "";
|
|
284
|
+
if (l && n) return a - i;
|
|
285
285
|
const f = Date.parse(String(e)), z = Date.parse(String(t));
|
|
286
286
|
return Number.isFinite(f) && Number.isFinite(z) ? f - z : L(e).localeCompare(L(t), "zh-Hans-CN");
|
|
287
287
|
}
|
|
288
288
|
function tt(e, t) {
|
|
289
|
-
const a = L(e).trim(), i = (t.value ?? "").trim(), l = a.toLowerCase(),
|
|
289
|
+
const a = L(e).trim(), i = (t.value ?? "").trim(), l = a.toLowerCase(), n = i.toLowerCase();
|
|
290
290
|
switch (t.operator) {
|
|
291
291
|
case "equals":
|
|
292
|
-
return l ===
|
|
292
|
+
return l === n;
|
|
293
293
|
case "not_equals":
|
|
294
|
-
return l !==
|
|
294
|
+
return l !== n;
|
|
295
295
|
case "contains":
|
|
296
|
-
return l.includes(
|
|
296
|
+
return l.includes(n);
|
|
297
297
|
case "not_contains":
|
|
298
|
-
return !l.includes(
|
|
298
|
+
return !l.includes(n);
|
|
299
299
|
case "starts_with":
|
|
300
|
-
return l.startsWith(
|
|
300
|
+
return l.startsWith(n);
|
|
301
301
|
case "ends_with":
|
|
302
|
-
return l.endsWith(
|
|
302
|
+
return l.endsWith(n);
|
|
303
303
|
case "gt":
|
|
304
304
|
return N(e, i) > 0;
|
|
305
305
|
case "gte":
|
|
@@ -392,7 +392,7 @@ const na = {
|
|
|
392
392
|
function A(e, t = []) {
|
|
393
393
|
var i;
|
|
394
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 :
|
|
395
|
+
return a != null && a.length ? a : Je(t);
|
|
396
396
|
}
|
|
397
397
|
function ot(e) {
|
|
398
398
|
return e ? {
|
|
@@ -407,15 +407,15 @@ const na = {
|
|
|
407
407
|
onClick: () => Le(e)
|
|
408
408
|
};
|
|
409
409
|
}
|
|
410
|
-
const U =
|
|
410
|
+
const U = je(o.tableId), ye = r(() => o.schema ?? null), nt = r(() => o.records ?? []), ke = r(() => {
|
|
411
411
|
var i, l;
|
|
412
|
-
const e = (o.views ?? []).map((
|
|
413
|
-
return t || e.unshift(
|
|
414
|
-
}),
|
|
412
|
+
const e = (o.views ?? []).map((n) => me(n)), t = e.some((n) => n.viewType === "table") || (((i = o.schema) == null ? void 0 : i.views) ?? []).some((n) => n.viewType === "table"), a = e.some((n) => n.viewType === "detail") || (((l = o.schema) == null ? void 0 : l.views) ?? []).some((n) => n.viewType === "detail");
|
|
413
|
+
return t || e.unshift(Me(o.schema, o.records ?? [])), a || e.push(Xe(o.schema, o.records ?? [])), e;
|
|
414
|
+
}), s = ra({
|
|
415
415
|
tableId: o.tableId,
|
|
416
416
|
mode: o.mode,
|
|
417
417
|
schema: ye,
|
|
418
|
-
records:
|
|
418
|
+
records: nt,
|
|
419
419
|
views: ke,
|
|
420
420
|
provider: o.provider,
|
|
421
421
|
defaultView: o.defaultView,
|
|
@@ -465,13 +465,13 @@ const na = {
|
|
|
465
465
|
u("refresh"), await ((t = (e = o.actions) == null ? void 0 : e.onRefresh) == null ? void 0 : t.call(e));
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
}), h = r(() =>
|
|
468
|
+
}), h = r(() => s.activeView.value), H = r(() => s.activeViewId.value), w = r(() => s.selectedRecord.value), st = r(() => s.selectedRecordId.value), S = r(() => s.schema.value ?? ye.value), I = r(() => [...s.records.value]), p = r(() => h.value.viewType || "table"), m = C({}), B = C(
|
|
469
469
|
U.detailPresentation ?? null
|
|
470
470
|
), oe = C(
|
|
471
|
-
|
|
471
|
+
j(U.sidePanelWidth ?? we, we)
|
|
472
472
|
), re = C(
|
|
473
|
-
|
|
474
|
-
), D = C(o.searchKeyword || U.searchKeyword || ""),
|
|
473
|
+
j(U.drawerWidth ?? pe, pe)
|
|
474
|
+
), D = C(o.searchKeyword || U.searchKeyword || ""), ne = C("and"), _ = C([]), y = C(
|
|
475
475
|
o.currentViewId === k || o.initialViewId === k || o.selectedRecordId != null || o.initialSelectedRecordId != null
|
|
476
476
|
);
|
|
477
477
|
F(
|
|
@@ -483,9 +483,9 @@ const na = {
|
|
|
483
483
|
), F(D, (e) => {
|
|
484
484
|
u("update:searchKeyword", e);
|
|
485
485
|
}), F(
|
|
486
|
-
[
|
|
486
|
+
[H, D, B, oe, re],
|
|
487
487
|
([e, t, a, i, l]) => {
|
|
488
|
-
|
|
488
|
+
He(o.tableId, {
|
|
489
489
|
activeViewId: e,
|
|
490
490
|
searchKeyword: t,
|
|
491
491
|
detailPresentation: a ?? void 0,
|
|
@@ -503,7 +503,7 @@ const na = {
|
|
|
503
503
|
), F(
|
|
504
504
|
() => o.currentViewId,
|
|
505
505
|
(e) => {
|
|
506
|
-
!e || e ===
|
|
506
|
+
!e || e === H.value || (s.setActiveViewId(e), e === k && (y.value = !0));
|
|
507
507
|
},
|
|
508
508
|
{ immediate: !0 }
|
|
509
509
|
), F(
|
|
@@ -511,29 +511,29 @@ const na = {
|
|
|
511
511
|
(e) => {
|
|
512
512
|
if (e !== void 0) {
|
|
513
513
|
if (!e) {
|
|
514
|
-
y.value = !1, m.value = {},
|
|
514
|
+
y.value = !1, m.value = {}, s.clearSelectedRecord();
|
|
515
515
|
return;
|
|
516
516
|
}
|
|
517
|
-
y.value = !0, m.value = {},
|
|
517
|
+
y.value = !0, m.value = {}, s.setSelectedRecord(e);
|
|
518
518
|
}
|
|
519
519
|
},
|
|
520
520
|
{ immediate: !0 }
|
|
521
521
|
), F(
|
|
522
|
-
|
|
522
|
+
H,
|
|
523
523
|
(e, t) => {
|
|
524
524
|
var a, i;
|
|
525
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) }));
|
|
526
526
|
},
|
|
527
527
|
{ immediate: !0 }
|
|
528
528
|
), F(
|
|
529
|
-
|
|
529
|
+
st,
|
|
530
530
|
(e, t) => {
|
|
531
531
|
u("update:selectedRecordId", e), t !== void 0 && e !== t && u("select-record", w.value ?? null);
|
|
532
532
|
},
|
|
533
533
|
{ immediate: !0 }
|
|
534
534
|
);
|
|
535
|
-
const
|
|
536
|
-
const e = o.viewTabs && o.viewTabs.length > 0 ? o.viewTabs.map((i) => ({ ...i })) :
|
|
535
|
+
const se = r(() => {
|
|
536
|
+
const e = o.viewTabs && o.viewTabs.length > 0 ? o.viewTabs.map((i) => ({ ...i })) : s.viewList.value.map((i) => ({
|
|
537
537
|
value: i.id,
|
|
538
538
|
label: i.name,
|
|
539
539
|
icon: he(i.type)
|
|
@@ -542,22 +542,22 @@ const na = {
|
|
|
542
542
|
a.has(i.value) || (a.add(i.value), t.push(i));
|
|
543
543
|
return a.has(k) || t.push({ value: k, label: "详情", icon: he("detail") }), t;
|
|
544
544
|
}), dt = r(
|
|
545
|
-
() =>
|
|
545
|
+
() => s.viewList.value.map((e) => ({
|
|
546
546
|
id: e.id,
|
|
547
547
|
name: e.name
|
|
548
548
|
}))
|
|
549
|
-
), de = r(() => Ze(h.value, S.value, I.value)), ge = r(() => Qe(S.value, I.value)),
|
|
549
|
+
), de = r(() => Ze(h.value, S.value, I.value)), ge = r(() => Qe(S.value, I.value)), J = r(() => et(S.value, I.value)), Ie = r(() => ot(w.value)), M = r(() => ({
|
|
550
550
|
...Ie.value,
|
|
551
551
|
...m.value
|
|
552
552
|
})), X = r(
|
|
553
553
|
() => {
|
|
554
|
-
var e, t, a, i, l,
|
|
554
|
+
var e, t, a, i, l, n, f;
|
|
555
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) ?? ((
|
|
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) ?? ((n = (l = w.value) == null ? void 0 : l.fields) == null ? void 0 : n.subject) ?? ((f = w.value) == null ? void 0 : f.id) ?? "记录详情"
|
|
557
557
|
) || "记录详情";
|
|
558
558
|
}
|
|
559
559
|
), Ce = r(
|
|
560
|
-
() => new Set(
|
|
560
|
+
() => new Set(J.value.filter((e) => e.type === "richtext").map((e) => e.id))
|
|
561
561
|
), Ve = r(
|
|
562
562
|
() => ge.value.filter((e) => !Ce.value.has(e.key))
|
|
563
563
|
), ut = r(
|
|
@@ -579,10 +579,10 @@ ${i}` : "";
|
|
|
579
579
|
}), vt = r(() => {
|
|
580
580
|
var e, t;
|
|
581
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 &&
|
|
582
|
+
}), Y = r(() => _.value), ft = r(() => Y.value.length > 0), wt = r(() => o.showToolbar !== !1), pt = r(() => o.showViewSwitch !== !1 && se.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
583
|
const e = [];
|
|
584
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 ??
|
|
585
|
+
}), ue = r(() => o.detailPresentation === "auto"), kt = r(() => o.loading ?? s.loading.value), Z = r(() => o.error ?? s.error.value), W = r(() => {
|
|
586
586
|
let e = [...I.value];
|
|
587
587
|
if (D.value.trim()) {
|
|
588
588
|
const a = D.value.trim().toLowerCase();
|
|
@@ -594,10 +594,10 @@ ${i}` : "";
|
|
|
594
594
|
}
|
|
595
595
|
Y.value.length > 0 && (e = e.filter((a) => {
|
|
596
596
|
const i = Y.value.map((l) => {
|
|
597
|
-
const
|
|
598
|
-
return tt(
|
|
597
|
+
const n = a.fields[l.field];
|
|
598
|
+
return tt(n, l);
|
|
599
599
|
});
|
|
600
|
-
return
|
|
600
|
+
return ne.value === "and" ? i.every(Boolean) : i.some(Boolean);
|
|
601
601
|
}));
|
|
602
602
|
const t = Te.value;
|
|
603
603
|
return t.field && t.order && e.sort((a, i) => {
|
|
@@ -608,7 +608,7 @@ ${i}` : "";
|
|
|
608
608
|
return t.order === "desc" ? -l : l;
|
|
609
609
|
}), e;
|
|
610
610
|
}), gt = r(
|
|
611
|
-
() =>
|
|
611
|
+
() => na(W.value, {
|
|
612
612
|
startFieldId: p.value === "timeline" ? "startDate" : void 0,
|
|
613
613
|
endFieldId: p.value === "timeline" ? "endDate" : void 0,
|
|
614
614
|
labelFieldId: "title"
|
|
@@ -622,14 +622,14 @@ ${i}` : "";
|
|
|
622
622
|
label: "打开第一条记录",
|
|
623
623
|
onClick: () => Q(e)
|
|
624
624
|
};
|
|
625
|
-
const t = ((a =
|
|
625
|
+
const t = ((a = se.value.find((i) => i.value !== k)) == null ? void 0 : a.value) ?? null;
|
|
626
626
|
return rt(t);
|
|
627
627
|
});
|
|
628
628
|
function ve(e) {
|
|
629
|
-
|
|
629
|
+
s.setRecords(e), u("update:records", e);
|
|
630
630
|
}
|
|
631
631
|
function Q(e) {
|
|
632
|
-
e && (y.value = !0, m.value = {},
|
|
632
|
+
e && (y.value = !0, m.value = {}, s.setSelectedRecord(e));
|
|
633
633
|
}
|
|
634
634
|
function De(e) {
|
|
635
635
|
ue.value && (B.value = e);
|
|
@@ -638,20 +638,20 @@ ${i}` : "";
|
|
|
638
638
|
return e ? I.value.find((t) => t.id === e) ?? null : null;
|
|
639
639
|
}
|
|
640
640
|
function Le(e) {
|
|
641
|
-
|
|
641
|
+
s.viewList.value.some((t) => t.id === e) && (e === k && (y.value = !0), s.switchView(e));
|
|
642
642
|
}
|
|
643
643
|
function Ct(e) {
|
|
644
644
|
Le(e);
|
|
645
645
|
}
|
|
646
646
|
function Vt(e) {
|
|
647
647
|
var t, a;
|
|
648
|
-
|
|
648
|
+
s.viewList.value.some((i) => i.id === e) && (e === k && (y.value = !0), s.switchView(e), u("load-view", e), (a = (t = o.actions) == null ? void 0 : t.onViewLoad) == null || a.call(t, { tableId: o.tableId, viewId: e }));
|
|
649
649
|
}
|
|
650
650
|
function St(e) {
|
|
651
|
-
|
|
651
|
+
s.saveView({ name: e });
|
|
652
652
|
}
|
|
653
653
|
function ee() {
|
|
654
|
-
|
|
654
|
+
s.updateActiveView({
|
|
655
655
|
filters: lt(_.value)
|
|
656
656
|
});
|
|
657
657
|
}
|
|
@@ -672,26 +672,26 @@ ${i}` : "";
|
|
|
672
672
|
_.value = [], ee();
|
|
673
673
|
}
|
|
674
674
|
function Et(e) {
|
|
675
|
-
|
|
675
|
+
ne.value = e, u("update:filterLogic", e);
|
|
676
676
|
}
|
|
677
677
|
function Lt(e) {
|
|
678
|
-
u("update:columns", e),
|
|
678
|
+
u("update:columns", e), s.updateActiveView({
|
|
679
679
|
visibleFields: e.filter((t) => !t.hidden).map((t) => t.key)
|
|
680
680
|
});
|
|
681
681
|
}
|
|
682
682
|
function At(e) {
|
|
683
683
|
var i;
|
|
684
684
|
if (!e) {
|
|
685
|
-
|
|
685
|
+
s.updateActiveView({ sorts: [] }), u("sort", e);
|
|
686
686
|
return;
|
|
687
687
|
}
|
|
688
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
|
-
|
|
689
|
+
s.updateActiveView({
|
|
690
690
|
sorts: [{ fieldId: e, direction: a }]
|
|
691
691
|
}), u("sort", e);
|
|
692
692
|
}
|
|
693
693
|
function Wt(e) {
|
|
694
|
-
|
|
694
|
+
s.updateActiveView({
|
|
695
695
|
groups: e ? [{ fieldId: e }] : []
|
|
696
696
|
}), u("group", e);
|
|
697
697
|
}
|
|
@@ -699,7 +699,7 @@ ${i}` : "";
|
|
|
699
699
|
D.value = e, u("update:searchKeyword", e);
|
|
700
700
|
}
|
|
701
701
|
function P(e) {
|
|
702
|
-
|
|
702
|
+
s.emitSchemaEvent(e);
|
|
703
703
|
}
|
|
704
704
|
function Nt(e, t, a) {
|
|
705
705
|
const i = I.value.map((l) => l.id !== e ? l : {
|
|
@@ -712,7 +712,7 @@ ${i}` : "";
|
|
|
712
712
|
ve(i);
|
|
713
713
|
}
|
|
714
714
|
function Ae(e) {
|
|
715
|
-
Nt(e.rowId, e.fieldId, e.value),
|
|
715
|
+
Nt(e.rowId, e.fieldId, e.value), s.emitCellEdit(e);
|
|
716
716
|
}
|
|
717
717
|
function Ut(e) {
|
|
718
718
|
var t, a;
|
|
@@ -734,7 +734,7 @@ ${i}` : "";
|
|
|
734
734
|
u("row-click", e), Q(Ee(e.sourceRecordId ?? e.id));
|
|
735
735
|
}
|
|
736
736
|
function K() {
|
|
737
|
-
y.value = !1, m.value = {},
|
|
737
|
+
y.value = !1, m.value = {}, s.clearSelectedRecord();
|
|
738
738
|
}
|
|
739
739
|
function zt(e) {
|
|
740
740
|
for (const [t, a] of Object.entries(e.fields))
|
|
@@ -743,10 +743,10 @@ ${i}` : "";
|
|
|
743
743
|
}
|
|
744
744
|
function Pe(e) {
|
|
745
745
|
const t = I.value.filter((a) => a.id !== e);
|
|
746
|
-
ve(t), y.value = !1, m.value = {},
|
|
746
|
+
ve(t), y.value = !1, m.value = {}, s.clearSelectedRecord();
|
|
747
747
|
}
|
|
748
748
|
function Ne(e) {
|
|
749
|
-
return
|
|
749
|
+
return J.value.find((t) => t.id === e) ?? {
|
|
750
750
|
id: e,
|
|
751
751
|
type: "text",
|
|
752
752
|
label: e
|
|
@@ -768,18 +768,18 @@ ${i}` : "";
|
|
|
768
768
|
});
|
|
769
769
|
}
|
|
770
770
|
function Ot(e) {
|
|
771
|
-
oe.value =
|
|
771
|
+
oe.value = j(e, we);
|
|
772
772
|
}
|
|
773
773
|
function qt(e) {
|
|
774
|
-
re.value =
|
|
774
|
+
re.value = j(e, pe);
|
|
775
775
|
}
|
|
776
776
|
return (e, t) => {
|
|
777
777
|
var a;
|
|
778
|
-
return d(), v("section",
|
|
778
|
+
return d(), v("section", Mt({
|
|
779
779
|
class: "of-database-view",
|
|
780
780
|
"data-role": "database-view"
|
|
781
781
|
}, e.$attrs), [
|
|
782
|
-
ce.value === "loading" ? (d(), v("div",
|
|
782
|
+
ce.value === "loading" ? (d(), v("div", sa, [
|
|
783
783
|
O(fe(Xt), {
|
|
784
784
|
class: "of-database-view__spinner",
|
|
785
785
|
size: 20
|
|
@@ -798,11 +798,11 @@ ${i}` : "";
|
|
|
798
798
|
wt.value ? (d(), V(ta, {
|
|
799
799
|
key: 0,
|
|
800
800
|
class: "of-database-view__toolbar",
|
|
801
|
-
"current-view":
|
|
802
|
-
"view-tabs":
|
|
801
|
+
"current-view": H.value,
|
|
802
|
+
"view-tabs": se.value,
|
|
803
803
|
columns: de.value,
|
|
804
804
|
"filter-conditions": Y.value,
|
|
805
|
-
"filter-logic":
|
|
805
|
+
"filter-logic": ne.value,
|
|
806
806
|
"filter-active": ft.value,
|
|
807
807
|
"current-sort": Te.value,
|
|
808
808
|
"current-group": vt.value,
|
|
@@ -913,7 +913,7 @@ ${i}` : "";
|
|
|
913
913
|
type: "button",
|
|
914
914
|
class: $e(["of-database-view__workspace-mode-btn", { "of-database-view__workspace-mode-btn--active": E.value === l.value }]),
|
|
915
915
|
"data-mode": l.value,
|
|
916
|
-
onClick: (
|
|
916
|
+
onClick: (n) => De(l.value)
|
|
917
917
|
}, b(l.label), 11, wa))), 128))
|
|
918
918
|
])) : te("", !0),
|
|
919
919
|
c("span", pa, b(((i = w.value) == null ? void 0 : i.id) ?? "record"), 1),
|
|
@@ -935,9 +935,9 @@ ${i}` : "";
|
|
|
935
935
|
}, [
|
|
936
936
|
c("span", ya, b(l.label), 1),
|
|
937
937
|
c("div", ka, [
|
|
938
|
-
|
|
938
|
+
J.value.length > 0 ? (d(), V(Oe, {
|
|
939
939
|
key: 0,
|
|
940
|
-
"row-id":
|
|
940
|
+
"row-id": M.value.id,
|
|
941
941
|
field: Ne(l.key),
|
|
942
942
|
value: $(l.key),
|
|
943
943
|
readonly: R.readonly,
|
|
@@ -955,7 +955,7 @@ ${i}` : "";
|
|
|
955
955
|
type: "button",
|
|
956
956
|
onClick: t[9] || (t[9] = (i) => {
|
|
957
957
|
var l;
|
|
958
|
-
return Pe(((l = w.value) == null ? void 0 : l.id) ??
|
|
958
|
+
return Pe(((l = w.value) == null ? void 0 : l.id) ?? M.value.id);
|
|
959
959
|
})
|
|
960
960
|
}, " 删除 "),
|
|
961
961
|
t[12] || (t[12] = c("div", { class: "of-database-view__detail-workspace-footer-spacer" }, null, -1)),
|
|
@@ -1002,7 +1002,7 @@ ${i}` : "";
|
|
|
1002
1002
|
type: "button",
|
|
1003
1003
|
class: $e(["of-database-view__workspace-mode-btn", { "of-database-view__workspace-mode-btn--active": E.value === l.value }]),
|
|
1004
1004
|
"data-mode": l.value,
|
|
1005
|
-
onClick: (
|
|
1005
|
+
onClick: (n) => De(l.value)
|
|
1006
1006
|
}, b(l.label), 11, Va))), 128))
|
|
1007
1007
|
])) : te("", !0),
|
|
1008
1008
|
c("span", Sa, b(((i = w.value) == null ? void 0 : i.id) ?? "record"), 1),
|
|
@@ -1024,9 +1024,9 @@ ${i}` : "";
|
|
|
1024
1024
|
}, [
|
|
1025
1025
|
c("span", Ea, b(l.label), 1),
|
|
1026
1026
|
c("div", La, [
|
|
1027
|
-
|
|
1027
|
+
J.value.length > 0 ? (d(), V(Oe, {
|
|
1028
1028
|
key: 0,
|
|
1029
|
-
"row-id":
|
|
1029
|
+
"row-id": M.value.id,
|
|
1030
1030
|
field: Ne(l.key),
|
|
1031
1031
|
value: $(l.key),
|
|
1032
1032
|
readonly: R.readonly,
|
|
@@ -1044,7 +1044,7 @@ ${i}` : "";
|
|
|
1044
1044
|
type: "button",
|
|
1045
1045
|
onClick: t[10] || (t[10] = (i) => {
|
|
1046
1046
|
var l;
|
|
1047
|
-
return Pe(((l = w.value) == null ? void 0 : l.id) ??
|
|
1047
|
+
return Pe(((l = w.value) == null ? void 0 : l.id) ?? M.value.id);
|
|
1048
1048
|
})
|
|
1049
1049
|
}, " 删除 "),
|
|
1050
1050
|
t[13] || (t[13] = c("div", { class: "of-database-view__detail-workspace-footer-spacer" }, null, -1)),
|