@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.
- package/README.en.md +219 -0
- package/README.md +219 -0
- package/dist/components/ai/AiMessageList.vue.js +1 -1
- package/dist/components/ai/AiMessageList.vue2.js +28 -27
- package/dist/components/common/ThemeScope.vue.d.ts +24 -0
- package/dist/components/common/ThemeScope.vue.js +24 -0
- package/dist/components/common/ThemeScope.vue2.js +4 -0
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/database/DatabaseView.vue.d.ts +4 -4
- package/dist/components/database/DatabaseView.vue.js +4 -4
- package/dist/components/database/DatabaseView.vue2.js +135 -134
- package/dist/components/database/index.d.ts +1 -1
- package/dist/components/kanban/KanbanColumn.vue.js +3 -3
- package/dist/components/kanban/KanbanColumn.vue2.js +31 -30
- package/dist/components/table/DataTable.vue.js +4 -4
- package/dist/components/table/DataTable.vue2.js +533 -504
- package/dist/components/table/FieldCell.vue.d.ts +6 -0
- package/dist/components/table/FieldCell.vue.js +2 -2
- package/dist/components/table/FieldCell.vue2.js +48 -41
- package/dist/composables/index.d.ts +5 -3
- package/dist/composables/useDataTableLayout.d.ts +1 -0
- package/dist/composables/useDataTableLayout.js +29 -26
- package/dist/composables/useDatabaseView.d.ts +1 -1
- package/dist/composables/useDatabaseView.js +311 -284
- package/dist/composables/useDatabaseViewMiddleware.d.ts +33 -0
- package/dist/composables/useDatabaseViewMiddleware.js +131 -0
- package/dist/composables/useVirtualList.d.ts +11 -0
- package/dist/composables/useVirtualList.js +146 -104
- package/dist/composables.js +71 -0
- package/dist/contracts/database.d.ts +23 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +259 -250
- package/dist/style.css +1 -1
- package/dist/theme.d.ts +1 -0
- package/dist/theme.js +4 -0
- 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
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-22598b04"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
import { defineComponent as F, computed as
|
|
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
|
-
},
|
|
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(
|
|
16
|
-
const t =
|
|
17
|
-
function
|
|
18
|
-
n.value
|
|
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
|
|
21
|
-
|
|
27
|
+
function E(i) {
|
|
28
|
+
h(t.rowId, t.field.id, i), r("commit", t.rowId, t.field.id, i);
|
|
22
29
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
30
|
+
function I() {
|
|
31
|
+
t.editing === void 0 && k(), r("request-cancel"), r("cancel");
|
|
25
32
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
33
|
+
function A() {
|
|
34
|
+
r("tabNext");
|
|
28
35
|
}
|
|
29
|
-
const
|
|
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
|
-
),
|
|
51
|
-
const
|
|
52
|
-
return
|
|
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 (
|
|
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":
|
|
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 ||
|
|
61
|
-
"aria-label": `${
|
|
62
|
-
title: n.value ? void 0 : `点击编辑 ${
|
|
63
|
-
onClick:
|
|
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(
|
|
66
|
-
p(v(
|
|
72
|
+
p(v(u, ["prevent"]), ["enter"]),
|
|
73
|
+
p(v(u, ["prevent"]), ["space"])
|
|
67
74
|
]
|
|
68
75
|
}, {
|
|
69
|
-
default:
|
|
70
|
-
|
|
71
|
-
fallback:
|
|
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:
|
|
75
|
-
(
|
|
76
|
-
value:
|
|
77
|
-
field:
|
|
78
|
-
onCommit:
|
|
79
|
-
onCancel:
|
|
80
|
-
onTabNext:
|
|
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
|
-
})) : (
|
|
85
|
-
|
|
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:
|
|
94
|
+
content: l.value,
|
|
88
95
|
"max-lines": 2
|
|
89
|
-
}, null, 8, ["content"])) : (
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
4
|
-
const { tableContainerRef:
|
|
5
|
-
let
|
|
6
|
-
function
|
|
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
|
-
|
|
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
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
19
|
-
"--of-data-table-group-row-height": `${
|
|
20
|
-
"--of-data-table-mobile-card-padding-x": `${
|
|
21
|
-
"--of-data-table-mobile-card-padding-y": `${
|
|
22
|
-
"--of-data-table-new-row-padding-x": `${
|
|
23
|
-
"--of-data-table-new-row-padding-y": `${
|
|
24
|
-
"--of-data-table-fill-min-width": `${
|
|
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:
|
|
29
|
-
densityMetrics:
|
|
30
|
-
densityClass:
|
|
31
|
-
containerWidthClass:
|
|
32
|
-
densityStyle:
|
|
33
|
-
syncTableContainerWidth:
|
|
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
|
-
|
|
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>;
|