@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
@@ -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 f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-6f065a71"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-33d4366a"]]);
5
5
  export {
6
- f as default
6
+ m as default
7
7
  };
@@ -1,121 +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
- 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
- }
50
- ), B(() => {
51
- typeof document > "u" || (document.removeEventListener("keydown", c), document.body.style.overflow = "");
49
+ () => a.modelValue,
50
+ (t) => {
51
+ typeof document > "u" || (document.body.style.overflow = t ? "hidden" : "", t ? z() : V());
52
+ },
53
+ { immediate: !0 }
54
+ ), L(() => {
55
+ typeof document > "u" || (document.removeEventListener("keydown", f), document.body.style.overflow = "");
52
56
  });
53
- function s() {
54
- w("update:modelValue", !1);
57
+ function d() {
58
+ r("update:modelValue", !1);
55
59
  }
56
- return (o, q) => (t(), S(E, { to: "body" }, [
57
- e.mode === "lazy" ? (t(), l(g, { key: 0 }, [
58
- 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", {
59
77
  key: 0,
60
78
  ref_key: "sidePanelRef",
61
- ref: r,
79
+ ref: c,
62
80
  class: "of-side-panel",
63
- style: u(n.value),
81
+ style: y(u.value),
64
82
  role: "dialog",
65
83
  "aria-modal": "true",
66
84
  "aria-label": e.title
67
85
  }, [
68
- o.$slots.header || e.title || e.showClose ? (t(), l("div", N, [
69
- d(o.$slots, "header", {}, () => [
70
- 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))
71
96
  ], !0),
72
- e.showClose ? (t(), l("button", {
97
+ e.showClose ? (o(), l("button", {
73
98
  key: 0,
74
99
  class: "of-side-panel__close",
75
100
  type: "button",
76
101
  "aria-label": "关闭",
77
- onClick: s
102
+ onClick: d
78
103
  }, [
79
- m(y(v), { size: 18 })
80
- ])) : a("", !0)
81
- ])) : a("", !0),
82
- h("div", L, [
83
- 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)
84
109
  ])
85
- ], 12, T)) : a("", !0)
86
- ], 64)) : z((t(), l("aside", {
110
+ ], 12, F)) : n("", !0)
111
+ ], 64)) : T((o(), l("aside", {
87
112
  key: 1,
88
113
  ref_key: "sidePanelRef",
89
- ref: r,
114
+ ref: c,
90
115
  class: "of-side-panel",
91
- style: u(n.value),
116
+ style: y(u.value),
92
117
  role: "dialog",
93
118
  "aria-modal": "true",
94
119
  "aria-label": e.title
95
120
  }, [
96
- o.$slots.header || e.title || e.showClose ? (t(), l("div", M, [
97
- d(o.$slots, "header", {}, () => [
98
- 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))
99
131
  ], !0),
100
- e.showClose ? (t(), l("button", {
132
+ e.showClose ? (o(), l("button", {
101
133
  key: 0,
102
134
  class: "of-side-panel__close",
103
135
  type: "button",
104
136
  "aria-label": "关闭",
105
- onClick: s
137
+ onClick: d
106
138
  }, [
107
- m(y(v), { size: 18 })
108
- ])) : a("", !0)
109
- ])) : a("", !0),
110
- h("div", j, [
111
- 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)
112
144
  ])
113
- ], 12, K)), [
114
- [P, e.modelValue]
145
+ ], 12, j)), [
146
+ [D, e.modelValue]
115
147
  ])
116
148
  ]));
117
149
  }
118
150
  });
119
151
  export {
120
- I as default
152
+ Q as default
121
153
  };
@@ -1,5 +1,18 @@
1
1
  import { FieldDef as CellFieldDef } from './FieldCell.vue';
2
2
  import { Density, Task, TableColumn, ColorMap, DataRecord, TableSchema, ViewConfig, ActiveCell, AggregationConfig, GroupConfig } from '../../types';
3
+ export interface BulkActionItem {
4
+ key: string;
5
+ label: string | ((context: BulkActionContext<unknown>) => string);
6
+ variant?: "default" | "danger";
7
+ disabled?: boolean | ((context: BulkActionContext<unknown>) => boolean);
8
+ visible?: boolean | ((context: BulkActionContext<unknown>) => boolean);
9
+ clearSelectionAfter?: boolean;
10
+ }
11
+ export interface BulkActionContext<TRecord = DataRecord> {
12
+ selectionCount: number;
13
+ rowIds: string[];
14
+ rows: TRecord[];
15
+ }
3
16
  declare const _default: <T extends {
4
17
  id: string;
5
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<{
@@ -55,7 +68,12 @@ declare const _default: <T extends {
55
68
  readonly "onSchema-hide-field"?: ((fieldId: string) => any) | undefined;
56
69
  readonly "onSchema-delete-field"?: ((fieldId: string) => any) | undefined;
57
70
  readonly "onSchema-duplicate-field"?: ((fieldId: string) => any) | undefined;
58
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onPaste" | "onRow-click" | "onAdd-row" | "onCell-edit" | "onRow-click-record" | "onSelection-change" | "onColumn-resize" | "onActive-cell-change" | "onRow-reorder" | "onRow-group-change" | "onDraft-commit" | "onDraft-discard" | "onDrafts-commit-all" | "onRow-delete" | "onSchema-add-field" | "onSchema-rename-field" | "onSchema-change-field-type" | "onSchema-hide-field" | "onSchema-delete-field" | "onSchema-duplicate-field"> & {
71
+ readonly "onBulk-action"?: ((payload: {
72
+ actionKey: string;
73
+ rowIds: string[];
74
+ rows: (T | DataRecord)[];
75
+ }) => any) | undefined;
76
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onPaste" | "onRow-click" | "onAdd-row" | "onCell-edit" | "onRow-click-record" | "onSelection-change" | "onColumn-resize" | "onActive-cell-change" | "onRow-reorder" | "onRow-group-change" | "onDraft-commit" | "onDraft-discard" | "onDrafts-commit-all" | "onRow-delete" | "onSchema-add-field" | "onSchema-rename-field" | "onSchema-change-field-type" | "onSchema-hide-field" | "onSchema-delete-field" | "onSchema-duplicate-field" | "onBulk-action"> & {
59
77
  tasks?: Task[];
60
78
  records?: DataRecord[];
61
79
  schema?: TableSchema;
@@ -90,6 +108,14 @@ declare const _default: <T extends {
90
108
  enableFieldManagement?: boolean;
91
109
  /** Density preset used for table, list, and detail affordances */
92
110
  density?: Density;
111
+ /** 显示默认行级快捷操作 */
112
+ showRowActions?: boolean;
113
+ /** 显示批量操作条 */
114
+ showSelectionBar?: boolean;
115
+ /** 批量操作定义,默认仅提供清空选择 */
116
+ bulkActionItems?: BulkActionItem[];
117
+ /** 开启表格容器感知密度收缩 */
118
+ containerResponsive?: boolean;
93
119
  } & Partial<{}>> & import('vue').PublicProps;
94
120
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
95
121
  attrs: any;
@@ -168,7 +194,11 @@ declare const _default: <T extends {
168
194
  }) => void) & ((evt: "schema-change-field-type", payload: {
169
195
  fieldId: string;
170
196
  newType: string;
171
- }) => void) & ((evt: "schema-hide-field", fieldId: string) => void) & ((evt: "schema-delete-field", fieldId: string) => void) & ((evt: "schema-duplicate-field", fieldId: string) => void);
197
+ }) => void) & ((evt: "schema-hide-field", fieldId: string) => void) & ((evt: "schema-delete-field", fieldId: string) => void) & ((evt: "schema-duplicate-field", fieldId: string) => void) & ((evt: "bulk-action", payload: {
198
+ actionKey: string;
199
+ rowIds: string[];
200
+ rows: (T | DataRecord)[];
201
+ }) => void);
172
202
  }>) => import('vue').VNode & {
173
203
  __ctx?: Awaited<typeof __VLS_setup>;
174
204
  };
@@ -1,7 +1,7 @@
1
- import a from "./DataTable.vue2.js";
1
+ import o from "./DataTable.vue2.js";
2
2
  /* empty css */
3
- import o from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ o(a, [["__scopeId", "data-v-1fb9662a"]]);
3
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-64e01b4b"]]);
5
5
  export {
6
6
  m as default
7
7
  };