@oneflowui/ui 0.8.1 → 0.8.3
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/dist/components/Dashboard/charts/BarChart.vue.js +2 -2
- package/dist/components/Dashboard/charts/BarChart.vue2.js +9 -9
- package/dist/components/Dashboard/charts/NumberCard.vue.js +2 -2
- package/dist/components/Dashboard/charts/PieChart.vue.js +1 -1
- package/dist/components/Dashboard/charts/PieChart.vue2.js +3 -3
- package/dist/components/Dashboard/charts/TableChart.vue.js +2 -2
- package/dist/components/Dashboard/index.vue.js +2 -2
- package/dist/components/base/InfoCard.vue.js +1 -1
- package/dist/components/base/InfoCard.vue2.js +40 -40
- package/dist/components/base/StatisticCard.vue.js +3 -3
- package/dist/components/base/StatusSummary.vue.js +1 -1
- package/dist/components/base/StatusSummary.vue2.js +5 -5
- package/dist/components/database/DatabaseDetailPresenter.vue.d.ts +41 -0
- package/dist/components/database/DatabaseDetailPresenter.vue.js +76 -0
- package/dist/components/database/DatabaseDetailPresenter.vue2.js +4 -0
- package/dist/components/database/DatabaseDetailWorkspace.vue.d.ts +37 -0
- package/dist/components/database/DatabaseDetailWorkspace.vue.js +7 -0
- package/dist/components/database/DatabaseDetailWorkspace.vue2.js +103 -0
- package/dist/components/database/DatabaseView.vue.d.ts +13 -76
- package/dist/components/database/DatabaseView.vue.js +2 -2
- package/dist/components/database/DatabaseView.vue2.js +322 -921
- package/dist/components/database/DatabaseViewContent.vue.d.ts +74 -0
- package/dist/components/database/DatabaseViewContent.vue.js +79 -0
- package/dist/components/database/DatabaseViewContent.vue2.js +4 -0
- package/dist/components/database/DatabaseViewDetailHost.vue.d.ts +43 -0
- package/dist/components/database/DatabaseViewDetailHost.vue.js +59 -0
- package/dist/components/database/DatabaseViewDetailHost.vue2.js +4 -0
- package/dist/components/database/DatabaseViewShell.vue.d.ts +35 -0
- package/dist/components/database/DatabaseViewShell.vue.js +7 -0
- package/dist/components/database/DatabaseViewShell.vue2.js +71 -0
- package/dist/components/database/DatabaseViewToolbar.vue.d.ts +77 -0
- package/dist/components/database/DatabaseViewToolbar.vue.js +62 -0
- package/dist/components/database/DatabaseViewToolbar.vue2.js +4 -0
- package/dist/components/database/databaseViewUtils.d.ts +91 -0
- package/dist/components/database/databaseViewUtils.js +266 -0
- package/dist/components/database/index.d.ts +1 -1
- package/dist/components/kanban/KanbanColumn.vue.d.ts +2 -2
- package/dist/components/layout/AppLayout.vue.js +1 -1
- package/dist/components/layout/Navbar.vue.js +1 -1
- package/dist/components/layout/Sidebar.vue.js +2 -2
- package/dist/components/layout/StatusBar.vue.js +2 -2
- package/dist/components/overlay/Dialog.vue.d.ts +1 -1
- package/dist/components/table/ColumnHeaderMenu.vue.js +3 -3
- package/dist/components/table/DataTable.vue.d.ts +6 -17
- package/dist/components/table/DataTable.vue.js +2 -2
- package/dist/components/table/DataTable.vue2.js +781 -872
- package/dist/components/table/DataTableDesktopFixedRegion.vue.d.ts +56 -0
- package/dist/components/table/DataTableDesktopFixedRegion.vue.js +7 -0
- package/dist/components/table/DataTableDesktopFixedRegion.vue2.js +67 -0
- package/dist/components/table/DataTableDesktopFrame.vue.d.ts +127 -0
- package/dist/components/table/DataTableDesktopFrame.vue.js +7 -0
- package/dist/components/table/DataTableDesktopFrame.vue2.js +196 -0
- package/dist/components/table/DataTableDesktopScrollRegion.vue.d.ts +55 -0
- package/dist/components/table/DataTableDesktopScrollRegion.vue.js +7 -0
- package/dist/components/table/DataTableDesktopScrollRegion.vue2.js +66 -0
- package/dist/components/table/DataTableDesktopStandardRegion.vue.d.ts +54 -0
- package/dist/components/table/DataTableDesktopStandardRegion.vue.js +7 -0
- package/dist/components/table/DataTableDesktopStandardRegion.vue2.js +65 -0
- package/dist/components/table/DataTableDraftToolbar.vue.d.ts +11 -0
- package/dist/components/table/DataTableDraftToolbar.vue.js +7 -0
- package/dist/components/table/DataTableDraftToolbar.vue2.js +25 -0
- package/dist/components/table/DataTableMobilePanel.vue.d.ts +79 -0
- package/dist/components/table/DataTableMobilePanel.vue.js +60 -0
- package/dist/components/table/DataTableMobilePanel.vue2.js +4 -0
- package/dist/components/table/DataTableSelectionBar.vue.d.ts +11 -0
- package/dist/components/table/DataTableSelectionBar.vue.js +7 -0
- package/dist/components/table/DataTableSelectionBar.vue2.js +33 -0
- package/dist/components/table/DetailSheet.vue.js +1 -1
- package/dist/components/table/DetailSheet.vue2.js +160 -187
- package/dist/components/table/FieldTypePicker.vue.js +3 -3
- package/dist/components/table/MobileListView.vue.js +1 -1
- package/dist/components/table/TableColumnManager.vue.js +3 -3
- package/dist/components/table/TableDataRow.vue.js +4 -4
- package/dist/components/table/TableFilterPanel.vue.js +1 -1
- package/dist/components/table/TableGroupRow.vue.js +2 -2
- package/dist/components/table/TableHeaderRow.vue.js +3 -3
- package/dist/components/table/TableToolbar.vue.js +2 -2
- package/dist/components/table/TableToolbar.vue2.js +126 -138
- package/dist/components/table/dataTableUtils.d.ts +26 -0
- package/dist/components/table/dataTableUtils.js +60 -0
- package/dist/composables/databaseDetailWorkspaceUtils.d.ts +59 -0
- package/dist/composables/databaseDetailWorkspaceUtils.js +160 -0
- package/dist/composables/index.d.ts +5 -0
- package/dist/composables/useDataTableDetailSheet.d.ts +47 -0
- package/dist/composables/useDataTableDetailSheet.js +58 -0
- package/dist/composables/useDataTableLayout.d.ts +16 -0
- package/dist/composables/useDataTableLayout.js +38 -0
- package/dist/composables/useDataTableSelection.d.ts +41 -0
- package/dist/composables/useDataTableSelection.js +73 -0
- package/dist/composables/useDatabaseDetailWorkspace.d.ts +67 -0
- package/dist/composables/useDatabaseDetailWorkspace.js +150 -0
- package/dist/composables/useDatabaseView.d.ts +3 -137
- package/dist/composables/useDatabaseWorkspace.d.ts +31 -0
- package/dist/composables/useDatabaseWorkspace.js +89 -0
- package/dist/composables/useTableToolbarPanels.d.ts +19 -0
- package/dist/composables/useTableToolbarPanels.js +53 -0
- package/dist/contracts/database.d.ts +252 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +261 -248
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +10 -261
- package/dist/registry/plugin-components.d.ts +291 -0
- package/dist/registry/plugin-components.js +114 -0
- package/dist/style.css +1 -1
- package/dist/types/data-table.d.ts +27 -0
- package/dist/types/data-table.js +29 -0
- package/package.json +1 -1
|
@@ -1,138 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export type DatabaseViewMode = "local" | "provider";
|
|
5
|
-
export interface DatabaseViewFetchParams {
|
|
6
|
-
tableId: string;
|
|
7
|
-
schema: TableSchema | null;
|
|
8
|
-
view: ViewConfig;
|
|
9
|
-
page: number;
|
|
10
|
-
pageSize: number;
|
|
11
|
-
sort: SortState;
|
|
12
|
-
selectedRecordId: string | null;
|
|
13
|
-
}
|
|
14
|
-
export interface DatabaseViewFetchResult<T extends DataRecord = DataRecord> {
|
|
15
|
-
records?: readonly T[] | T[];
|
|
16
|
-
data?: readonly T[] | T[];
|
|
17
|
-
total?: number;
|
|
18
|
-
schema?: TableSchema | null;
|
|
19
|
-
views?: readonly ViewConfig[] | ViewConfig[] | null;
|
|
20
|
-
activeViewId?: string | null;
|
|
21
|
-
selectedRecordId?: string | null;
|
|
22
|
-
}
|
|
23
|
-
export interface DatabaseViewProvider<T extends DataRecord = DataRecord> {
|
|
24
|
-
mode?: DatabaseViewMode;
|
|
25
|
-
onFetch?: (params: DatabaseViewFetchParams) => Promise<DatabaseViewFetchResult<T>>;
|
|
26
|
-
onRefresh?: (params: DatabaseViewFetchParams) => Promise<void> | void;
|
|
27
|
-
}
|
|
28
|
-
export type DatabaseSchemaEvent = {
|
|
29
|
-
type: "schema-add-field";
|
|
30
|
-
fieldType: string;
|
|
31
|
-
} | {
|
|
32
|
-
type: "schema-rename-field";
|
|
33
|
-
fieldId: string;
|
|
34
|
-
newName: string;
|
|
35
|
-
} | {
|
|
36
|
-
type: "schema-change-field-type";
|
|
37
|
-
fieldId: string;
|
|
38
|
-
newType: string;
|
|
39
|
-
} | {
|
|
40
|
-
type: "schema-hide-field";
|
|
41
|
-
fieldId: string;
|
|
42
|
-
} | {
|
|
43
|
-
type: "schema-delete-field";
|
|
44
|
-
fieldId: string;
|
|
45
|
-
} | {
|
|
46
|
-
type: "schema-duplicate-field";
|
|
47
|
-
fieldId: string;
|
|
48
|
-
};
|
|
49
|
-
export interface DatabaseViewActions<T extends DataRecord = DataRecord> {
|
|
50
|
-
onCellEdit?: (payload: {
|
|
51
|
-
rowId: string;
|
|
52
|
-
fieldId: string;
|
|
53
|
-
value: unknown;
|
|
54
|
-
}) => Promise<void> | void;
|
|
55
|
-
onSelectRecord?: (record: T | null) => Promise<void> | void;
|
|
56
|
-
onSchemaEvent?: (event: DatabaseSchemaEvent) => Promise<void> | void;
|
|
57
|
-
onSaveView?: (view: ViewConfig) => Promise<void> | void;
|
|
58
|
-
onDeleteView?: (viewId: string) => Promise<void> | void;
|
|
59
|
-
onRefresh?: () => Promise<void> | void;
|
|
60
|
-
}
|
|
61
|
-
export interface DatabaseViewDetailOptions {
|
|
62
|
-
clearSelection?: boolean;
|
|
63
|
-
}
|
|
64
|
-
export interface DatabaseViewNavigationOptions {
|
|
65
|
-
wrap?: boolean;
|
|
66
|
-
openDetail?: boolean;
|
|
67
|
-
}
|
|
68
|
-
export interface UseDatabaseViewOptions<T extends DataRecord = DataRecord> {
|
|
69
|
-
tableId: string;
|
|
70
|
-
mode?: DatabaseViewMode;
|
|
71
|
-
schema?: Ref<TableSchema | null | undefined> | TableSchema | null | undefined;
|
|
72
|
-
records?: Ref<readonly T[] | T[] | undefined> | readonly T[] | T[] | undefined;
|
|
73
|
-
views?: Ref<readonly ViewConfig[] | ViewConfig[] | undefined> | readonly ViewConfig[] | ViewConfig[] | undefined;
|
|
74
|
-
provider?: DatabaseViewProvider<T>;
|
|
75
|
-
actions?: DatabaseViewActions<T>;
|
|
76
|
-
defaultView?: ViewConfig;
|
|
77
|
-
initialViewId?: string;
|
|
78
|
-
initialSelectedRecordId?: string | null;
|
|
79
|
-
initialDetailOpen?: boolean;
|
|
80
|
-
pageSize?: number;
|
|
81
|
-
autoLoad?: boolean;
|
|
82
|
-
}
|
|
83
|
-
export interface UseDatabaseViewResult<T extends DataRecord = DataRecord> {
|
|
84
|
-
tableId: string;
|
|
85
|
-
mode: Readonly<Ref<DatabaseViewMode>>;
|
|
86
|
-
schema: Readonly<Ref<TableSchema | null>>;
|
|
87
|
-
records: Readonly<Ref<readonly T[]>>;
|
|
88
|
-
views: Readonly<Ref<ViewConfig[]>>;
|
|
89
|
-
activeViewId: Readonly<Ref<string>>;
|
|
90
|
-
activeView: Readonly<Ref<ViewConfig>>;
|
|
91
|
-
selectedRecordId: Readonly<Ref<string | null>>;
|
|
92
|
-
selectedRecord: Readonly<Ref<T | null>>;
|
|
93
|
-
selectedRecordIndex: Readonly<Ref<number>>;
|
|
94
|
-
selectedRecordOrdinal: Readonly<Ref<number | null>>;
|
|
95
|
-
hasSelectedRecord: Readonly<Ref<boolean>>;
|
|
96
|
-
detailOpen: Readonly<Ref<boolean>>;
|
|
97
|
-
detailRecord: Readonly<Ref<T | null>>;
|
|
98
|
-
loading: Readonly<Ref<boolean>>;
|
|
99
|
-
error: Readonly<Ref<Error | null>>;
|
|
100
|
-
page: Readonly<Ref<number>>;
|
|
101
|
-
pageSize: Readonly<Ref<number>>;
|
|
102
|
-
totalCount: Readonly<Ref<number>>;
|
|
103
|
-
viewList: Readonly<Ref<{
|
|
104
|
-
id: string;
|
|
105
|
-
name: string;
|
|
106
|
-
type: ViewConfig["viewType"];
|
|
107
|
-
}[]>>;
|
|
108
|
-
isProviderMode: Readonly<Ref<boolean>>;
|
|
109
|
-
isLocalMode: Readonly<Ref<boolean>>;
|
|
110
|
-
refresh: () => Promise<void>;
|
|
111
|
-
getRecordById: (recordId: string) => T | null;
|
|
112
|
-
getRecordIndex: (recordId: string) => number;
|
|
113
|
-
selectRecord: (record: T | string | null) => void;
|
|
114
|
-
openRecordDetail: (record?: T | string | null) => void;
|
|
115
|
-
closeRecordDetail: (options?: DatabaseViewDetailOptions) => void;
|
|
116
|
-
toggleRecordDetail: (record?: T | string | null) => void;
|
|
117
|
-
selectNextRecord: (options?: DatabaseViewNavigationOptions) => void;
|
|
118
|
-
selectPreviousRecord: (options?: DatabaseViewNavigationOptions) => void;
|
|
119
|
-
switchView: (viewId: string) => void;
|
|
120
|
-
setActiveViewId: (viewId: string) => void;
|
|
121
|
-
createView: (name: string, baseConfig?: Partial<ViewConfig>) => Promise<string>;
|
|
122
|
-
saveView: (config?: Partial<ViewConfig>) => Promise<void>;
|
|
123
|
-
deleteView: (viewId: string) => Promise<void>;
|
|
124
|
-
duplicateView: (sourceViewId: string, newName: string) => Promise<string>;
|
|
125
|
-
updateActiveView: (patch: Partial<ViewConfig>) => void;
|
|
126
|
-
setSelectedRecord: (record: T | string | null) => void;
|
|
127
|
-
clearSelectedRecord: () => void;
|
|
128
|
-
setPage: (page: number) => void;
|
|
129
|
-
setPageSize: (pageSize: number) => void;
|
|
130
|
-
emitCellEdit: (payload: {
|
|
131
|
-
rowId: string;
|
|
132
|
-
fieldId: string;
|
|
133
|
-
value: unknown;
|
|
134
|
-
}) => Promise<void>;
|
|
135
|
-
emitSchemaEvent: (event: DatabaseSchemaEvent) => Promise<void>;
|
|
136
|
-
setRecords: (next: readonly T[] | T[]) => void;
|
|
137
|
-
}
|
|
1
|
+
import { DataRecord } from '../types';
|
|
2
|
+
import { UseDatabaseViewOptions, UseDatabaseViewResult } from '../contracts/database';
|
|
3
|
+
export type { DatabaseViewMode, DatabaseViewFetchParams, DatabaseViewFetchResult, DatabaseViewProvider, DatabaseSchemaEvent, DatabaseViewActions, DatabaseViewDetailOptions, DatabaseViewNavigationOptions, UseDatabaseViewOptions, UseDatabaseViewResult, } from '../contracts/database';
|
|
138
4
|
export declare function useDatabaseView<T extends DataRecord = DataRecord>(options: UseDatabaseViewOptions<T>): UseDatabaseViewResult<T>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { DatabaseViewResolvedDetailPresentation, DatabaseViewWorkspacePreferences } from '../contracts/database';
|
|
3
|
+
export declare const DATABASE_DETAIL_VIEW_ID = "detail";
|
|
4
|
+
export declare const DATABASE_MOBILE_BREAKPOINT = "(max-width: 768px)";
|
|
5
|
+
export declare const DATABASE_WORKSPACE_STORAGE_PREFIX = "oneui-database-workspace:";
|
|
6
|
+
export declare const DEFAULT_SIDE_PANEL_WIDTH = 720;
|
|
7
|
+
export declare const DEFAULT_DRAWER_WIDTH = 900;
|
|
8
|
+
export declare const MIN_DETAIL_PANEL_WIDTH = 420;
|
|
9
|
+
export declare const MAX_DETAIL_PANEL_WIDTH = 1320;
|
|
10
|
+
export declare function clampWorkspaceWidth(width: number, fallback: number): number;
|
|
11
|
+
export declare function getWorkspaceStorageKey(tableId?: string): string | null;
|
|
12
|
+
export declare function readWorkspacePreferences(tableId?: string): DatabaseViewWorkspacePreferences;
|
|
13
|
+
export declare function writeWorkspacePreferences(tableId: string | undefined, prefs: DatabaseViewWorkspacePreferences): void;
|
|
14
|
+
export declare function useDatabaseViewport(mediaQuery?: string): {
|
|
15
|
+
isMobileViewport: Ref<boolean, boolean>;
|
|
16
|
+
};
|
|
17
|
+
interface UseDatabaseWorkspaceStateOptions {
|
|
18
|
+
tableId: Readonly<Ref<string | undefined>>;
|
|
19
|
+
activeViewId: Readonly<Ref<string>>;
|
|
20
|
+
initialSearchKeyword?: string;
|
|
21
|
+
initialDetailPresentation?: DatabaseViewResolvedDetailPresentation | null;
|
|
22
|
+
initialSidePanelWidth?: number;
|
|
23
|
+
initialDrawerWidth?: number;
|
|
24
|
+
}
|
|
25
|
+
export declare function useDatabaseWorkspaceState(options: UseDatabaseWorkspaceStateOptions): {
|
|
26
|
+
preferredDetailPresentation: Ref<DatabaseViewResolvedDetailPresentation | null, DatabaseViewResolvedDetailPresentation | null>;
|
|
27
|
+
sidePanelWidth: Ref<number, number>;
|
|
28
|
+
drawerWidth: Ref<number, number>;
|
|
29
|
+
searchKeyword: Ref<string, string>;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ref as i, onMounted as E, onBeforeUnmount as h, watch as D } from "vue";
|
|
2
|
+
const S = "detail", I = "(max-width: 768px)", W = "oneui-database-workspace:", o = 720, c = 900, _ = 420, m = 1320;
|
|
3
|
+
function s(t, n) {
|
|
4
|
+
return Number.isFinite(t) ? Math.max(_, Math.min(m, t)) : n;
|
|
5
|
+
}
|
|
6
|
+
function d(t) {
|
|
7
|
+
const n = (t ?? "").trim();
|
|
8
|
+
return n ? `${W}${n}` : null;
|
|
9
|
+
}
|
|
10
|
+
function T(t) {
|
|
11
|
+
const n = d(t);
|
|
12
|
+
if (!n || typeof window > "u") return {};
|
|
13
|
+
try {
|
|
14
|
+
const e = window.localStorage.getItem(n);
|
|
15
|
+
return e ? JSON.parse(e) : {};
|
|
16
|
+
} catch {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function p(t, n) {
|
|
21
|
+
const e = d(t);
|
|
22
|
+
if (!(!e || typeof window > "u"))
|
|
23
|
+
try {
|
|
24
|
+
window.localStorage.setItem(e, JSON.stringify(n));
|
|
25
|
+
} catch {
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function y(t = I) {
|
|
29
|
+
const n = i(!1);
|
|
30
|
+
let e = null;
|
|
31
|
+
function r() {
|
|
32
|
+
n.value = (e == null ? void 0 : e.matches) ?? !1;
|
|
33
|
+
}
|
|
34
|
+
return E(() => {
|
|
35
|
+
typeof window > "u" || typeof window.matchMedia != "function" || (e = window.matchMedia(t), r(), e.addEventListener("change", r));
|
|
36
|
+
}), h(() => {
|
|
37
|
+
e == null || e.removeEventListener("change", r), e = null;
|
|
38
|
+
}), {
|
|
39
|
+
isMobileViewport: n
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function L(t) {
|
|
43
|
+
const n = i(
|
|
44
|
+
t.initialDetailPresentation ?? null
|
|
45
|
+
), e = i(
|
|
46
|
+
s(t.initialSidePanelWidth ?? o, o)
|
|
47
|
+
), r = i(
|
|
48
|
+
s(t.initialDrawerWidth ?? c, c)
|
|
49
|
+
), a = i(t.initialSearchKeyword ?? "");
|
|
50
|
+
return D(
|
|
51
|
+
[
|
|
52
|
+
t.activeViewId,
|
|
53
|
+
a,
|
|
54
|
+
n,
|
|
55
|
+
e,
|
|
56
|
+
r
|
|
57
|
+
],
|
|
58
|
+
([u, l, f, w, A]) => {
|
|
59
|
+
p(t.tableId.value, {
|
|
60
|
+
activeViewId: u,
|
|
61
|
+
searchKeyword: l,
|
|
62
|
+
detailPresentation: f ?? void 0,
|
|
63
|
+
sidePanelWidth: w,
|
|
64
|
+
drawerWidth: A
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
{ immediate: !0 }
|
|
68
|
+
), {
|
|
69
|
+
preferredDetailPresentation: n,
|
|
70
|
+
sidePanelWidth: e,
|
|
71
|
+
drawerWidth: r,
|
|
72
|
+
searchKeyword: a
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
S as DATABASE_DETAIL_VIEW_ID,
|
|
77
|
+
I as DATABASE_MOBILE_BREAKPOINT,
|
|
78
|
+
W as DATABASE_WORKSPACE_STORAGE_PREFIX,
|
|
79
|
+
c as DEFAULT_DRAWER_WIDTH,
|
|
80
|
+
o as DEFAULT_SIDE_PANEL_WIDTH,
|
|
81
|
+
m as MAX_DETAIL_PANEL_WIDTH,
|
|
82
|
+
_ as MIN_DETAIL_PANEL_WIDTH,
|
|
83
|
+
s as clampWorkspaceWidth,
|
|
84
|
+
d as getWorkspaceStorageKey,
|
|
85
|
+
T as readWorkspacePreferences,
|
|
86
|
+
y as useDatabaseViewport,
|
|
87
|
+
L as useDatabaseWorkspaceState,
|
|
88
|
+
p as writeWorkspacePreferences
|
|
89
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export type TableToolbarPanelKey = "filter" | "sort" | "group" | "column";
|
|
3
|
+
type PanelStyle = Record<string, string>;
|
|
4
|
+
type ButtonRefMap = Record<TableToolbarPanelKey, Ref<HTMLElement | null>>;
|
|
5
|
+
export declare function calcToolbarDropdownStyle(el: HTMLElement | null): PanelStyle;
|
|
6
|
+
export declare function useTableToolbarPanels(buttonRefs: ButtonRefMap): {
|
|
7
|
+
showFilterPanel: Ref<boolean, boolean>;
|
|
8
|
+
showSortPanel: Ref<boolean, boolean>;
|
|
9
|
+
showGroupPanel: Ref<boolean, boolean>;
|
|
10
|
+
showColumnPanel: Ref<boolean, boolean>;
|
|
11
|
+
filterDropdownStyle: Ref<PanelStyle, PanelStyle>;
|
|
12
|
+
sortDropdownStyle: Ref<PanelStyle, PanelStyle>;
|
|
13
|
+
groupDropdownStyle: Ref<PanelStyle, PanelStyle>;
|
|
14
|
+
columnDropdownStyle: Ref<PanelStyle, PanelStyle>;
|
|
15
|
+
togglePanel: (panel: TableToolbarPanelKey) => void;
|
|
16
|
+
closePanel: (panel: TableToolbarPanelKey) => void;
|
|
17
|
+
closeAllPanels: () => void;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ref as o, onMounted as g, onUnmounted as m, nextTick as y } from "vue";
|
|
2
|
+
function P(n) {
|
|
3
|
+
if (!n) return {};
|
|
4
|
+
const l = n.getBoundingClientRect();
|
|
5
|
+
return {
|
|
6
|
+
top: `${l.bottom + 4}px`,
|
|
7
|
+
left: `${l.left}px`
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function D(n) {
|
|
11
|
+
const l = o(!1), a = o(!1), r = o(!1), c = o(!1), u = o({}), f = o({}), i = o({}), w = o({}), s = {
|
|
12
|
+
filter: { show: l, style: u },
|
|
13
|
+
sort: { show: a, style: f },
|
|
14
|
+
group: { show: r, style: i },
|
|
15
|
+
column: { show: c, style: w }
|
|
16
|
+
};
|
|
17
|
+
function d() {
|
|
18
|
+
l.value = !1, a.value = !1, r.value = !1, c.value = !1;
|
|
19
|
+
}
|
|
20
|
+
function v(e) {
|
|
21
|
+
Object.keys(s).forEach((p) => {
|
|
22
|
+
p !== e && (s[p].show.value = !1);
|
|
23
|
+
});
|
|
24
|
+
const t = s[e];
|
|
25
|
+
t.show.value = !t.show.value, t.show.value && y(() => {
|
|
26
|
+
t.style.value = P(n[e].value);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function b(e) {
|
|
30
|
+
s[e].show.value = !1;
|
|
31
|
+
}
|
|
32
|
+
function h(e) {
|
|
33
|
+
const t = e.target;
|
|
34
|
+
!t.closest(".of-table-toolbar__btn-group") && !t.closest(".of-table-toolbar__dropdown") && d();
|
|
35
|
+
}
|
|
36
|
+
return g(() => document.addEventListener("click", h, !0)), m(() => document.removeEventListener("click", h, !0)), {
|
|
37
|
+
showFilterPanel: l,
|
|
38
|
+
showSortPanel: a,
|
|
39
|
+
showGroupPanel: r,
|
|
40
|
+
showColumnPanel: c,
|
|
41
|
+
filterDropdownStyle: u,
|
|
42
|
+
sortDropdownStyle: f,
|
|
43
|
+
groupDropdownStyle: i,
|
|
44
|
+
columnDropdownStyle: w,
|
|
45
|
+
togglePanel: v,
|
|
46
|
+
closePanel: b,
|
|
47
|
+
closeAllPanels: d
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
P as calcToolbarDropdownStyle,
|
|
52
|
+
D as useTableToolbarPanels
|
|
53
|
+
};
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { Component, Ref } from 'vue';
|
|
2
|
+
import { DataRecord, Density, TableColumn, TableSchema, ViewConfig } from '../types';
|
|
3
|
+
import { FilterLogic } from '../composables/useTableFilter';
|
|
4
|
+
export type DatabaseViewMode = "local" | "provider";
|
|
5
|
+
export type DatabaseViewSortOrder = "asc" | "desc" | null;
|
|
6
|
+
export interface DatabaseViewSortState {
|
|
7
|
+
field: string | null;
|
|
8
|
+
order: DatabaseViewSortOrder;
|
|
9
|
+
}
|
|
10
|
+
export interface DatabaseViewFetchParams {
|
|
11
|
+
tableId: string;
|
|
12
|
+
schema: TableSchema | null;
|
|
13
|
+
view: ViewConfig;
|
|
14
|
+
page: number;
|
|
15
|
+
pageSize: number;
|
|
16
|
+
sort: DatabaseViewSortState;
|
|
17
|
+
selectedRecordId: string | null;
|
|
18
|
+
}
|
|
19
|
+
export interface DatabaseViewFetchResult<T extends DataRecord = DataRecord> {
|
|
20
|
+
records?: readonly T[] | T[];
|
|
21
|
+
data?: readonly T[] | T[];
|
|
22
|
+
total?: number;
|
|
23
|
+
schema?: TableSchema | null;
|
|
24
|
+
views?: readonly ViewConfig[] | ViewConfig[] | null;
|
|
25
|
+
activeViewId?: string | null;
|
|
26
|
+
selectedRecordId?: string | null;
|
|
27
|
+
}
|
|
28
|
+
export interface DatabaseViewProvider<T extends DataRecord = DataRecord> {
|
|
29
|
+
mode?: DatabaseViewMode;
|
|
30
|
+
onFetch?: (params: DatabaseViewFetchParams) => Promise<DatabaseViewFetchResult<T>>;
|
|
31
|
+
onRefresh?: (params: DatabaseViewFetchParams) => Promise<void> | void;
|
|
32
|
+
}
|
|
33
|
+
export type DatabaseSchemaEvent = {
|
|
34
|
+
type: "schema-add-field";
|
|
35
|
+
fieldType: string;
|
|
36
|
+
} | {
|
|
37
|
+
type: "schema-rename-field";
|
|
38
|
+
fieldId: string;
|
|
39
|
+
newName: string;
|
|
40
|
+
} | {
|
|
41
|
+
type: "schema-change-field-type";
|
|
42
|
+
fieldId: string;
|
|
43
|
+
newType: string;
|
|
44
|
+
} | {
|
|
45
|
+
type: "schema-hide-field";
|
|
46
|
+
fieldId: string;
|
|
47
|
+
} | {
|
|
48
|
+
type: "schema-delete-field";
|
|
49
|
+
fieldId: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: "schema-duplicate-field";
|
|
52
|
+
fieldId: string;
|
|
53
|
+
};
|
|
54
|
+
export type DatabaseViewSchemaEvent = DatabaseSchemaEvent;
|
|
55
|
+
export interface DatabaseViewActions<T extends DataRecord = DataRecord> {
|
|
56
|
+
onCellEdit?: (payload: {
|
|
57
|
+
rowId: string;
|
|
58
|
+
fieldId: string;
|
|
59
|
+
value: unknown;
|
|
60
|
+
}) => Promise<void> | void;
|
|
61
|
+
onSelectRecord?: (record: T | null) => Promise<void> | void;
|
|
62
|
+
onSchemaEvent?: (event: DatabaseSchemaEvent) => Promise<void> | void;
|
|
63
|
+
onSaveView?: (view: ViewConfig) => Promise<void> | void;
|
|
64
|
+
onDeleteView?: (viewId: string) => Promise<void> | void;
|
|
65
|
+
onRefresh?: () => Promise<void> | void;
|
|
66
|
+
}
|
|
67
|
+
export interface DatabaseViewDetailOptions {
|
|
68
|
+
clearSelection?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface DatabaseViewNavigationOptions {
|
|
71
|
+
wrap?: boolean;
|
|
72
|
+
openDetail?: boolean;
|
|
73
|
+
}
|
|
74
|
+
export interface UseDatabaseViewOptions<T extends DataRecord = DataRecord> {
|
|
75
|
+
tableId: string;
|
|
76
|
+
mode?: DatabaseViewMode;
|
|
77
|
+
schema?: Ref<TableSchema | null | undefined> | TableSchema | null | undefined;
|
|
78
|
+
records?: Ref<readonly T[] | T[] | undefined> | readonly T[] | T[] | undefined;
|
|
79
|
+
views?: Ref<readonly ViewConfig[] | ViewConfig[] | undefined> | readonly ViewConfig[] | ViewConfig[] | undefined;
|
|
80
|
+
provider?: DatabaseViewProvider<T>;
|
|
81
|
+
actions?: DatabaseViewActions<T>;
|
|
82
|
+
defaultView?: ViewConfig;
|
|
83
|
+
initialViewId?: string;
|
|
84
|
+
initialSelectedRecordId?: string | null;
|
|
85
|
+
initialDetailOpen?: boolean;
|
|
86
|
+
pageSize?: number;
|
|
87
|
+
autoLoad?: boolean;
|
|
88
|
+
}
|
|
89
|
+
export interface UseDatabaseViewResult<T extends DataRecord = DataRecord> {
|
|
90
|
+
tableId: string;
|
|
91
|
+
mode: Readonly<Ref<DatabaseViewMode>>;
|
|
92
|
+
schema: Readonly<Ref<TableSchema | null>>;
|
|
93
|
+
records: Readonly<Ref<readonly T[]>>;
|
|
94
|
+
views: Readonly<Ref<ViewConfig[]>>;
|
|
95
|
+
activeViewId: Readonly<Ref<string>>;
|
|
96
|
+
activeView: Readonly<Ref<ViewConfig>>;
|
|
97
|
+
selectedRecordId: Readonly<Ref<string | null>>;
|
|
98
|
+
selectedRecord: Readonly<Ref<T | null>>;
|
|
99
|
+
selectedRecordIndex: Readonly<Ref<number>>;
|
|
100
|
+
selectedRecordOrdinal: Readonly<Ref<number | null>>;
|
|
101
|
+
hasSelectedRecord: Readonly<Ref<boolean>>;
|
|
102
|
+
detailOpen: Readonly<Ref<boolean>>;
|
|
103
|
+
detailRecord: Readonly<Ref<T | null>>;
|
|
104
|
+
loading: Readonly<Ref<boolean>>;
|
|
105
|
+
error: Readonly<Ref<Error | null>>;
|
|
106
|
+
page: Readonly<Ref<number>>;
|
|
107
|
+
pageSize: Readonly<Ref<number>>;
|
|
108
|
+
totalCount: Readonly<Ref<number>>;
|
|
109
|
+
viewList: Readonly<Ref<{
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
type: ViewConfig["viewType"];
|
|
113
|
+
}[]>>;
|
|
114
|
+
isProviderMode: Readonly<Ref<boolean>>;
|
|
115
|
+
isLocalMode: Readonly<Ref<boolean>>;
|
|
116
|
+
refresh: () => Promise<void>;
|
|
117
|
+
getRecordById: (recordId: string) => T | null;
|
|
118
|
+
getRecordIndex: (recordId: string) => number;
|
|
119
|
+
selectRecord: (record: T | string | null) => void;
|
|
120
|
+
openRecordDetail: (record?: T | string | null) => void;
|
|
121
|
+
closeRecordDetail: (options?: DatabaseViewDetailOptions) => void;
|
|
122
|
+
toggleRecordDetail: (record?: T | string | null) => void;
|
|
123
|
+
selectNextRecord: (options?: DatabaseViewNavigationOptions) => void;
|
|
124
|
+
selectPreviousRecord: (options?: DatabaseViewNavigationOptions) => void;
|
|
125
|
+
switchView: (viewId: string) => void;
|
|
126
|
+
setActiveViewId: (viewId: string) => void;
|
|
127
|
+
createView: (name: string, baseConfig?: Partial<ViewConfig>) => Promise<string>;
|
|
128
|
+
saveView: (config?: Partial<ViewConfig>) => Promise<void>;
|
|
129
|
+
deleteView: (viewId: string) => Promise<void>;
|
|
130
|
+
duplicateView: (sourceViewId: string, newName: string) => Promise<string>;
|
|
131
|
+
updateActiveView: (patch: Partial<ViewConfig>) => void;
|
|
132
|
+
setSelectedRecord: (record: T | string | null) => void;
|
|
133
|
+
clearSelectedRecord: () => void;
|
|
134
|
+
setPage: (page: number) => void;
|
|
135
|
+
setPageSize: (pageSize: number) => void;
|
|
136
|
+
emitCellEdit: (payload: {
|
|
137
|
+
rowId: string;
|
|
138
|
+
fieldId: string;
|
|
139
|
+
value: unknown;
|
|
140
|
+
}) => Promise<void>;
|
|
141
|
+
emitSchemaEvent: (event: DatabaseSchemaEvent) => Promise<void>;
|
|
142
|
+
setRecords: (next: readonly T[] | T[]) => void;
|
|
143
|
+
}
|
|
144
|
+
export interface DatabaseViewViewTab {
|
|
145
|
+
value: string;
|
|
146
|
+
label: string;
|
|
147
|
+
icon?: string | Component;
|
|
148
|
+
}
|
|
149
|
+
export interface DatabaseViewUiOptions {
|
|
150
|
+
enableFieldManagement?: boolean;
|
|
151
|
+
}
|
|
152
|
+
export type DatabaseViewDetailPresentation = "auto" | "side-panel" | "sheet" | "full-page";
|
|
153
|
+
export type DatabaseViewResolvedDetailPresentation = Exclude<DatabaseViewDetailPresentation, "auto">;
|
|
154
|
+
export interface DatabaseViewWorkspacePreferences {
|
|
155
|
+
activeViewId?: string;
|
|
156
|
+
detailPresentation?: DatabaseViewResolvedDetailPresentation;
|
|
157
|
+
sidePanelWidth?: number;
|
|
158
|
+
drawerWidth?: number;
|
|
159
|
+
searchKeyword?: string;
|
|
160
|
+
}
|
|
161
|
+
export interface DatabaseViewComponentActions extends DatabaseViewActions<DataRecord> {
|
|
162
|
+
onViewChange?: (payload: {
|
|
163
|
+
tableId: string;
|
|
164
|
+
view: ViewConfig;
|
|
165
|
+
}) => void | Promise<void>;
|
|
166
|
+
onViewLoad?: (payload: {
|
|
167
|
+
tableId: string;
|
|
168
|
+
viewId: string;
|
|
169
|
+
}) => void | Promise<void>;
|
|
170
|
+
onViewSave?: (payload: {
|
|
171
|
+
tableId: string;
|
|
172
|
+
viewId: string;
|
|
173
|
+
name: string;
|
|
174
|
+
}) => void | Promise<void>;
|
|
175
|
+
onRecordChange?: (payload: {
|
|
176
|
+
tableId: string;
|
|
177
|
+
recordId: string;
|
|
178
|
+
startDate?: string;
|
|
179
|
+
endDate?: string;
|
|
180
|
+
}) => void | Promise<void>;
|
|
181
|
+
}
|
|
182
|
+
export interface DatabaseViewProps {
|
|
183
|
+
tableId?: string;
|
|
184
|
+
mode?: DatabaseViewMode;
|
|
185
|
+
detailPresentation?: DatabaseViewDetailPresentation;
|
|
186
|
+
density?: Density;
|
|
187
|
+
schema?: TableSchema | null;
|
|
188
|
+
records?: DataRecord[];
|
|
189
|
+
views?: ViewConfig[];
|
|
190
|
+
provider?: DatabaseViewProvider<DataRecord>;
|
|
191
|
+
defaultView?: ViewConfig;
|
|
192
|
+
currentViewId?: string;
|
|
193
|
+
initialViewId?: string;
|
|
194
|
+
selectedRecordId?: string | null;
|
|
195
|
+
initialSelectedRecordId?: string | null;
|
|
196
|
+
searchKeyword?: string;
|
|
197
|
+
loading?: boolean;
|
|
198
|
+
error?: string | Error | null;
|
|
199
|
+
viewTabs?: DatabaseViewViewTab[];
|
|
200
|
+
actions?: DatabaseViewComponentActions;
|
|
201
|
+
ui?: DatabaseViewUiOptions;
|
|
202
|
+
showToolbar?: boolean;
|
|
203
|
+
showViewSwitch?: boolean;
|
|
204
|
+
showFilter?: boolean;
|
|
205
|
+
showSort?: boolean;
|
|
206
|
+
showGroup?: boolean;
|
|
207
|
+
showColumns?: boolean;
|
|
208
|
+
showSearch?: boolean;
|
|
209
|
+
readonly?: boolean;
|
|
210
|
+
pageSize?: number;
|
|
211
|
+
autoLoad?: boolean;
|
|
212
|
+
}
|
|
213
|
+
export interface DatabaseViewEmits {
|
|
214
|
+
"update:currentViewId": [string];
|
|
215
|
+
"update:selectedRecordId": [string | null];
|
|
216
|
+
"update:searchKeyword": [string];
|
|
217
|
+
"update:columns": [TableColumn[]];
|
|
218
|
+
"update:filterLogic": [FilterLogic];
|
|
219
|
+
"update:records": [DataRecord[]];
|
|
220
|
+
"cell-edit": [{
|
|
221
|
+
rowId: string;
|
|
222
|
+
fieldId: string;
|
|
223
|
+
value: unknown;
|
|
224
|
+
}];
|
|
225
|
+
"select-record": [DataRecord | null];
|
|
226
|
+
"schema-add-field": [string];
|
|
227
|
+
"schema-rename-field": [{
|
|
228
|
+
fieldId: string;
|
|
229
|
+
newName: string;
|
|
230
|
+
}];
|
|
231
|
+
"schema-change-field-type": [{
|
|
232
|
+
fieldId: string;
|
|
233
|
+
newType: string;
|
|
234
|
+
}];
|
|
235
|
+
"schema-hide-field": [string];
|
|
236
|
+
"schema-delete-field": [string];
|
|
237
|
+
"schema-duplicate-field": [string];
|
|
238
|
+
"row-click": [unknown];
|
|
239
|
+
"card-click": [unknown];
|
|
240
|
+
add: [];
|
|
241
|
+
"add-column": [];
|
|
242
|
+
"record-change": [{
|
|
243
|
+
recordId: string;
|
|
244
|
+
startDate?: string;
|
|
245
|
+
endDate?: string;
|
|
246
|
+
}];
|
|
247
|
+
"load-view": [string];
|
|
248
|
+
"save-view": [string];
|
|
249
|
+
sort: [string];
|
|
250
|
+
group: [string | null];
|
|
251
|
+
refresh: [];
|
|
252
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type { ButtonOption, EmptyStateAction, MenuItem, StepItem, StepperProps,
|
|
|
3
3
|
export { AppLayout, Navbar, Sidebar, StatusBar } from './components/layout';
|
|
4
4
|
export { default as FieldMarkdownPreview } from './components/field/FieldMarkdownPreview.vue';
|
|
5
5
|
export { DataTable, TableHeaderRow, TableDataRow, TableGroupRow, NewRowBtn, TableFilterPanel, TableColumnManager, TableToolbar, FieldCell, FieldTypePicker, ColumnHeaderMenu, } from './components/table';
|
|
6
|
+
export { pluginComponentNames, pluginComponentRegistry, installPluginComponents, registerOneUIComponents, } from './registry/plugin-components';
|
|
6
7
|
export { GalleryView, GalleryCard } from './components/gallery';
|
|
7
8
|
export { ActivityTimeline, GanttTimeline, GanttRow } from './components/timeline';
|
|
8
9
|
export type { ActivityTimelineProps, ActivityTimelineStatus, TimelineItem, } from './components/timeline';
|
|
@@ -43,6 +44,8 @@ export type { UseFixedColumnsOptions } from './composables/useFixedColumns';
|
|
|
43
44
|
export type { UseKeyboardNavigationOptions } from './composables/useKeyboardNavigation';
|
|
44
45
|
export type { RowReorderPayload, RowGroupChangePayload } from './composables/useRowDrag';
|
|
45
46
|
export type { UseDraftRowsOptions } from './composables/useDraftRows';
|
|
47
|
+
export type { UseDataTableSelectionOptions, UseDataTableSelectionReturn, } from './composables/useDataTableSelection';
|
|
48
|
+
export type { DataTableDetailSheetBaseRow, DataTableDetailSheetRow, DataTableCellEditPayload, DataTableDetailSavePayload, DataTableRowClickResult, } from './composables/useDataTableDetailSheet';
|
|
46
49
|
export type { ValidationRule, FilterFieldConfig, FilterPanelConfig, UseSchemaEngineOptions, } from './composables/useSchemaEngine';
|
|
47
50
|
export { inferSchema, fetchSchemaFromSupabase, humanizeColumnName } from './utils/supabaseSchema';
|
|
48
51
|
export type { PgColumnInfo, InferSchemaOptions } from './utils/supabaseSchema';
|
|
@@ -61,6 +64,8 @@ export { useFixedColumns } from './composables/useFixedColumns';
|
|
|
61
64
|
export { useKeyboardNavigation } from './composables/useKeyboardNavigation';
|
|
62
65
|
export { useRowDrag } from './composables/useRowDrag';
|
|
63
66
|
export { useDraftRows } from './composables/useDraftRows';
|
|
67
|
+
export { useDataTableSelection } from './composables/useDataTableSelection';
|
|
68
|
+
export { useDataTableDetailSheet, buildDetailSheetCellEditPayloads } from './composables/useDataTableDetailSheet';
|
|
64
69
|
export { useWorkerSort } from './composables/useWorkerSort';
|
|
65
70
|
export { useSchemaEngine } from './composables/useSchemaEngine';
|
|
66
71
|
export { useSupabaseProvider } from './composables/useSupabaseProvider';
|
|
@@ -69,5 +74,6 @@ export { useViewPersistence, createLocalStorageBackend, createSupabaseBackend, }
|
|
|
69
74
|
export type { ViewStorageBackend, SupabaseViewBackendOptions, UseViewPersistenceOptions, } from './composables/useViewPersistence';
|
|
70
75
|
export { useDatabaseView } from './composables/useDatabaseView';
|
|
71
76
|
export type { DatabaseViewMode, DatabaseViewFetchParams, DatabaseViewFetchResult, DatabaseViewProvider, DatabaseSchemaEvent, DatabaseViewActions, UseDatabaseViewOptions, UseDatabaseViewResult, } from './composables/useDatabaseView';
|
|
77
|
+
export { useDatabaseViewport, useDatabaseWorkspaceState } from './composables/useDatabaseWorkspace';
|
|
72
78
|
export { useSearch } from './composables/useSearch';
|
|
73
79
|
export type { UseSearchOptions, SearchHighlight as SearchHighlightSegment, } from './composables/useSearch';
|