@oneflowui/ui 0.8.4 → 0.8.5
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/README.en.md +219 -0
- package/README.md +219 -0
- package/dist/components/ai/AiMessageList.vue.js +1 -1
- package/dist/components/ai/AiMessageList.vue2.js +28 -27
- package/dist/components/common/ThemeScope.vue.d.ts +24 -0
- package/dist/components/common/ThemeScope.vue.js +24 -0
- package/dist/components/common/ThemeScope.vue2.js +4 -0
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/database/DatabaseView.vue.d.ts +4 -4
- package/dist/components/database/DatabaseView.vue.js +4 -4
- package/dist/components/database/DatabaseView.vue2.js +135 -134
- package/dist/components/database/index.d.ts +1 -1
- package/dist/components/kanban/KanbanColumn.vue.js +3 -3
- package/dist/components/kanban/KanbanColumn.vue2.js +31 -30
- package/dist/components/table/DataTable.vue.js +2 -2
- package/dist/components/table/DataTable.vue2.js +251 -249
- package/dist/composables/index.d.ts +5 -3
- package/dist/composables/useDataTableLayout.d.ts +1 -0
- package/dist/composables/useDataTableLayout.js +29 -26
- package/dist/composables/useDatabaseView.d.ts +1 -1
- package/dist/composables/useDatabaseView.js +311 -284
- package/dist/composables/useDatabaseViewMiddleware.d.ts +33 -0
- package/dist/composables/useDatabaseViewMiddleware.js +131 -0
- package/dist/composables/useVirtualList.d.ts +11 -0
- package/dist/composables/useVirtualList.js +146 -104
- package/dist/composables.js +71 -0
- package/dist/contracts/database.d.ts +23 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +259 -250
- package/dist/style.css +1 -1
- package/dist/theme.d.ts +1 -0
- package/dist/theme.js +4 -0
- package/package.json +16 -2
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
function
|
|
3
|
-
return !!(
|
|
1
|
+
import { computed as f, ref as I, shallowRef as Be, watch as W } from "vue";
|
|
2
|
+
function ke(t) {
|
|
3
|
+
return !!(t && typeof t == "object" && "value" in t);
|
|
4
4
|
}
|
|
5
|
-
function G(
|
|
6
|
-
if (
|
|
7
|
-
return
|
|
5
|
+
function G(t) {
|
|
6
|
+
if (t !== void 0)
|
|
7
|
+
return ke(t) ? t.value : t;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (
|
|
11
|
-
return { ...
|
|
9
|
+
function Pe(t) {
|
|
10
|
+
if (t)
|
|
11
|
+
return { ...t };
|
|
12
12
|
}
|
|
13
|
-
function z(
|
|
14
|
-
var
|
|
13
|
+
function z(t) {
|
|
14
|
+
var i, v, a, h;
|
|
15
15
|
return {
|
|
16
|
-
...
|
|
17
|
-
visibleFields: [...
|
|
18
|
-
sorts: (
|
|
19
|
-
groups: (v =
|
|
20
|
-
filters: (a =
|
|
21
|
-
aggregations: (
|
|
22
|
-
fixedColumns:
|
|
23
|
-
galleryCardFields:
|
|
16
|
+
...t,
|
|
17
|
+
visibleFields: [...t.visibleFields],
|
|
18
|
+
sorts: (i = t.sorts) == null ? void 0 : i.map(Pe).filter((w) => w !== void 0),
|
|
19
|
+
groups: (v = t.groups) == null ? void 0 : v.map((w) => ({ ...w })),
|
|
20
|
+
filters: (a = t.filters) == null ? void 0 : a.map((w) => ({ ...w })),
|
|
21
|
+
aggregations: (h = t.aggregations) == null ? void 0 : h.map((w) => ({ ...w })),
|
|
22
|
+
fixedColumns: t.fixedColumns ? [...t.fixedColumns] : void 0,
|
|
23
|
+
galleryCardFields: t.galleryCardFields ? [...t.galleryCardFields] : void 0
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
28
|
-
...
|
|
29
|
-
fields:
|
|
30
|
-
views: (
|
|
26
|
+
function de(t) {
|
|
27
|
+
return t ? {
|
|
28
|
+
...t,
|
|
29
|
+
fields: t.fields.map((i) => ({ ...i })),
|
|
30
|
+
views: (t.views ?? []).map(z)
|
|
31
31
|
} : null;
|
|
32
32
|
}
|
|
33
|
-
function H(
|
|
34
|
-
return
|
|
35
|
-
...
|
|
36
|
-
fields: { ...
|
|
33
|
+
function H(t) {
|
|
34
|
+
return t ? t.map((i) => ({
|
|
35
|
+
...i,
|
|
36
|
+
fields: { ...i.fields }
|
|
37
37
|
})) : [];
|
|
38
38
|
}
|
|
39
|
-
function J(
|
|
40
|
-
if (!
|
|
41
|
-
const
|
|
42
|
-
for (const a of
|
|
43
|
-
!(a != null && a.viewId) ||
|
|
39
|
+
function J(t) {
|
|
40
|
+
if (!t) return [];
|
|
41
|
+
const i = /* @__PURE__ */ new Set(), v = [];
|
|
42
|
+
for (const a of t)
|
|
43
|
+
!(a != null && a.viewId) || i.has(a.viewId) || (i.add(a.viewId), v.push(z(a)));
|
|
44
44
|
return v;
|
|
45
45
|
}
|
|
46
|
-
function K(
|
|
46
|
+
function K(t, i, v = (i == null ? void 0 : i.viewId) ?? "__default__") {
|
|
47
47
|
var w;
|
|
48
|
-
const a =
|
|
48
|
+
const a = i ? z(i) : void 0, h = (w = a == null ? void 0 : a.visibleFields) != null && w.length ? [...a.visibleFields] : (t == null ? void 0 : t.fields.map((x) => x.id)) ?? [];
|
|
49
49
|
return {
|
|
50
50
|
viewId: v,
|
|
51
51
|
viewType: (a == null ? void 0 : a.viewType) ?? "table",
|
|
52
|
-
name: (a == null ? void 0 : a.name) ?? (
|
|
53
|
-
visibleFields:
|
|
52
|
+
name: (a == null ? void 0 : a.name) ?? (t == null ? void 0 : t.name) ?? "全部记录",
|
|
53
|
+
visibleFields: h,
|
|
54
54
|
sorts: a == null ? void 0 : a.sorts,
|
|
55
55
|
groups: a == null ? void 0 : a.groups,
|
|
56
56
|
filters: a == null ? void 0 : a.filters,
|
|
@@ -59,330 +59,357 @@ function K(l, r, v = (r == null ? void 0 : r.viewId) ?? "__default__") {
|
|
|
59
59
|
galleryCardFields: a == null ? void 0 : a.galleryCardFields
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
const
|
|
64
|
-
for (const
|
|
65
|
-
w.set(
|
|
66
|
-
const
|
|
67
|
-
for (const
|
|
68
|
-
a.has(
|
|
69
|
-
const
|
|
70
|
-
for (const
|
|
71
|
-
a.has(
|
|
72
|
-
const
|
|
73
|
-
for (const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
for (const
|
|
78
|
-
a.has(
|
|
79
|
-
for (const
|
|
80
|
-
a.has(
|
|
81
|
-
return
|
|
62
|
+
function qe(t, i, v, a) {
|
|
63
|
+
const h = t.filter((r) => !a.has(r.viewId)), w = /* @__PURE__ */ new Map();
|
|
64
|
+
for (const r of h)
|
|
65
|
+
w.set(r.viewId, r);
|
|
66
|
+
const x = /* @__PURE__ */ new Map();
|
|
67
|
+
for (const r of i)
|
|
68
|
+
a.has(r.viewId) || x.set(r.viewId, r);
|
|
69
|
+
const y = /* @__PURE__ */ new Map();
|
|
70
|
+
for (const r of v)
|
|
71
|
+
a.has(r.viewId) || y.set(r.viewId, r);
|
|
72
|
+
const S = [], d = /* @__PURE__ */ new Set();
|
|
73
|
+
for (const r of h) {
|
|
74
|
+
const A = y.get(r.viewId) ?? x.get(r.viewId) ?? r;
|
|
75
|
+
S.push(A), d.add(A.viewId);
|
|
76
|
+
}
|
|
77
|
+
for (const r of i)
|
|
78
|
+
a.has(r.viewId) || d.has(r.viewId) || (S.push(r), d.add(r.viewId));
|
|
79
|
+
for (const r of v)
|
|
80
|
+
a.has(r.viewId) || d.has(r.viewId) || (S.push(r), d.add(r.viewId));
|
|
81
|
+
return S;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function Oe(t) {
|
|
84
84
|
var v;
|
|
85
|
-
const
|
|
86
|
-
return
|
|
87
|
-
field:
|
|
88
|
-
order:
|
|
85
|
+
const i = (v = t == null ? void 0 : t.sorts) == null ? void 0 : v[0];
|
|
86
|
+
return i ? {
|
|
87
|
+
field: i.fieldId,
|
|
88
|
+
order: i.direction
|
|
89
89
|
} : { field: null, order: null };
|
|
90
90
|
}
|
|
91
|
-
function Q(
|
|
92
|
-
return
|
|
91
|
+
function Q(t, i) {
|
|
92
|
+
return t.some((v) => v.viewId === i);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
(
|
|
109
|
-
|
|
94
|
+
function Te(t) {
|
|
95
|
+
return t ? Array.isArray(t) ? t.filter(
|
|
96
|
+
(i) => !!i
|
|
97
|
+
) : [t] : [];
|
|
98
|
+
}
|
|
99
|
+
function je(t) {
|
|
100
|
+
var ce, oe;
|
|
101
|
+
const i = f(() => {
|
|
102
|
+
var e, l;
|
|
103
|
+
return t.mode ? t.mode : (e = t.provider) != null && e.mode ? t.provider.mode : (l = t.provider) != null && l.onFetch ? "provider" : "local";
|
|
104
|
+
}), v = f(() => de(G(t.schema) ?? null)), a = f(() => H(G(t.records))), h = f(() => J(G(t.views))), w = I(null), x = I([]), y = I([]), S = I(/* @__PURE__ */ new Set()), d = Be(a.value), r = I(!1), A = I(null), E = I(d.value.length), M = I(1), B = I(t.pageSize ?? 20), s = I(
|
|
105
|
+
t.initialSelectedRecordId !== void 0 ? t.initialSelectedRecordId : ((ce = d.value[0]) == null ? void 0 : ce.id) ?? null
|
|
106
|
+
), m = I(t.initialViewId ?? ""), T = I(!1), k = I(0), p = I(t.initialSelectedRecordId === void 0), P = f(() => w.value ?? v.value), $ = f(() => {
|
|
107
|
+
var n;
|
|
108
|
+
const e = [...((n = v.value) == null ? void 0 : n.views) ?? [], ...h.value], l = J(e);
|
|
109
|
+
return l.length > 0 ? l : [K(v.value, t.defaultView)];
|
|
110
|
+
}), j = Te((oe = t.actions) == null ? void 0 : oe.middleware), g = f(
|
|
111
|
+
() => qe($.value, x.value, y.value, S.value)
|
|
112
|
+
), V = f(() => g.value.find((l) => l.viewId === m.value) ?? g.value[0] ?? K(P.value, t.defaultView, m.value || "__default__")), D = f(() => s.value ? d.value.find((e) => e.id === s.value) ?? null : null), q = f(() => s.value ? d.value.findIndex((e) => e.id === s.value) : -1), U = f(() => q.value >= 0), ve = f(
|
|
113
|
+
() => U.value ? q.value + 1 : null
|
|
114
|
+
), R = I(!!(t.initialDetailOpen ?? t.initialSelectedRecordId)), se = f(() => R.value ? D.value : null), fe = f(
|
|
110
115
|
() => g.value.map((e) => ({
|
|
111
116
|
id: e.viewId,
|
|
112
117
|
name: e.name,
|
|
113
118
|
type: e.viewType
|
|
114
119
|
}))
|
|
115
|
-
),
|
|
120
|
+
), C = f(() => {
|
|
116
121
|
var e;
|
|
117
|
-
return
|
|
118
|
-
}),
|
|
119
|
-
function
|
|
120
|
-
|
|
122
|
+
return i.value === "provider" && !!((e = t.provider) != null && e.onFetch);
|
|
123
|
+
}), we = f(() => !C.value);
|
|
124
|
+
function X(e) {
|
|
125
|
+
A.value = e instanceof Error ? e : new Error(String(e));
|
|
126
|
+
}
|
|
127
|
+
function Ie(e, l) {
|
|
128
|
+
return {
|
|
129
|
+
action: e,
|
|
130
|
+
payload: l,
|
|
131
|
+
tableId: t.tableId,
|
|
132
|
+
mode: i.value,
|
|
133
|
+
view: V.value,
|
|
134
|
+
activeViewId: m.value,
|
|
135
|
+
selectedRecordId: s.value,
|
|
136
|
+
selectedRecord: D.value,
|
|
137
|
+
page: M.value,
|
|
138
|
+
pageSize: B.value,
|
|
139
|
+
totalCount: E.value
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
async function Y(e, l) {
|
|
143
|
+
const n = e === "before" ? j : [...j].reverse();
|
|
144
|
+
for (const u of n) {
|
|
145
|
+
const c = u[e];
|
|
146
|
+
c && await c(l);
|
|
147
|
+
}
|
|
121
148
|
}
|
|
122
|
-
function
|
|
123
|
-
|
|
149
|
+
async function me(e, l) {
|
|
150
|
+
const n = {
|
|
151
|
+
...e,
|
|
152
|
+
error: l
|
|
153
|
+
};
|
|
154
|
+
for (const u of [...j].reverse())
|
|
155
|
+
u.error && await u.error(n);
|
|
124
156
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
157
|
+
async function F(e, l, n) {
|
|
158
|
+
const u = Ie(e, l);
|
|
159
|
+
try {
|
|
160
|
+
await Y("before", u), await (n == null ? void 0 : n()), await Y("after", u);
|
|
161
|
+
} catch (c) {
|
|
162
|
+
try {
|
|
163
|
+
await me(u, c);
|
|
164
|
+
} catch (o) {
|
|
165
|
+
X(o);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
X(c);
|
|
169
|
+
}
|
|
127
170
|
}
|
|
128
|
-
function
|
|
129
|
-
return
|
|
171
|
+
function Z(e) {
|
|
172
|
+
return d.value.findIndex((l) => l.id === e);
|
|
130
173
|
}
|
|
131
|
-
function
|
|
174
|
+
function ge(e) {
|
|
175
|
+
return d.value.find((l) => l.id === e) ?? null;
|
|
176
|
+
}
|
|
177
|
+
function Re(e) {
|
|
178
|
+
return Z(e) >= 0;
|
|
179
|
+
}
|
|
180
|
+
function ee(e) {
|
|
132
181
|
return e == null ? null : typeof e == "string" ? e : e.id;
|
|
133
182
|
}
|
|
134
|
-
function
|
|
183
|
+
function L() {
|
|
135
184
|
var e;
|
|
136
|
-
Q(g.value, m.value) || (m.value = ((e = g.value[0]) == null ? void 0 : e.viewId) ?? K(
|
|
185
|
+
Q(g.value, m.value) || (m.value = ((e = g.value[0]) == null ? void 0 : e.viewId) ?? K(P.value, t.defaultView).viewId);
|
|
137
186
|
}
|
|
138
|
-
function
|
|
187
|
+
function _() {
|
|
139
188
|
var e;
|
|
140
|
-
|
|
189
|
+
p.value && (!s.value || !Re(s.value)) && (s.value = ((e = d.value[0]) == null ? void 0 : e.id) ?? null);
|
|
141
190
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
191
|
+
function te(e) {
|
|
192
|
+
p.value = !1, s.value = ee(e);
|
|
144
193
|
}
|
|
145
|
-
function
|
|
146
|
-
|
|
194
|
+
function le(e) {
|
|
195
|
+
p.value = !1, e !== void 0 && (s.value = ee(e)), R.value = !0;
|
|
147
196
|
}
|
|
148
|
-
function
|
|
149
|
-
|
|
197
|
+
function ae(e) {
|
|
198
|
+
R.value = !1, e != null && e.clearSelection && (p.value = !1, s.value = null);
|
|
150
199
|
}
|
|
151
|
-
function
|
|
152
|
-
if (
|
|
153
|
-
|
|
200
|
+
function he(e) {
|
|
201
|
+
if (R.value) {
|
|
202
|
+
ae();
|
|
154
203
|
return;
|
|
155
204
|
}
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
function
|
|
159
|
-
const
|
|
160
|
-
if (
|
|
161
|
-
const
|
|
162
|
-
let
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
else if (
|
|
205
|
+
le(e);
|
|
206
|
+
}
|
|
207
|
+
function ne(e, l) {
|
|
208
|
+
const n = d.value.length;
|
|
209
|
+
if (n <= 0) return;
|
|
210
|
+
const u = q.value;
|
|
211
|
+
let c = u >= 0 ? u + e : e > 0 ? 0 : n - 1;
|
|
212
|
+
if (l != null && l.wrap)
|
|
213
|
+
c = (c + n) % n;
|
|
214
|
+
else if (c < 0 || c >= n)
|
|
166
215
|
return;
|
|
167
|
-
const
|
|
168
|
-
|
|
216
|
+
const o = d.value[c];
|
|
217
|
+
o && (p.value = !1, s.value = o.id, ((l == null ? void 0 : l.openDetail) ?? R.value) && (R.value = !0));
|
|
169
218
|
}
|
|
170
|
-
function
|
|
171
|
-
|
|
219
|
+
function Se(e) {
|
|
220
|
+
ne(1, e);
|
|
172
221
|
}
|
|
173
|
-
function
|
|
174
|
-
|
|
222
|
+
function ye(e) {
|
|
223
|
+
ne(-1, e);
|
|
175
224
|
}
|
|
176
|
-
function
|
|
177
|
-
const
|
|
178
|
-
|
|
225
|
+
function N(e) {
|
|
226
|
+
const l = z(e);
|
|
227
|
+
y.value = [...y.value.filter((n) => n.viewId !== l.viewId), l], S.value.delete(l.viewId), L();
|
|
179
228
|
}
|
|
180
|
-
function
|
|
181
|
-
|
|
229
|
+
function ie(e) {
|
|
230
|
+
y.value = y.value.filter((l) => l.viewId !== e);
|
|
182
231
|
}
|
|
183
|
-
function
|
|
184
|
-
|
|
232
|
+
function Ve(e) {
|
|
233
|
+
S.value = /* @__PURE__ */ new Set([...S.value, e]), ie(e);
|
|
185
234
|
}
|
|
186
|
-
async function
|
|
187
|
-
var i, c, o;
|
|
235
|
+
async function b() {
|
|
188
236
|
const e = {
|
|
189
|
-
tableId:
|
|
190
|
-
schema:
|
|
191
|
-
view:
|
|
192
|
-
page:
|
|
193
|
-
pageSize:
|
|
194
|
-
sort:
|
|
195
|
-
selectedRecordId:
|
|
237
|
+
tableId: t.tableId,
|
|
238
|
+
schema: P.value,
|
|
239
|
+
view: V.value,
|
|
240
|
+
page: M.value,
|
|
241
|
+
pageSize: B.value,
|
|
242
|
+
sort: Oe(V.value),
|
|
243
|
+
selectedRecordId: s.value
|
|
196
244
|
};
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
x(u);
|
|
245
|
+
await F("refresh", e, async () => {
|
|
246
|
+
var n, u, c;
|
|
247
|
+
if (A.value = null, (n = t.actions) != null && n.onRefresh && await t.actions.onRefresh(), (u = t.provider) != null && u.onRefresh && await t.provider.onRefresh(e), !C.value || !((c = t.provider) != null && c.onFetch)) {
|
|
248
|
+
d.value = a.value, E.value = d.value.length, _(), L(), T.value = !1;
|
|
202
249
|
return;
|
|
203
250
|
}
|
|
204
|
-
|
|
251
|
+
const l = k.value + 1;
|
|
252
|
+
k.value = l, r.value = !0;
|
|
205
253
|
try {
|
|
206
|
-
await
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
254
|
+
const o = await t.provider.onFetch(e);
|
|
255
|
+
if (k.value !== l) return;
|
|
256
|
+
const O = H(o.records ?? o.data);
|
|
257
|
+
d.value = O, E.value = o.total ?? O.length, o.schema !== void 0 && (w.value = de(o.schema)), o.views !== void 0 && o.views !== null && (x.value = J(o.views)), o.activeViewId && (m.value = o.activeViewId), o.selectedRecordId !== void 0 && (p.value = !1, s.value = o.selectedRecordId, o.selectedRecordId === null && (R.value = !1)), T.value = !0, L(), _();
|
|
258
|
+
} finally {
|
|
259
|
+
k.value === l && (r.value = !1);
|
|
210
260
|
}
|
|
211
|
-
|
|
212
|
-
d.value = a.value, E.value = d.value.length, P(), _(), $.value = !1;
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
const t = B.value + 1;
|
|
216
|
-
B.value = t, n.value = !0;
|
|
217
|
-
try {
|
|
218
|
-
const u = await l.provider.onFetch(e);
|
|
219
|
-
if (B.value !== t) return;
|
|
220
|
-
const R = H(u.records ?? u.data);
|
|
221
|
-
d.value = R, E.value = u.total ?? R.length, u.schema !== void 0 && (w.value = ue(u.schema)), u.views !== void 0 && u.views !== null && (p.value = J(u.views)), u.activeViewId && (m.value = u.activeViewId), u.selectedRecordId !== void 0 && (F.value = !1, f.value = u.selectedRecordId, u.selectedRecordId === null && (h.value = !1)), $.value = !0, _(), P();
|
|
222
|
-
} catch (u) {
|
|
223
|
-
B.value === t && x(u);
|
|
224
|
-
} finally {
|
|
225
|
-
B.value === t && (n.value = !1);
|
|
226
|
-
}
|
|
261
|
+
});
|
|
227
262
|
}
|
|
228
|
-
function
|
|
229
|
-
Q(g.value, e) && (m.value = e,
|
|
263
|
+
function re(e) {
|
|
264
|
+
Q(g.value, e) && (m.value = e, M.value = 1, C.value && b());
|
|
230
265
|
}
|
|
231
|
-
function
|
|
232
|
-
|
|
266
|
+
function xe(e) {
|
|
267
|
+
re(e);
|
|
233
268
|
}
|
|
234
|
-
async function
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
...t,
|
|
269
|
+
async function Me(e) {
|
|
270
|
+
const l = V.value, n = z({
|
|
271
|
+
...l,
|
|
238
272
|
...e,
|
|
239
|
-
viewId:
|
|
273
|
+
viewId: l.viewId
|
|
274
|
+
});
|
|
275
|
+
await F("save-view", n, async () => {
|
|
276
|
+
var u, c;
|
|
277
|
+
N(n), await ((c = (u = t.actions) == null ? void 0 : u.onSaveView) == null ? void 0 : c.call(u, n));
|
|
240
278
|
});
|
|
241
|
-
j(i);
|
|
242
|
-
try {
|
|
243
|
-
await ((o = (c = l.actions) == null ? void 0 : c.onSaveView) == null ? void 0 : o.call(c, i));
|
|
244
|
-
} catch (u) {
|
|
245
|
-
x(u);
|
|
246
|
-
}
|
|
247
279
|
}
|
|
248
|
-
async function
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
...
|
|
252
|
-
|
|
253
|
-
viewId: i,
|
|
280
|
+
async function ue(e, l) {
|
|
281
|
+
const n = `view-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`, u = z({
|
|
282
|
+
...V.value,
|
|
283
|
+
...l,
|
|
284
|
+
viewId: n,
|
|
254
285
|
name: e
|
|
255
286
|
});
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
await ((
|
|
259
|
-
}
|
|
260
|
-
x(R);
|
|
261
|
-
}
|
|
262
|
-
return i;
|
|
287
|
+
return await F("save-view", u, async () => {
|
|
288
|
+
var c, o;
|
|
289
|
+
N(u), m.value = n, M.value = 1, await ((o = (c = t.actions) == null ? void 0 : c.onSaveView) == null ? void 0 : o.call(c, u));
|
|
290
|
+
}), n;
|
|
263
291
|
}
|
|
264
|
-
async function
|
|
265
|
-
var c, o, u;
|
|
292
|
+
async function pe(e) {
|
|
266
293
|
if (!Q(g.value, e)) return;
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
x(R);
|
|
273
|
-
}
|
|
294
|
+
const l = m.value === e, n = $.value.some((u) => u.viewId === e);
|
|
295
|
+
await F("delete-view", e, async () => {
|
|
296
|
+
var u, c, o;
|
|
297
|
+
n ? Ve(e) : ie(e), l && (m.value = ((u = g.value.find((O) => O.viewId !== e)) == null ? void 0 : u.viewId) ?? "", L()), await ((o = (c = t.actions) == null ? void 0 : c.onDeleteView) == null ? void 0 : o.call(c, e));
|
|
298
|
+
});
|
|
274
299
|
}
|
|
275
|
-
async function
|
|
276
|
-
const
|
|
277
|
-
return
|
|
300
|
+
async function Ce(e, l) {
|
|
301
|
+
const n = g.value.find((u) => u.viewId === e);
|
|
302
|
+
return n ? ue(l, { ...n }) : "";
|
|
278
303
|
}
|
|
279
|
-
function
|
|
280
|
-
const
|
|
281
|
-
...
|
|
304
|
+
function Fe(e) {
|
|
305
|
+
const l = z({
|
|
306
|
+
...V.value,
|
|
282
307
|
...e,
|
|
283
|
-
viewId:
|
|
308
|
+
viewId: V.value.viewId
|
|
284
309
|
});
|
|
285
|
-
|
|
310
|
+
N(l);
|
|
286
311
|
}
|
|
287
|
-
function
|
|
288
|
-
|
|
312
|
+
function ze(e) {
|
|
313
|
+
te(e), s.value === null && (R.value = !1);
|
|
289
314
|
}
|
|
290
|
-
function
|
|
291
|
-
|
|
315
|
+
function Ae() {
|
|
316
|
+
p.value = !1, s.value = null, R.value = !1;
|
|
292
317
|
}
|
|
293
|
-
function
|
|
294
|
-
|
|
318
|
+
function Ee(e) {
|
|
319
|
+
M.value = Math.max(1, Math.floor(e) || 1), C.value && b();
|
|
295
320
|
}
|
|
296
|
-
function
|
|
297
|
-
|
|
321
|
+
function De(e) {
|
|
322
|
+
B.value = Math.max(1, Math.floor(e) || 1), M.value = 1, C.value && b();
|
|
298
323
|
}
|
|
299
|
-
async function
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
304
|
-
x(c);
|
|
305
|
-
}
|
|
324
|
+
async function Le(e) {
|
|
325
|
+
await F("cell-edit", e, () => {
|
|
326
|
+
var l, n;
|
|
327
|
+
return (n = (l = t.actions) == null ? void 0 : l.onCellEdit) == null ? void 0 : n.call(l, e);
|
|
328
|
+
});
|
|
306
329
|
}
|
|
307
|
-
async function
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
x(c);
|
|
313
|
-
}
|
|
330
|
+
async function _e(e) {
|
|
331
|
+
await F("schema-event", e, () => {
|
|
332
|
+
var l, n;
|
|
333
|
+
return (n = (l = t.actions) == null ? void 0 : l.onSchemaEvent) == null ? void 0 : n.call(l, e);
|
|
334
|
+
});
|
|
314
335
|
}
|
|
315
|
-
function
|
|
316
|
-
const
|
|
317
|
-
d.value =
|
|
336
|
+
function be(e) {
|
|
337
|
+
const l = H(e);
|
|
338
|
+
d.value = l, E.value = l.length, _();
|
|
318
339
|
}
|
|
319
|
-
return
|
|
340
|
+
return W(
|
|
320
341
|
a,
|
|
321
342
|
(e) => {
|
|
322
|
-
|
|
343
|
+
C.value && T.value || (d.value = e, E.value = e.length, _());
|
|
323
344
|
},
|
|
324
345
|
{ immediate: !0 }
|
|
325
|
-
),
|
|
326
|
-
|
|
346
|
+
), W(
|
|
347
|
+
$,
|
|
327
348
|
() => {
|
|
328
|
-
|
|
349
|
+
L();
|
|
329
350
|
},
|
|
330
351
|
{ immediate: !0, deep: !0 }
|
|
331
|
-
),
|
|
332
|
-
|
|
352
|
+
), W(
|
|
353
|
+
D,
|
|
333
354
|
() => {
|
|
334
|
-
|
|
335
|
-
|
|
355
|
+
F(
|
|
356
|
+
"select-record",
|
|
357
|
+
D.value,
|
|
358
|
+
() => {
|
|
359
|
+
var e, l;
|
|
360
|
+
return (l = (e = t.actions) == null ? void 0 : e.onSelectRecord) == null ? void 0 : l.call(e, D.value);
|
|
361
|
+
}
|
|
362
|
+
);
|
|
336
363
|
},
|
|
337
364
|
{ immediate: !0, deep: !1, flush: "sync" }
|
|
338
|
-
),
|
|
339
|
-
tableId:
|
|
340
|
-
mode:
|
|
341
|
-
schema:
|
|
365
|
+
), t.autoLoad !== !1 ? b() : (L(), _()), {
|
|
366
|
+
tableId: t.tableId,
|
|
367
|
+
mode: i,
|
|
368
|
+
schema: P,
|
|
342
369
|
records: d,
|
|
343
370
|
views: g,
|
|
344
371
|
activeViewId: m,
|
|
345
|
-
activeView:
|
|
346
|
-
selectedRecordId:
|
|
347
|
-
selectedRecord:
|
|
348
|
-
selectedRecordIndex:
|
|
349
|
-
selectedRecordOrdinal:
|
|
372
|
+
activeView: V,
|
|
373
|
+
selectedRecordId: s,
|
|
374
|
+
selectedRecord: D,
|
|
375
|
+
selectedRecordIndex: q,
|
|
376
|
+
selectedRecordOrdinal: ve,
|
|
350
377
|
hasSelectedRecord: U,
|
|
351
|
-
detailOpen:
|
|
352
|
-
detailRecord:
|
|
353
|
-
loading:
|
|
354
|
-
error:
|
|
355
|
-
page:
|
|
356
|
-
pageSize:
|
|
378
|
+
detailOpen: R,
|
|
379
|
+
detailRecord: se,
|
|
380
|
+
loading: r,
|
|
381
|
+
error: A,
|
|
382
|
+
page: M,
|
|
383
|
+
pageSize: B,
|
|
357
384
|
totalCount: E,
|
|
358
|
-
viewList:
|
|
359
|
-
isProviderMode:
|
|
360
|
-
isLocalMode:
|
|
361
|
-
refresh:
|
|
362
|
-
getRecordById:
|
|
363
|
-
getRecordIndex:
|
|
364
|
-
selectRecord:
|
|
365
|
-
openRecordDetail:
|
|
366
|
-
closeRecordDetail:
|
|
367
|
-
toggleRecordDetail:
|
|
368
|
-
selectNextRecord:
|
|
369
|
-
selectPreviousRecord:
|
|
370
|
-
switchView:
|
|
371
|
-
setActiveViewId:
|
|
372
|
-
createView:
|
|
373
|
-
saveView:
|
|
374
|
-
deleteView:
|
|
375
|
-
duplicateView:
|
|
376
|
-
updateActiveView:
|
|
377
|
-
setSelectedRecord:
|
|
378
|
-
clearSelectedRecord:
|
|
379
|
-
setPage:
|
|
380
|
-
setPageSize:
|
|
381
|
-
emitCellEdit:
|
|
382
|
-
emitSchemaEvent:
|
|
383
|
-
setRecords:
|
|
385
|
+
viewList: fe,
|
|
386
|
+
isProviderMode: C,
|
|
387
|
+
isLocalMode: we,
|
|
388
|
+
refresh: b,
|
|
389
|
+
getRecordById: ge,
|
|
390
|
+
getRecordIndex: Z,
|
|
391
|
+
selectRecord: te,
|
|
392
|
+
openRecordDetail: le,
|
|
393
|
+
closeRecordDetail: ae,
|
|
394
|
+
toggleRecordDetail: he,
|
|
395
|
+
selectNextRecord: Se,
|
|
396
|
+
selectPreviousRecord: ye,
|
|
397
|
+
switchView: re,
|
|
398
|
+
setActiveViewId: xe,
|
|
399
|
+
createView: ue,
|
|
400
|
+
saveView: Me,
|
|
401
|
+
deleteView: pe,
|
|
402
|
+
duplicateView: Ce,
|
|
403
|
+
updateActiveView: Fe,
|
|
404
|
+
setSelectedRecord: ze,
|
|
405
|
+
clearSelectedRecord: Ae,
|
|
406
|
+
setPage: Ee,
|
|
407
|
+
setPageSize: De,
|
|
408
|
+
emitCellEdit: Le,
|
|
409
|
+
emitSchemaEvent: _e,
|
|
410
|
+
setRecords: be
|
|
384
411
|
};
|
|
385
412
|
}
|
|
386
413
|
export {
|
|
387
|
-
|
|
414
|
+
je as useDatabaseView
|
|
388
415
|
};
|