@oneflowui/ui 0.4.3 → 0.5.0

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 (158) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +70 -0
  3. package/dist/assets/tableWorker-CTsbCPPP.js +1 -0
  4. package/dist/components/ContextMenu/index.vue.d.ts +2 -1
  5. package/dist/components/ContextMenu/index.vue.js +2 -2
  6. package/dist/components/ContextMenu/index.vue2.js +37 -36
  7. package/dist/components/base/DropdownMenu.vue.js +2 -2
  8. package/dist/components/base/DropdownMenu.vue2.js +38 -39
  9. package/dist/components/base/MonitorItem.vue.d.ts +1 -1
  10. package/dist/components/base/PersonaCard.vue.d.ts +2 -1
  11. package/dist/components/base/PersonaCard.vue.js +3 -3
  12. package/dist/components/base/PersonaCard.vue2.js +51 -39
  13. package/dist/components/base/RefTag.vue.d.ts +2 -2
  14. package/dist/components/base/RefTag.vue.js +3 -3
  15. package/dist/components/base/SearchHighlight.vue.d.ts +6 -0
  16. package/dist/components/base/SearchHighlight.vue.js +7 -0
  17. package/dist/components/base/SearchHighlight.vue2.js +21 -0
  18. package/dist/components/base/ToolbarBtn.vue.d.ts +2 -1
  19. package/dist/components/base/ToolbarBtn.vue.js +1 -1
  20. package/dist/components/base/ViewModeGroup.vue.d.ts +2 -1
  21. package/dist/components/base/ViewModeGroup.vue.js +3 -3
  22. package/dist/components/base/ViewSwitcher.vue.d.ts +2 -1
  23. package/dist/components/base/ViewSwitcher.vue.js +2 -2
  24. package/dist/components/base/index.d.ts +1 -0
  25. package/dist/components/database/DatabaseView.vue.d.ts +171 -0
  26. package/dist/components/database/DatabaseView.vue.js +7 -0
  27. package/dist/components/database/DatabaseView.vue2.js +774 -0
  28. package/dist/components/database/index.d.ts +2 -0
  29. package/dist/components/field/FieldAttachment.vue.d.ts +17 -0
  30. package/dist/components/field/FieldAttachment.vue.js +7 -0
  31. package/dist/components/field/FieldAttachment.vue2.js +69 -0
  32. package/dist/components/field/FieldAutoNumber.vue.d.ts +7 -0
  33. package/dist/components/field/FieldAutoNumber.vue.js +7 -0
  34. package/dist/components/field/FieldAutoNumber.vue2.js +15 -0
  35. package/dist/components/field/FieldCreator.vue.d.ts +7 -0
  36. package/dist/components/field/FieldCreator.vue.js +7 -0
  37. package/dist/components/field/FieldCreator.vue2.js +24 -0
  38. package/dist/components/field/FieldCurrency.vue.d.ts +17 -0
  39. package/dist/components/field/FieldCurrency.vue.js +7 -0
  40. package/dist/components/field/FieldCurrency.vue2.js +42 -0
  41. package/dist/components/field/FieldDate.vue.js +2 -2
  42. package/dist/components/field/FieldDate.vue2.js +13 -10
  43. package/dist/components/field/FieldDatetime.vue.js +1 -1
  44. package/dist/components/field/FieldMarkdownPreview.vue.d.ts +13 -0
  45. package/dist/components/field/FieldMarkdownPreview.vue.js +7 -0
  46. package/dist/components/field/FieldMarkdownPreview.vue2.js +37 -0
  47. package/dist/components/field/FieldMultiSelect.vue.js +2 -2
  48. package/dist/components/field/FieldPhone.vue.d.ts +17 -0
  49. package/dist/components/field/FieldPhone.vue.js +7 -0
  50. package/dist/components/field/FieldPhone.vue2.js +34 -0
  51. package/dist/components/field/FieldProgress.vue.d.ts +15 -0
  52. package/dist/components/field/FieldProgress.vue.js +7 -0
  53. package/dist/components/field/FieldProgress.vue2.js +40 -0
  54. package/dist/components/field/FieldRelation.vue.d.ts +17 -0
  55. package/dist/components/field/FieldRelation.vue.js +7 -0
  56. package/dist/components/field/FieldRelation.vue2.js +67 -0
  57. package/dist/components/field/FieldRichText.vue.d.ts +17 -0
  58. package/dist/components/field/FieldRichText.vue.js +7 -0
  59. package/dist/components/field/FieldRichText.vue2.js +65 -0
  60. package/dist/components/field/FieldSelect.vue.js +1 -1
  61. package/dist/components/field/FieldSelect.vue2.js +43 -42
  62. package/dist/components/form/FormDesigner.vue.js +2 -2
  63. package/dist/components/form/FormDesigner.vue2.js +62 -52
  64. package/dist/components/gallery/GalleryCard.vue.js +2 -2
  65. package/dist/components/gallery/GalleryView.vue.d.ts +6 -2
  66. package/dist/components/gallery/GalleryView.vue.js +2 -2
  67. package/dist/components/gallery/GalleryView.vue2.js +30 -20
  68. package/dist/components/kanban/KanbanBoard.vue.d.ts +5 -1
  69. package/dist/components/kanban/KanbanBoard.vue.js +4 -4
  70. package/dist/components/kanban/KanbanBoard.vue2.js +81 -48
  71. package/dist/components/layout/AppLayout.vue.js +2 -2
  72. package/dist/components/layout/AppLayout.vue2.js +46 -62
  73. package/dist/components/overlay/Drawer.vue.js +1 -1
  74. package/dist/components/overlay/Drawer.vue2.js +52 -68
  75. package/dist/components/overlay/Modal.vue.js +1 -1
  76. package/dist/components/overlay/Modal.vue2.js +52 -68
  77. package/dist/components/overlay/SidePanel.vue.js +2 -2
  78. package/dist/components/overlay/SidePanel.vue2.js +64 -80
  79. package/dist/components/table/ColumnHeaderMenu.vue.d.ts +33 -0
  80. package/dist/components/table/ColumnHeaderMenu.vue.js +7 -0
  81. package/dist/components/table/ColumnHeaderMenu.vue2.js +153 -0
  82. package/dist/components/table/DataTable.vue.d.ts +116 -25
  83. package/dist/components/table/DataTable.vue.js +4 -4
  84. package/dist/components/table/DataTable.vue2.js +775 -188
  85. package/dist/components/table/DetailSheet.vue.d.ts +43 -0
  86. package/dist/components/table/DetailSheet.vue.js +7 -0
  87. package/dist/components/table/DetailSheet.vue2.js +140 -0
  88. package/dist/components/table/FieldCell.vue.d.ts +1 -1
  89. package/dist/components/table/FieldCell.vue.js +1 -1
  90. package/dist/components/table/FieldCell.vue2.js +59 -44
  91. package/dist/components/table/FieldTypePicker.vue.d.ts +15 -0
  92. package/dist/components/table/FieldTypePicker.vue.js +7 -0
  93. package/dist/components/table/FieldTypePicker.vue2.js +92 -0
  94. package/dist/components/table/MobileListView.vue.d.ts +24 -0
  95. package/dist/components/table/MobileListView.vue.js +7 -0
  96. package/dist/components/table/MobileListView.vue2.js +90 -0
  97. package/dist/components/table/TableGroupRow.vue.d.ts +5 -0
  98. package/dist/components/table/TableGroupRow.vue.js +2 -2
  99. package/dist/components/table/TableGroupRow.vue2.js +33 -23
  100. package/dist/components/table/TableHeaderRow.vue.d.ts +16 -0
  101. package/dist/components/table/TableHeaderRow.vue.js +2 -2
  102. package/dist/components/table/TableHeaderRow.vue2.js +54 -33
  103. package/dist/components/table/TableToolbar.vue.d.ts +118 -0
  104. package/dist/components/table/TableToolbar.vue.js +7 -0
  105. package/dist/components/table/TableToolbar.vue2.js +273 -0
  106. package/dist/components/table/index.d.ts +5 -0
  107. package/dist/components/timeline/GanttTimeline.vue.js +1 -1
  108. package/dist/components/timeline/GanttTimeline.vue2.js +128 -127
  109. package/dist/components/toast/ToastItem.vue.js +3 -3
  110. package/dist/composables/index.d.ts +21 -0
  111. package/dist/composables/useBreakpoint.d.ts +2 -1
  112. package/dist/composables/useBreakpoint.js +14 -12
  113. package/dist/composables/useColumnResize.d.ts +19 -0
  114. package/dist/composables/useColumnResize.js +58 -0
  115. package/dist/composables/useDatabaseView.d.ts +138 -0
  116. package/dist/composables/useDatabaseView.js +388 -0
  117. package/dist/composables/useDraftRows.d.ts +33 -0
  118. package/dist/composables/useDraftRows.js +103 -0
  119. package/dist/composables/useFixedColumns.d.ts +25 -0
  120. package/dist/composables/useFixedColumns.js +61 -0
  121. package/dist/composables/useFocusTrap.d.ts +10 -0
  122. package/dist/composables/useFocusTrap.js +37 -0
  123. package/dist/composables/useInlineEdit.js +3 -3
  124. package/dist/composables/useKeyboardNavigation.d.ts +45 -0
  125. package/dist/composables/useKeyboardNavigation.js +140 -0
  126. package/dist/composables/useRowDrag.d.ts +32 -0
  127. package/dist/composables/useRowDrag.js +85 -0
  128. package/dist/composables/useSchemaEngine.d.ts +31 -0
  129. package/dist/composables/useSchemaEngine.js +129 -0
  130. package/dist/composables/useSearch.d.ts +30 -0
  131. package/dist/composables/useSearch.js +59 -0
  132. package/dist/composables/useSupabaseProvider.d.ts +70 -0
  133. package/dist/composables/useSupabaseProvider.js +126 -0
  134. package/dist/composables/useTable.d.ts +3 -0
  135. package/dist/composables/useTable.js +103 -83
  136. package/dist/composables/useTableGroup.d.ts +14 -1
  137. package/dist/composables/useTableGroup.js +57 -33
  138. package/dist/composables/useViewPersistence.d.ts +98 -0
  139. package/dist/composables/useViewPersistence.js +141 -0
  140. package/dist/composables/useVirtualList.d.ts +4 -1
  141. package/dist/composables/useVirtualList.js +108 -85
  142. package/dist/composables/useWorkerSort.d.ts +14 -0
  143. package/dist/composables/useWorkerSort.js +61 -0
  144. package/dist/index.d.ts +32 -4
  145. package/dist/index.js +274 -221
  146. package/dist/style.css +1 -1
  147. package/dist/tests/database-view.integration.spec.d.ts +1 -0
  148. package/dist/types/index.d.ts +63 -2
  149. package/dist/types/index.js +23 -6
  150. package/dist/types/table-internal.d.ts +64 -0
  151. package/dist/utils/aggregation.d.ts +5 -0
  152. package/dist/utils/aggregation.js +38 -0
  153. package/dist/utils/supabaseAdapter.d.ts +48 -0
  154. package/dist/utils/supabaseAdapter.js +76 -0
  155. package/dist/utils/supabaseSchema.d.ts +81 -0
  156. package/dist/utils/supabaseSchema.js +202 -0
  157. package/dist/workers/tableWorker.d.ts +31 -0
  158. package/package.json +17 -17
@@ -1,86 +1,119 @@
1
- import { defineComponent as T, ref as w, watch as A, openBlock as d, createElementBlock as s, createElementVNode as f, Fragment as F, renderList as I, createVNode as u, unref as V, createCommentVNode as x } from "vue";
2
- import { Plus as y } from "lucide-vue-next";
3
- import B from "./KanbanColumn.vue.js";
4
- import K from "./QuickAddRow.vue.js";
5
- import { buildKanbanColumns as O } from "../../types/index.js";
6
- const g = { class: "of-kanban-board" }, h = { class: "of-kanban-inner" }, P = /* @__PURE__ */ T({
1
+ import { defineComponent as I, computed as u, ref as g, watch as y, openBlock as d, createElementBlock as s, createElementVNode as k, Fragment as A, renderList as K, createVNode as c, unref as V, createCommentVNode as x } from "vue";
2
+ import { Plus as B } from "lucide-vue-next";
3
+ import S from "./KanbanColumn.vue.js";
4
+ import L from "./QuickAddRow.vue.js";
5
+ import { isSelectField as p, buildKanbanColumns as N } from "../../types/index.js";
6
+ const _ = { class: "of-kanban-board" }, z = { class: "of-kanban-inner" }, j = /* @__PURE__ */ I({
7
7
  __name: "KanbanBoard",
8
8
  props: {
9
9
  columns: { default: () => [] },
10
10
  records: { default: () => [] },
11
- kanbanFieldId: { default: "status" },
11
+ schema: { default: void 0 },
12
+ view: { default: void 0 },
13
+ kanbanFieldId: { default: void 0 },
12
14
  laneOrder: { default: () => [] },
13
15
  laneTitles: { default: () => ({}) },
14
16
  addColumnVisible: { type: Boolean, default: !1 }
15
17
  },
16
18
  emits: ["update:columns", "add-column", "card-click"],
17
- setup(i, { emit: k }) {
18
- const n = i, r = k, c = () => n.columns.length > 0 ? structuredClone(n.columns) : n.records.length > 0 ? O(n.records, {
19
- kanbanFieldId: n.kanbanFieldId,
20
- laneOrder: n.laneOrder,
21
- laneTitles: n.laneTitles
22
- }) : [], a = w(c());
23
- A(
24
- () => [n.columns, n.records, n.kanbanFieldId, n.laneOrder, n.laneTitles],
19
+ setup(f, { emit: b }) {
20
+ const e = f, i = b, r = u(
25
21
  () => {
26
- a.value = c();
22
+ var n;
23
+ return e.kanbanFieldId ?? ((n = e.view) == null ? void 0 : n.kanbanFieldId) ?? "status";
24
+ }
25
+ ), C = u(() => {
26
+ if (e.laneOrder && e.laneOrder.length > 0) return e.laneOrder;
27
+ if (e.schema) {
28
+ const n = e.schema.fields.find((l) => l.id === r.value);
29
+ if (n && p(n))
30
+ return n.options.map((l) => l.value);
31
+ }
32
+ }), h = u(() => {
33
+ if (e.laneTitles && Object.keys(e.laneTitles).length > 0) return e.laneTitles;
34
+ if (e.schema) {
35
+ const n = e.schema.fields.find((l) => l.id === r.value);
36
+ if (n && p(n)) {
37
+ const l = {};
38
+ for (const t of n.options)
39
+ l[t.value] = t.label;
40
+ return l;
41
+ }
42
+ }
43
+ }), m = () => e.columns.length > 0 ? structuredClone(e.columns) : e.records.length > 0 ? N(e.records, {
44
+ kanbanFieldId: r.value,
45
+ laneOrder: C.value,
46
+ laneTitles: h.value
47
+ }) : [], o = g(m());
48
+ y(
49
+ () => [
50
+ e.columns,
51
+ e.records,
52
+ e.kanbanFieldId,
53
+ e.laneOrder,
54
+ e.laneTitles,
55
+ e.view,
56
+ e.schema
57
+ ],
58
+ () => {
59
+ o.value = m();
27
60
  }
28
61
  );
29
- function m(o) {
30
- const l = a.value.findIndex((e) => e.id === o.id);
62
+ function v(n) {
63
+ const l = o.value.findIndex((t) => t.id === n.id);
31
64
  if (l !== -1) {
32
- const e = o.tasks.map((t) => ({
33
- ...t,
34
- status: o.id
65
+ const t = n.tasks.map((a) => ({
66
+ ...a,
67
+ status: n.id
35
68
  }));
36
- a.value[l] = { ...o, tasks: e }, r("update:columns", structuredClone(a.value));
69
+ o.value[l] = { ...n, tasks: t }, i("update:columns", structuredClone(o.value));
37
70
  }
38
71
  }
39
- function b(o) {
72
+ function T(n) {
40
73
  }
41
- function p(o, l) {
42
- const e = a.value.find((v) => v.id === o);
43
- if (!e) return;
44
- const t = {
74
+ function w(n, l) {
75
+ const t = o.value.find((O) => O.id === n);
76
+ if (!t) return;
77
+ const a = {
45
78
  id: `TASK-${Date.now()}`,
46
79
  title: l,
47
- status: o,
80
+ status: n,
48
81
  priority: "P3"
49
- }, C = {
50
- ...e,
51
- tasks: [...e.tasks, t]
82
+ }, F = {
83
+ ...t,
84
+ tasks: [...t.tasks, a]
52
85
  };
53
- m(C);
86
+ v(F);
54
87
  }
55
- return (o, l) => (d(), s("div", g, [
56
- f("div", h, [
57
- (d(!0), s(F, null, I(a.value, (e) => (d(), s("div", {
58
- key: e.id,
88
+ return (n, l) => (d(), s("div", _, [
89
+ k("div", z, [
90
+ (d(!0), s(A, null, K(o.value, (t) => (d(), s("div", {
91
+ key: t.id,
59
92
  class: "of-kanban-col-wrapper"
60
93
  }, [
61
- u(B, {
62
- column: e,
63
- onAddCard: b,
64
- onCardClick: l[0] || (l[0] = (t) => r("card-click", t)),
65
- "onUpdate:column": m
94
+ c(S, {
95
+ column: t,
96
+ onAddCard: T,
97
+ onCardClick: l[0] || (l[0] = (a) => i("card-click", a)),
98
+ "onUpdate:column": v
66
99
  }, null, 8, ["column"]),
67
- u(K, {
100
+ c(L, {
68
101
  class: "of-quick-add-below",
69
- onSubmit: (t) => p(e.id, t)
102
+ onSubmit: (a) => w(t.id, a)
70
103
  }, null, 8, ["onSubmit"])
71
104
  ]))), 128)),
72
- i.addColumnVisible ? (d(), s("button", {
105
+ f.addColumnVisible ? (d(), s("button", {
73
106
  key: 0,
74
107
  class: "of-add-column-btn",
75
- onClick: l[1] || (l[1] = (e) => r("add-column"))
108
+ onClick: l[1] || (l[1] = (t) => i("add-column"))
76
109
  }, [
77
- u(V(y), { size: 16 }),
78
- l[2] || (l[2] = f("span", null, "添加列", -1))
110
+ c(V(B), { size: 16 }),
111
+ l[2] || (l[2] = k("span", null, "添加列", -1))
79
112
  ])) : x("", !0)
80
113
  ])
81
114
  ]));
82
115
  }
83
116
  });
84
117
  export {
85
- P as default
118
+ j as default
86
119
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./AppLayout.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-4bb400e7"]]);
4
+ const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-8488617f"]]);
5
5
  export {
6
- m as default
6
+ f as default
7
7
  };
@@ -1,98 +1,82 @@
1
- import { defineComponent as N, provide as m, computed as C, ref as h, onBeforeUnmount as T, openBlock as n, createElementBlock as s, normalizeClass as E, createElementVNode as r, unref as p, createCommentVNode as c, renderSlot as l, Fragment as $, nextTick as B } from "vue";
2
- import { useBreakpoint as S } from "../../composables/useBreakpoint.js";
3
- const x = { class: "of-app-layout__navbar" }, A = ["aria-expanded"], D = { class: "of-app-layout__body" }, M = {
1
+ import { defineComponent as h, provide as l, computed as w, ref as g, onBeforeUnmount as E, openBlock as o, createElementBlock as t, normalizeClass as v, createElementVNode as s, unref as c, createCommentVNode as d, renderSlot as r, Fragment as N } from "vue";
2
+ import { useBreakpoint as T } from "../../composables/useBreakpoint.js";
3
+ import { useFocusTrap as C } from "../../composables/useFocusTrap.js";
4
+ const L = { class: "of-app-layout__navbar" }, $ = ["aria-expanded"], B = { class: "of-app-layout__body" }, R = {
4
5
  key: 0,
5
6
  class: "of-app-layout__sidebar"
6
- }, R = { class: "of-app-layout__main" }, V = { class: "of-app-layout__statusbar" }, K = /* @__PURE__ */ N({
7
+ }, S = { class: "of-app-layout__main" }, F = { class: "of-app-layout__statusbar" }, O = /* @__PURE__ */ h({
7
8
  __name: "AppLayout",
8
9
  props: {
9
10
  density: { default: "comfortable" }
10
11
  },
11
- setup(v) {
12
- const w = v, { isMobile: i, isTablet: g } = S();
13
- m("isMobile", i), m("isTablet", g), m(
12
+ setup(u) {
13
+ const m = u, { isMobile: n, isTablet: y } = T();
14
+ l("isMobile", n), l("isTablet", y), l(
14
15
  "density",
15
- C(() => w.density)
16
+ w(() => m.density)
16
17
  );
17
- const a = h(!1), f = h(null);
18
- let t = null;
19
- function b() {
20
- return f.value ? Array.from(
21
- f.value.querySelectorAll(
22
- 'button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), a[href]'
23
- )
24
- ).filter((e) => !e.closest('[aria-hidden="true"]')) : [];
25
- }
26
- function d(e) {
27
- if (e.key !== "Tab") return;
28
- const o = b();
29
- if (o.length === 0) {
30
- e.preventDefault();
31
- return;
32
- }
33
- const _ = o[0], k = o[o.length - 1];
34
- e.shiftKey ? document.activeElement === _ && (e.preventDefault(), k.focus()) : document.activeElement === k && (e.preventDefault(), _.focus());
35
- }
36
- function L() {
18
+ const a = g(!1), {
19
+ containerRef: _,
20
+ activate: b,
21
+ deactivate: p
22
+ } = C();
23
+ function k() {
37
24
  const e = !a.value;
38
- a.value = e, e ? (t = document.activeElement, B(() => {
39
- const o = b();
40
- o.length && o[0].focus(), document.addEventListener("keydown", d), document.addEventListener("keydown", u);
41
- })) : (document.removeEventListener("keydown", d), document.removeEventListener("keydown", u), t == null || t.focus(), t = null);
25
+ a.value = e, e ? (b(), document.addEventListener("keydown", i)) : (p(), document.removeEventListener("keydown", i));
42
26
  }
43
- function y() {
44
- a.value = !1, document.removeEventListener("keydown", d), document.removeEventListener("keydown", u), t == null || t.focus(), t = null;
27
+ function f() {
28
+ a.value = !1, p(), document.removeEventListener("keydown", i);
45
29
  }
46
- function u(e) {
47
- e.key === "Escape" && y();
30
+ function i(e) {
31
+ e.key === "Escape" && f();
48
32
  }
49
- return T(() => {
50
- document.removeEventListener("keydown", d), document.removeEventListener("keydown", u);
51
- }), (e, o) => (n(), s("div", {
52
- class: E(["of-app-layout", { "of-density-compact": v.density === "compact" }])
33
+ return E(() => {
34
+ document.removeEventListener("keydown", i);
35
+ }), (e, M) => (o(), t("div", {
36
+ class: v(["of-app-layout", { "of-density-compact": u.density === "compact" }])
53
37
  }, [
54
- r("header", x, [
55
- p(i) ? (n(), s("button", {
38
+ s("header", L, [
39
+ c(n) ? (o(), t("button", {
56
40
  key: 0,
57
41
  class: "of-app-layout__hamburger",
58
42
  "aria-label": "Toggle sidebar",
59
43
  "aria-expanded": a.value,
60
- onClick: L
61
- }, " ☰ ", 8, A)) : c("", !0),
62
- l(e.$slots, "navbar", {}, void 0, !0)
44
+ onClick: k
45
+ }, " ☰ ", 8, $)) : d("", !0),
46
+ r(e.$slots, "navbar", {}, void 0, !0)
63
47
  ]),
64
- r("div", D, [
65
- p(i) ? c("", !0) : (n(), s("aside", M, [
66
- l(e.$slots, "sidebar", {}, void 0, !0)
48
+ s("div", B, [
49
+ c(n) ? d("", !0) : (o(), t("aside", R, [
50
+ r(e.$slots, "sidebar", {}, void 0, !0)
67
51
  ])),
68
- p(i) ? (n(), s($, { key: 1 }, [
69
- a.value ? (n(), s("div", {
52
+ c(n) ? (o(), t(N, { key: 1 }, [
53
+ a.value ? (o(), t("div", {
70
54
  key: 0,
71
55
  class: "of-drawer-overlay",
72
56
  "aria-hidden": "true",
73
- onClick: y
74
- })) : c("", !0),
75
- r("aside", {
57
+ onClick: f
58
+ })) : d("", !0),
59
+ s("aside", {
76
60
  ref_key: "drawerNavRef",
77
- ref: f,
78
- class: E(["of-drawer-sidebar", { "of-drawer-sidebar--open": a.value }]),
61
+ ref: _,
62
+ class: v(["of-drawer-sidebar", { "of-drawer-sidebar--open": a.value }]),
79
63
  role: "dialog",
80
64
  "aria-modal": "true",
81
65
  "aria-label": "导航菜单"
82
66
  }, [
83
- l(e.$slots, "sidebar", {}, void 0, !0)
67
+ r(e.$slots, "sidebar", {}, void 0, !0)
84
68
  ], 2)
85
- ], 64)) : c("", !0),
86
- r("main", R, [
87
- l(e.$slots, "default", {}, void 0, !0)
69
+ ], 64)) : d("", !0),
70
+ s("main", S, [
71
+ r(e.$slots, "default", {}, void 0, !0)
88
72
  ])
89
73
  ]),
90
- r("footer", V, [
91
- l(e.$slots, "statusbar", {}, void 0, !0)
74
+ s("footer", F, [
75
+ r(e.$slots, "statusbar", {}, void 0, !0)
92
76
  ])
93
77
  ], 2));
94
78
  }
95
79
  });
96
80
  export {
97
- K as default
81
+ O as default
98
82
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./Drawer.vue2.js";
2
2
  /* empty css */
3
3
  import r from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-1f5095d4"]]);
4
+ const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-cf8560a2"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -1,12 +1,13 @@
1
- import { defineComponent as V, useSlots as _, computed as B, ref as g, onMounted as S, watch as z, nextTick as D, onBeforeUnmount as L, openBlock as l, createBlock as T, Teleport as $, createVNode as v, Transition as I, withCtx as N, createElementBlock as d, normalizeStyle as b, createElementVNode as a, withModifiers as A, unref as h, renderSlot as k, toDisplayString as K, createCommentVNode as r } from "vue";
2
- import { X as M } from "lucide-vue-next";
3
- const R = ["aria-label"], q = { class: "of-drawer__inner" }, F = {
1
+ import { defineComponent as p, useSlots as V, computed as _, onMounted as B, watch as x, onBeforeUnmount as z, openBlock as o, createBlock as E, Teleport as S, createVNode as u, Transition as T, withCtx as $, createElementBlock as l, normalizeStyle as f, createElementVNode as d, withModifiers as I, unref as c, renderSlot as m, toDisplayString as N, createCommentVNode as n } from "vue";
2
+ import { X as R } from "lucide-vue-next";
3
+ import { useFocusTrap as g } from "../../composables/useFocusTrap.js";
4
+ const D = ["aria-label"], L = { class: "of-drawer__inner" }, M = {
4
5
  key: 0,
5
6
  class: "of-drawer__header"
6
- }, U = { class: "of-drawer__title" }, X = {
7
+ }, F = { class: "of-drawer__title" }, K = {
7
8
  key: 0,
8
9
  class: "of-drawer__title-text"
9
- }, j = { class: "of-drawer__body" }, J = /* @__PURE__ */ V({
10
+ }, U = { class: "of-drawer__body" }, G = /* @__PURE__ */ p({
10
11
  __name: "Drawer",
11
12
  props: {
12
13
  modelValue: { type: Boolean },
@@ -17,90 +18,73 @@ const R = ["aria-label"], q = { class: "of-drawer__inner" }, F = {
17
18
  zIndex: { default: 1e3 }
18
19
  },
19
20
  emits: ["update:modelValue"],
20
- setup(o, { emit: C }) {
21
- const i = o, E = C, p = _(), x = B(() => ({
22
- width: `${i.width}px`
23
- })), s = g(null);
24
- let n = null;
25
- function m() {
26
- return s.value ? Array.from(
27
- s.value.querySelectorAll(
28
- 'button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), a[href]'
29
- )
30
- ).filter((e) => !e.closest('[aria-hidden="true"]')) : [];
21
+ setup(e, { emit: y }) {
22
+ const r = e, w = y, v = V(), h = _(() => ({
23
+ width: `${r.width}px`
24
+ })), {
25
+ containerRef: k,
26
+ activate: C,
27
+ deactivate: b
28
+ } = g();
29
+ function i() {
30
+ w("update:modelValue", !1);
31
31
  }
32
- function u(e) {
33
- if (e.key !== "Tab") return;
34
- const t = m();
35
- if (t.length === 0) {
36
- e.preventDefault();
37
- return;
38
- }
39
- const c = t[0], w = t[t.length - 1];
40
- e.shiftKey ? document.activeElement === c && (e.preventDefault(), w.focus()) : document.activeElement === w && (e.preventDefault(), c.focus());
32
+ function s(t) {
33
+ t.key === "Escape" && r.modelValue && i();
41
34
  }
42
- function f() {
43
- E("update:modelValue", !1);
44
- }
45
- function y(e) {
46
- e.key === "Escape" && i.modelValue && f();
47
- }
48
- return S(() => {
49
- typeof document > "u" || document.addEventListener("keydown", y);
50
- }), z(
51
- () => i.modelValue,
52
- (e) => {
53
- typeof document > "u" || (document.body.style.overflow = e ? "hidden" : "", e ? (n = document.activeElement, D(() => {
54
- const t = m();
55
- t.length && t[0].focus(), document.addEventListener("keydown", u);
56
- })) : (document.removeEventListener("keydown", u), n == null || n.focus(), n = null));
35
+ return B(() => {
36
+ typeof document > "u" || document.addEventListener("keydown", s);
37
+ }), x(
38
+ () => r.modelValue,
39
+ (t) => {
40
+ typeof document > "u" || (document.body.style.overflow = t ? "hidden" : "", t ? C() : b());
57
41
  },
58
42
  { immediate: !0 }
59
- ), L(() => {
60
- typeof document > "u" || (document.removeEventListener("keydown", y), document.removeEventListener("keydown", u), document.body.style.overflow = "");
61
- }), (e, t) => (l(), T($, { to: "body" }, [
62
- v(I, { name: "of-drawer" }, {
63
- default: N(() => [
64
- o.modelValue ? (l(), d("div", {
43
+ ), z(() => {
44
+ typeof document > "u" || (document.removeEventListener("keydown", s), document.body.style.overflow = "");
45
+ }), (t, a) => (o(), E(S, { to: "body" }, [
46
+ u(T, { name: "of-drawer" }, {
47
+ default: $(() => [
48
+ e.modelValue ? (o(), l("div", {
65
49
  key: 0,
66
50
  class: "of-drawer-overlay",
67
- style: b({ zIndex: o.zIndex }),
68
- onClick: t[1] || (t[1] = (c) => o.maskClosable && f())
51
+ style: f({ zIndex: e.zIndex }),
52
+ onClick: a[1] || (a[1] = (X) => e.maskClosable && i())
69
53
  }, [
70
- a("aside", {
54
+ d("aside", {
71
55
  ref_key: "drawerRef",
72
- ref: s,
56
+ ref: k,
73
57
  class: "of-drawer",
74
58
  role: "dialog",
75
59
  "aria-modal": "true",
76
- "aria-label": o.title,
77
- style: b(x.value),
78
- onClick: t[0] || (t[0] = A(() => {
60
+ "aria-label": e.title,
61
+ style: f(h.value),
62
+ onClick: a[0] || (a[0] = I(() => {
79
63
  }, ["stop"]))
80
64
  }, [
81
- a("div", q, [
82
- h(p).title || o.title || o.showClose ? (l(), d("div", F, [
83
- a("div", U, [
84
- k(e.$slots, "title", {}, () => [
85
- o.title ? (l(), d("h3", X, K(o.title), 1)) : r("", !0)
65
+ d("div", L, [
66
+ c(v).title || e.title || e.showClose ? (o(), l("div", M, [
67
+ d("div", F, [
68
+ m(t.$slots, "title", {}, () => [
69
+ e.title ? (o(), l("h3", K, N(e.title), 1)) : n("", !0)
86
70
  ], !0)
87
71
  ]),
88
- o.showClose ? (l(), d("button", {
72
+ e.showClose ? (o(), l("button", {
89
73
  key: 0,
90
74
  class: "of-drawer__close",
91
75
  type: "button",
92
76
  "aria-label": "关闭",
93
- onClick: f
77
+ onClick: i
94
78
  }, [
95
- v(h(M), { size: 18 })
96
- ])) : r("", !0)
97
- ])) : r("", !0),
98
- a("div", j, [
99
- k(e.$slots, "default", {}, void 0, !0)
79
+ u(c(R), { size: 18 })
80
+ ])) : n("", !0)
81
+ ])) : n("", !0),
82
+ d("div", U, [
83
+ m(t.$slots, "default", {}, void 0, !0)
100
84
  ])
101
85
  ])
102
- ], 12, R)
103
- ], 4)) : r("", !0)
86
+ ], 12, D)
87
+ ], 4)) : n("", !0)
104
88
  ]),
105
89
  _: 3
106
90
  })
@@ -108,5 +92,5 @@ const R = ["aria-label"], q = { class: "of-drawer__inner" }, F = {
108
92
  }
109
93
  });
110
94
  export {
111
- J as default
95
+ G as default
112
96
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./Modal.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-4d50e8f4"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-98fd9016"]]);
5
5
  export {
6
6
  m as default
7
7
  };