@oneflowui/ui 0.4.3 → 0.4.4

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 (149) hide show
  1. package/dist/assets/tableWorker-CTsbCPPP.js +1 -0
  2. package/dist/components/ContextMenu/index.vue.d.ts +2 -1
  3. package/dist/components/ContextMenu/index.vue.js +2 -2
  4. package/dist/components/ContextMenu/index.vue2.js +37 -36
  5. package/dist/components/base/DropdownMenu.vue.js +2 -2
  6. package/dist/components/base/DropdownMenu.vue2.js +38 -39
  7. package/dist/components/base/MonitorItem.vue.d.ts +1 -1
  8. package/dist/components/base/PersonaCard.vue.d.ts +2 -1
  9. package/dist/components/base/PersonaCard.vue.js +3 -3
  10. package/dist/components/base/PersonaCard.vue2.js +51 -39
  11. package/dist/components/base/RefTag.vue.d.ts +2 -2
  12. package/dist/components/base/RefTag.vue.js +3 -3
  13. package/dist/components/base/SearchHighlight.vue.d.ts +6 -0
  14. package/dist/components/base/SearchHighlight.vue.js +7 -0
  15. package/dist/components/base/SearchHighlight.vue2.js +21 -0
  16. package/dist/components/base/ToolbarBtn.vue.d.ts +2 -1
  17. package/dist/components/base/ToolbarBtn.vue.js +1 -1
  18. package/dist/components/base/ViewModeGroup.vue.d.ts +2 -1
  19. package/dist/components/base/ViewModeGroup.vue.js +3 -3
  20. package/dist/components/base/ViewSwitcher.vue.d.ts +2 -1
  21. package/dist/components/base/ViewSwitcher.vue.js +2 -2
  22. package/dist/components/base/index.d.ts +1 -0
  23. package/dist/components/field/FieldAttachment.vue.d.ts +17 -0
  24. package/dist/components/field/FieldAttachment.vue.js +7 -0
  25. package/dist/components/field/FieldAttachment.vue2.js +69 -0
  26. package/dist/components/field/FieldAutoNumber.vue.d.ts +7 -0
  27. package/dist/components/field/FieldAutoNumber.vue.js +7 -0
  28. package/dist/components/field/FieldAutoNumber.vue2.js +15 -0
  29. package/dist/components/field/FieldCreator.vue.d.ts +7 -0
  30. package/dist/components/field/FieldCreator.vue.js +7 -0
  31. package/dist/components/field/FieldCreator.vue2.js +24 -0
  32. package/dist/components/field/FieldCurrency.vue.d.ts +17 -0
  33. package/dist/components/field/FieldCurrency.vue.js +7 -0
  34. package/dist/components/field/FieldCurrency.vue2.js +42 -0
  35. package/dist/components/field/FieldDate.vue.js +2 -2
  36. package/dist/components/field/FieldDate.vue2.js +13 -10
  37. package/dist/components/field/FieldDatetime.vue.js +1 -1
  38. package/dist/components/field/FieldMarkdownPreview.vue.d.ts +13 -0
  39. package/dist/components/field/FieldMarkdownPreview.vue.js +7 -0
  40. package/dist/components/field/FieldMarkdownPreview.vue2.js +37 -0
  41. package/dist/components/field/FieldMultiSelect.vue.js +2 -2
  42. package/dist/components/field/FieldPhone.vue.d.ts +17 -0
  43. package/dist/components/field/FieldPhone.vue.js +7 -0
  44. package/dist/components/field/FieldPhone.vue2.js +34 -0
  45. package/dist/components/field/FieldProgress.vue.d.ts +15 -0
  46. package/dist/components/field/FieldProgress.vue.js +7 -0
  47. package/dist/components/field/FieldProgress.vue2.js +40 -0
  48. package/dist/components/field/FieldRelation.vue.d.ts +17 -0
  49. package/dist/components/field/FieldRelation.vue.js +7 -0
  50. package/dist/components/field/FieldRelation.vue2.js +67 -0
  51. package/dist/components/field/FieldRichText.vue.d.ts +17 -0
  52. package/dist/components/field/FieldRichText.vue.js +7 -0
  53. package/dist/components/field/FieldRichText.vue2.js +65 -0
  54. package/dist/components/field/FieldSelect.vue.js +1 -1
  55. package/dist/components/field/FieldSelect.vue2.js +43 -42
  56. package/dist/components/form/FormDesigner.vue.js +2 -2
  57. package/dist/components/form/FormDesigner.vue2.js +62 -52
  58. package/dist/components/gallery/GalleryCard.vue.js +2 -2
  59. package/dist/components/gallery/GalleryView.vue.d.ts +6 -2
  60. package/dist/components/gallery/GalleryView.vue.js +2 -2
  61. package/dist/components/gallery/GalleryView.vue2.js +30 -20
  62. package/dist/components/kanban/KanbanBoard.vue.d.ts +5 -1
  63. package/dist/components/kanban/KanbanBoard.vue.js +4 -4
  64. package/dist/components/kanban/KanbanBoard.vue2.js +81 -48
  65. package/dist/components/layout/AppLayout.vue.js +2 -2
  66. package/dist/components/layout/AppLayout.vue2.js +46 -62
  67. package/dist/components/overlay/Drawer.vue.js +1 -1
  68. package/dist/components/overlay/Drawer.vue2.js +52 -68
  69. package/dist/components/overlay/Modal.vue.js +1 -1
  70. package/dist/components/overlay/Modal.vue2.js +52 -68
  71. package/dist/components/overlay/SidePanel.vue.js +2 -2
  72. package/dist/components/overlay/SidePanel.vue2.js +64 -80
  73. package/dist/components/table/ColumnHeaderMenu.vue.d.ts +33 -0
  74. package/dist/components/table/ColumnHeaderMenu.vue.js +7 -0
  75. package/dist/components/table/ColumnHeaderMenu.vue2.js +153 -0
  76. package/dist/components/table/DataTable.vue.d.ts +116 -25
  77. package/dist/components/table/DataTable.vue.js +4 -4
  78. package/dist/components/table/DataTable.vue2.js +775 -188
  79. package/dist/components/table/DetailSheet.vue.d.ts +43 -0
  80. package/dist/components/table/DetailSheet.vue.js +7 -0
  81. package/dist/components/table/DetailSheet.vue2.js +140 -0
  82. package/dist/components/table/FieldCell.vue.d.ts +1 -1
  83. package/dist/components/table/FieldCell.vue.js +1 -1
  84. package/dist/components/table/FieldCell.vue2.js +59 -44
  85. package/dist/components/table/FieldTypePicker.vue.d.ts +15 -0
  86. package/dist/components/table/FieldTypePicker.vue.js +7 -0
  87. package/dist/components/table/FieldTypePicker.vue2.js +92 -0
  88. package/dist/components/table/MobileListView.vue.d.ts +24 -0
  89. package/dist/components/table/MobileListView.vue.js +7 -0
  90. package/dist/components/table/MobileListView.vue2.js +90 -0
  91. package/dist/components/table/TableGroupRow.vue.d.ts +5 -0
  92. package/dist/components/table/TableGroupRow.vue.js +2 -2
  93. package/dist/components/table/TableGroupRow.vue2.js +33 -23
  94. package/dist/components/table/TableHeaderRow.vue.d.ts +16 -0
  95. package/dist/components/table/TableHeaderRow.vue.js +2 -2
  96. package/dist/components/table/TableHeaderRow.vue2.js +54 -33
  97. package/dist/components/table/TableToolbar.vue.d.ts +118 -0
  98. package/dist/components/table/TableToolbar.vue.js +7 -0
  99. package/dist/components/table/TableToolbar.vue2.js +273 -0
  100. package/dist/components/table/index.d.ts +5 -0
  101. package/dist/components/timeline/GanttTimeline.vue.js +1 -1
  102. package/dist/components/timeline/GanttTimeline.vue2.js +128 -127
  103. package/dist/components/toast/ToastItem.vue.js +3 -3
  104. package/dist/composables/index.d.ts +19 -0
  105. package/dist/composables/useBreakpoint.d.ts +2 -1
  106. package/dist/composables/useBreakpoint.js +14 -12
  107. package/dist/composables/useColumnResize.d.ts +19 -0
  108. package/dist/composables/useColumnResize.js +58 -0
  109. package/dist/composables/useDraftRows.d.ts +33 -0
  110. package/dist/composables/useDraftRows.js +103 -0
  111. package/dist/composables/useFixedColumns.d.ts +25 -0
  112. package/dist/composables/useFixedColumns.js +61 -0
  113. package/dist/composables/useFocusTrap.d.ts +10 -0
  114. package/dist/composables/useFocusTrap.js +37 -0
  115. package/dist/composables/useInlineEdit.js +3 -3
  116. package/dist/composables/useKeyboardNavigation.d.ts +45 -0
  117. package/dist/composables/useKeyboardNavigation.js +140 -0
  118. package/dist/composables/useRowDrag.d.ts +32 -0
  119. package/dist/composables/useRowDrag.js +85 -0
  120. package/dist/composables/useSchemaEngine.d.ts +31 -0
  121. package/dist/composables/useSchemaEngine.js +129 -0
  122. package/dist/composables/useSearch.d.ts +30 -0
  123. package/dist/composables/useSearch.js +59 -0
  124. package/dist/composables/useSupabaseProvider.d.ts +70 -0
  125. package/dist/composables/useSupabaseProvider.js +126 -0
  126. package/dist/composables/useTable.d.ts +3 -0
  127. package/dist/composables/useTable.js +103 -83
  128. package/dist/composables/useTableGroup.d.ts +14 -1
  129. package/dist/composables/useTableGroup.js +57 -33
  130. package/dist/composables/useViewPersistence.d.ts +98 -0
  131. package/dist/composables/useViewPersistence.js +141 -0
  132. package/dist/composables/useVirtualList.d.ts +4 -1
  133. package/dist/composables/useVirtualList.js +108 -85
  134. package/dist/composables/useWorkerSort.d.ts +14 -0
  135. package/dist/composables/useWorkerSort.js +61 -0
  136. package/dist/index.d.ts +28 -4
  137. package/dist/index.js +264 -216
  138. package/dist/style.css +1 -1
  139. package/dist/types/index.d.ts +63 -2
  140. package/dist/types/index.js +23 -6
  141. package/dist/types/table-internal.d.ts +64 -0
  142. package/dist/utils/aggregation.d.ts +5 -0
  143. package/dist/utils/aggregation.js +38 -0
  144. package/dist/utils/supabaseAdapter.d.ts +48 -0
  145. package/dist/utils/supabaseAdapter.js +76 -0
  146. package/dist/utils/supabaseSchema.d.ts +81 -0
  147. package/dist/utils/supabaseSchema.js +202 -0
  148. package/dist/workers/tableWorker.d.ts +31 -0
  149. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
- import { defineComponent as m, computed as n, openBlock as o, createElementBlock as l, createCommentVNode as c, createElementVNode as u, normalizeClass as _, normalizeStyle as p, createTextVNode as f, toDisplayString as r } from "vue";
2
- import { resolveBadge as y } from "../../composables/useBadge.js";
3
- const v = {
1
+ import { defineComponent as w, computed as u, openBlock as l, createElementBlock as a, normalizeStyle as p, createCommentVNode as g, createElementVNode as d, normalizeClass as k, createTextVNode as x, toDisplayString as n, Fragment as h, renderList as B } from "vue";
2
+ import { resolveBadge as C } from "../../composables/useBadge.js";
3
+ const N = {
4
4
  key: 0,
5
5
  class: "of-table-group-row__checkbox-spacer"
6
- }, w = {
6
+ }, K = {
7
7
  key: 2,
8
8
  class: "of-table-group-row__label"
9
- }, k = { class: "of-table-group-row__count" }, C = /* @__PURE__ */ m({
9
+ }, L = { class: "of-table-group-row__count" }, T = /* @__PURE__ */ w({
10
10
  name: "TableGroupRow",
11
11
  __name: "TableGroupRow",
12
12
  props: {
@@ -14,35 +14,45 @@ const v = {
14
14
  count: {},
15
15
  collapsed: { type: Boolean, default: !1 },
16
16
  colorMap: {},
17
- selectable: { type: Boolean, default: !0 }
17
+ selectable: { type: Boolean, default: !0 },
18
+ level: { default: 0 },
19
+ aggregations: {}
18
20
  },
19
21
  emits: ["toggle"],
20
- setup(t, { emit: d }) {
21
- const a = t, g = d, e = n(() => a.colorMap ? y(a.groupKey, a.colorMap) : null), b = n(() => a.groupKey || "(空)");
22
- return (i, s) => (o(), l("div", {
22
+ setup(s, { emit: i }) {
23
+ const o = s, m = i, r = u(() => o.colorMap ? C(o.groupKey, o.colorMap) : null), b = u(() => o.groupKey || "(空)"), f = u(() => o.level * 16), _ = u(() => o.aggregations ? Object.entries(o.aggregations).map(([c, t]) => {
24
+ const [, e] = c.split(":"), y = e === "sum" ? "总计" : e === "avg" ? "平均" : e === "min" ? "最小" : e === "max" ? "最大" : "计数", v = typeof t == "number" && !Number.isInteger(t) ? t.toFixed(2) : String(t);
25
+ return { key: c, label: y, value: v };
26
+ }) : []);
27
+ return (c, t) => (l(), a("div", {
23
28
  class: "of-table-group-row",
24
- onClick: s[0] || (s[0] = (h) => g("toggle"))
29
+ onClick: t[0] || (t[0] = (e) => m("toggle")),
30
+ style: p({ paddingLeft: `${12 + f.value}px` })
25
31
  }, [
26
- t.selectable ? (o(), l("div", v)) : c("", !0),
27
- u("span", {
28
- class: _(["of-table-group-row__chevron", { "of-table-group-row__chevron--collapsed": t.collapsed }])
32
+ s.selectable ? (l(), a("div", N)) : g("", !0),
33
+ d("span", {
34
+ class: k(["of-table-group-row__chevron", { "of-table-group-row__chevron--collapsed": s.collapsed }])
29
35
  }, "▼", 2),
30
- e.value ? (o(), l("span", {
36
+ r.value ? (l(), a("span", {
31
37
  key: 1,
32
38
  class: "of-table-group-row__badge",
33
- style: p(e.value.style)
39
+ style: p(r.value.style)
34
40
  }, [
35
- e.value.dot ? (o(), l("span", {
41
+ r.value.dot ? (l(), a("span", {
36
42
  key: 0,
37
43
  class: "of-table-group-row__badge-dot",
38
- style: p({ background: e.value.dot })
39
- }, null, 4)) : c("", !0),
40
- f(" " + r(e.value.label), 1)
41
- ], 4)) : (o(), l("span", w, r(b.value), 1)),
42
- u("span", k, "(" + r(t.count) + ")", 1)
43
- ]));
44
+ style: p({ background: r.value.dot })
45
+ }, null, 4)) : g("", !0),
46
+ x(" " + n(r.value.label), 1)
47
+ ], 4)) : (l(), a("span", K, n(b.value), 1)),
48
+ d("span", L, "(" + n(s.count) + ")", 1),
49
+ (l(!0), a(h, null, B(_.value, (e) => (l(), a("span", {
50
+ key: e.key,
51
+ class: "of-table-group-row__agg"
52
+ }, n(e.label) + ": " + n(e.value), 1))), 128))
53
+ ], 4));
44
54
  }
45
55
  });
46
56
  export {
47
- C as default
57
+ T as default
48
58
  };
@@ -6,18 +6,34 @@ type __VLS_Props = {
6
6
  sortOrder?: "asc" | "desc";
7
7
  allSelected?: boolean;
8
8
  indeterminate?: boolean;
9
+ enableResize?: boolean;
10
+ enableFieldMenu?: boolean;
11
+ enableAddField?: boolean;
9
12
  };
10
13
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
11
14
  sort: (key: string) => any;
12
15
  "select-all": () => any;
16
+ "resize-start": (event: MouseEvent, colKey: string) => any;
17
+ "resize-dblclick": (colKey: string) => any;
18
+ "header-contextmenu": (event: MouseEvent, colKey: string) => any;
19
+ "header-dblclick": (colKey: string) => any;
20
+ "add-field": () => any;
13
21
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
14
22
  onSort?: ((key: string) => any) | undefined;
15
23
  "onSelect-all"?: (() => any) | undefined;
24
+ "onResize-start"?: ((event: MouseEvent, colKey: string) => any) | undefined;
25
+ "onResize-dblclick"?: ((colKey: string) => any) | undefined;
26
+ "onHeader-contextmenu"?: ((event: MouseEvent, colKey: string) => any) | undefined;
27
+ "onHeader-dblclick"?: ((colKey: string) => any) | undefined;
28
+ "onAdd-field"?: (() => any) | undefined;
16
29
  }>, {
17
30
  selectable: boolean;
18
31
  sortKey: string;
19
32
  sortOrder: "asc" | "desc";
20
33
  allSelected: boolean;
21
34
  indeterminate: boolean;
35
+ enableResize: boolean;
36
+ enableFieldMenu: boolean;
37
+ enableAddField: boolean;
22
38
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
23
39
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import o from "./TableHeaderRow.vue2.js";
2
2
  /* empty css */
3
3
  import a from "../../_virtual/_plugin-vue_export-helper.js";
4
- const f = /* @__PURE__ */ a(o, [["__scopeId", "data-v-5f75e88a"]]);
4
+ const m = /* @__PURE__ */ a(o, [["__scopeId", "data-v-1a914c68"]]);
5
5
  export {
6
- f as default
6
+ m as default
7
7
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as u, openBlock as n, createElementBlock as a, createElementVNode as l, createCommentVNode as y, Fragment as k, renderList as b, normalizeStyle as v, normalizeClass as x, toDisplayString as C, createBlock as r, unref as i } from "vue";
2
- import { ChevronUp as S, ChevronDown as d } from "lucide-vue-next";
3
- const w = { class: "of-table-header" }, B = {
1
+ import { defineComponent as v, openBlock as o, createElementBlock as i, createElementVNode as c, createCommentVNode as f, Fragment as x, renderList as z, withModifiers as d, normalizeStyle as C, normalizeClass as w, toDisplayString as B, createBlock as u, unref as r, createVNode as S } from "vue";
2
+ import { ChevronUp as $, ChevronDown as k, Plus as g } from "lucide-vue-next";
3
+ const D = { class: "of-table-header" }, F = {
4
4
  key: 0,
5
5
  class: "of-th of-th-checkbox"
6
- }, g = ["checked", "indeterminate"], z = ["aria-sort", "onClick"], K = { class: "of-th-label" }, $ = { class: "of-th-sort-icon" }, N = /* @__PURE__ */ u({
6
+ }, M = ["checked", "indeterminate"], K = ["aria-sort", "onClick", "onContextmenu", "onDblclick"], O = { class: "of-th-label" }, R = { class: "of-th-sort-icon" }, N = ["onMousedown", "onDblclick"], E = /* @__PURE__ */ v({
7
7
  __name: "TableHeaderRow",
8
8
  props: {
9
9
  columns: {},
@@ -11,59 +11,80 @@ const w = { class: "of-table-header" }, B = {
11
11
  sortKey: { default: "" },
12
12
  sortOrder: { default: "asc" },
13
13
  allSelected: { type: Boolean, default: !1 },
14
- indeterminate: { type: Boolean, default: !1 }
14
+ indeterminate: { type: Boolean, default: !1 },
15
+ enableResize: { type: Boolean, default: !1 },
16
+ enableFieldMenu: { type: Boolean, default: !1 },
17
+ enableAddField: { type: Boolean, default: !1 }
15
18
  },
16
- emits: ["sort", "select-all"],
17
- setup(e, { emit: f }) {
18
- const c = f;
19
- function h(o) {
20
- if (o.width === "fill") {
21
- const s = `${o.minWidth ?? 220}px`;
22
- return { flex: `1 1 ${s}`, minWidth: s };
19
+ emits: ["sort", "select-all", "resize-start", "resize-dblclick", "header-contextmenu", "header-dblclick", "add-field"],
20
+ setup(e, { emit: h }) {
21
+ const s = h;
22
+ function y(n) {
23
+ if (n.width === "fill") {
24
+ const l = `${n.minWidth ?? 220}px`;
25
+ return { flex: `1 1 ${l}`, minWidth: l };
23
26
  }
24
- return { width: `${o.width}px`, flexShrink: "0", flexGrow: "0" };
27
+ return { width: `${n.width}px`, flexShrink: "0", flexGrow: "0" };
25
28
  }
26
- function m(o) {
27
- c("sort", o);
29
+ function m(n) {
30
+ s("sort", n);
28
31
  }
29
- return (o, s) => (n(), a("div", w, [
30
- e.selectable ? (n(), a("div", B, [
31
- l("input", {
32
+ function b(n, l) {
33
+ n.stopPropagation(), s("resize-start", n, l);
34
+ }
35
+ return (n, l) => (o(), i("div", D, [
36
+ e.selectable ? (o(), i("div", F, [
37
+ c("input", {
32
38
  type: "checkbox",
33
39
  class: "of-checkbox",
34
40
  checked: e.allSelected,
35
41
  indeterminate: e.indeterminate,
36
- onChange: s[0] || (s[0] = (t) => c("select-all"))
37
- }, null, 40, g)
38
- ])) : y("", !0),
39
- (n(!0), a(k, null, b(e.columns, (t) => (n(), a("div", {
42
+ onChange: l[0] || (l[0] = (t) => s("select-all"))
43
+ }, null, 40, M)
44
+ ])) : f("", !0),
45
+ (o(!0), i(x, null, z(e.columns, (t) => (o(), i("div", {
40
46
  key: t.key,
41
47
  role: "columnheader",
42
- class: x(["of-th", { "of-th--sortable": !0, "of-th--active": e.sortKey === t.key }]),
43
- style: v(h(t)),
48
+ class: w(["of-th", { "of-th--sortable": !0, "of-th--active": e.sortKey === t.key }]),
49
+ style: C(y(t)),
44
50
  "aria-sort": e.sortKey === t.key ? e.sortOrder === "asc" ? "ascending" : "descending" : "none",
45
- onClick: (O) => m(t.key)
51
+ onClick: (a) => m(t.key),
52
+ onContextmenu: d((a) => e.enableFieldMenu && s("header-contextmenu", a, t.key), ["prevent"]),
53
+ onDblclick: d((a) => e.enableFieldMenu && s("header-dblclick", t.key), ["stop"])
46
54
  }, [
47
- l("span", K, C(t.label), 1),
48
- l("span", $, [
49
- e.sortKey === t.key && e.sortOrder === "asc" ? (n(), r(i(S), {
55
+ c("span", O, B(t.label), 1),
56
+ c("span", R, [
57
+ e.sortKey === t.key && e.sortOrder === "asc" ? (o(), u(r($), {
50
58
  key: 0,
51
59
  size: 12,
52
60
  class: "of-sort-icon-active"
53
- })) : e.sortKey === t.key && e.sortOrder === "desc" ? (n(), r(i(d), {
61
+ })) : e.sortKey === t.key && e.sortOrder === "desc" ? (o(), u(r(k), {
54
62
  key: 1,
55
63
  size: 12,
56
64
  class: "of-sort-icon-active"
57
- })) : (n(), r(i(d), {
65
+ })) : (o(), u(r(k), {
58
66
  key: 2,
59
67
  size: 12,
60
68
  class: "of-sort-icon-idle"
61
69
  }))
62
- ])
63
- ], 14, z))), 128))
70
+ ]),
71
+ e.enableResize ? (o(), i("div", {
72
+ key: 0,
73
+ class: "of-th-resizer",
74
+ onMousedown: (a) => b(a, t.key),
75
+ onDblclick: d((a) => s("resize-dblclick", t.key), ["stop"])
76
+ }, null, 40, N)) : f("", !0)
77
+ ], 46, K))), 128)),
78
+ e.enableAddField ? (o(), i("div", {
79
+ key: 1,
80
+ class: "of-th of-th-add",
81
+ onClick: l[1] || (l[1] = d((t) => s("add-field"), ["stop"]))
82
+ }, [
83
+ S(r(g), { size: 14 })
84
+ ])) : f("", !0)
64
85
  ]));
65
86
  }
66
87
  });
67
88
  export {
68
- N as default
89
+ E as default
69
90
  };
@@ -0,0 +1,118 @@
1
+ import { Component } from 'vue';
2
+ import { TableColumn } from '../../types';
3
+ import { FilterCondition, FilterLogic } from '../../composables/useTableFilter';
4
+ export interface ViewSwitcherTab {
5
+ value: string;
6
+ label: string;
7
+ icon?: string | Component;
8
+ }
9
+ type __VLS_Props = {
10
+ /** 当前视图模式 */
11
+ currentView?: string;
12
+ /** 视图标签配置 */
13
+ viewTabs?: ViewSwitcherTab[];
14
+ /** 列配置 */
15
+ columns: TableColumn[];
16
+ /** 筛选条件 */
17
+ filterConditions?: readonly FilterCondition[];
18
+ /** 筛选逻辑 */
19
+ filterLogic?: FilterLogic;
20
+ /** 筛选是否激活 */
21
+ filterActive?: boolean;
22
+ /** 当前排序 */
23
+ currentSort?: {
24
+ field: string | null;
25
+ order: "asc" | "desc" | null;
26
+ };
27
+ /** 当前分组字段 */
28
+ currentGroup?: string;
29
+ /** 搜索关键词 */
30
+ searchKeyword?: string;
31
+ /** 显示控制 */
32
+ showViewSwitch?: boolean;
33
+ showFilter?: boolean;
34
+ showSort?: boolean;
35
+ showGroup?: boolean;
36
+ showColumns?: boolean;
37
+ showSearch?: boolean;
38
+ /** 可用的保存视图列表 */
39
+ savedViews?: {
40
+ id: string;
41
+ name: string;
42
+ }[];
43
+ };
44
+ declare function __VLS_template(): {
45
+ attrs: Partial<{}>;
46
+ slots: {
47
+ default?(_: {}): any;
48
+ };
49
+ refs: {
50
+ filterBtnRef: HTMLDivElement;
51
+ sortBtnRef: HTMLDivElement;
52
+ groupBtnRef: HTMLDivElement;
53
+ columnBtnRef: HTMLDivElement;
54
+ };
55
+ rootEl: HTMLDivElement;
56
+ };
57
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
58
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
59
+ sort: (field: string) => any;
60
+ group: (field: string | null) => any;
61
+ "update:columns": (columns: TableColumn[]) => any;
62
+ "update:currentView": (view: string) => any;
63
+ "update:searchKeyword": (keyword: string) => any;
64
+ "add-filter": () => any;
65
+ "remove-filter": (id: string) => any;
66
+ "update-filter": (id: string, update: Partial<FilterCondition>) => any;
67
+ "clear-filters": () => any;
68
+ "update:filterLogic": (logic: FilterLogic) => any;
69
+ "save-view": (name: string) => any;
70
+ "load-view": (viewId: string) => any;
71
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
72
+ onSort?: ((field: string) => any) | undefined;
73
+ onGroup?: ((field: string | null) => any) | undefined;
74
+ "onUpdate:columns"?: ((columns: TableColumn[]) => any) | undefined;
75
+ "onUpdate:currentView"?: ((view: string) => any) | undefined;
76
+ "onUpdate:searchKeyword"?: ((keyword: string) => any) | undefined;
77
+ "onAdd-filter"?: (() => any) | undefined;
78
+ "onRemove-filter"?: ((id: string) => any) | undefined;
79
+ "onUpdate-filter"?: ((id: string, update: Partial<FilterCondition>) => any) | undefined;
80
+ "onClear-filters"?: (() => any) | undefined;
81
+ "onUpdate:filterLogic"?: ((logic: FilterLogic) => any) | undefined;
82
+ "onSave-view"?: ((name: string) => any) | undefined;
83
+ "onLoad-view"?: ((viewId: string) => any) | undefined;
84
+ }>, {
85
+ showFilter: boolean;
86
+ showGroup: boolean;
87
+ showSort: boolean;
88
+ showSearch: boolean;
89
+ currentView: string;
90
+ viewTabs: ViewSwitcherTab[];
91
+ filterConditions: readonly FilterCondition[];
92
+ filterLogic: FilterLogic;
93
+ filterActive: boolean;
94
+ currentSort: {
95
+ field: string | null;
96
+ order: "asc" | "desc" | null;
97
+ };
98
+ currentGroup: string;
99
+ searchKeyword: string;
100
+ showViewSwitch: boolean;
101
+ showColumns: boolean;
102
+ savedViews: {
103
+ id: string;
104
+ name: string;
105
+ }[];
106
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
107
+ filterBtnRef: HTMLDivElement;
108
+ sortBtnRef: HTMLDivElement;
109
+ groupBtnRef: HTMLDivElement;
110
+ columnBtnRef: HTMLDivElement;
111
+ }, HTMLDivElement>;
112
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
113
+ export default _default;
114
+ type __VLS_WithTemplateSlots<T, S> = T & {
115
+ new (): {
116
+ $slots: S;
117
+ };
118
+ };
@@ -0,0 +1,7 @@
1
+ import o from "./TableToolbar.vue2.js";
2
+ /* empty css */
3
+ import a from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const m = /* @__PURE__ */ a(o, [["__scopeId", "data-v-02ad76f7"]]);
5
+ export {
6
+ m as default
7
+ };
@@ -0,0 +1,273 @@
1
+ import { defineComponent as Q, computed as T, ref as i, onMounted as W, onUnmounted as X, openBlock as o, createElementBlock as n, Fragment as V, renderList as L, normalizeClass as m, createBlock as C, resolveDynamicComponent as Y, unref as w, createCommentVNode as s, createElementVNode as a, toDisplayString as g, withModifiers as d, createVNode as b, Teleport as B, normalizeStyle as $, renderSlot as Z, nextTick as ee } from "vue";
2
+ import { resolveIcon as te } from "../../utils/icon.js";
3
+ import oe from "./TableFilterPanel.vue.js";
4
+ import le from "./TableColumnManager.vue.js";
5
+ import { ListFilter as ne, ArrowUpDown as re, Layers as se, Columns3 as ae, Search as ue } from "lucide-vue-next";
6
+ const ie = { class: "of-table-toolbar" }, fe = {
7
+ key: 0,
8
+ class: "of-table-toolbar__views"
9
+ }, de = ["onClick"], be = {
10
+ key: 1,
11
+ class: "of-table-toolbar__sep"
12
+ }, ve = {
13
+ key: 0,
14
+ class: "of-table-toolbar__badge"
15
+ }, ce = { class: "of-table-toolbar__simple-panel" }, ye = ["onClick"], me = {
16
+ key: 0,
17
+ class: "of-table-toolbar__sort-dir"
18
+ }, we = { class: "of-table-toolbar__simple-panel" }, ke = ["onClick"], pe = {
19
+ key: 6,
20
+ class: "of-table-toolbar__search"
21
+ }, Ce = ["value"], Ve = /* @__PURE__ */ Q({
22
+ __name: "TableToolbar",
23
+ props: {
24
+ currentView: { default: "table" },
25
+ viewTabs: { default: void 0 },
26
+ columns: {},
27
+ filterConditions: { default: void 0 },
28
+ filterLogic: { default: "and" },
29
+ filterActive: { type: Boolean, default: !1 },
30
+ currentSort: { default: void 0 },
31
+ currentGroup: { default: void 0 },
32
+ searchKeyword: { default: "" },
33
+ showViewSwitch: { type: Boolean, default: !0 },
34
+ showFilter: { type: Boolean, default: !0 },
35
+ showSort: { type: Boolean, default: !0 },
36
+ showGroup: { type: Boolean, default: !0 },
37
+ showColumns: { type: Boolean, default: !0 },
38
+ showSearch: { type: Boolean, default: !0 },
39
+ savedViews: { default: void 0 }
40
+ },
41
+ emits: ["update:currentView", "update:columns", "update:searchKeyword", "add-filter", "remove-filter", "update-filter", "clear-filters", "update:filterLogic", "sort", "group", "save-view", "load-view"],
42
+ setup(l, { emit: N }) {
43
+ const I = [
44
+ { value: "table", label: "表格", icon: "table-2" },
45
+ { value: "kanban", label: "看板", icon: "columns-3" },
46
+ { value: "timeline", label: "时间线", icon: "calendar" }
47
+ ], R = l, u = N, j = T(() => R.viewTabs ?? I), k = i(!1), v = i(!1), c = i(!1), p = i(!1), D = i(null), G = i(null), A = i(null), z = i(null), F = i({}), P = i({}), U = i({}), E = i({});
48
+ function q(r) {
49
+ if (!r) return {};
50
+ const e = r.getBoundingClientRect();
51
+ return {
52
+ top: `${e.bottom + 4}px`,
53
+ left: `${e.left}px`
54
+ };
55
+ }
56
+ function S(r) {
57
+ r !== "filter" && (k.value = !1), r !== "sort" && (v.value = !1), r !== "group" && (c.value = !1), r !== "column" && (p.value = !1);
58
+ const f = {
59
+ filter: { show: k, btnRef: D, style: F },
60
+ sort: { show: v, btnRef: G, style: P },
61
+ group: { show: c, btnRef: A, style: U },
62
+ column: { show: p, btnRef: z, style: E }
63
+ }[r];
64
+ f.show.value = !f.show.value, f.show.value && ee(() => {
65
+ f.style.value = q(f.btnRef.value);
66
+ });
67
+ }
68
+ function H() {
69
+ k.value = !1, v.value = !1, c.value = !1, p.value = !1;
70
+ }
71
+ function h(r) {
72
+ const e = r.target;
73
+ !e.closest(".of-table-toolbar__btn-group") && !e.closest(".of-table-toolbar__dropdown") && H();
74
+ }
75
+ W(() => document.addEventListener("click", h, !0)), X(() => document.removeEventListener("click", h, !0));
76
+ const J = T(() => R.columns.filter((r) => !r.hidden)), O = T(
77
+ () => R.columns.filter(
78
+ (r) => !r.hidden && (r.type === "status" || r.type === "string" || r.type === "priority")
79
+ )
80
+ );
81
+ return (r, e) => {
82
+ var f, x, K;
83
+ return o(), n("div", ie, [
84
+ l.showViewSwitch ? (o(), n("div", fe, [
85
+ (o(!0), n(V, null, L(j.value, (t) => (o(), n("button", {
86
+ key: t.value,
87
+ class: m(["of-table-toolbar__view-tab", { "of-table-toolbar__view-tab--active": l.currentView === t.value }]),
88
+ onClick: (y) => u("update:currentView", t.value)
89
+ }, [
90
+ t.icon ? (o(), C(Y(w(te)(t.icon)), {
91
+ key: 0,
92
+ class: "of-table-toolbar__tab-icon"
93
+ })) : s("", !0),
94
+ a("span", null, g(t.label), 1)
95
+ ], 10, de))), 128))
96
+ ])) : s("", !0),
97
+ l.showViewSwitch ? (o(), n("div", be)) : s("", !0),
98
+ l.showFilter ? (o(), n("div", {
99
+ key: 2,
100
+ ref_key: "filterBtnRef",
101
+ ref: D,
102
+ class: "of-table-toolbar__btn-group"
103
+ }, [
104
+ a("button", {
105
+ class: m(["of-table-toolbar__btn", { "of-table-toolbar__btn--active": l.filterActive }]),
106
+ onClick: e[0] || (e[0] = d((t) => S("filter"), ["stop"]))
107
+ }, [
108
+ b(w(ne), { size: 14 }),
109
+ e[19] || (e[19] = a("span", null, "筛选", -1)),
110
+ l.filterActive ? (o(), n("span", ve, g(((f = l.filterConditions) == null ? void 0 : f.length) ?? 0), 1)) : s("", !0)
111
+ ], 2),
112
+ (o(), C(B, { to: "body" }, [
113
+ k.value ? (o(), n("div", {
114
+ key: 0,
115
+ class: "of-table-toolbar__dropdown",
116
+ style: $(F.value),
117
+ onClick: e[7] || (e[7] = d(() => {
118
+ }, ["stop"]))
119
+ }, [
120
+ b(oe, {
121
+ conditions: l.filterConditions ?? [],
122
+ columns: l.columns,
123
+ logic: l.filterLogic ?? "and",
124
+ visible: !0,
125
+ onAddCondition: e[1] || (e[1] = (t) => u("add-filter")),
126
+ onRemoveCondition: e[2] || (e[2] = (t) => u("remove-filter", t)),
127
+ onUpdateCondition: e[3] || (e[3] = (t, y) => u("update-filter", t, y)),
128
+ onClear: e[4] || (e[4] = (t) => u("clear-filters")),
129
+ "onUpdate:logic": e[5] || (e[5] = (t) => u("update:filterLogic", t)),
130
+ onClose: e[6] || (e[6] = (t) => k.value = !1)
131
+ }, null, 8, ["conditions", "columns", "logic"])
132
+ ], 4)) : s("", !0)
133
+ ]))
134
+ ], 512)) : s("", !0),
135
+ l.showSort ? (o(), n("div", {
136
+ key: 3,
137
+ ref_key: "sortBtnRef",
138
+ ref: G,
139
+ class: "of-table-toolbar__btn-group"
140
+ }, [
141
+ a("button", {
142
+ class: m(["of-table-toolbar__btn", { "of-table-toolbar__btn--active": (x = l.currentSort) == null ? void 0 : x.field }]),
143
+ onClick: e[8] || (e[8] = d((t) => S("sort"), ["stop"]))
144
+ }, [
145
+ b(w(re), { size: 14 }),
146
+ e[20] || (e[20] = a("span", null, "排序", -1))
147
+ ], 2),
148
+ (o(), C(B, { to: "body" }, [
149
+ v.value ? (o(), n("div", {
150
+ key: 0,
151
+ class: "of-table-toolbar__dropdown",
152
+ style: $(P.value),
153
+ onClick: e[10] || (e[10] = d(() => {
154
+ }, ["stop"]))
155
+ }, [
156
+ a("div", ce, [
157
+ e[21] || (e[21] = a("div", { class: "of-table-toolbar__panel-title" }, "排序", -1)),
158
+ (o(!0), n(V, null, L(J.value, (t) => {
159
+ var y, _, M;
160
+ return o(), n("button", {
161
+ key: t.key,
162
+ class: m(["of-table-toolbar__sort-item", { active: ((y = l.currentSort) == null ? void 0 : y.field) === t.key }]),
163
+ onClick: (ge) => {
164
+ u("sort", t.key), v.value = !1;
165
+ }
166
+ }, [
167
+ a("span", null, g(t.label), 1),
168
+ ((_ = l.currentSort) == null ? void 0 : _.field) === t.key ? (o(), n("span", me, g(((M = l.currentSort) == null ? void 0 : M.order) === "asc" ? "↑" : "↓"), 1)) : s("", !0)
169
+ ], 10, ye);
170
+ }), 128)),
171
+ (K = l.currentSort) != null && K.field ? (o(), n("button", {
172
+ key: 0,
173
+ class: "of-table-toolbar__clear-btn",
174
+ onClick: e[9] || (e[9] = (t) => {
175
+ u("sort", ""), v.value = !1;
176
+ })
177
+ }, " 清除排序 ")) : s("", !0)
178
+ ])
179
+ ], 4)) : s("", !0)
180
+ ]))
181
+ ], 512)) : s("", !0),
182
+ l.showGroup ? (o(), n("div", {
183
+ key: 4,
184
+ ref_key: "groupBtnRef",
185
+ ref: A,
186
+ class: "of-table-toolbar__btn-group"
187
+ }, [
188
+ a("button", {
189
+ class: m(["of-table-toolbar__btn", { "of-table-toolbar__btn--active": !!l.currentGroup }]),
190
+ onClick: e[11] || (e[11] = d((t) => S("group"), ["stop"]))
191
+ }, [
192
+ b(w(se), { size: 14 }),
193
+ e[22] || (e[22] = a("span", null, "分组", -1))
194
+ ], 2),
195
+ (o(), C(B, { to: "body" }, [
196
+ c.value ? (o(), n("div", {
197
+ key: 0,
198
+ class: "of-table-toolbar__dropdown",
199
+ style: $(U.value),
200
+ onClick: e[13] || (e[13] = d(() => {
201
+ }, ["stop"]))
202
+ }, [
203
+ a("div", we, [
204
+ e[23] || (e[23] = a("div", { class: "of-table-toolbar__panel-title" }, "分组", -1)),
205
+ (o(!0), n(V, null, L(O.value, (t) => (o(), n("button", {
206
+ key: t.key,
207
+ class: m(["of-table-toolbar__sort-item", { active: l.currentGroup === t.key }]),
208
+ onClick: (y) => {
209
+ u("group", l.currentGroup === t.key ? null : t.key), c.value = !1;
210
+ }
211
+ }, g(t.label), 11, ke))), 128)),
212
+ l.currentGroup ? (o(), n("button", {
213
+ key: 0,
214
+ class: "of-table-toolbar__clear-btn",
215
+ onClick: e[12] || (e[12] = (t) => {
216
+ u("group", null), c.value = !1;
217
+ })
218
+ }, " 取消分组 ")) : s("", !0)
219
+ ])
220
+ ], 4)) : s("", !0)
221
+ ]))
222
+ ], 512)) : s("", !0),
223
+ l.showColumns ? (o(), n("div", {
224
+ key: 5,
225
+ ref_key: "columnBtnRef",
226
+ ref: z,
227
+ class: "of-table-toolbar__btn-group"
228
+ }, [
229
+ a("button", {
230
+ class: "of-table-toolbar__btn",
231
+ onClick: e[14] || (e[14] = d((t) => S("column"), ["stop"]))
232
+ }, [
233
+ b(w(ae), { size: 14 }),
234
+ e[24] || (e[24] = a("span", null, "列", -1))
235
+ ]),
236
+ (o(), C(B, { to: "body" }, [
237
+ p.value ? (o(), n("div", {
238
+ key: 0,
239
+ class: "of-table-toolbar__dropdown",
240
+ style: $(E.value),
241
+ onClick: e[17] || (e[17] = d(() => {
242
+ }, ["stop"]))
243
+ }, [
244
+ b(le, {
245
+ columns: l.columns,
246
+ visible: !0,
247
+ "onUpdate:columns": e[15] || (e[15] = (t) => u("update:columns", t)),
248
+ onClose: e[16] || (e[16] = (t) => p.value = !1)
249
+ }, null, 8, ["columns"])
250
+ ], 4)) : s("", !0)
251
+ ]))
252
+ ], 512)) : s("", !0),
253
+ e[25] || (e[25] = a("div", { class: "of-table-toolbar__spacer" }, null, -1)),
254
+ l.showSearch ? (o(), n("div", pe, [
255
+ b(w(ue), {
256
+ size: 14,
257
+ class: "of-table-toolbar__search-icon"
258
+ }),
259
+ a("input", {
260
+ class: "of-table-toolbar__search-input",
261
+ placeholder: "搜索...",
262
+ value: l.searchKeyword,
263
+ onInput: e[18] || (e[18] = (t) => u("update:searchKeyword", t.target.value))
264
+ }, null, 40, Ce)
265
+ ])) : s("", !0),
266
+ Z(r.$slots, "default", {}, void 0, !0)
267
+ ]);
268
+ };
269
+ }
270
+ });
271
+ export {
272
+ Ve as default
273
+ };
@@ -7,3 +7,8 @@ export { default as TableColumnManager } from './TableColumnManager.vue';
7
7
  export { default as FieldCell } from './FieldCell.vue';
8
8
  export type { FieldDef, FieldType, FieldOption, CellValue } from './FieldCell.vue';
9
9
  export { default as TableGroupRow } from './TableGroupRow.vue';
10
+ export { default as MobileListView } from './MobileListView.vue';
11
+ export { default as DetailSheet } from './DetailSheet.vue';
12
+ export { default as TableToolbar } from './TableToolbar.vue';
13
+ export { default as FieldTypePicker } from './FieldTypePicker.vue';
14
+ export { default as ColumnHeaderMenu } from './ColumnHeaderMenu.vue';