@oneflowui/ui 0.8.3 → 0.8.5

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 (36) hide show
  1. package/README.en.md +219 -0
  2. package/README.md +219 -0
  3. package/dist/components/ai/AiMessageList.vue.js +1 -1
  4. package/dist/components/ai/AiMessageList.vue2.js +28 -27
  5. package/dist/components/common/ThemeScope.vue.d.ts +24 -0
  6. package/dist/components/common/ThemeScope.vue.js +24 -0
  7. package/dist/components/common/ThemeScope.vue2.js +4 -0
  8. package/dist/components/common/index.d.ts +1 -0
  9. package/dist/components/database/DatabaseView.vue.d.ts +4 -4
  10. package/dist/components/database/DatabaseView.vue.js +4 -4
  11. package/dist/components/database/DatabaseView.vue2.js +135 -134
  12. package/dist/components/database/index.d.ts +1 -1
  13. package/dist/components/kanban/KanbanColumn.vue.js +3 -3
  14. package/dist/components/kanban/KanbanColumn.vue2.js +31 -30
  15. package/dist/components/table/DataTable.vue.js +4 -4
  16. package/dist/components/table/DataTable.vue2.js +533 -504
  17. package/dist/components/table/FieldCell.vue.d.ts +6 -0
  18. package/dist/components/table/FieldCell.vue.js +2 -2
  19. package/dist/components/table/FieldCell.vue2.js +48 -41
  20. package/dist/composables/index.d.ts +5 -3
  21. package/dist/composables/useDataTableLayout.d.ts +1 -0
  22. package/dist/composables/useDataTableLayout.js +29 -26
  23. package/dist/composables/useDatabaseView.d.ts +1 -1
  24. package/dist/composables/useDatabaseView.js +311 -284
  25. package/dist/composables/useDatabaseViewMiddleware.d.ts +33 -0
  26. package/dist/composables/useDatabaseViewMiddleware.js +131 -0
  27. package/dist/composables/useVirtualList.d.ts +11 -0
  28. package/dist/composables/useVirtualList.js +146 -104
  29. package/dist/composables.js +71 -0
  30. package/dist/contracts/database.d.ts +23 -0
  31. package/dist/index.d.ts +6 -3
  32. package/dist/index.js +259 -250
  33. package/dist/style.css +1 -1
  34. package/dist/theme.d.ts +1 -0
  35. package/dist/theme.js +4 -0
  36. package/package.json +16 -2
@@ -18,17 +18,23 @@ type __VLS_Props = {
18
18
  field: FieldDef;
19
19
  value?: CellValue;
20
20
  readonly?: boolean;
21
+ editing?: boolean;
21
22
  };
22
23
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
23
24
  cancel: () => any;
24
25
  commit: (rowId: string, fieldId: string, value: CellValue) => any;
25
26
  tabNext: () => any;
27
+ "request-cancel": () => any;
28
+ "request-edit": (rowId: string, fieldId: string) => any;
26
29
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
27
30
  onCancel?: (() => any) | undefined;
28
31
  onCommit?: ((rowId: string, fieldId: string, value: CellValue) => any) | undefined;
29
32
  onTabNext?: (() => any) | undefined;
33
+ "onRequest-cancel"?: (() => any) | undefined;
34
+ "onRequest-edit"?: ((rowId: string, fieldId: string) => any) | undefined;
30
35
  }>, {
31
36
  value: string | number | boolean | string[] | null;
37
+ editing: boolean;
32
38
  readonly: boolean;
33
39
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
34
40
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import o from "./FieldCell.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-6062f0e7"]]);
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-22598b04"]]);
5
5
  export {
6
- m as default
6
+ p as default
7
7
  };
@@ -1,32 +1,39 @@
1
- import { defineComponent as F, computed as a, defineAsyncComponent as e, openBlock as o, createBlock as d, resolveDynamicComponent as s, withKeys as p, withModifiers as v, normalizeClass as K, withCtx as u, Suspense as M, createElementVNode as D, createElementBlock as y, Fragment as T, unref as V, toDisplayString as $ } from "vue";
1
+ import { defineComponent as F, computed as o, defineAsyncComponent as e, openBlock as a, createBlock as c, resolveDynamicComponent as s, withKeys as p, withModifiers as v, normalizeClass as K, withCtx as m, Suspense as M, createElementVNode as D, createElementBlock as y, Fragment as T, unref as V, toDisplayString as $ } from "vue";
2
2
  import { useInlineEdit as j } from "../../composables/useInlineEdit.js";
3
3
  const z = {
4
4
  key: 1,
5
5
  class: "of-field-cell__display"
6
- }, q = /* @__PURE__ */ F({
6
+ }, G = /* @__PURE__ */ F({
7
7
  __name: "FieldCell",
8
8
  props: {
9
9
  rowId: {},
10
10
  field: {},
11
11
  value: { type: [String, Number, Boolean, Array, null], default: void 0 },
12
- readonly: { type: Boolean, default: !1 }
12
+ readonly: { type: Boolean, default: !1 },
13
+ editing: { type: Boolean, default: void 0 }
13
14
  },
14
- emits: ["commit", "cancel", "tabNext"],
15
- setup(i, { emit: b }) {
16
- const t = i, c = b, { isEditing: h, activate: k, commit: w, cancel: x } = j(), r = a(() => h(t.rowId, t.field.id)), n = a(() => t.readonly || t.field.readonly), C = a(() => !n.value);
17
- function m() {
18
- n.value || k(t.rowId, t.field.id);
15
+ emits: ["commit", "cancel", "request-cancel", "tabNext", "request-edit"],
16
+ setup(l, { emit: b }) {
17
+ const t = l, r = b, { isEditing: g, activate: w, commit: h, cancel: k } = j(), x = o(() => g(t.rowId, t.field.id)), d = o(() => t.editing ?? x.value), n = o(() => t.readonly || t.field.readonly), C = o(() => !n.value);
18
+ function u() {
19
+ if (!n.value) {
20
+ if (t.editing !== void 0) {
21
+ r("request-edit", t.rowId, t.field.id);
22
+ return;
23
+ }
24
+ w(t.rowId, t.field.id);
25
+ }
19
26
  }
20
- function g(l) {
21
- w(t.rowId, t.field.id, l), c("commit", t.rowId, t.field.id, l);
27
+ function E(i) {
28
+ h(t.rowId, t.field.id, i), r("commit", t.rowId, t.field.id, i);
22
29
  }
23
- function A() {
24
- x(), c("cancel");
30
+ function I() {
31
+ t.editing === void 0 && k(), r("request-cancel"), r("cancel");
25
32
  }
26
- function E() {
27
- c("tabNext");
33
+ function A() {
34
+ r("tabNext");
28
35
  }
29
- const I = {
36
+ const B = {
30
37
  text: e(() => import("../field/FieldText.vue.js")),
31
38
  number: e(() => import("../field/FieldNumber.vue.js")),
32
39
  checkbox: e(() => import("../field/FieldCheckbox.vue.js")),
@@ -47,46 +54,46 @@ const z = {
47
54
  phone: e(() => import("../field/FieldPhone.vue.js"))
48
55
  }, N = e(
49
56
  () => import("../field/FieldMarkdownPreview.vue.js")
50
- ), B = a(() => I[t.field.type]), S = a(() => {
51
- const l = t.value;
52
- return l == null || l === "" ? "—" : Array.isArray(l) ? l.join(", ") : typeof l == "boolean" ? l ? "✓" : "—" : String(l);
57
+ ), q = o(() => B[t.field.type]), S = o(() => {
58
+ const i = t.value;
59
+ return i == null || i === "" ? "—" : Array.isArray(i) ? i.join(", ") : typeof i == "boolean" ? i ? "✓" : "—" : String(i);
53
60
  });
54
- return (l, f) => (o(), d(s(n.value || r.value ? "div" : "button"), {
61
+ return (i, f) => (a(), c(s(n.value || d.value ? "div" : "button"), {
55
62
  class: K(["of-field-cell", {
56
- "of-field-cell--editing": r.value,
63
+ "of-field-cell--editing": d.value,
57
64
  "of-field-cell--readonly": n.value,
58
65
  "of-field-cell--actionable": C.value
59
66
  }]),
60
- type: n.value || r.value ? void 0 : "button",
61
- "aria-label": `${i.field.label}字段`,
62
- title: n.value ? void 0 : `点击编辑 ${i.field.label}`,
63
- onClick: m,
67
+ type: n.value || d.value ? void 0 : "button",
68
+ "aria-label": `${l.field.label}字段`,
69
+ title: n.value ? void 0 : `点击编辑 ${l.field.label}`,
70
+ onClick: u,
64
71
  onKeydown: [
65
- p(v(m, ["prevent"]), ["enter"]),
66
- p(v(m, ["prevent"]), ["space"])
72
+ p(v(u, ["prevent"]), ["enter"]),
73
+ p(v(u, ["prevent"]), ["space"])
67
74
  ]
68
75
  }, {
69
- default: u(() => [
70
- r.value ? (o(), d(M, { key: 0 }, {
71
- fallback: u(() => [...f[0] || (f[0] = [
76
+ default: m(() => [
77
+ d.value ? (a(), c(M, { key: 0 }, {
78
+ fallback: m(() => [...f[0] || (f[0] = [
72
79
  D("span", { class: "of-field-cell__loading" }, "...", -1)
73
80
  ])]),
74
- default: u(() => [
75
- (o(), d(s(B.value), {
76
- value: i.value,
77
- field: i.field,
78
- onCommit: g,
79
- onCancel: A,
80
- onTabNext: E
81
+ default: m(() => [
82
+ (a(), c(s(q.value), {
83
+ value: l.value,
84
+ field: l.field,
85
+ onCommit: E,
86
+ onCancel: I,
87
+ onTabNext: A
81
88
  }, null, 40, ["value", "field"]))
82
89
  ]),
83
90
  _: 1
84
- })) : (o(), y(T, { key: 1 }, [
85
- i.field.type === "richtext" && typeof i.value == "string" && i.value ? (o(), d(V(N), {
91
+ })) : (a(), y(T, { key: 1 }, [
92
+ l.field.type === "richtext" && typeof l.value == "string" && l.value ? (a(), c(V(N), {
86
93
  key: 0,
87
- content: i.value,
94
+ content: l.value,
88
95
  "max-lines": 2
89
- }, null, 8, ["content"])) : (o(), y("span", z, $(S.value), 1))
96
+ }, null, 8, ["content"])) : (a(), y("span", z, $(S.value), 1))
90
97
  ], 64))
91
98
  ]),
92
99
  _: 1
@@ -94,5 +101,5 @@ const z = {
94
101
  }
95
102
  });
96
103
  export {
97
- q as default
104
+ G as default
98
105
  };
@@ -14,8 +14,8 @@ export { useMarkdown } from './useMarkdown';
14
14
  export type { UseMarkdownOptions } from './useMarkdown';
15
15
  export { useInlineEdit } from './useInlineEdit';
16
16
  export type { EditingCell } from './useInlineEdit';
17
- export { useVirtualList } from './useVirtualList';
18
- export type { UseVirtualListOptions, VirtualItem } from './useVirtualList';
17
+ export { createVirtualListState, useVirtualList, useVirtualListStateCache } from './useVirtualList';
18
+ export type { UseVirtualListOptions, VirtualItem, VirtualListState } from './useVirtualList';
19
19
  export { useToast } from './useToast';
20
20
  export type { UseToastOptions, ToastType, ToastItem } from './useToast';
21
21
  export { useTableData } from './useTableData';
@@ -45,7 +45,9 @@ export type { SupabaseQueryBuilder, SupabaseFilterBuilder, UseSupabaseProviderOp
45
45
  export { useViewPersistence, createLocalStorageBackend, createSupabaseBackend, } from './useViewPersistence';
46
46
  export type { ViewStorageBackend, SupabaseViewBackendOptions, UseViewPersistenceOptions, } from './useViewPersistence';
47
47
  export { useDatabaseView } from './useDatabaseView';
48
- export type { DatabaseViewMode, DatabaseViewFetchParams, DatabaseViewFetchResult, DatabaseViewProvider, DatabaseSchemaEvent, DatabaseViewActions, DatabaseViewDetailOptions, DatabaseViewNavigationOptions, UseDatabaseViewOptions, UseDatabaseViewResult, } from './useDatabaseView';
48
+ export { composeDatabaseViewMiddlewares, createDatabaseViewAnalyticsMiddleware, createDatabaseViewToastMiddleware, createDatabaseViewOptimisticMiddleware, } from './useDatabaseViewMiddleware';
49
+ export type { DatabaseViewActionContext, DatabaseViewActionErrorContext, DatabaseViewActionMiddleware, DatabaseViewActionMiddlewareList, DatabaseViewMode, DatabaseViewFetchParams, DatabaseViewFetchResult, DatabaseViewProvider, DatabaseSchemaEvent, DatabaseViewActions, DatabaseViewDetailOptions, DatabaseViewNavigationOptions, UseDatabaseViewOptions, UseDatabaseViewResult, } from './useDatabaseView';
50
+ export type { DatabaseViewAnalyticsEvent, DatabaseViewAnalyticsMiddlewareOptions, DatabaseViewMiddlewareInput, DatabaseViewOptimisticMiddlewareOptions, DatabaseViewToastMiddlewareOptions, } from './useDatabaseViewMiddleware';
49
51
  export { useDatabaseViewport, useDatabaseWorkspaceState } from './useDatabaseWorkspace';
50
52
  export { useSearch } from './useSearch';
51
53
  export type { UseSearchOptions, SearchHighlight } from './useSearch';
@@ -5,6 +5,7 @@ export declare function useDataTableLayout(params: {
5
5
  density: Ref<Density>;
6
6
  containerResponsive: Ref<boolean>;
7
7
  isMobile: Ref<boolean>;
8
+ onContainerWidthChange?: (width: number) => void;
8
9
  }): {
9
10
  tableContainerWidth: Ref<number, number>;
10
11
  containerDensity: import('vue').ComputedRef<Density>;
@@ -1,38 +1,41 @@
1
- import { ref as m, onMounted as g, onBeforeUnmount as y, computed as n } from "vue";
1
+ import { ref as x, onMounted as g, onBeforeUnmount as w, computed as o } from "vue";
2
2
  import { TABLE_DENSITY_METRICS as h } from "../types/data-table.js";
3
- function x(c) {
4
- const { tableContainerRef: o, density: l, containerResponsive: f, isMobile: v } = c, e = m(0);
5
- let t = null;
6
- function d() {
3
+ function M(v) {
4
+ const { tableContainerRef: r, density: u, containerResponsive: s, isMobile: b, onContainerWidthChange: a } = v, e = x(0);
5
+ let n = null;
6
+ function f() {
7
7
  var i;
8
- e.value = ((i = o.value) == null ? void 0 : i.clientWidth) ?? 0;
8
+ const l = ((i = r.value) == null ? void 0 : i.clientWidth) ?? 0;
9
+ l !== e.value && (e.value = l, a == null || a(l));
9
10
  }
10
11
  g(() => {
11
- d(), !(typeof ResizeObserver > "u" || !o.value) && (t = new ResizeObserver((i) => {
12
- const u = i[0];
13
- u && (e.value = u.contentRect.width);
14
- }), t.observe(o.value));
15
- }), y(() => {
16
- t == null || t.disconnect(), t = null;
12
+ f(), !(typeof ResizeObserver > "u" || !r.value) && (n = new ResizeObserver((l) => {
13
+ const i = l[0];
14
+ if (!i) return;
15
+ const c = i.contentRect.width;
16
+ c !== e.value && (e.value = c, a == null || a(c));
17
+ }), n.observe(r.value));
18
+ }), w(() => {
19
+ n == null || n.disconnect(), n = null;
17
20
  });
18
- const r = n(() => !f.value || v.value ? l.value : e.value > 0 && e.value <= 860 ? "compact" : e.value > 0 && e.value <= 1080 && l.value === "comfortable" ? "standard" : l.value), a = n(() => h[r.value]), s = n(() => `of-data-table--${r.value}`), b = n(() => e.value > 0 && e.value <= 860 ? "of-data-table--container-tight" : e.value > 0 && e.value <= 1080 ? "of-data-table--container-medium" : "of-data-table--container-wide"), p = n(() => ({
19
- "--of-data-table-group-row-height": `${a.value.groupRowHeight}px`,
20
- "--of-data-table-mobile-card-padding-x": `${a.value.mobileCardPaddingX}px`,
21
- "--of-data-table-mobile-card-padding-y": `${a.value.mobileCardPaddingY}px`,
22
- "--of-data-table-new-row-padding-x": `${a.value.mobileCardPaddingX}px`,
23
- "--of-data-table-new-row-padding-y": `${a.value.mobileCardPaddingY}px`,
24
- "--of-data-table-fill-min-width": `${a.value.fillMinWidth}px`
21
+ const d = o(() => !s.value || b.value ? u.value : e.value > 0 && e.value <= 860 ? "compact" : e.value > 0 && e.value <= 1080 && u.value === "comfortable" ? "standard" : u.value), t = o(() => h[d.value]), p = o(() => `of-data-table--${d.value}`), m = o(() => e.value > 0 && e.value <= 860 ? "of-data-table--container-tight" : e.value > 0 && e.value <= 1080 ? "of-data-table--container-medium" : "of-data-table--container-wide"), y = o(() => ({
22
+ "--of-data-table-group-row-height": `${t.value.groupRowHeight}px`,
23
+ "--of-data-table-mobile-card-padding-x": `${t.value.mobileCardPaddingX}px`,
24
+ "--of-data-table-mobile-card-padding-y": `${t.value.mobileCardPaddingY}px`,
25
+ "--of-data-table-new-row-padding-x": `${t.value.mobileCardPaddingX}px`,
26
+ "--of-data-table-new-row-padding-y": `${t.value.mobileCardPaddingY}px`,
27
+ "--of-data-table-fill-min-width": `${t.value.fillMinWidth}px`
25
28
  }));
26
29
  return {
27
30
  tableContainerWidth: e,
28
- containerDensity: r,
29
- densityMetrics: a,
30
- densityClass: s,
31
- containerWidthClass: b,
32
- densityStyle: p,
33
- syncTableContainerWidth: d
31
+ containerDensity: d,
32
+ densityMetrics: t,
33
+ densityClass: p,
34
+ containerWidthClass: m,
35
+ densityStyle: y,
36
+ syncTableContainerWidth: f
34
37
  };
35
38
  }
36
39
  export {
37
- x as useDataTableLayout
40
+ M as useDataTableLayout
38
41
  };
@@ -1,4 +1,4 @@
1
1
  import { DataRecord } from '../types';
2
2
  import { UseDatabaseViewOptions, UseDatabaseViewResult } from '../contracts/database';
3
- export type { DatabaseViewMode, DatabaseViewFetchParams, DatabaseViewFetchResult, DatabaseViewProvider, DatabaseSchemaEvent, DatabaseViewActions, DatabaseViewDetailOptions, DatabaseViewNavigationOptions, UseDatabaseViewOptions, UseDatabaseViewResult, } from '../contracts/database';
3
+ export type { DatabaseViewActionContext, DatabaseViewActionErrorContext, DatabaseViewActionMiddleware, DatabaseViewActionMiddlewareList, DatabaseViewMode, DatabaseViewFetchParams, DatabaseViewFetchResult, DatabaseViewProvider, DatabaseSchemaEvent, DatabaseViewActions, DatabaseViewDetailOptions, DatabaseViewNavigationOptions, UseDatabaseViewOptions, UseDatabaseViewResult, } from '../contracts/database';
4
4
  export declare function useDatabaseView<T extends DataRecord = DataRecord>(options: UseDatabaseViewOptions<T>): UseDatabaseViewResult<T>;