@oneflowui/ui 0.6.0 → 0.8.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 (27) hide show
  1. package/dist/components/Dashboard/index.vue.d.ts +3 -1
  2. package/dist/components/Dashboard/index.vue.js +2 -2
  3. package/dist/components/Dashboard/index.vue2.js +59 -30
  4. package/dist/components/database/DatabaseView.vue.js +4 -4
  5. package/dist/components/database/DatabaseView.vue2.js +597 -442
  6. package/dist/components/detail/DetailLayout.vue.d.ts +12 -1
  7. package/dist/components/detail/DetailLayout.vue.js +2 -2
  8. package/dist/components/detail/DetailLayout.vue2.js +115 -68
  9. package/dist/components/gallery/GalleryView.vue.d.ts +3 -1
  10. package/dist/components/gallery/GalleryView.vue.js +2 -2
  11. package/dist/components/gallery/GalleryView.vue2.js +51 -27
  12. package/dist/components/overlay/Drawer.vue.d.ts +10 -0
  13. package/dist/components/overlay/Drawer.vue.js +1 -1
  14. package/dist/components/overlay/Drawer.vue2.js +74 -48
  15. package/dist/components/overlay/SidePanel.vue.d.ts +8 -0
  16. package/dist/components/overlay/SidePanel.vue.js +2 -2
  17. package/dist/components/overlay/SidePanel.vue2.js +97 -65
  18. package/dist/components/table/DataTable.vue.d.ts +32 -2
  19. package/dist/components/table/DataTable.vue.js +3 -3
  20. package/dist/components/table/DataTable.vue2.js +751 -609
  21. package/dist/components/table/FieldCell.vue.js +2 -2
  22. package/dist/components/table/FieldCell.vue2.js +26 -24
  23. package/dist/components/table/TableDataRow.vue.d.ts +19 -0
  24. package/dist/components/table/TableDataRow.vue.js +3 -3
  25. package/dist/components/table/TableDataRow.vue2.js +110 -73
  26. package/dist/style.css +1 -1
  27. package/package.json +1 -1
@@ -1,10 +1,15 @@
1
1
  import { Task, CommentData, PropItem } from '../../types';
2
+ type DetailLayoutState = "ready" | "loading" | "empty" | "error";
2
3
  type __VLS_Props = {
3
- task: Task;
4
+ task?: Task | null;
5
+ title?: string;
4
6
  comments?: CommentData[];
5
7
  propItems?: PropItem[];
6
8
  descriptionContent?: string;
7
9
  descriptionEditable?: boolean;
10
+ state?: DetailLayoutState;
11
+ stateTitle?: string;
12
+ stateDescription?: string;
8
13
  };
9
14
  declare function __VLS_template(): {
10
15
  attrs: Partial<{}>;
@@ -12,6 +17,7 @@ declare function __VLS_template(): {
12
17
  meta?(_: {}): any;
13
18
  description?(_: {}): any;
14
19
  comments?(_: {}): any;
20
+ footer?(_: {}): any;
15
21
  props?(_: {}): any;
16
22
  };
17
23
  refs: {};
@@ -23,10 +29,15 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
23
29
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
24
30
  "onUpdate:descriptionContent"?: ((value: string) => any) | undefined;
25
31
  }>, {
32
+ title: string;
33
+ task: Task | null;
26
34
  comments: CommentData[];
27
35
  propItems: PropItem[];
28
36
  descriptionContent: string;
29
37
  descriptionEditable: boolean;
38
+ state: DetailLayoutState;
39
+ stateTitle: string;
40
+ stateDescription: string;
30
41
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
31
42
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
32
43
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import o from "./DetailLayout.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-f887b37a"]]);
4
+ const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c18fe8bd"]]);
5
5
  export {
6
- m as default
6
+ f as default
7
7
  };
@@ -1,34 +1,48 @@
1
- import { defineComponent as h, computed as d, openBlock as s, createElementBlock as a, createElementVNode as e, toDisplayString as i, Fragment as g, normalizeStyle as v, createCommentVNode as r, renderSlot as c, createVNode as C, unref as B, renderList as P, createBlock as b } from "vue";
2
- import I from "./PropPanel.vue.js";
3
- import S from "./CommentItem.vue.js";
4
- import $ from "../editor/ContentBlock.vue.js";
5
- const E = { class: "detail-layout" }, D = { class: "detail-layout__main" }, L = { class: "detail-layout__title" }, N = { class: "detail-layout__meta" }, V = {
1
+ import { defineComponent as T, computed as s, openBlock as o, createElementBlock as r, createElementVNode as a, toDisplayString as i, Fragment as c, normalizeStyle as k, createCommentVNode as n, renderSlot as d, createBlock as p, resolveDynamicComponent as E, createVNode as N, unref as V, renderList as z } from "vue";
2
+ import { Loader2 as A, AlertCircle as M, Inbox as R } from "lucide-vue-next";
3
+ import U from "./PropPanel.vue.js";
4
+ import F from "./CommentItem.vue.js";
5
+ import j from "../editor/ContentBlock.vue.js";
6
+ const q = { class: "detail-layout" }, w = { class: "detail-layout__main" }, G = { class: "detail-layout__title" }, H = { class: "detail-layout__meta" }, J = {
6
7
  key: 0,
7
8
  class: "detail-layout__badge detail-layout__badge--role"
8
- }, M = {
9
+ }, K = {
9
10
  key: 1,
10
11
  class: "detail-layout__meta-text"
11
- }, U = { class: "detail-layout__section" }, z = { class: "detail-layout__description" }, F = {
12
+ }, O = ["data-role"], Q = { class: "detail-layout__state-copy" }, W = { class: "detail-layout__state-title" }, X = { class: "detail-layout__state-description" }, Y = { class: "detail-layout__section" }, Z = { class: "detail-layout__description" }, tt = {
12
13
  key: 0,
13
14
  class: "detail-layout__desc-placeholder"
14
- }, T = { class: "detail-layout__section" }, j = { class: "detail-layout__comments" }, q = {
15
+ }, et = { class: "detail-layout__section" }, ot = { class: "detail-layout__comments" }, at = {
15
16
  key: 0,
16
17
  class: "detail-layout__comment-list"
17
- }, w = {
18
+ }, st = {
18
19
  key: 1,
19
20
  class: "detail-layout__empty-hint"
20
- }, A = { class: "detail-layout__sidebar" }, O = /* @__PURE__ */ h({
21
+ }, rt = {
22
+ key: 0,
23
+ class: "detail-layout__footer"
24
+ }, lt = {
25
+ key: 0,
26
+ class: "detail-layout__sidebar"
27
+ }, pt = /* @__PURE__ */ T({
21
28
  __name: "DetailLayout",
22
29
  props: {
23
- task: {},
30
+ task: { default: null },
31
+ title: { default: "" },
24
32
  comments: { default: () => [] },
25
33
  propItems: { default: () => [] },
26
34
  descriptionContent: { default: "" },
27
- descriptionEditable: { type: Boolean, default: !1 }
35
+ descriptionEditable: { type: Boolean, default: !1 },
36
+ state: { default: "ready" },
37
+ stateTitle: { default: "" },
38
+ stateDescription: { default: "" }
28
39
  },
29
40
  emits: ["update:descriptionContent"],
30
- setup(t, { emit: _ }) {
31
- const l = t, f = _, u = d(() => ({
41
+ setup(l, { emit: x }) {
42
+ const t = l, h = x, C = s(() => {
43
+ var e;
44
+ return t.title || ((e = t.task) == null ? void 0 : e.title) || "未命名工作区";
45
+ }), y = s(() => t.state === "ready"), D = s(() => t.state === "loading" ? A : t.state === "error" ? M : R), L = s(() => t.stateTitle ? t.stateTitle : t.state === "loading" ? "正在准备工作区" : t.state === "error" ? "工作区加载失败" : t.state === "empty" ? "暂无详情内容" : ""), $ = s(() => t.stateDescription ? t.stateDescription : t.state === "loading" ? "请稍候,当前记录的详情数据正在整理。" : t.state === "error" ? "暂时无法展示当前详情,请稍后重试。" : t.state === "empty" ? "当前记录还没有可展示的描述、属性或活动记录。" : ""), _ = s(() => t.task ? {
32
46
  todo: { text: "var(--of-status-todo-text)", bg: "var(--of-status-todo-bg)" },
33
47
  in_progress: {
34
48
  text: "var(--of-status-in-progress-text)",
@@ -36,83 +50,116 @@ const E = { class: "detail-layout" }, D = { class: "detail-layout__main" }, L =
36
50
  },
37
51
  blocked: { text: "var(--of-status-blocked-text)", bg: "var(--of-status-blocked-bg)" },
38
52
  done: { text: "var(--of-status-done-text)", bg: "var(--of-status-done-bg)" }
39
- })[l.task.status] ?? {
53
+ }[t.task.status] ?? {
54
+ text: "var(--of-color-text-secondary)",
55
+ bg: "var(--of-color-gray-100)"
56
+ } : {
40
57
  text: "var(--of-color-text-secondary)",
41
58
  bg: "var(--of-color-gray-100)"
42
- }), m = d(() => ({
59
+ }), f = s(() => t.task ? {
43
60
  P0: { text: "var(--of-priority-p0-text)", bg: "var(--of-priority-p0-bg)" },
44
61
  P1: { text: "var(--of-priority-p1-text)", bg: "var(--of-priority-p1-bg)" },
45
62
  P2: { text: "var(--of-priority-p2-text)", bg: "var(--of-priority-p2-bg)" },
46
63
  P3: { text: "var(--of-priority-p3-text)", bg: "var(--of-priority-p3-bg)" }
47
- })[l.task.priority] ?? {
64
+ }[t.task.priority] ?? {
48
65
  text: "var(--of-color-text-secondary)",
49
66
  bg: "var(--of-color-gray-100)"
50
- }), k = d(() => ({
67
+ } : {
68
+ text: "var(--of-color-text-secondary)",
69
+ bg: "var(--of-color-gray-100)"
70
+ }), B = s(() => t.task ? {
51
71
  todo: "待处理",
52
72
  in_progress: "进行中",
53
73
  blocked: "阻塞",
54
74
  done: "已完成"
55
- })[l.task.status] ?? l.task.status), p = d(() => l.descriptionContent || l.task.description || "");
56
- function x(o) {
57
- f("update:descriptionContent", o);
75
+ }[t.task.status] ?? t.task.status : ""), I = s(() => t.task ? B.value : ""), P = s(() => t.task ? t.task.priority : ""), v = s(() => {
76
+ var e;
77
+ return ((e = t.task) == null ? void 0 : e.role) ?? "";
78
+ }), m = s(() => {
79
+ var e;
80
+ return ((e = t.task) == null ? void 0 : e.assignee) ?? "";
81
+ }), g = s(() => {
82
+ var e;
83
+ return t.descriptionContent || ((e = t.task) == null ? void 0 : e.description) || "";
84
+ });
85
+ function S(e) {
86
+ h("update:descriptionContent", e);
58
87
  }
59
- return (o, n) => (s(), a("div", E, [
60
- e("div", D, [
61
- e("h1", L, i(t.task.title), 1),
62
- e("div", N, [
63
- o.$slots.meta ? r("", !0) : (s(), a(g, { key: 0 }, [
64
- e("span", {
88
+ return (e, u) => (o(), r("div", q, [
89
+ a("div", w, [
90
+ a("h1", G, i(C.value), 1),
91
+ a("div", H, [
92
+ t.task && !e.$slots.meta ? (o(), r(c, { key: 0 }, [
93
+ a("span", {
65
94
  class: "detail-layout__badge",
66
- style: v({ color: u.value.text, backgroundColor: u.value.bg })
67
- }, i(k.value), 5),
68
- e("span", {
95
+ style: k({ color: _.value.text, backgroundColor: _.value.bg })
96
+ }, i(I.value), 5),
97
+ a("span", {
69
98
  class: "detail-layout__badge",
70
- style: v({ color: m.value.text, backgroundColor: m.value.bg })
71
- }, i(t.task.priority), 5),
72
- t.task.role ? (s(), a("span", V, i(t.task.role), 1)) : r("", !0),
73
- t.task.assignee ? (s(), a("span", M, i(t.task.assignee), 1)) : r("", !0)
74
- ], 64)),
75
- c(o.$slots, "meta", {}, void 0, !0)
76
- ]),
77
- e("div", U, [
78
- n[0] || (n[0] = e("div", { class: "detail-layout__section-title" }, "描述", -1)),
79
- e("div", z, [
80
- c(o.$slots, "description", {}, () => [
81
- C(B($), {
82
- content: p.value,
83
- editable: t.descriptionEditable,
84
- "onUpdate:content": x
85
- }, null, 8, ["content", "editable"]),
86
- p.value ? r("", !0) : (s(), a("p", F, "暂无描述"))
87
- ], !0)
88
- ])
99
+ style: k({ color: f.value.text, backgroundColor: f.value.bg })
100
+ }, i(P.value), 5),
101
+ v.value ? (o(), r("span", J, i(v.value), 1)) : n("", !0),
102
+ m.value ? (o(), r("span", K, i(m.value), 1)) : n("", !0)
103
+ ], 64)) : n("", !0),
104
+ d(e.$slots, "meta", {}, void 0, !0)
89
105
  ]),
90
- e("div", T, [
91
- n[1] || (n[1] = e("div", { class: "detail-layout__section-title" }, "活动记录", -1)),
92
- e("div", j, [
93
- c(o.$slots, "comments", {}, () => [
94
- t.comments && t.comments.length > 0 ? (s(), a("div", q, [
95
- (s(!0), a(g, null, P(t.comments, (y) => (s(), b(S, {
96
- key: y.id,
97
- comment: y
98
- }, null, 8, ["comment"]))), 128))
99
- ])) : (s(), a("p", w, "暂无活动记录"))
100
- ], !0)
106
+ y.value ? (o(), r(c, { key: 1 }, [
107
+ a("div", Y, [
108
+ u[0] || (u[0] = a("div", { class: "detail-layout__section-title" }, "描述", -1)),
109
+ a("div", Z, [
110
+ d(e.$slots, "description", {}, () => [
111
+ N(V(j), {
112
+ content: g.value,
113
+ editable: l.descriptionEditable,
114
+ "onUpdate:content": S
115
+ }, null, 8, ["content", "editable"]),
116
+ g.value ? n("", !0) : (o(), r("p", tt, "暂无描述"))
117
+ ], !0)
118
+ ])
119
+ ]),
120
+ a("div", et, [
121
+ u[1] || (u[1] = a("div", { class: "detail-layout__section-title" }, "活动记录", -1)),
122
+ a("div", ot, [
123
+ d(e.$slots, "comments", {}, () => [
124
+ l.comments && l.comments.length > 0 ? (o(), r("div", at, [
125
+ (o(!0), r(c, null, z(l.comments, (b) => (o(), p(F, {
126
+ key: b.id,
127
+ comment: b
128
+ }, null, 8, ["comment"]))), 128))
129
+ ])) : (o(), r("p", st, "暂无活动记录"))
130
+ ], !0)
131
+ ])
132
+ ]),
133
+ e.$slots.footer ? (o(), r("div", rt, [
134
+ d(e.$slots, "footer", {}, void 0, !0)
135
+ ])) : n("", !0)
136
+ ], 64)) : (o(), r("div", {
137
+ key: 0,
138
+ class: "detail-layout__state",
139
+ "data-role": `detail-state-${t.state}`
140
+ }, [
141
+ (o(), p(E(D.value), {
142
+ class: "detail-layout__state-icon",
143
+ size: 20
144
+ })),
145
+ a("div", Q, [
146
+ a("div", W, i(L.value), 1),
147
+ a("p", X, i($.value), 1)
101
148
  ])
102
- ])
149
+ ], 8, O))
103
150
  ]),
104
- e("div", A, [
105
- c(o.$slots, "props", {}, () => [
106
- t.propItems && t.propItems.length > 0 ? (s(), b(I, {
151
+ y.value ? (o(), r("div", lt, [
152
+ d(e.$slots, "props", {}, () => [
153
+ l.propItems && l.propItems.length > 0 ? (o(), p(U, {
107
154
  key: 0,
108
- items: t.propItems,
155
+ items: l.propItems,
109
156
  title: "属性"
110
- }, null, 8, ["items"])) : r("", !0)
157
+ }, null, 8, ["items"])) : n("", !0)
111
158
  ], !0)
112
- ])
159
+ ])) : n("", !0)
113
160
  ]));
114
161
  }
115
162
  });
116
163
  export {
117
- O as default
164
+ pt as default
118
165
  };
@@ -24,5 +24,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
24
24
  schema: TableSchema;
25
25
  coverFieldId: string;
26
26
  cardFieldIds: string[];
27
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
27
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
28
+ galleryRef: HTMLDivElement;
29
+ }, HTMLDivElement>;
28
30
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import o from "./GalleryView.vue2.js";
2
2
  /* empty css */
3
- import e from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ e(o, [["__scopeId", "data-v-28632dee"]]);
3
+ import r from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-047984a4"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -1,8 +1,8 @@
1
- import { defineComponent as g, computed as t, openBlock as i, createElementBlock as o, normalizeStyle as p, Fragment as I, renderList as w, createBlock as C, createVNode as k, unref as b, createElementVNode as _, createCommentVNode as B } from "vue";
2
- import { PlusIcon as V } from "lucide-vue-next";
3
- import h from "./GalleryCard.vue.js";
4
- import { buildGalleryItems as G } from "../../types/index.js";
5
- const S = /* @__PURE__ */ g({
1
+ import { defineComponent as k, ref as p, computed as d, onMounted as M, onBeforeUnmount as _, openBlock as a, createElementBlock as s, normalizeStyle as B, Fragment as R, renderList as x, createBlock as G, createVNode as V, unref as z, createElementVNode as N, createCommentVNode as S } from "vue";
2
+ import { PlusIcon as E } from "lucide-vue-next";
3
+ import W from "./GalleryCard.vue.js";
4
+ import { buildGalleryItems as $ } from "../../types/index.js";
5
+ const j = /* @__PURE__ */ k({
6
6
  __name: "GalleryView",
7
7
  props: {
8
8
  items: { default: () => [] },
@@ -15,44 +15,68 @@ const S = /* @__PURE__ */ g({
15
15
  addable: { type: Boolean, default: !0 }
16
16
  },
17
17
  emits: ["card-click", "add"],
18
- setup(n, { emit: v }) {
19
- const e = n, s = v, m = t(() => ({
20
- "--columns": e.columns
21
- })), c = t(
18
+ setup(c, { emit: w }) {
19
+ const t = c, v = w, i = p(null), o = p(0);
20
+ let n = null;
21
+ const h = d(() => Math.max(1, Math.floor(t.columns))), f = d(() => {
22
+ const e = o.value, l = h.value;
23
+ return e ? e < 520 ? 1 : e < 820 ? Math.min(l, 2) : e < 1120 ? Math.min(l, 3) : l : l;
24
+ }), F = d(() => ({
25
+ "--gallery-columns": String(f.value),
26
+ "--gallery-card-min-width": f.value <= 1 ? "0px" : "220px"
27
+ }));
28
+ function m(e) {
29
+ var l;
30
+ if (e) {
31
+ o.value = Math.round(e.contentRect.width);
32
+ return;
33
+ }
34
+ o.value = Math.round(((l = i.value) == null ? void 0 : l.getBoundingClientRect().width) ?? 0);
35
+ }
36
+ M(() => {
37
+ m(), !(typeof ResizeObserver > "u" || !i.value) && (n = new ResizeObserver((e) => {
38
+ e[0] && m(e[0]);
39
+ }), n.observe(i.value));
40
+ }), _(() => {
41
+ n == null || n.disconnect(), n = null;
42
+ });
43
+ const y = d(
22
44
  () => {
23
- var d;
24
- return e.coverFieldId || ((d = e.view) == null ? void 0 : d.galleryCoverFieldId) || "";
45
+ var e;
46
+ return t.coverFieldId || ((e = t.view) == null ? void 0 : e.galleryCoverFieldId) || "";
25
47
  }
26
- ), f = t(() => {
27
- var d, l, r, a, u;
28
- return (d = e.cardFieldIds) != null && d.length ? e.cardFieldIds : (r = (l = e.view) == null ? void 0 : l.galleryCardFields) != null && r.length ? e.view.galleryCardFields : (u = (a = e.view) == null ? void 0 : a.visibleFields) != null && u.length ? e.view.visibleFields.filter((F) => F !== c.value) : [];
29
- }), y = t(() => e.items.length > 0 ? e.items : e.records.length > 0 ? G(e.records, {
30
- coverFieldId: c.value || void 0,
31
- cardFieldIds: f.value
48
+ ), C = d(() => {
49
+ var e, l, r, u, g;
50
+ return (e = t.cardFieldIds) != null && e.length ? t.cardFieldIds : (r = (l = t.view) == null ? void 0 : l.galleryCardFields) != null && r.length ? t.view.galleryCardFields : (g = (u = t.view) == null ? void 0 : u.visibleFields) != null && g.length ? t.view.visibleFields.filter((b) => b !== y.value) : [];
51
+ }), I = d(() => t.items.length > 0 ? t.items : t.records.length > 0 ? $(t.records, {
52
+ coverFieldId: y.value || void 0,
53
+ cardFieldIds: C.value
32
54
  }) : []);
33
- return (d, l) => (i(), o("div", {
55
+ return (e, l) => (a(), s("div", {
56
+ ref_key: "galleryRef",
57
+ ref: i,
34
58
  class: "gallery-view",
35
- style: p(m.value)
59
+ style: B(F.value)
36
60
  }, [
37
- (i(!0), o(I, null, w(y.value, (r) => (i(), C(h, {
61
+ (a(!0), s(R, null, x(I.value, (r) => (a(), G(W, {
38
62
  key: r.id,
39
63
  item: r,
40
- onClick: (a) => s("card-click", r)
64
+ onClick: (u) => v("card-click", r)
41
65
  }, null, 8, ["item", "onClick"]))), 128)),
42
- n.addable ? (i(), o("button", {
66
+ c.addable ? (a(), s("button", {
43
67
  key: 0,
44
68
  class: "gallery-view__add-btn",
45
- onClick: l[0] || (l[0] = (r) => s("add"))
69
+ onClick: l[0] || (l[0] = (r) => v("add"))
46
70
  }, [
47
- k(b(V), {
71
+ V(z(E), {
48
72
  size: 18,
49
73
  class: "gallery-view__add-icon"
50
74
  }),
51
- l[1] || (l[1] = _("span", { class: "gallery-view__add-label" }, "添加", -1))
52
- ])) : B("", !0)
75
+ l[1] || (l[1] = N("span", { class: "gallery-view__add-label" }, "添加", -1))
76
+ ])) : S("", !0)
53
77
  ], 4));
54
78
  }
55
79
  });
56
80
  export {
57
- S as default
81
+ j as default
58
82
  };
@@ -5,6 +5,10 @@ type __VLS_Props = {
5
5
  showClose?: boolean;
6
6
  maskClosable?: boolean;
7
7
  zIndex?: number;
8
+ fullscreen?: boolean;
9
+ resizable?: boolean;
10
+ minWidth?: number;
11
+ maxWidth?: number;
8
12
  };
9
13
  declare function __VLS_template(): {
10
14
  attrs: Partial<{}>;
@@ -20,14 +24,20 @@ declare function __VLS_template(): {
20
24
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
21
25
  declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
22
26
  "update:modelValue": (value: boolean) => any;
27
+ "update:width": (value: number) => any;
23
28
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
24
29
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
30
+ "onUpdate:width"?: ((value: number) => any) | undefined;
25
31
  }>, {
26
32
  title: string;
27
33
  width: number;
34
+ fullscreen: boolean;
35
+ maxWidth: number;
36
+ minWidth: number;
28
37
  zIndex: number;
29
38
  maskClosable: boolean;
30
39
  showClose: boolean;
40
+ resizable: boolean;
31
41
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
32
42
  drawerRef: HTMLElement;
33
43
  }, any>;
@@ -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 p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-9cd908b5"]]);
4
+ const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-c40443d8"]]);
5
5
  export {
6
6
  p as default
7
7
  };
@@ -1,13 +1,13 @@
1
- import { defineComponent as _, useSlots as p, computed as V, 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 I, createElementBlock as a, normalizeStyle as c, createCommentVNode as l, createElementVNode as d, withModifiers as N, unref as f, renderSlot as m, toDisplayString as R } from "vue";
2
- import { X as $ } from "lucide-vue-next";
3
- import { useFocusTrap as g } from "../../composables/useFocusTrap.js";
4
- const D = ["aria-label"], L = { class: "of-drawer__inner" }, M = {
1
+ import { defineComponent as V, useSlots as _, computed as W, onMounted as L, watch as S, onBeforeUnmount as M, openBlock as n, createBlock as T, Teleport as R, createVNode as c, Transition as D, withCtx as I, createElementBlock as a, normalizeStyle as m, createCommentVNode as l, createElementVNode as r, withModifiers as N, normalizeClass as P, unref as w, renderSlot as y, toDisplayString as $ } from "vue";
2
+ import { X as g } from "lucide-vue-next";
3
+ import { useFocusTrap as U } from "../../composables/useFocusTrap.js";
4
+ const X = ["aria-label"], F = { class: "of-drawer__inner" }, K = {
5
5
  key: 0,
6
6
  class: "of-drawer__header"
7
- }, F = { class: "of-drawer__title" }, K = {
7
+ }, j = { class: "of-drawer__title" }, q = {
8
8
  key: 0,
9
9
  class: "of-drawer__title-text"
10
- }, U = { class: "of-drawer__body" }, A = /* @__PURE__ */ _({
10
+ }, A = { class: "of-drawer__body" }, O = /* @__PURE__ */ V({
11
11
  __name: "Drawer",
12
12
  props: {
13
13
  modelValue: { type: Boolean },
@@ -15,81 +15,107 @@ const D = ["aria-label"], L = { class: "of-drawer__inner" }, M = {
15
15
  title: { default: void 0 },
16
16
  showClose: { type: Boolean, default: !0 },
17
17
  maskClosable: { type: Boolean, default: !0 },
18
- zIndex: { default: 1e3 }
18
+ zIndex: { default: 1e3 },
19
+ fullscreen: { type: Boolean, default: !1 },
20
+ resizable: { type: Boolean, default: !1 },
21
+ minWidth: { default: 360 },
22
+ maxWidth: { default: 1320 }
19
23
  },
20
- emits: ["update:modelValue"],
21
- setup(e, { emit: y }) {
22
- const r = e, w = y, h = p(), v = V(() => ({
23
- width: `${r.width}px`
24
+ emits: ["update:modelValue", "update:width"],
25
+ setup(e, { emit: h }) {
26
+ const o = e, s = h, v = _(), b = W(() => ({
27
+ "--of-drawer-width": `${o.width}px`
24
28
  })), {
25
- containerRef: k,
26
- activate: b,
29
+ containerRef: p,
30
+ activate: k,
27
31
  deactivate: C
28
- } = g();
29
- function n() {
30
- w("update:modelValue", !1);
32
+ } = U();
33
+ function i() {
34
+ s("update:modelValue", !1);
31
35
  }
32
- function i(t) {
33
- t.key === "Escape" && r.modelValue && n();
36
+ function z(t) {
37
+ return Math.max(o.minWidth, Math.min(o.maxWidth, t));
34
38
  }
35
- return B(() => {
36
- typeof document > "u" || document.addEventListener("keydown", i);
37
- }), x(
38
- () => r.modelValue,
39
+ function u(t) {
40
+ t.key === "Escape" && o.modelValue && i();
41
+ }
42
+ L(() => {
43
+ typeof document > "u" || document.addEventListener("keydown", u);
44
+ }), S(
45
+ () => o.modelValue,
39
46
  (t) => {
40
- typeof document > "u" || (document.body.style.overflow = t ? "hidden" : "", t ? b() : C());
47
+ typeof document > "u" || (document.body.style.overflow = t ? "hidden" : "", t ? k() : C());
41
48
  },
42
49
  { immediate: !0 }
43
- ), z(() => {
44
- typeof document > "u" || (document.removeEventListener("keydown", i), document.body.style.overflow = "");
45
- }), (t, s) => (o(), E(S, { to: "body" }, [
46
- u(T, { name: "of-drawer" }, {
50
+ ), M(() => {
51
+ typeof document > "u" || (document.removeEventListener("keydown", u), document.body.style.overflow = "");
52
+ });
53
+ function x(t) {
54
+ if (!o.resizable || o.fullscreen || typeof window > "u") return;
55
+ t.preventDefault();
56
+ const d = (B) => {
57
+ const E = z(window.innerWidth - B.clientX);
58
+ s("update:width", E);
59
+ }, f = () => {
60
+ window.removeEventListener("pointermove", d), window.removeEventListener("pointerup", f);
61
+ };
62
+ window.addEventListener("pointermove", d), window.addEventListener("pointerup", f, { once: !0 });
63
+ }
64
+ return (t, d) => (n(), T(R, { to: "body" }, [
65
+ c(D, { name: "of-drawer" }, {
47
66
  default: I(() => [
48
- e.modelValue ? (o(), a("div", {
67
+ e.modelValue ? (n(), a("div", {
49
68
  key: 0,
50
69
  class: "of-drawer-overlay",
51
- style: c({ zIndex: e.zIndex })
70
+ style: m({ zIndex: e.zIndex })
52
71
  }, [
53
- e.maskClosable ? (o(), a("button", {
72
+ e.maskClosable ? (n(), a("button", {
54
73
  key: 0,
55
74
  type: "button",
56
75
  class: "of-drawer-overlay__hitarea",
57
76
  "aria-label": "关闭抽屉",
58
- onClick: n
77
+ onClick: i
59
78
  })) : l("", !0),
60
- d("aside", {
79
+ r("aside", {
61
80
  ref_key: "drawerRef",
62
- ref: k,
63
- class: "of-drawer",
81
+ ref: p,
82
+ class: P(["of-drawer", { "of-drawer--fullscreen": e.fullscreen }]),
64
83
  role: "dialog",
65
84
  "aria-modal": "true",
66
85
  "aria-label": e.title,
67
- style: c(v.value),
68
- onClick: s[0] || (s[0] = N(() => {
86
+ style: m(b.value),
87
+ onClick: d[0] || (d[0] = N(() => {
69
88
  }, ["stop"]))
70
89
  }, [
71
- d("div", L, [
72
- f(h).title || e.title || e.showClose ? (o(), a("div", M, [
73
- d("div", F, [
74
- m(t.$slots, "title", {}, () => [
75
- e.title ? (o(), a("h3", K, R(e.title), 1)) : l("", !0)
90
+ e.resizable && !e.fullscreen ? (n(), a("button", {
91
+ key: 0,
92
+ type: "button",
93
+ class: "of-drawer__resize-handle",
94
+ "aria-label": "调整抽屉宽度",
95
+ onPointerdown: x
96
+ }, null, 32)) : l("", !0),
97
+ r("div", F, [
98
+ w(v).title || e.title || e.showClose ? (n(), a("div", K, [
99
+ r("div", j, [
100
+ y(t.$slots, "title", {}, () => [
101
+ e.title ? (n(), a("h3", q, $(e.title), 1)) : l("", !0)
76
102
  ], !0)
77
103
  ]),
78
- e.showClose ? (o(), a("button", {
104
+ e.showClose ? (n(), a("button", {
79
105
  key: 0,
80
106
  class: "of-drawer__close",
81
107
  type: "button",
82
108
  "aria-label": "关闭",
83
- onClick: n
109
+ onClick: i
84
110
  }, [
85
- u(f($), { size: 18 })
111
+ c(w(g), { size: 18 })
86
112
  ])) : l("", !0)
87
113
  ])) : l("", !0),
88
- d("div", U, [
89
- m(t.$slots, "default", {}, void 0, !0)
114
+ r("div", A, [
115
+ y(t.$slots, "default", {}, void 0, !0)
90
116
  ])
91
117
  ])
92
- ], 12, D)
118
+ ], 14, X)
93
119
  ], 4)) : l("", !0)
94
120
  ]),
95
121
  _: 3
@@ -98,5 +124,5 @@ const D = ["aria-label"], L = { class: "of-drawer__inner" }, M = {
98
124
  }
99
125
  });
100
126
  export {
101
- A as default
127
+ O as default
102
128
  };