@oneflowui/ui 0.7.0 → 0.8.1

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.
@@ -6,6 +6,9 @@ type __VLS_Props = {
6
6
  maskClosable?: boolean;
7
7
  zIndex?: number;
8
8
  fullscreen?: boolean;
9
+ resizable?: boolean;
10
+ minWidth?: number;
11
+ maxWidth?: number;
9
12
  };
10
13
  declare function __VLS_template(): {
11
14
  attrs: Partial<{}>;
@@ -21,15 +24,20 @@ declare function __VLS_template(): {
21
24
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
22
25
  declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
23
26
  "update:modelValue": (value: boolean) => any;
27
+ "update:width": (value: number) => any;
24
28
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
25
29
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
30
+ "onUpdate:width"?: ((value: number) => any) | undefined;
26
31
  }>, {
27
32
  title: string;
28
33
  width: number;
29
34
  fullscreen: boolean;
35
+ maxWidth: number;
36
+ minWidth: number;
30
37
  zIndex: number;
31
38
  maskClosable: boolean;
32
39
  showClose: boolean;
40
+ resizable: boolean;
33
41
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
34
42
  drawerRef: HTMLElement;
35
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 m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-1f598ba6"]]);
4
+ const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-c40443d8"]]);
5
5
  export {
6
- m as default
6
+ p as default
7
7
  };
@@ -1,13 +1,13 @@
1
- import { defineComponent as p, useSlots as _, 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 f, createCommentVNode as l, createElementVNode as r, withModifiers as N, normalizeClass as R, unref as c, renderSlot as m, toDisplayString as $ } from "vue";
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
2
  import { X as g } from "lucide-vue-next";
3
- import { useFocusTrap as D } from "../../composables/useFocusTrap.js";
4
- const L = ["aria-label"], M = { class: "of-drawer__inner" }, F = {
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
- }, K = { class: "of-drawer__title" }, U = {
7
+ }, j = { class: "of-drawer__title" }, q = {
8
8
  key: 0,
9
9
  class: "of-drawer__title-text"
10
- }, X = { class: "of-drawer__body" }, G = /* @__PURE__ */ p({
10
+ }, A = { class: "of-drawer__body" }, O = /* @__PURE__ */ V({
11
11
  __name: "Drawer",
12
12
  props: {
13
13
  modelValue: { type: Boolean },
@@ -16,81 +16,106 @@ const L = ["aria-label"], M = { class: "of-drawer__inner" }, F = {
16
16
  showClose: { type: Boolean, default: !0 },
17
17
  maskClosable: { type: Boolean, default: !0 },
18
18
  zIndex: { default: 1e3 },
19
- fullscreen: { type: Boolean, default: !1 }
19
+ fullscreen: { type: Boolean, default: !1 },
20
+ resizable: { type: Boolean, default: !1 },
21
+ minWidth: { default: 360 },
22
+ maxWidth: { default: 1320 }
20
23
  },
21
- emits: ["update:modelValue"],
22
- setup(e, { emit: y }) {
23
- const d = e, w = y, h = _(), v = V(() => ({
24
- "--of-drawer-width": `${d.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`
25
28
  })), {
26
- containerRef: k,
27
- activate: b,
29
+ containerRef: p,
30
+ activate: k,
28
31
  deactivate: C
29
- } = D();
30
- function n() {
31
- w("update:modelValue", !1);
32
+ } = U();
33
+ function i() {
34
+ s("update:modelValue", !1);
32
35
  }
33
- function i(t) {
34
- t.key === "Escape" && d.modelValue && n();
36
+ function z(t) {
37
+ return Math.max(o.minWidth, Math.min(o.maxWidth, t));
35
38
  }
36
- return B(() => {
37
- typeof document > "u" || document.addEventListener("keydown", i);
38
- }), x(
39
- () => d.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,
40
46
  (t) => {
41
- 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());
42
48
  },
43
49
  { immediate: !0 }
44
- ), z(() => {
45
- typeof document > "u" || (document.removeEventListener("keydown", i), document.body.style.overflow = "");
46
- }), (t, s) => (o(), E(S, { to: "body" }, [
47
- 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" }, {
48
66
  default: I(() => [
49
- e.modelValue ? (o(), a("div", {
67
+ e.modelValue ? (n(), a("div", {
50
68
  key: 0,
51
69
  class: "of-drawer-overlay",
52
- style: f({ zIndex: e.zIndex })
70
+ style: m({ zIndex: e.zIndex })
53
71
  }, [
54
- e.maskClosable ? (o(), a("button", {
72
+ e.maskClosable ? (n(), a("button", {
55
73
  key: 0,
56
74
  type: "button",
57
75
  class: "of-drawer-overlay__hitarea",
58
76
  "aria-label": "关闭抽屉",
59
- onClick: n
77
+ onClick: i
60
78
  })) : l("", !0),
61
79
  r("aside", {
62
80
  ref_key: "drawerRef",
63
- ref: k,
64
- class: R(["of-drawer", { "of-drawer--fullscreen": e.fullscreen }]),
81
+ ref: p,
82
+ class: P(["of-drawer", { "of-drawer--fullscreen": e.fullscreen }]),
65
83
  role: "dialog",
66
84
  "aria-modal": "true",
67
85
  "aria-label": e.title,
68
- style: f(v.value),
69
- onClick: s[0] || (s[0] = N(() => {
86
+ style: m(b.value),
87
+ onClick: d[0] || (d[0] = N(() => {
70
88
  }, ["stop"]))
71
89
  }, [
72
- r("div", M, [
73
- c(h).title || e.title || e.showClose ? (o(), a("div", F, [
74
- r("div", K, [
75
- m(t.$slots, "title", {}, () => [
76
- e.title ? (o(), a("h3", U, $(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)
77
102
  ], !0)
78
103
  ]),
79
- e.showClose ? (o(), a("button", {
104
+ e.showClose ? (n(), a("button", {
80
105
  key: 0,
81
106
  class: "of-drawer__close",
82
107
  type: "button",
83
108
  "aria-label": "关闭",
84
- onClick: n
109
+ onClick: i
85
110
  }, [
86
- u(c(g), { size: 18 })
111
+ c(w(g), { size: 18 })
87
112
  ])) : l("", !0)
88
113
  ])) : l("", !0),
89
- r("div", X, [
90
- m(t.$slots, "default", {}, void 0, !0)
114
+ r("div", A, [
115
+ y(t.$slots, "default", {}, void 0, !0)
91
116
  ])
92
117
  ])
93
- ], 14, L)
118
+ ], 14, X)
94
119
  ], 4)) : l("", !0)
95
120
  ]),
96
121
  _: 3
@@ -99,5 +124,5 @@ const L = ["aria-label"], M = { class: "of-drawer__inner" }, F = {
99
124
  }
100
125
  });
101
126
  export {
102
- G as default
127
+ O as default
103
128
  };
@@ -5,6 +5,9 @@ export interface SidePanelProps {
5
5
  title?: string;
6
6
  showClose?: boolean;
7
7
  mode?: "lazy" | "persistent";
8
+ resizable?: boolean;
9
+ minWidth?: number;
10
+ maxWidth?: number;
8
11
  }
9
12
  declare function __VLS_template(): {
10
13
  attrs: Partial<{}>;
@@ -23,13 +26,18 @@ declare function __VLS_template(): {
23
26
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
24
27
  declare const __VLS_component: import('vue').DefineComponent<SidePanelProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
25
28
  "update:modelValue": (value: boolean) => any;
29
+ "update:width": (value: number) => any;
26
30
  }, string, import('vue').PublicProps, Readonly<SidePanelProps> & Readonly<{
27
31
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
32
+ "onUpdate:width"?: ((value: number) => any) | undefined;
28
33
  }>, {
29
34
  title: string;
30
35
  width: number;
31
36
  mode: "lazy" | "persistent";
37
+ maxWidth: number;
38
+ minWidth: number;
32
39
  showClose: boolean;
40
+ resizable: boolean;
33
41
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
34
42
  sidePanelRef: HTMLElement;
35
43
  }, any>;
@@ -1,7 +1,7 @@
1
1
  import o from "./SidePanel.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-e3756298"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-33d4366a"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -1,122 +1,153 @@
1
- import { defineComponent as _, computed as V, onMounted as C, watch as $, onBeforeUnmount as B, openBlock as t, createBlock as S, Teleport as E, createElementBlock as l, Fragment as g, normalizeStyle as u, renderSlot as d, toDisplayString as f, createVNode as m, unref as y, createCommentVNode as a, createElementVNode as h, withDirectives as z, vShow as P } from "vue";
2
- import { X as v } from "lucide-vue-next";
3
- import { useFocusTrap as R } from "../../composables/useFocusTrap.js";
4
- const T = ["aria-label"], N = {
5
- key: 0,
1
+ import { defineComponent as B, computed as S, onMounted as W, watch as $, onBeforeUnmount as L, openBlock as o, createBlock as R, Teleport as g, createElementBlock as l, Fragment as M, normalizeStyle as y, createCommentVNode as n, renderSlot as i, toDisplayString as v, createVNode as w, unref as p, createElementVNode as b, withDirectives as T, vShow as D } from "vue";
2
+ import { X as k } from "lucide-vue-next";
3
+ import { useFocusTrap as N } from "../../composables/useFocusTrap.js";
4
+ const F = ["aria-label"], U = {
5
+ key: 1,
6
6
  class: "of-side-panel__header"
7
- }, D = {
7
+ }, X = {
8
8
  key: 0,
9
9
  class: "of-side-panel__title"
10
- }, F = {
10
+ }, x = {
11
11
  key: 1,
12
12
  class: "of-side-panel__title-placeholder"
13
- }, L = { class: "of-side-panel__body" }, K = ["aria-label"], M = {
14
- key: 0,
13
+ }, K = { class: "of-side-panel__body" }, j = ["aria-label"], q = {
14
+ key: 1,
15
15
  class: "of-side-panel__header"
16
- }, U = {
16
+ }, A = {
17
17
  key: 0,
18
18
  class: "of-side-panel__title"
19
- }, X = {
19
+ }, G = {
20
20
  key: 1,
21
21
  class: "of-side-panel__title-placeholder"
22
- }, j = { class: "of-side-panel__body" }, I = /* @__PURE__ */ _({
22
+ }, H = { class: "of-side-panel__body" }, Q = /* @__PURE__ */ B({
23
23
  __name: "SidePanel",
24
24
  props: {
25
25
  modelValue: { type: Boolean },
26
26
  width: { default: 500 },
27
27
  title: { default: void 0 },
28
28
  showClose: { type: Boolean, default: !0 },
29
- mode: { default: "persistent" }
29
+ mode: { default: "persistent" },
30
+ resizable: { type: Boolean, default: !1 },
31
+ minWidth: { default: 360 },
32
+ maxWidth: { default: 1320 }
30
33
  },
31
- emits: ["update:modelValue"],
32
- setup(e, { emit: k }) {
33
- const i = e, w = k, n = V(() => ({
34
- "--of-side-panel-width": `${i.width}px`
34
+ emits: ["update:modelValue", "update:width"],
35
+ setup(e, { emit: _ }) {
36
+ const a = e, r = _, u = S(() => ({
37
+ "--of-side-panel-width": `${a.width}px`
35
38
  })), {
36
- containerRef: r,
37
- activate: b,
38
- deactivate: p
39
- } = R();
40
- function c(o) {
41
- o.key === "Escape" && i.modelValue && s();
39
+ containerRef: c,
40
+ activate: z,
41
+ deactivate: V
42
+ } = N();
43
+ function f(t) {
44
+ t.key === "Escape" && a.modelValue && d();
42
45
  }
43
- C(() => {
44
- typeof document > "u" || document.addEventListener("keydown", c);
46
+ W(() => {
47
+ typeof document > "u" || document.addEventListener("keydown", f);
45
48
  }), $(
46
- () => i.modelValue,
47
- (o) => {
48
- typeof document > "u" || (document.body.style.overflow = o ? "hidden" : "", o ? b() : p());
49
+ () => a.modelValue,
50
+ (t) => {
51
+ typeof document > "u" || (document.body.style.overflow = t ? "hidden" : "", t ? z() : V());
49
52
  },
50
53
  { immediate: !0 }
51
- ), B(() => {
52
- typeof document > "u" || (document.removeEventListener("keydown", c), document.body.style.overflow = "");
54
+ ), L(() => {
55
+ typeof document > "u" || (document.removeEventListener("keydown", f), document.body.style.overflow = "");
53
56
  });
54
- function s() {
55
- w("update:modelValue", !1);
57
+ function d() {
58
+ r("update:modelValue", !1);
56
59
  }
57
- return (o, q) => (t(), S(E, { to: "body" }, [
58
- e.mode === "lazy" ? (t(), l(g, { key: 0 }, [
59
- e.modelValue ? (t(), l("aside", {
60
+ function C(t) {
61
+ return Math.max(a.minWidth, Math.min(a.maxWidth, t));
62
+ }
63
+ function m(t) {
64
+ if (!a.resizable || typeof window > "u") return;
65
+ t.preventDefault();
66
+ const s = (E) => {
67
+ const P = C(window.innerWidth - E.clientX);
68
+ r("update:width", P);
69
+ }, h = () => {
70
+ window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", h);
71
+ };
72
+ window.addEventListener("pointermove", s), window.addEventListener("pointerup", h, { once: !0 });
73
+ }
74
+ return (t, s) => (o(), R(g, { to: "body" }, [
75
+ e.mode === "lazy" ? (o(), l(M, { key: 0 }, [
76
+ e.modelValue ? (o(), l("aside", {
60
77
  key: 0,
61
78
  ref_key: "sidePanelRef",
62
- ref: r,
79
+ ref: c,
63
80
  class: "of-side-panel",
64
- style: u(n.value),
81
+ style: y(u.value),
65
82
  role: "dialog",
66
83
  "aria-modal": "true",
67
84
  "aria-label": e.title
68
85
  }, [
69
- o.$slots.header || e.title || e.showClose ? (t(), l("div", N, [
70
- d(o.$slots, "header", {}, () => [
71
- e.title ? (t(), l("h3", D, f(e.title), 1)) : (t(), l("div", F))
86
+ e.resizable ? (o(), l("button", {
87
+ key: 0,
88
+ type: "button",
89
+ class: "of-side-panel__resize-handle",
90
+ "aria-label": "调整面板宽度",
91
+ onPointerdown: m
92
+ }, null, 32)) : n("", !0),
93
+ t.$slots.header || e.title || e.showClose ? (o(), l("div", U, [
94
+ i(t.$slots, "header", {}, () => [
95
+ e.title ? (o(), l("h3", X, v(e.title), 1)) : (o(), l("div", x))
72
96
  ], !0),
73
- e.showClose ? (t(), l("button", {
97
+ e.showClose ? (o(), l("button", {
74
98
  key: 0,
75
99
  class: "of-side-panel__close",
76
100
  type: "button",
77
101
  "aria-label": "关闭",
78
- onClick: s
102
+ onClick: d
79
103
  }, [
80
- m(y(v), { size: 18 })
81
- ])) : a("", !0)
82
- ])) : a("", !0),
83
- h("div", L, [
84
- d(o.$slots, "default", {}, void 0, !0)
104
+ w(p(k), { size: 18 })
105
+ ])) : n("", !0)
106
+ ])) : n("", !0),
107
+ b("div", K, [
108
+ i(t.$slots, "default", {}, void 0, !0)
85
109
  ])
86
- ], 12, T)) : a("", !0)
87
- ], 64)) : z((t(), l("aside", {
110
+ ], 12, F)) : n("", !0)
111
+ ], 64)) : T((o(), l("aside", {
88
112
  key: 1,
89
113
  ref_key: "sidePanelRef",
90
- ref: r,
114
+ ref: c,
91
115
  class: "of-side-panel",
92
- style: u(n.value),
116
+ style: y(u.value),
93
117
  role: "dialog",
94
118
  "aria-modal": "true",
95
119
  "aria-label": e.title
96
120
  }, [
97
- o.$slots.header || e.title || e.showClose ? (t(), l("div", M, [
98
- d(o.$slots, "header", {}, () => [
99
- e.title ? (t(), l("h3", U, f(e.title), 1)) : (t(), l("div", X))
121
+ e.resizable ? (o(), l("button", {
122
+ key: 0,
123
+ type: "button",
124
+ class: "of-side-panel__resize-handle",
125
+ "aria-label": "调整面板宽度",
126
+ onPointerdown: m
127
+ }, null, 32)) : n("", !0),
128
+ t.$slots.header || e.title || e.showClose ? (o(), l("div", q, [
129
+ i(t.$slots, "header", {}, () => [
130
+ e.title ? (o(), l("h3", A, v(e.title), 1)) : (o(), l("div", G))
100
131
  ], !0),
101
- e.showClose ? (t(), l("button", {
132
+ e.showClose ? (o(), l("button", {
102
133
  key: 0,
103
134
  class: "of-side-panel__close",
104
135
  type: "button",
105
136
  "aria-label": "关闭",
106
- onClick: s
137
+ onClick: d
107
138
  }, [
108
- m(y(v), { size: 18 })
109
- ])) : a("", !0)
110
- ])) : a("", !0),
111
- h("div", j, [
112
- d(o.$slots, "default", {}, void 0, !0)
139
+ w(p(k), { size: 18 })
140
+ ])) : n("", !0)
141
+ ])) : n("", !0),
142
+ b("div", H, [
143
+ i(t.$slots, "default", {}, void 0, !0)
113
144
  ])
114
- ], 12, K)), [
115
- [P, e.modelValue]
145
+ ], 12, j)), [
146
+ [D, e.modelValue]
116
147
  ])
117
148
  ]));
118
149
  }
119
150
  });
120
151
  export {
121
- I as default
152
+ Q as default
122
153
  };
@@ -2,11 +2,17 @@ import { FieldDef as CellFieldDef } from './FieldCell.vue';
2
2
  import { Density, Task, TableColumn, ColorMap, DataRecord, TableSchema, ViewConfig, ActiveCell, AggregationConfig, GroupConfig } from '../../types';
3
3
  export interface BulkActionItem {
4
4
  key: string;
5
- label: string;
5
+ label: string | ((context: BulkActionContext<unknown>) => string);
6
6
  variant?: "default" | "danger";
7
- disabled?: boolean;
7
+ disabled?: boolean | ((context: BulkActionContext<unknown>) => boolean);
8
+ visible?: boolean | ((context: BulkActionContext<unknown>) => boolean);
8
9
  clearSelectionAfter?: boolean;
9
10
  }
11
+ export interface BulkActionContext<TRecord = DataRecord> {
12
+ selectionCount: number;
13
+ rowIds: string[];
14
+ rows: TRecord[];
15
+ }
10
16
  declare const _default: <T extends {
11
17
  id: string;
12
18
  } & Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
@@ -1,7 +1,7 @@
1
1
  import o from "./DataTable.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-c743201c"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-64e01b4b"]]);
5
5
  export {
6
6
  m as default
7
7
  };