@oneflowui/ui 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/components/Dashboard/charts/BarChart.vue.js +2 -2
  2. package/dist/components/Dashboard/charts/BarChart.vue2.js +9 -9
  3. package/dist/components/Dashboard/charts/NumberCard.vue.js +2 -2
  4. package/dist/components/Dashboard/charts/PieChart.vue.js +1 -1
  5. package/dist/components/Dashboard/charts/PieChart.vue2.js +3 -3
  6. package/dist/components/Dashboard/charts/TableChart.vue.js +2 -2
  7. package/dist/components/Dashboard/index.vue.js +2 -2
  8. package/dist/components/base/InfoCard.vue.js +1 -1
  9. package/dist/components/base/InfoCard.vue2.js +40 -40
  10. package/dist/components/base/StatisticCard.vue.js +3 -3
  11. package/dist/components/base/StatusSummary.vue.js +1 -1
  12. package/dist/components/base/StatusSummary.vue2.js +5 -5
  13. package/dist/components/database/DatabaseDetailPresenter.vue.d.ts +41 -0
  14. package/dist/components/database/DatabaseDetailPresenter.vue.js +76 -0
  15. package/dist/components/database/DatabaseDetailPresenter.vue2.js +4 -0
  16. package/dist/components/database/DatabaseDetailWorkspace.vue.d.ts +37 -0
  17. package/dist/components/database/DatabaseDetailWorkspace.vue.js +7 -0
  18. package/dist/components/database/DatabaseDetailWorkspace.vue2.js +103 -0
  19. package/dist/components/database/DatabaseView.vue.d.ts +13 -76
  20. package/dist/components/database/DatabaseView.vue.js +2 -2
  21. package/dist/components/database/DatabaseView.vue2.js +322 -921
  22. package/dist/components/database/DatabaseViewContent.vue.d.ts +74 -0
  23. package/dist/components/database/DatabaseViewContent.vue.js +79 -0
  24. package/dist/components/database/DatabaseViewContent.vue2.js +4 -0
  25. package/dist/components/database/DatabaseViewDetailHost.vue.d.ts +43 -0
  26. package/dist/components/database/DatabaseViewDetailHost.vue.js +59 -0
  27. package/dist/components/database/DatabaseViewDetailHost.vue2.js +4 -0
  28. package/dist/components/database/DatabaseViewShell.vue.d.ts +35 -0
  29. package/dist/components/database/DatabaseViewShell.vue.js +7 -0
  30. package/dist/components/database/DatabaseViewShell.vue2.js +71 -0
  31. package/dist/components/database/DatabaseViewToolbar.vue.d.ts +77 -0
  32. package/dist/components/database/DatabaseViewToolbar.vue.js +62 -0
  33. package/dist/components/database/DatabaseViewToolbar.vue2.js +4 -0
  34. package/dist/components/database/databaseViewUtils.d.ts +91 -0
  35. package/dist/components/database/databaseViewUtils.js +266 -0
  36. package/dist/components/database/index.d.ts +1 -1
  37. package/dist/components/kanban/KanbanColumn.vue.d.ts +2 -2
  38. package/dist/components/layout/AppLayout.vue.js +1 -1
  39. package/dist/components/layout/Navbar.vue.js +1 -1
  40. package/dist/components/layout/Sidebar.vue.js +2 -2
  41. package/dist/components/layout/StatusBar.vue.js +2 -2
  42. package/dist/components/overlay/Dialog.vue.d.ts +1 -1
  43. package/dist/components/table/ColumnHeaderMenu.vue.js +3 -3
  44. package/dist/components/table/DataTable.vue.d.ts +6 -17
  45. package/dist/components/table/DataTable.vue.js +2 -2
  46. package/dist/components/table/DataTable.vue2.js +781 -872
  47. package/dist/components/table/DataTableDesktopFixedRegion.vue.d.ts +56 -0
  48. package/dist/components/table/DataTableDesktopFixedRegion.vue.js +7 -0
  49. package/dist/components/table/DataTableDesktopFixedRegion.vue2.js +67 -0
  50. package/dist/components/table/DataTableDesktopFrame.vue.d.ts +127 -0
  51. package/dist/components/table/DataTableDesktopFrame.vue.js +7 -0
  52. package/dist/components/table/DataTableDesktopFrame.vue2.js +196 -0
  53. package/dist/components/table/DataTableDesktopScrollRegion.vue.d.ts +55 -0
  54. package/dist/components/table/DataTableDesktopScrollRegion.vue.js +7 -0
  55. package/dist/components/table/DataTableDesktopScrollRegion.vue2.js +66 -0
  56. package/dist/components/table/DataTableDesktopStandardRegion.vue.d.ts +54 -0
  57. package/dist/components/table/DataTableDesktopStandardRegion.vue.js +7 -0
  58. package/dist/components/table/DataTableDesktopStandardRegion.vue2.js +65 -0
  59. package/dist/components/table/DataTableDraftToolbar.vue.d.ts +11 -0
  60. package/dist/components/table/DataTableDraftToolbar.vue.js +7 -0
  61. package/dist/components/table/DataTableDraftToolbar.vue2.js +25 -0
  62. package/dist/components/table/DataTableMobilePanel.vue.d.ts +79 -0
  63. package/dist/components/table/DataTableMobilePanel.vue.js +60 -0
  64. package/dist/components/table/DataTableMobilePanel.vue2.js +4 -0
  65. package/dist/components/table/DataTableSelectionBar.vue.d.ts +11 -0
  66. package/dist/components/table/DataTableSelectionBar.vue.js +7 -0
  67. package/dist/components/table/DataTableSelectionBar.vue2.js +33 -0
  68. package/dist/components/table/DetailSheet.vue.js +1 -1
  69. package/dist/components/table/DetailSheet.vue2.js +160 -187
  70. package/dist/components/table/FieldTypePicker.vue.js +3 -3
  71. package/dist/components/table/MobileListView.vue.js +1 -1
  72. package/dist/components/table/TableColumnManager.vue.js +3 -3
  73. package/dist/components/table/TableDataRow.vue.js +4 -4
  74. package/dist/components/table/TableFilterPanel.vue.js +1 -1
  75. package/dist/components/table/TableGroupRow.vue.js +2 -2
  76. package/dist/components/table/TableHeaderRow.vue.js +3 -3
  77. package/dist/components/table/TableToolbar.vue.js +2 -2
  78. package/dist/components/table/TableToolbar.vue2.js +126 -138
  79. package/dist/components/table/dataTableUtils.d.ts +26 -0
  80. package/dist/components/table/dataTableUtils.js +60 -0
  81. package/dist/composables/databaseDetailWorkspaceUtils.d.ts +59 -0
  82. package/dist/composables/databaseDetailWorkspaceUtils.js +160 -0
  83. package/dist/composables/index.d.ts +5 -0
  84. package/dist/composables/useDataTableDetailSheet.d.ts +47 -0
  85. package/dist/composables/useDataTableDetailSheet.js +58 -0
  86. package/dist/composables/useDataTableLayout.d.ts +16 -0
  87. package/dist/composables/useDataTableLayout.js +38 -0
  88. package/dist/composables/useDataTableSelection.d.ts +41 -0
  89. package/dist/composables/useDataTableSelection.js +73 -0
  90. package/dist/composables/useDatabaseDetailWorkspace.d.ts +67 -0
  91. package/dist/composables/useDatabaseDetailWorkspace.js +150 -0
  92. package/dist/composables/useDatabaseView.d.ts +3 -137
  93. package/dist/composables/useDatabaseWorkspace.d.ts +31 -0
  94. package/dist/composables/useDatabaseWorkspace.js +89 -0
  95. package/dist/composables/useTableToolbarPanels.d.ts +19 -0
  96. package/dist/composables/useTableToolbarPanels.js +53 -0
  97. package/dist/contracts/database.d.ts +252 -0
  98. package/dist/index.d.ts +6 -0
  99. package/dist/index.js +261 -248
  100. package/dist/plugin.d.ts +2 -0
  101. package/dist/plugin.js +10 -261
  102. package/dist/registry/plugin-components.d.ts +291 -0
  103. package/dist/registry/plugin-components.js +114 -0
  104. package/dist/style.css +1 -1
  105. package/dist/types/data-table.d.ts +27 -0
  106. package/dist/types/data-table.js +29 -0
  107. package/package.json +1 -1
@@ -1,47 +1,15 @@
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
- key: 0,
17
- class: "of-database-view__state of-database-view__state--loading",
18
- "data-role": "loading-state"
19
- }, da = {
20
- key: 1,
21
- class: "of-database-view__state",
22
- "data-role": "error-state"
23
- }, ua = {
24
- key: 1,
25
- class: "of-database-view__state of-database-view__state--empty",
26
- "data-role": "empty-state"
27
- }, ca = ["data-view"], va = {
28
- key: 4,
29
- class: "of-database-view__detail-anchor"
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 = {
35
- key: 1,
36
- class: "of-database-view__detail-workspace-fallback"
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 = {
42
- key: 1,
43
- class: "of-database-view__detail-workspace-fallback"
44
- }, Wa = ["disabled"], k = "detail", Pa = "(max-width: 768px)", Na = "oneui-database-workspace:", we = 720, pe = 900, Ua = 420, Ba = 1320, Qa = /* @__PURE__ */ jt({
1
+ import { defineComponent as Ze, computed as o, ref as O, watch as m, toRef as T, openBlock as B, createBlock as K, mergeProps as xe, unref as n, withCtx as G, createCommentVNode as Q, createVNode as _e } from "vue";
2
+ import { Database as et, AlertCircle as tt } from "lucide-vue-next";
3
+ import it from "./DatabaseViewDetailHost.vue.js";
4
+ import at from "./DatabaseViewContent.vue.js";
5
+ import ot from "./DatabaseViewShell.vue.js";
6
+ import lt from "./DatabaseViewToolbar.vue.js";
7
+ import { useDatabaseView as dt } from "../../composables/useDatabaseView.js";
8
+ import { readWorkspacePreferences as rt, DATABASE_DETAIL_VIEW_ID as h } from "../../composables/useDatabaseWorkspace.js";
9
+ import { useDatabaseDetailWorkspace as nt } from "../../composables/useDatabaseDetailWorkspace.js";
10
+ import { buildGanttItems as st } from "../../types/index.js";
11
+ import { cloneView as X, buildFallbackView as ct, buildVirtualDetailView as ut, convertViewFiltersToToolbarFilters as wt, buildDatabaseViewTabs as ft, buildTableColumns as vt, getVisibleFieldIds as ht, buildRenderedRecords as mt, buildEmptyFilter as pt, convertToolbarFiltersToViewFilters as bt } from "./databaseViewUtils.js";
12
+ const yt = "正在加载数据视图", It = "请稍候,页面级编排器正在准备当前视图。", St = "数据视图加载失败", Vt = "暂无记录", Pt = /* @__PURE__ */ Ze({
45
13
  name: "DatabaseView",
46
14
  inheritAttrs: !1,
47
15
  __name: "DatabaseView",
@@ -77,998 +45,431 @@ const sa = {
77
45
  autoLoad: { type: Boolean, default: !0 }
78
46
  },
79
47
  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"],
80
- setup(R, { emit: Ge }) {
81
- var xe, Ke;
82
- const o = R, u = Ge, G = C(!1);
83
- let g = null;
84
- function ie() {
85
- G.value = (g == null ? void 0 : g.matches) ?? !1;
86
- }
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;
91
- });
92
- function me(e) {
93
- var t, a, i, l;
94
- return {
95
- ...e,
96
- visibleFields: [...e.visibleFields],
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
- fixedColumns: e.fixedColumns ? [...e.fixedColumns] : void 0,
102
- galleryCardFields: e.galleryCardFields ? [...e.galleryCardFields] : void 0
103
- };
104
- }
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) {
131
- const t = e[0];
132
- return t ? Object.keys(t.fields) : [];
133
- }
134
- function he(e) {
135
- switch (e) {
136
- case "kanban":
137
- return "columns-3";
138
- case "gallery":
139
- return "image";
140
- case "timeline":
141
- return "calendar-range";
142
- case "detail":
143
- return "file-text";
144
- case "table":
145
- default:
146
- return "table-2";
147
- }
148
- }
149
- function Me(e, t = []) {
150
- const a = A(e, t);
151
- return {
152
- viewId: "table",
153
- viewType: "table",
154
- name: (e == null ? void 0 : e.name) || "表格",
155
- visibleFields: a,
156
- sorts: [],
157
- groups: [],
158
- filters: [],
159
- fixedColumns: []
160
- };
161
- }
162
- function Xe(e, t = []) {
163
- const a = A(e, t);
164
- return {
165
- viewId: k,
166
- viewType: "detail",
167
- name: "详情",
168
- visibleFields: a,
169
- sorts: [],
170
- groups: [],
171
- filters: [],
172
- fixedColumns: []
173
- };
174
- }
175
- function le(e, t) {
176
- var a;
177
- return ((a = t == null ? void 0 : t.fields.find((i) => i.id === e)) == null ? void 0 : a.name) ?? e;
178
- }
179
- function _e(e) {
180
- switch (e == null ? void 0 : e.type) {
181
- case "number":
182
- case "currency":
183
- case "progress":
184
- return "number";
185
- case "date":
186
- case "datetime":
187
- return "date";
188
- case "select":
189
- case "multi_select":
190
- return "status";
191
- default:
192
- return "string";
193
- }
194
- }
195
- function Ye(e) {
196
- switch (e == null ? void 0 : e.type) {
197
- case "number":
198
- return "number";
199
- case "select":
200
- return "select";
201
- case "multi_select":
202
- return "multiselect";
203
- case "date":
204
- return "date";
205
- case "datetime":
206
- return "datetime";
207
- case "checkbox":
208
- return "checkbox";
209
- case "url":
210
- return "url";
211
- case "email":
212
- return "email";
213
- case "phone":
214
- return "phone";
215
- case "rating":
216
- return "rating";
217
- case "attachment":
218
- return "attachment";
219
- case "relation":
220
- return "relation";
221
- case "formula":
222
- return "text";
223
- case "currency":
224
- return "currency";
225
- case "richtext":
226
- return "richtext";
227
- case "auto_number":
228
- return "auto_number";
229
- case "creator":
230
- return "creator";
231
- case "progress":
232
- return "progress";
233
- case "text":
234
- default:
235
- return "text";
236
- }
237
- }
238
- function Ze(e, t, a = []) {
239
- var l;
240
- return ((((l = e.visibleFields) == null ? void 0 : l.length) ?? 0) > 0 ? e.visibleFields : A(t, a)).map((n) => {
241
- var z;
242
- const f = (z = t == null ? void 0 : t.fields) == null ? void 0 : z.find((Gt) => Gt.id === n);
243
- return {
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
249
- };
250
- });
251
- }
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);
256
- return {
257
- key: i,
258
- label: le(i, e),
259
- type: _e(l),
260
- hidden: (l == null ? void 0 : l.hidden) ?? !1,
261
- width: l == null ? void 0 : l.width
262
- };
263
- });
264
- }
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);
269
- return {
270
- id: i,
271
- type: Ye(l),
272
- label: le(i, e)
273
- };
274
- });
275
- }
276
- function L(e) {
277
- return e == null ? "" : Array.isArray(e) ? e.map((t) => String(t)).join(", ") : String(e);
278
- }
279
- function N(e, t) {
280
- if (e == null && t == null) return 0;
281
- if (e == null) return -1;
282
- if (t == null) return 1;
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");
287
- }
288
- function tt(e, t) {
289
- const a = L(e).trim(), i = (t.value ?? "").trim(), l = a.toLowerCase(), n = i.toLowerCase();
290
- switch (t.operator) {
291
- case "equals":
292
- return l === n;
293
- case "not_equals":
294
- return l !== n;
295
- case "contains":
296
- return l.includes(n);
297
- case "not_contains":
298
- return !l.includes(n);
299
- case "starts_with":
300
- return l.startsWith(n);
301
- case "ends_with":
302
- return l.endsWith(n);
303
- case "gt":
304
- return N(e, i) > 0;
305
- case "gte":
306
- return N(e, i) >= 0;
307
- case "lt":
308
- return N(e, i) < 0;
309
- case "lte":
310
- return N(e, i) <= 0;
311
- case "is_empty":
312
- return a === "";
313
- case "is_not_empty":
314
- return a !== "";
315
- default:
316
- return !0;
317
- }
318
- }
319
- function at(e) {
320
- return {
321
- id: `f_${Math.random().toString(36).slice(2, 8)}`,
322
- field: e,
323
- operator: "contains",
324
- value: ""
325
- };
326
- }
327
- function it(e = []) {
328
- return e.map((t, a) => ({
329
- id: `f_${t.fieldId}_${a}`,
330
- field: t.fieldId,
331
- operator: (() => {
332
- switch (t.operator) {
333
- case "eq":
334
- return "equals";
335
- case "neq":
336
- return "not_equals";
337
- case "gt":
338
- return "gt";
339
- case "lt":
340
- return "lt";
341
- case "is_empty":
342
- return "is_empty";
343
- case "is_not_empty":
344
- return "is_not_empty";
345
- case "contains":
346
- default:
347
- return "contains";
348
- }
349
- })(),
350
- value: t.value == null ? "" : String(t.value)
351
- }));
352
- }
353
- function lt(e) {
354
- return e.filter((t) => t.field).map((t) => {
355
- let a;
356
- switch (t.operator) {
357
- case "equals":
358
- a = "eq";
359
- break;
360
- case "not_equals":
361
- a = "neq";
362
- break;
363
- case "gt":
364
- case "gte":
365
- a = "gt";
366
- break;
367
- case "lt":
368
- case "lte":
369
- a = "lt";
370
- break;
371
- case "is_empty":
372
- a = "is_empty";
373
- break;
374
- case "is_not_empty":
375
- a = "is_not_empty";
376
- break;
377
- case "contains":
378
- case "not_contains":
379
- case "starts_with":
380
- case "ends_with":
381
- default:
382
- a = "contains";
383
- break;
384
- }
385
- return {
386
- fieldId: t.field,
387
- operator: a,
388
- value: t.value == null ? "" : t.value
389
- };
390
- });
391
- }
392
- function A(e, t = []) {
393
- var i;
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 : Je(t);
396
- }
397
- function ot(e) {
398
- return e ? {
399
- id: e.id,
400
- ...e.fields
401
- } : { id: "__detail-empty__" };
402
- }
403
- function rt(e) {
404
- if (e)
405
- return {
406
- label: "返回列表",
407
- onClick: () => Le(e)
408
- };
409
- }
410
- const U = je(o.tableId), ye = r(() => o.schema ?? null), nt = r(() => o.records ?? []), ke = r(() => {
411
- var i, l;
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
- tableId: o.tableId,
416
- mode: o.mode,
417
- schema: ye,
418
- records: nt,
419
- views: ke,
420
- provider: o.provider,
421
- defaultView: o.defaultView,
422
- initialViewId: o.currentViewId || o.initialViewId || U.activeViewId || ((xe = o.defaultView) == null ? void 0 : xe.viewId) || ((Ke = ke.value[0]) == null ? void 0 : Ke.viewId) || "",
423
- initialSelectedRecordId: o.selectedRecordId ?? o.initialSelectedRecordId,
424
- pageSize: o.pageSize,
425
- autoLoad: o.autoLoad,
48
+ setup(V, { emit: Y }) {
49
+ var q, J;
50
+ const i = V, d = Y, b = rt(i.tableId), $ = o(() => i.schema ?? null), Z = o(() => i.records ?? []), N = o(() => {
51
+ var r, s;
52
+ const e = (i.views ?? []).map((f) => X(f)), t = e.some((f) => f.viewType === "table") || (((r = i.schema) == null ? void 0 : r.views) ?? []).some((f) => f.viewType === "table"), a = e.some((f) => f.viewType === "detail") || (((s = i.schema) == null ? void 0 : s.views) ?? []).some((f) => f.viewType === "detail");
53
+ return t || e.unshift(ct(i.schema, i.records ?? [])), a || e.push(ut(h, i.schema, i.records ?? [])), e;
54
+ }), l = dt({
55
+ tableId: i.tableId,
56
+ mode: i.mode,
57
+ schema: $,
58
+ records: Z,
59
+ views: N,
60
+ provider: i.provider,
61
+ defaultView: i.defaultView,
62
+ initialViewId: i.currentViewId || i.initialViewId || b.activeViewId || ((q = i.defaultView) == null ? void 0 : q.viewId) || ((J = N.value[0]) == null ? void 0 : J.viewId) || "",
63
+ initialSelectedRecordId: i.selectedRecordId ?? i.initialSelectedRecordId,
64
+ pageSize: i.pageSize,
65
+ autoLoad: i.autoLoad,
426
66
  actions: {
427
67
  onCellEdit: async (e) => {
428
68
  var t, a;
429
- u("cell-edit", e), await ((a = (t = o.actions) == null ? void 0 : t.onCellEdit) == null ? void 0 : a.call(t, e));
69
+ d("cell-edit", e), await ((a = (t = i.actions) == null ? void 0 : t.onCellEdit) == null ? void 0 : a.call(t, e));
430
70
  },
431
71
  onSelectRecord: async (e) => {
432
72
  var t, a;
433
- await ((a = (t = o.actions) == null ? void 0 : t.onSelectRecord) == null ? void 0 : a.call(t, e));
73
+ await ((a = (t = i.actions) == null ? void 0 : t.onSelectRecord) == null ? void 0 : a.call(t, e));
434
74
  },
435
75
  onSchemaEvent: async (e) => {
436
76
  var t, a;
437
77
  switch (e.type) {
438
78
  case "schema-add-field":
439
- u("schema-add-field", e.fieldType);
79
+ d("schema-add-field", e.fieldType);
440
80
  break;
441
81
  case "schema-rename-field":
442
- u("schema-rename-field", { fieldId: e.fieldId, newName: e.newName });
82
+ d("schema-rename-field", { fieldId: e.fieldId, newName: e.newName });
443
83
  break;
444
84
  case "schema-change-field-type":
445
- u("schema-change-field-type", { fieldId: e.fieldId, newType: e.newType });
85
+ d("schema-change-field-type", { fieldId: e.fieldId, newType: e.newType });
446
86
  break;
447
87
  case "schema-hide-field":
448
- u("schema-hide-field", e.fieldId);
88
+ d("schema-hide-field", e.fieldId);
449
89
  break;
450
90
  case "schema-delete-field":
451
- u("schema-delete-field", e.fieldId);
91
+ d("schema-delete-field", e.fieldId);
452
92
  break;
453
93
  case "schema-duplicate-field":
454
- u("schema-duplicate-field", e.fieldId);
94
+ d("schema-duplicate-field", e.fieldId);
455
95
  break;
456
96
  }
457
- await ((a = (t = o.actions) == null ? void 0 : t.onSchemaEvent) == null ? void 0 : a.call(t, e));
97
+ await ((a = (t = i.actions) == null ? void 0 : t.onSchemaEvent) == null ? void 0 : a.call(t, e));
458
98
  },
459
99
  onSaveView: async (e) => {
460
100
  var t, a;
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 }));
101
+ d("save-view", e.name), await ((a = (t = i.actions) == null ? void 0 : t.onViewSave) == null ? void 0 : a.call(t, { tableId: i.tableId, viewId: e.viewId, name: e.name }));
462
102
  },
463
103
  onRefresh: async () => {
464
104
  var e, t;
465
- u("refresh"), await ((t = (e = o.actions) == null ? void 0 : e.onRefresh) == null ? void 0 : t.call(e));
105
+ d("refresh"), await ((t = (e = i.actions) == null ? void 0 : e.onRefresh) == null ? void 0 : t.call(e));
466
106
  }
467
107
  }
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(
475
- o.currentViewId === k || o.initialViewId === k || o.selectedRecordId != null || o.initialSelectedRecordId != null
476
- );
477
- F(
478
- () => o.searchKeyword,
108
+ }), v = o(() => l.activeView.value), g = o(() => l.activeViewId.value), D = o(() => l.selectedRecord.value), x = o(() => l.selectedRecordId.value), R = o(() => l.schema.value ?? $.value), y = o(() => [...l.records.value]), w = o(() => v.value.viewType || "table"), F = O("and"), c = O([]);
109
+ m(
110
+ v,
479
111
  (e) => {
480
- e !== void 0 && (D.value = e);
112
+ c.value = wt(e.filters ?? []);
481
113
  },
482
114
  { 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
- });
115
+ );
116
+ const W = o(
117
+ () => ft({
118
+ providedTabs: i.viewTabs,
119
+ viewList: l.viewList.value,
120
+ detailViewId: h
121
+ })
122
+ ), u = nt({
123
+ tableId: T(i, "tableId"),
124
+ activeViewId: g,
125
+ currentViewId: T(i, "currentViewId"),
126
+ selectedRecordId: T(i, "selectedRecordId"),
127
+ selectedRecord: D,
128
+ resolvedSchema: R,
129
+ resolvedRecords: y,
130
+ viewTabs: W,
131
+ detailPresentation: T(i, "detailPresentation"),
132
+ initialSearchKeyword: i.searchKeyword || b.searchKeyword || "",
133
+ initialDetailPresentation: b.detailPresentation ?? null,
134
+ initialSidePanelWidth: b.sidePanelWidth,
135
+ initialDrawerWidth: b.drawerWidth,
136
+ initialWorkspaceActive: i.currentViewId === h || i.initialViewId === h || i.selectedRecordId != null || i.initialSelectedRecordId != null,
137
+ onSelectRecord: (e) => {
138
+ l.setSelectedRecord(e);
495
139
  },
496
- { immediate: !0 }
497
- ), F(
498
- h,
140
+ onClearSelectedRecord: () => {
141
+ l.clearSelectedRecord();
142
+ },
143
+ onSetRecords: (e) => {
144
+ E(e);
145
+ },
146
+ onCellEdit: (e) => {
147
+ H(e);
148
+ },
149
+ onSwitchView: (e) => {
150
+ M(e);
151
+ }
152
+ }), {
153
+ searchKeyword: I,
154
+ sidePanelWidth: _,
155
+ drawerWidth: ee,
156
+ detailWorkspaceRow: te,
157
+ detailWorkspaceTitle: ie,
158
+ detailWorkspaceDescription: ae,
159
+ detailPropertyItems: oe,
160
+ hasDetailDraftChanges: le,
161
+ showDetailWorkspace: A,
162
+ resolvedDetailPresentation: de,
163
+ workspaceModes: re,
164
+ canSwitchDetailPresentation: ne,
165
+ detailEmptyAction: se,
166
+ setPreferredDetailPresentation: ce,
167
+ activateDetailWorkspace: S
168
+ } = u;
169
+ m(
170
+ () => i.searchKeyword,
499
171
  (e) => {
500
- _.value = it(e.filters ?? []);
172
+ e !== void 0 && (I.value = e);
501
173
  },
502
174
  { immediate: !0 }
503
- ), F(
504
- () => o.currentViewId,
175
+ ), m(I, (e) => {
176
+ d("update:searchKeyword", e);
177
+ }), m(
178
+ () => i.currentViewId,
505
179
  (e) => {
506
- !e || e === H.value || (s.setActiveViewId(e), e === k && (y.value = !0));
180
+ !e || e === g.value || (e === h && S(), l.setActiveViewId(e));
507
181
  },
508
182
  { immediate: !0 }
509
- ), F(
510
- () => o.selectedRecordId,
183
+ ), m(
184
+ () => i.selectedRecordId,
511
185
  (e) => {
512
186
  if (e !== void 0) {
513
187
  if (!e) {
514
- y.value = !1, m.value = {}, s.clearSelectedRecord();
188
+ j();
515
189
  return;
516
190
  }
517
- y.value = !0, m.value = {}, s.setSelectedRecord(e);
191
+ S(), l.setSelectedRecord(e);
518
192
  }
519
193
  },
520
194
  { immediate: !0 }
521
- ), F(
522
- H,
195
+ ), m(
196
+ g,
523
197
  (e, t) => {
524
- var a, i;
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) }));
198
+ var a, r;
199
+ d("update:currentViewId", e), e === h && S(), t !== void 0 && e !== t && ((r = (a = i.actions) == null ? void 0 : a.onViewChange) == null || r.call(a, {
200
+ tableId: i.tableId,
201
+ view: X(v.value)
202
+ }));
526
203
  },
527
204
  { immediate: !0 }
528
- ), F(
529
- st,
205
+ ), m(
206
+ x,
530
207
  (e, t) => {
531
- u("update:selectedRecordId", e), t !== void 0 && e !== t && u("select-record", w.value ?? null);
208
+ d("update:selectedRecordId", e), t !== void 0 && e !== t && d("select-record", D.value ?? null);
532
209
  },
533
210
  { immediate: !0 }
534
211
  );
535
- const se = r(() => {
536
- const e = o.viewTabs && o.viewTabs.length > 0 ? o.viewTabs.map((i) => ({ ...i })) : s.viewList.value.map((i) => ({
537
- value: i.id,
538
- label: i.name,
539
- icon: he(i.type)
540
- })), t = [], a = /* @__PURE__ */ new Set();
541
- for (const i of e)
542
- a.has(i.value) || (a.add(i.value), t.push(i));
543
- return a.has(k) || t.push({ value: k, label: "详情", icon: he("detail") }), t;
544
- }), dt = r(
545
- () => s.viewList.value.map((e) => ({
212
+ const ue = o(
213
+ () => l.viewList.value.map((e) => ({
546
214
  id: e.id,
547
215
  name: e.name
548
216
  }))
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(
553
- () => {
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) ?? "记录详情"
557
- ) || "记录详情";
558
- }
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();
567
- return i ? `## ${t.label}
568
-
569
- ${i}` : "";
570
- }).filter((t) => t.length > 0).join(`
571
-
572
- `)), Fe = r(() => Object.keys(m.value).length > 0), ct = r(() => A(S.value, I.value)), Te = r(() => {
217
+ ), U = o(() => vt(v.value, R.value, y.value)), we = o(() => ht(R.value, y.value)), fe = o(() => w.value === "detail" ? "请选择一条记录,详情工作区会在这里打开。" : w.value === "timeline" ? "当前时间线没有可渲染的起止日期。" : "当前视图没有匹配的数据,或者被筛选条件过滤为空。"), z = o(() => {
573
218
  var t;
574
- const e = (t = h.value.sorts) == null ? void 0 : t[0];
219
+ const e = (t = v.value.sorts) == null ? void 0 : t[0];
575
220
  return {
576
221
  field: (e == null ? void 0 : e.fieldId) ?? null,
577
222
  order: (e == null ? void 0 : e.direction) ?? null
578
223
  };
579
- }), vt = r(() => {
224
+ }), ve = o(() => {
580
225
  var e, t;
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();
589
- e = e.filter(
590
- (i) => ct.value.some(
591
- (l) => L(i.fields[l]).toLowerCase().includes(a)
592
- )
593
- );
594
- }
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);
599
- });
600
- return ne.value === "and" ? i.every(Boolean) : i.some(Boolean);
601
- }));
602
- const t = Te.value;
603
- return t.field && t.order && e.sort((a, i) => {
604
- const l = N(
605
- a.fields[t.field],
606
- i.fields[t.field]
607
- );
608
- return t.order === "desc" ? -l : l;
609
- }), e;
610
- }), gt = r(
611
- () => na(W.value, {
612
- startFieldId: p.value === "timeline" ? "startDate" : void 0,
613
- endFieldId: p.value === "timeline" ? "endDate" : void 0,
226
+ return ((t = (e = v.value.groups) == null ? void 0 : e[0]) == null ? void 0 : t.fieldId) ?? void 0;
227
+ }), L = o(() => c.value), he = o(() => L.value.length > 0), me = o(() => i.showToolbar !== !1), pe = o(() => i.showViewSwitch !== !1 && W.value.length > 1), be = o(() => i.showFilter !== !1), ye = o(() => i.showSort !== !1), Ie = o(() => i.showGroup !== !1), Se = o(() => i.showColumns !== !1), Ve = o(() => i.showSearch !== !1), ge = o(() => i.loading ?? l.loading.value), C = o(() => i.error ?? l.error.value), P = o(
228
+ () => mt({
229
+ records: y.value,
230
+ searchKeyword: I.value,
231
+ visibleFieldIds: we.value,
232
+ filterConditions: L.value,
233
+ filterLogic: F.value,
234
+ sort: z.value
235
+ })
236
+ ), Re = o(
237
+ () => st(P.value, {
238
+ startFieldId: w.value === "timeline" ? "startDate" : void 0,
239
+ endFieldId: w.value === "timeline" ? "endDate" : void 0,
614
240
  labelFieldId: "title"
615
241
  })
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(() => {
617
- var a;
618
- if (p.value !== "detail") return;
619
- const e = I.value[0];
620
- if (e)
621
- return {
622
- label: "打开第一条记录",
623
- onClick: () => Q(e)
624
- };
625
- const t = ((a = se.value.find((i) => i.value !== k)) == null ? void 0 : a.value) ?? null;
626
- return rt(t);
627
- });
628
- function ve(e) {
629
- s.setRecords(e), u("update:records", e);
242
+ ), Ce = o(() => ge.value ? "loading" : C.value ? "error" : w.value === "detail" ? A.value ? "normal" : "empty" : w.value === "timeline" ? Re.value.length > 0 ? "normal" : "empty" : P.value.length > 0 ? "normal" : "empty");
243
+ function E(e) {
244
+ l.setRecords(e), d("update:records", e);
630
245
  }
631
- function Q(e) {
632
- e && (y.value = !0, m.value = {}, s.setSelectedRecord(e));
246
+ function M(e) {
247
+ l.viewList.value.some((t) => t.id === e) && (e === h && S(), l.switchView(e));
633
248
  }
634
- function De(e) {
635
- ue.value && (B.value = e);
636
- }
637
- function Ee(e) {
638
- return e ? I.value.find((t) => t.id === e) ?? null : null;
639
- }
640
- function Le(e) {
641
- s.viewList.value.some((t) => t.id === e) && (e === k && (y.value = !0), s.switchView(e));
249
+ function ke(e) {
250
+ M(e);
642
251
  }
643
- function Ct(e) {
644
- Le(e);
645
- }
646
- function Vt(e) {
252
+ function Te(e) {
647
253
  var t, a;
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 }));
254
+ l.viewList.value.some((r) => r.id === e) && (e === h && S(), l.switchView(e), d("load-view", e), (a = (t = i.actions) == null ? void 0 : t.onViewLoad) == null || a.call(t, { tableId: i.tableId, viewId: e }));
649
255
  }
650
- function St(e) {
651
- s.saveView({ name: e });
256
+ function De(e) {
257
+ l.saveView({ name: e });
652
258
  }
653
- function ee() {
654
- s.updateActiveView({
655
- filters: lt(_.value)
259
+ function k() {
260
+ l.updateActiveView({
261
+ filters: bt(c.value)
656
262
  });
657
263
  }
658
- function Ft() {
264
+ function Fe() {
659
265
  var t;
660
- const e = ((t = de.value.find((a) => !a.hidden)) == null ? void 0 : t.key) ?? "";
661
- e && (_.value = [..._.value, at(e)], ee());
266
+ const e = ((t = U.value.find((a) => !a.hidden)) == null ? void 0 : t.key) ?? "";
267
+ e && (c.value = [...c.value, pt(e)], k());
662
268
  }
663
- function Tt(e) {
664
- _.value = _.value.filter((t) => t.id !== e), ee();
269
+ function We(e) {
270
+ c.value = c.value.filter((t) => t.id !== e), k();
665
271
  }
666
- function Rt(e, t) {
667
- _.value = _.value.map(
272
+ function Ae(e, t) {
273
+ c.value = c.value.map(
668
274
  (a) => a.id === e ? { ...a, ...t } : a
669
- ), ee();
275
+ ), k();
670
276
  }
671
- function Dt() {
672
- _.value = [], ee();
277
+ function Ue() {
278
+ c.value = [], k();
673
279
  }
674
- function Et(e) {
675
- ne.value = e, u("update:filterLogic", e);
280
+ function Le(e) {
281
+ F.value = e, d("update:filterLogic", e);
676
282
  }
677
- function Lt(e) {
678
- u("update:columns", e), s.updateActiveView({
283
+ function Pe(e) {
284
+ d("update:columns", e), l.updateActiveView({
679
285
  visibleFields: e.filter((t) => !t.hidden).map((t) => t.key)
680
286
  });
681
287
  }
682
- function At(e) {
683
- var i;
288
+ function Ee(e) {
289
+ var r;
684
290
  if (!e) {
685
- s.updateActiveView({ sorts: [] }), u("sort", e);
291
+ l.updateActiveView({ sorts: [] }), d("sort", e);
686
292
  return;
687
293
  }
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({
294
+ const t = (r = v.value.sorts) == null ? void 0 : r[0], a = (t == null ? void 0 : t.fieldId) === e && t.direction === "asc" ? "desc" : "asc";
295
+ l.updateActiveView({
690
296
  sorts: [{ fieldId: e, direction: a }]
691
- }), u("sort", e);
297
+ }), d("sort", e);
692
298
  }
693
- function Wt(e) {
694
- s.updateActiveView({
299
+ function Be(e) {
300
+ l.updateActiveView({
695
301
  groups: e ? [{ fieldId: e }] : []
696
- }), u("group", e);
302
+ }), d("group", e);
697
303
  }
698
- function Pt(e) {
699
- D.value = e, u("update:searchKeyword", e);
304
+ function Ke(e) {
305
+ I.value = e;
700
306
  }
701
- function P(e) {
702
- s.emitSchemaEvent(e);
307
+ function p(e) {
308
+ l.emitSchemaEvent(e);
703
309
  }
704
- function Nt(e, t, a) {
705
- const i = I.value.map((l) => l.id !== e ? l : {
706
- ...l,
310
+ function Ge(e, t, a) {
311
+ const r = y.value.map((s) => s.id !== e ? s : {
312
+ ...s,
707
313
  fields: {
708
- ...l.fields,
314
+ ...s.fields,
709
315
  [t]: a
710
316
  }
711
317
  });
712
- ve(i);
318
+ E(r);
713
319
  }
714
- function Ae(e) {
715
- Nt(e.rowId, e.fieldId, e.value), s.emitCellEdit(e);
320
+ function H(e) {
321
+ Ge(e.rowId, e.fieldId, e.value), l.emitCellEdit(e);
716
322
  }
717
- function Ut(e) {
323
+ function $e(e) {
718
324
  var t, a;
719
- u("record-change", e), (a = (t = o.actions) == null ? void 0 : t.onRecordChange) == null || a.call(t, { tableId: o.tableId, ...e });
325
+ d("record-change", e), (a = (t = i.actions) == null ? void 0 : t.onRecordChange) == null || a.call(t, { tableId: i.tableId, ...e });
720
326
  }
721
- function Bt(e) {
722
- ve(e);
723
- }
724
- function xt(e) {
725
- Q(e);
726
- }
727
- function Kt(e) {
728
- u("row-click", e);
729
- }
730
- function We(e) {
731
- u("card-click", e), Q(Ee(e.id));
327
+ function Ne(e) {
328
+ E(e);
732
329
  }
733
- function $t(e) {
734
- u("row-click", e), Q(Ee(e.sourceRecordId ?? e.id));
330
+ function ze(e) {
331
+ u.handleRowSelect(e);
735
332
  }
736
- function K() {
737
- y.value = !1, m.value = {}, s.clearSelectedRecord();
333
+ function Me(e) {
334
+ d("row-click", e);
738
335
  }
739
- function zt(e) {
740
- for (const [t, a] of Object.entries(e.fields))
741
- Ae({ rowId: e.rowId, fieldId: t, value: a });
742
- m.value = {}, K();
336
+ function He(e) {
337
+ if (w.value === "timeline") {
338
+ qe(e);
339
+ return;
340
+ }
341
+ Me(e);
743
342
  }
744
- function Pe(e) {
745
- const t = I.value.filter((a) => a.id !== e);
746
- ve(t), y.value = !1, m.value = {}, s.clearSelectedRecord();
343
+ function je(e) {
344
+ d("card-click", e), u.handleCardClick(e);
747
345
  }
748
- function Ne(e) {
749
- return J.value.find((t) => t.id === e) ?? {
750
- id: e,
751
- type: "text",
752
- label: e
753
- };
346
+ function qe(e) {
347
+ d("row-click", e), u.handleTimelineRowClick(e);
754
348
  }
755
- function $(e) {
756
- return Object.prototype.hasOwnProperty.call(m.value, e) ? m.value[e] : Ie.value[e];
349
+ function j() {
350
+ u.handleDetailClose();
757
351
  }
758
- function Ue(e, t, a) {
759
- m.value = {
760
- ...m.value,
761
- [t]: a
762
- };
352
+ function Je(e) {
353
+ u.handleDetailDelete(e);
763
354
  }
764
- function Be() {
765
- w.value && zt({
766
- rowId: w.value.id,
767
- fields: { ...m.value }
768
- });
355
+ function Oe(e, t, a) {
356
+ u.handleDetailWorkspaceCommit(e, t, a);
769
357
  }
770
- function Ot(e) {
771
- oe.value = j(e, we);
358
+ function Qe() {
359
+ u.handleDetailWorkspaceSave();
772
360
  }
773
- function qt(e) {
774
- re.value = j(e, pe);
361
+ function Xe(e) {
362
+ u.handleSidePanelWidthUpdate(e);
775
363
  }
776
- return (e, t) => {
777
- var a;
778
- return d(), v("section", Mt({
779
- class: "of-database-view",
780
- "data-role": "database-view"
781
- }, e.$attrs), [
782
- ce.value === "loading" ? (d(), v("div", sa, [
783
- O(fe(Xt), {
784
- class: "of-database-view__spinner",
785
- size: 20
786
- }),
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" }, "请稍候,页面级编排器正在准备当前视图。")
790
- ], -1))
791
- ])) : ce.value === "error" ? (d(), v("div", da, [
792
- O(ze, {
793
- icon: fe(Yt),
794
- title: "数据视图加载失败",
795
- description: Z.value instanceof Error ? Z.value.message : String(Z.value)
796
- }, null, 8, ["icon", "description"])
797
- ])) : (d(), v(q, { key: 2 }, [
798
- wt.value ? (d(), V(ta, {
364
+ function Ye(e) {
365
+ u.handleDrawerWidthUpdate(e);
366
+ }
367
+ return (e, t) => (B(), K(ot, xe({
368
+ state: Ce.value,
369
+ "loading-title": yt,
370
+ "loading-description": It,
371
+ "error-title": St,
372
+ "error-description": C.value instanceof Error ? C.value.message : String(C.value),
373
+ "error-icon": n(tt),
374
+ "empty-icon": n(et),
375
+ "empty-title": Vt,
376
+ "empty-description": fe.value,
377
+ "empty-action": n(se)
378
+ }, e.$attrs), {
379
+ toolbar: G(() => [
380
+ me.value ? (B(), K(lt, {
381
+ key: 0,
382
+ "current-view": g.value,
383
+ "view-tabs": W.value,
384
+ columns: U.value,
385
+ "filter-conditions": L.value,
386
+ "filter-logic": F.value,
387
+ "filter-active": he.value,
388
+ "current-sort": z.value,
389
+ "current-group": ve.value,
390
+ "search-keyword": n(I),
391
+ "show-view-switch": pe.value,
392
+ "show-filter": be.value,
393
+ "show-sort": ye.value,
394
+ "show-group": Ie.value,
395
+ "show-columns": Se.value,
396
+ "show-search": Ve.value,
397
+ "saved-views": ue.value,
398
+ "onUpdate:currentView": ke,
399
+ "onUpdate:columns": Pe,
400
+ "onUpdate:searchKeyword": Ke,
401
+ onAddFilter: Fe,
402
+ onRemoveFilter: We,
403
+ onUpdateFilter: Ae,
404
+ onClearFilters: Ue,
405
+ "onUpdate:filterLogic": Le,
406
+ onSort: Ee,
407
+ onGroup: Be,
408
+ onSaveView: De,
409
+ onLoadView: Te
410
+ }, 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"])) : Q("", !0)
411
+ ]),
412
+ content: G(() => {
413
+ var a;
414
+ return [
415
+ _e(at, {
416
+ "view-type": w.value,
417
+ records: P.value,
418
+ schema: R.value,
419
+ view: v.value,
420
+ columns: U.value,
421
+ readonly: V.readonly,
422
+ "enable-field-management": ((a = V.ui) == null ? void 0 : a.enableFieldManagement) ?? !1,
423
+ onCellEdit: H,
424
+ onSchemaAddField: t[0] || (t[0] = (r) => p({ type: "schema-add-field", fieldType: r })),
425
+ onSchemaRenameField: t[1] || (t[1] = ({ fieldId: r, newName: s }) => p({ type: "schema-rename-field", fieldId: r, newName: s })),
426
+ onSchemaChangeFieldType: t[2] || (t[2] = ({ fieldId: r, newType: s }) => p({ type: "schema-change-field-type", fieldId: r, newType: s })),
427
+ onSchemaHideField: t[3] || (t[3] = (r) => p({ type: "schema-hide-field", fieldId: r })),
428
+ onSchemaDeleteField: t[4] || (t[4] = (r) => p({ type: "schema-delete-field", fieldId: r })),
429
+ onSchemaDuplicateField: t[5] || (t[5] = (r) => p({ type: "schema-duplicate-field", fieldId: r })),
430
+ onRowClick: He,
431
+ onRowClickRecord: ze,
432
+ onCardClick: je,
433
+ onAdd: t[6] || (t[6] = (r) => d("add")),
434
+ onAddColumn: t[7] || (t[7] = (r) => d("add-column")),
435
+ onRecordChange: $e,
436
+ "onUpdate:records": Ne
437
+ }, null, 8, ["view-type", "records", "schema", "view", "columns", "readonly", "enable-field-management"])
438
+ ];
439
+ }),
440
+ detail: G(() => {
441
+ var a;
442
+ return [
443
+ n(A) ? (B(), K(it, {
799
444
  key: 0,
800
- class: "of-database-view__toolbar",
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),
833
- title: "暂无记录",
834
- description: p.value === "detail" ? "请选择一条记录,详情工作区会在这里打开。" : p.value === "timeline" ? "当前时间线没有可渲染的起止日期。" : "当前视图没有匹配的数据,或者被筛选条件过滤为空。",
835
- action: It.value
836
- }, null, 8, ["icon", "description", "action"])
837
- ])) : (d(), v("div", {
838
- key: 2,
839
- class: "of-database-view__content",
840
- "data-view": p.value
841
- }, [
842
- p.value === "table" ? (d(), V(aa, {
843
- key: 0,
844
- class: "of-database-view__view of-database-view__view--table",
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, {
861
- key: 1,
862
- class: "of-database-view__view of-database-view__view--kanban",
863
- records: W.value,
864
- schema: S.value ?? void 0,
865
- view: h.value,
866
- onCardClick: We,
867
- "onUpdate:columns": t[6] || (t[6] = () => {
868
- }),
869
- onAddColumn: t[7] || (t[7] = () => u("add-column"))
870
- }, null, 8, ["records", "schema", "view"])) : p.value === "gallery" ? (d(), V(la, {
871
- key: 2,
872
- class: "of-database-view__view of-database-view__view--gallery",
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, {
879
- key: 3,
880
- class: "of-database-view__view of-database-view__view--timeline",
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))
889
- ], 64)),
890
- x.value && E.value === "side-panel" ? (d(), V(ea, {
891
- key: 3,
892
- "model-value": x.value,
893
- title: X.value,
894
- width: oe.value,
895
- resizable: !0,
896
- mode: "persistent",
897
- "onUpdate:width": Ot,
898
- "onUpdate:modelValue": K
899
- }, {
900
- default: T(() => [
901
- O(qe, {
902
- title: X.value,
903
- comments: [],
904
- "description-content": Se.value,
905
- "description-editable": !1
906
- }, {
907
- meta: T(() => {
908
- var i;
909
- return [
910
- ue.value ? (d(), v("div", fa, [
911
- (d(!0), v(q, null, ae(Re.value, (l) => (d(), v("button", {
912
- key: l.value,
913
- type: "button",
914
- class: $e(["of-database-view__workspace-mode-btn", { "of-database-view__workspace-mode-btn--active": E.value === l.value }]),
915
- "data-mode": l.value,
916
- onClick: (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)
922
- ];
923
- }),
924
- props: T(() => {
925
- var i;
926
- return [
927
- c("div", {
928
- class: "of-database-view__detail-workspace",
929
- "data-record-id": ((i = w.value) == null ? void 0 : i.id) ?? ""
930
- }, [
931
- c("section", _a, [
932
- (d(!0), v(q, null, ae(Ve.value, (l) => (d(), v("div", {
933
- key: l.key,
934
- class: "of-database-view__detail-workspace-field"
935
- }, [
936
- c("span", ya, b(l.label), 1),
937
- c("div", ka, [
938
- J.value.length > 0 ? (d(), V(Oe, {
939
- key: 0,
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))
946
- ])
947
- ]))), 128))
948
- ])
949
- ], 8, ha)
950
- ];
951
- }),
952
- footer: T(() => [
953
- c("button", {
954
- class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--delete",
955
- type: "button",
956
- onClick: t[9] || (t[9] = (i) => {
957
- var l;
958
- return Pe(((l = w.value) == null ? void 0 : l.id) ?? M.value.id);
959
- })
960
- }, " 删除 "),
961
- t[12] || (t[12] = c("div", { class: "of-database-view__detail-workspace-footer-spacer" }, null, -1)),
962
- c("button", {
963
- class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--cancel",
964
- type: "button",
965
- onClick: K
966
- }, " 取消 "),
967
- c("button", {
968
- class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--save",
969
- type: "button",
970
- disabled: R.readonly || !Fe.value,
971
- onClick: Be
972
- }, " 保存 ", 8, Ia)
973
- ]),
974
- _: 1
975
- }, 8, ["title", "description-content"])
976
- ]),
977
- _: 1
978
- }, 8, ["model-value", "title", "width"])) : x.value ? (d(), V(Qt, {
979
- key: 4,
980
- "model-value": x.value,
981
- title: X.value,
982
- width: re.value,
983
- resizable: E.value !== "full-page",
984
- fullscreen: E.value === "full-page",
985
- "mask-closable": !0,
986
- "onUpdate:width": qt,
987
- "onUpdate:modelValue": K
988
- }, {
989
- default: T(() => [
990
- O(qe, {
991
- title: X.value,
992
- comments: [],
993
- "description-content": Se.value,
994
- "description-editable": !1
995
- }, {
996
- meta: T(() => {
997
- var i;
998
- return [
999
- ue.value ? (d(), v("div", Ca, [
1000
- (d(!0), v(q, null, ae(Re.value, (l) => (d(), v("button", {
1001
- key: l.value,
1002
- type: "button",
1003
- class: $e(["of-database-view__workspace-mode-btn", { "of-database-view__workspace-mode-btn--active": E.value === l.value }]),
1004
- "data-mode": l.value,
1005
- onClick: (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)
1011
- ];
1012
- }),
1013
- props: T(() => {
1014
- var i;
1015
- return [
1016
- c("div", {
1017
- class: "of-database-view__detail-workspace",
1018
- "data-record-id": ((i = w.value) == null ? void 0 : i.id) ?? ""
1019
- }, [
1020
- c("section", Da, [
1021
- (d(!0), v(q, null, ae(Ve.value, (l) => (d(), v("div", {
1022
- key: l.key,
1023
- class: "of-database-view__detail-workspace-field"
1024
- }, [
1025
- c("span", Ea, b(l.label), 1),
1026
- c("div", La, [
1027
- J.value.length > 0 ? (d(), V(Oe, {
1028
- key: 0,
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))
1035
- ])
1036
- ]))), 128))
1037
- ])
1038
- ], 8, Ra)
1039
- ];
1040
- }),
1041
- footer: T(() => [
1042
- c("button", {
1043
- class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--delete",
1044
- type: "button",
1045
- onClick: t[10] || (t[10] = (i) => {
1046
- var l;
1047
- return Pe(((l = w.value) == null ? void 0 : l.id) ?? M.value.id);
1048
- })
1049
- }, " 删除 "),
1050
- t[13] || (t[13] = c("div", { class: "of-database-view__detail-workspace-footer-spacer" }, null, -1)),
1051
- c("button", {
1052
- class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--cancel",
1053
- type: "button",
1054
- onClick: K
1055
- }, " 取消 "),
1056
- c("button", {
1057
- class: "of-database-view__detail-workspace-btn of-database-view__detail-workspace-btn--save",
1058
- type: "button",
1059
- disabled: R.readonly || !Fe.value,
1060
- onClick: Be
1061
- }, " 保存 ", 8, Wa)
1062
- ]),
1063
- _: 1
1064
- }, 8, ["title", "description-content"])
1065
- ]),
1066
- _: 1
1067
- }, 8, ["model-value", "title", "width", "resizable", "fullscreen"])) : te("", !0)
1068
- ], 16);
1069
- };
445
+ visible: n(A),
446
+ title: n(ie),
447
+ "row-id": n(te).id,
448
+ "record-id": ((a = D.value) == null ? void 0 : a.id) ?? "",
449
+ "view-type": w.value,
450
+ description: n(ae),
451
+ presentation: n(de),
452
+ "side-panel-width": n(_),
453
+ "drawer-width": n(ee),
454
+ "can-switch-presentation": n(ne),
455
+ "workspace-modes": n(re),
456
+ "property-items": n(oe),
457
+ readonly: V.readonly,
458
+ "has-draft-changes": n(le),
459
+ onCommit: Oe,
460
+ onSave: Qe,
461
+ onDelete: Je,
462
+ onClose: j,
463
+ "onUpdate:sidePanelWidth": Xe,
464
+ "onUpdate:drawerWidth": Ye,
465
+ "onUpdate:presentation": n(ce)
466
+ }, null, 8, ["visible", "title", "row-id", "record-id", "view-type", "description", "presentation", "side-panel-width", "drawer-width", "can-switch-presentation", "workspace-modes", "property-items", "readonly", "has-draft-changes", "onUpdate:presentation"])) : Q("", !0)
467
+ ];
468
+ }),
469
+ _: 1
470
+ }, 16, ["state", "error-description", "error-icon", "empty-icon", "empty-description", "empty-action"]));
1070
471
  }
1071
472
  });
1072
473
  export {
1073
- Qa as default
474
+ Pt as default
1074
475
  };