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