@origen-ui/tabs 1.0.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.
- package/LICENSE +21 -0
- package/README.md +92 -0
- package/dist/config-BVOCsdxN.js +16 -0
- package/dist/config-DbOzZnZx.cjs +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +396 -0
- package/dist/index.mjs +2247 -0
- package/dist/locale.cjs +1 -0
- package/dist/locale.d.ts +64 -0
- package/dist/locale.mjs +63 -0
- package/dist/runtime.cjs +1 -0
- package/dist/runtime.d.ts +209 -0
- package/dist/runtime.mjs +9 -0
- package/dist/style.css +1 -0
- package/package.json +77 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { CSSProperties } from 'vue';
|
|
3
|
+
import { DeepPartial } from '@origen-ui/shared';
|
|
4
|
+
import { MaybePromise } from '@origen-ui/shared';
|
|
5
|
+
import { OrigenUiLocaleSource } from '@origen-ui/shared';
|
|
6
|
+
import { Plugin as Plugin_2 } from 'vue';
|
|
7
|
+
import { PublicProps } from 'vue';
|
|
8
|
+
import { ShallowRef } from 'vue';
|
|
9
|
+
import { ShallowUnwrapRef } from 'vue';
|
|
10
|
+
import { Slots } from 'vue';
|
|
11
|
+
import { TabPaneName } from 'element-plus';
|
|
12
|
+
import { TabsInstance } from 'element-plus';
|
|
13
|
+
import { TabsProps } from 'element-plus';
|
|
14
|
+
import { VNode } from 'vue';
|
|
15
|
+
import { VNodeChild } from 'vue';
|
|
16
|
+
|
|
17
|
+
declare const __VLS_export: <TKey extends TabKey = TabKey, TData = unknown>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
18
|
+
props: PublicProps & __VLS_PrettifyLocal<OgTabsProps<TKey, TData> & {
|
|
19
|
+
"onUpdate:modelValue"?: ((key: TKey | undefined) => any) | undefined;
|
|
20
|
+
"onUpdate:items"?: ((items: readonly OgTabItem<TKey, TData>[]) => any) | undefined;
|
|
21
|
+
"onAction-request"?: ((context: OgTabsActionContext<TKey, TData>) => any) | undefined;
|
|
22
|
+
"onClose-request"?: ((context: OgTabsActionContext<TKey, TData>) => any) | undefined;
|
|
23
|
+
"onRefresh-request"?: ((context: OgTabsActionContext<TKey, TData>) => any) | undefined;
|
|
24
|
+
"onPin-change-request"?: ((context: OgTabsActionContext<TKey, TData>) => any) | undefined;
|
|
25
|
+
"onReorder-request"?: ((context: OgTabsActionContext<TKey, TData>) => any) | undefined;
|
|
26
|
+
"onOperation-denied"?: ((operation: OgTabsOperation, tab: OgTabItem<TKey, TData> | undefined, reason: OgTabsDeniedReason) => any) | undefined;
|
|
27
|
+
"onOperation-error"?: ((context: OgTabsActionContext<TKey, TData>, error: unknown) => any) | undefined;
|
|
28
|
+
"onTab-click"?: ((pane: {
|
|
29
|
+
uid: number;
|
|
30
|
+
getVnode: () => VNode;
|
|
31
|
+
slots: Slots;
|
|
32
|
+
props: {
|
|
33
|
+
label?: string | undefined;
|
|
34
|
+
name?: string | number | undefined;
|
|
35
|
+
closable?: boolean | undefined;
|
|
36
|
+
disabled?: boolean | undefined;
|
|
37
|
+
lazy?: boolean | undefined;
|
|
38
|
+
};
|
|
39
|
+
paneName: TabPaneName | undefined;
|
|
40
|
+
active: boolean;
|
|
41
|
+
index: string | undefined;
|
|
42
|
+
isClosable: boolean;
|
|
43
|
+
isFocusInsidePane: () => boolean | undefined;
|
|
44
|
+
}, event: Event) => any) | undefined;
|
|
45
|
+
"onTab-change"?: ((name: TabPaneName) => any) | undefined;
|
|
46
|
+
"onTab-remove"?: ((name: TabPaneName) => any) | undefined;
|
|
47
|
+
}> & (typeof globalThis extends {
|
|
48
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
49
|
+
} ? P : {});
|
|
50
|
+
expose: (exposed: ShallowUnwrapRef<{
|
|
51
|
+
getNativeTabs: () => TabsInstance | undefined;
|
|
52
|
+
pending: Readonly< ShallowRef<boolean>>;
|
|
53
|
+
dispatch: (context: OgTabsActionContext<TKey, TData>) => Promise<boolean>;
|
|
54
|
+
closeScopeAt: (scope: OgTabsCloseScope, key: TKey | undefined, source?: OgTabsActionSource) => Promise<boolean>;
|
|
55
|
+
refreshAt: (key: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
56
|
+
moveBefore: (key: TKey, beforeKey: TKey | undefined, source?: OgTabsActionSource) => Promise<boolean>;
|
|
57
|
+
activate: (key: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
58
|
+
close: (key: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
59
|
+
refresh: (source?: OgTabsActionSource) => Promise<boolean>;
|
|
60
|
+
pin: (key: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
61
|
+
unpin: (key: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
62
|
+
move: (key: TKey, targetKey: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
63
|
+
moveTop: (key: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
64
|
+
moveBottom: (key: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
65
|
+
closeScope: (scope: OgTabsCloseScope, source?: OgTabsActionSource) => Promise<boolean>;
|
|
66
|
+
scrollTo: (key: TKey) => void;
|
|
67
|
+
getItems: () => readonly OgTabItem<TKey, TData>[];
|
|
68
|
+
}>) => void;
|
|
69
|
+
attrs: any;
|
|
70
|
+
slots: OgTabsSlots<TKey, TData>;
|
|
71
|
+
emit: ((evt: "update:modelValue", key: TKey | undefined) => void) & ((evt: "update:items", items: readonly OgTabItem<TKey, TData>[]) => void) & ((evt: "action-request", context: OgTabsActionContext<TKey, TData>) => void) & ((evt: "close-request", context: OgTabsActionContext<TKey, TData>) => void) & ((evt: "refresh-request", context: OgTabsActionContext<TKey, TData>) => void) & ((evt: "pin-change-request", context: OgTabsActionContext<TKey, TData>) => void) & ((evt: "reorder-request", context: OgTabsActionContext<TKey, TData>) => void) & ((evt: "operation-denied", operation: OgTabsOperation, tab: OgTabItem<TKey, TData> | undefined, reason: OgTabsDeniedReason) => void) & ((evt: "operation-error", context: OgTabsActionContext<TKey, TData>, error: unknown) => void) & ((evt: "tab-click", pane: {
|
|
72
|
+
uid: number;
|
|
73
|
+
getVnode: () => VNode;
|
|
74
|
+
slots: Slots;
|
|
75
|
+
props: {
|
|
76
|
+
label?: string | undefined;
|
|
77
|
+
name?: string | number | undefined;
|
|
78
|
+
closable?: boolean | undefined;
|
|
79
|
+
disabled?: boolean | undefined;
|
|
80
|
+
lazy?: boolean | undefined;
|
|
81
|
+
};
|
|
82
|
+
paneName: TabPaneName | undefined;
|
|
83
|
+
active: boolean;
|
|
84
|
+
index: string | undefined;
|
|
85
|
+
isClosable: boolean;
|
|
86
|
+
isFocusInsidePane: () => boolean | undefined;
|
|
87
|
+
}, event: Event) => void) & ((evt: "tab-change", name: TabPaneName) => void) & ((evt: "tab-remove", name: TabPaneName) => void);
|
|
88
|
+
}>) => VNode & {
|
|
89
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
declare type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
93
|
+
[K in keyof T]: T[K];
|
|
94
|
+
} : {
|
|
95
|
+
[K in keyof T as K]: T[K];
|
|
96
|
+
}) & {};
|
|
97
|
+
|
|
98
|
+
export declare function canCloseTab<TKey extends TabKey, TData>(tab: OgTabItem<TKey, TData> | undefined): boolean;
|
|
99
|
+
|
|
100
|
+
export declare function canMoveTab<TKey extends TabKey, TData>(tab: OgTabItem<TKey, TData> | undefined): boolean;
|
|
101
|
+
|
|
102
|
+
export declare function canPinTab<TKey extends TabKey, TData>(tab: OgTabItem<TKey, TData> | undefined): boolean;
|
|
103
|
+
|
|
104
|
+
/** Installs app-scoped OgTabs defaults without sharing state across Vue apps. */
|
|
105
|
+
export declare function createOgTabs(config?: OgTabsGlobalConfig): Plugin_2;
|
|
106
|
+
|
|
107
|
+
export declare function filterTabs<TKey extends TabKey, TData>(items: readonly OgTabItem<TKey, TData>[], query?: string): OgTabItem<TKey, TData>[];
|
|
108
|
+
|
|
109
|
+
export declare function findTab<TKey extends TabKey, TData>(items: readonly OgTabItem<TKey, TData>[], key: TKey | undefined): OgTabItem<TKey, TData> | undefined;
|
|
110
|
+
|
|
111
|
+
export declare function getCloseScopeTabs<TKey extends TabKey, TData>(items: readonly OgTabItem<TKey, TData>[], key: TKey | undefined, scope: OgTabsCloseScope): OgTabItem<TKey, TData>[];
|
|
112
|
+
|
|
113
|
+
export declare function hasDuplicateKeys<TKey extends TabKey, TData>(items: readonly OgTabItem<TKey, TData>[]): boolean;
|
|
114
|
+
|
|
115
|
+
export declare function moveTab<TKey extends TabKey, TData>(items: readonly OgTabItem<TKey, TData>[], key: TKey, targetKey: TKey): OgTabItem<TKey, TData>[];
|
|
116
|
+
|
|
117
|
+
export declare function moveTabToEdge<TKey extends TabKey, TData>(items: readonly OgTabItem<TKey, TData>[], key: TKey, edge: 'top' | 'bottom'): OgTabItem<TKey, TData>[];
|
|
118
|
+
|
|
119
|
+
export declare const OG_TABS_LOCALE_EN_US: {
|
|
120
|
+
pin: string;
|
|
121
|
+
unpin: string;
|
|
122
|
+
close: string;
|
|
123
|
+
closeOthers: string;
|
|
124
|
+
closeLeft: string;
|
|
125
|
+
closeRight: string;
|
|
126
|
+
closeAll: string;
|
|
127
|
+
refresh: string;
|
|
128
|
+
moveTop: string;
|
|
129
|
+
moveBottom: string;
|
|
130
|
+
findTabs: string;
|
|
131
|
+
findTabsPlaceholder: string;
|
|
132
|
+
noResults: string;
|
|
133
|
+
tabActions: string;
|
|
134
|
+
pinned: string;
|
|
135
|
+
loading: string;
|
|
136
|
+
empty: string;
|
|
137
|
+
unsaved: string;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export declare const OG_TABS_LOCALE_ZH_CN: {
|
|
141
|
+
pin: string;
|
|
142
|
+
unpin: string;
|
|
143
|
+
close: string;
|
|
144
|
+
closeOthers: string;
|
|
145
|
+
closeLeft: string;
|
|
146
|
+
closeRight: string;
|
|
147
|
+
closeAll: string;
|
|
148
|
+
refresh: string;
|
|
149
|
+
moveTop: string;
|
|
150
|
+
moveBottom: string;
|
|
151
|
+
findTabs: string;
|
|
152
|
+
findTabsPlaceholder: string;
|
|
153
|
+
noResults: string;
|
|
154
|
+
tabActions: string;
|
|
155
|
+
pinned: string;
|
|
156
|
+
loading: string;
|
|
157
|
+
empty: string;
|
|
158
|
+
unsaved: string;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export declare const OG_TABS_LOCALE_ZH_TW: {
|
|
162
|
+
pin: string;
|
|
163
|
+
unpin: string;
|
|
164
|
+
close: string;
|
|
165
|
+
closeOthers: string;
|
|
166
|
+
closeLeft: string;
|
|
167
|
+
closeRight: string;
|
|
168
|
+
closeAll: string;
|
|
169
|
+
refresh: string;
|
|
170
|
+
moveTop: string;
|
|
171
|
+
moveBottom: string;
|
|
172
|
+
findTabs: string;
|
|
173
|
+
findTabsPlaceholder: string;
|
|
174
|
+
noResults: string;
|
|
175
|
+
tabActions: string;
|
|
176
|
+
pinned: string;
|
|
177
|
+
loading: string;
|
|
178
|
+
empty: string;
|
|
179
|
+
unsaved: string;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export declare interface OgTabItem<TKey extends TabKey = TabKey, TData = unknown> {
|
|
183
|
+
key: TKey;
|
|
184
|
+
label: string;
|
|
185
|
+
icon?: Component;
|
|
186
|
+
badge?: string | number;
|
|
187
|
+
status?: OgTabsStatus;
|
|
188
|
+
statusIcon?: Component;
|
|
189
|
+
remark?: string;
|
|
190
|
+
/** Marks a tab whose underlying task has unsaved changes. */
|
|
191
|
+
dirty?: boolean;
|
|
192
|
+
disabled?: boolean;
|
|
193
|
+
readonly?: boolean;
|
|
194
|
+
closable?: boolean;
|
|
195
|
+
pinned?: boolean;
|
|
196
|
+
pinnable?: boolean;
|
|
197
|
+
draggable?: boolean;
|
|
198
|
+
lazy?: boolean;
|
|
199
|
+
data?: TData;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export declare const OgTabs: typeof __VLS_export;
|
|
203
|
+
|
|
204
|
+
export declare interface OgTabsActionContext<TKey extends TabKey = TabKey, TData = unknown> {
|
|
205
|
+
operation: OgTabsOperation;
|
|
206
|
+
source: OgTabsActionSource;
|
|
207
|
+
tab: OgTabItem<TKey, TData> | undefined;
|
|
208
|
+
activeKey: TKey | undefined;
|
|
209
|
+
activeTab: OgTabItem<TKey, TData> | undefined;
|
|
210
|
+
items: readonly OgTabItem<TKey, TData>[];
|
|
211
|
+
nextItems?: readonly OgTabItem<TKey, TData>[];
|
|
212
|
+
nextActiveKey?: TKey | undefined;
|
|
213
|
+
targets?: readonly OgTabItem<TKey, TData>[];
|
|
214
|
+
targetTab?: OgTabItem<TKey, TData> | undefined;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** One explicit action-policy mode prevents whitelist/blacklist precedence conflicts. */
|
|
218
|
+
export declare type OgTabsActionPolicy = {
|
|
219
|
+
mode: 'allow';
|
|
220
|
+
actions: readonly OgTabsOperation[];
|
|
221
|
+
} | {
|
|
222
|
+
mode: 'deny';
|
|
223
|
+
actions: readonly OgTabsOperation[];
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export declare type OgTabsActionSource = 'native' | 'contextmenu' | 'menu' | 'keyboard' | 'drag' | 'finder' | 'api';
|
|
227
|
+
|
|
228
|
+
export declare type OgTabsCloseScope = 'current' | 'others' | 'left' | 'right' | 'all';
|
|
229
|
+
|
|
230
|
+
export declare interface OgTabsContextMenuOptions {
|
|
231
|
+
/** Enables pointer, keyboard, and active-tab context-menu triggers. Defaults to true. */
|
|
232
|
+
enabled?: boolean;
|
|
233
|
+
hiddenActions?: readonly OgTabsOperation[];
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export declare interface OgTabsController<TKey extends TabKey, TData> extends Omit<OgTabsExpose<TKey, TData>, 'getNativeTabs'> {
|
|
237
|
+
readonly pending: Readonly<ShallowRef<boolean>>;
|
|
238
|
+
dispatch: (context: OgTabsActionContext<TKey, TData>) => Promise<boolean>;
|
|
239
|
+
closeScopeAt: (scope: OgTabsCloseScope, key: TKey | undefined, source?: OgTabsActionSource) => Promise<boolean>;
|
|
240
|
+
refreshAt: (key: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
241
|
+
moveBefore: (key: TKey, beforeKey: TKey | undefined, source?: OgTabsActionSource) => Promise<boolean>;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export declare type OgTabsDeniedReason = 'busy' | 'disabled' | 'readonly' | 'pinned' | 'policy' | 'boundary' | 'not-found';
|
|
245
|
+
|
|
246
|
+
export declare type OgTabsDensity = 'compact' | 'default';
|
|
247
|
+
|
|
248
|
+
export declare type OgTabsElementProps = Omit<Partial<TabsProps>, 'modelValue' | 'beforeLeave' | 'closable' | 'editable' | 'addable'>;
|
|
249
|
+
|
|
250
|
+
export declare interface OgTabsExpose<TKey extends TabKey = TabKey, TData = unknown> {
|
|
251
|
+
activate: (key: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
252
|
+
close: (key: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
253
|
+
closeScope: (scope: OgTabsCloseScope, source?: OgTabsActionSource) => Promise<boolean>;
|
|
254
|
+
pin: (key: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
255
|
+
unpin: (key: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
256
|
+
move: (key: TKey, targetKey: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
257
|
+
moveTop: (key: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
258
|
+
moveBottom: (key: TKey, source?: OgTabsActionSource) => Promise<boolean>;
|
|
259
|
+
refresh: (source?: OgTabsActionSource) => Promise<boolean>;
|
|
260
|
+
scrollTo: (key: TKey) => void;
|
|
261
|
+
getItems: () => readonly OgTabItem<TKey, TData>[];
|
|
262
|
+
getNativeTabs: () => TabsInstance | undefined;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export declare interface OgTabsFeatures {
|
|
266
|
+
close?: boolean;
|
|
267
|
+
pin?: boolean;
|
|
268
|
+
refresh?: boolean;
|
|
269
|
+
drag?: boolean;
|
|
270
|
+
finder?: boolean;
|
|
271
|
+
keyboard?: boolean;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** App-wide presentation and feature defaults. Controlled tab state and callbacks remain local. */
|
|
275
|
+
export declare interface OgTabsGlobalConfig {
|
|
276
|
+
variant?: OgTabsVariant;
|
|
277
|
+
density?: OgTabsDensity;
|
|
278
|
+
renderContent?: boolean;
|
|
279
|
+
features?: OgTabsFeatures;
|
|
280
|
+
tabsProps?: OgTabsElementProps;
|
|
281
|
+
locale?: DeepPartial<OgTabsLocale>;
|
|
282
|
+
/** Reactive language namespace provided by the application integration. */
|
|
283
|
+
localeSource?: OrigenUiLocaleSource<OgTabsLocale>;
|
|
284
|
+
minTabWidth?: string | number;
|
|
285
|
+
maxTabWidth?: string | number;
|
|
286
|
+
themeColor?: string;
|
|
287
|
+
sticky?: boolean | number;
|
|
288
|
+
finderThreshold?: number;
|
|
289
|
+
contextMenu?: OgTabsContextMenuOptions;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export declare type OgTabsInlineStyle = CSSProperties;
|
|
293
|
+
|
|
294
|
+
export declare interface OgTabsLocale {
|
|
295
|
+
pin: string;
|
|
296
|
+
unpin: string;
|
|
297
|
+
close: string;
|
|
298
|
+
closeOthers: string;
|
|
299
|
+
closeLeft: string;
|
|
300
|
+
closeRight: string;
|
|
301
|
+
closeAll: string;
|
|
302
|
+
refresh: string;
|
|
303
|
+
moveTop: string;
|
|
304
|
+
moveBottom: string;
|
|
305
|
+
findTabs: string;
|
|
306
|
+
findTabsPlaceholder: string;
|
|
307
|
+
noResults: string;
|
|
308
|
+
tabActions: string;
|
|
309
|
+
pinned: string;
|
|
310
|
+
loading: string;
|
|
311
|
+
empty: string;
|
|
312
|
+
unsaved: string;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export declare type OgTabsOperation = 'activate' | 'close' | 'close-others' | 'close-left' | 'close-right' | 'close-all' | 'refresh' | 'pin' | 'unpin' | 'move' | 'move-top' | 'move-bottom';
|
|
316
|
+
|
|
317
|
+
export declare interface OgTabsProps<TKey extends TabKey = TabKey, TData = unknown> {
|
|
318
|
+
/** An omitted value and an explicit `undefined` both represent no active tab. */
|
|
319
|
+
modelValue?: TKey | undefined;
|
|
320
|
+
items: readonly OgTabItem<TKey, TData>[];
|
|
321
|
+
variant?: OgTabsVariant | undefined;
|
|
322
|
+
density?: OgTabsDensity | undefined;
|
|
323
|
+
renderContent?: boolean | undefined;
|
|
324
|
+
features?: OgTabsFeatures | undefined;
|
|
325
|
+
readonly?: boolean | undefined;
|
|
326
|
+
busy?: boolean | undefined;
|
|
327
|
+
tabsProps?: OgTabsElementProps | undefined;
|
|
328
|
+
locale?: DeepPartial<OgTabsLocale> | undefined;
|
|
329
|
+
minTabWidth?: string | number | undefined;
|
|
330
|
+
maxTabWidth?: string | number | undefined;
|
|
331
|
+
themeColor?: string | undefined;
|
|
332
|
+
sticky?: boolean | number | undefined;
|
|
333
|
+
finderThreshold?: number | undefined;
|
|
334
|
+
contextMenu?: OgTabsContextMenuOptions | undefined;
|
|
335
|
+
actionPolicy?: OgTabsActionPolicy | undefined;
|
|
336
|
+
beforeAction?: ((context: OgTabsActionContext<TKey, TData>) => MaybePromise<boolean | void>) | undefined;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export declare interface OgTabsSlots<TKey extends TabKey = TabKey, TData = unknown> {
|
|
340
|
+
default?: (props: {
|
|
341
|
+
tab: OgTabItem<TKey, TData>;
|
|
342
|
+
active: boolean;
|
|
343
|
+
}) => VNodeChild;
|
|
344
|
+
label?: (props: {
|
|
345
|
+
tab: OgTabItem<TKey, TData>;
|
|
346
|
+
active: boolean;
|
|
347
|
+
}) => VNodeChild;
|
|
348
|
+
tabBefore?: (props: {
|
|
349
|
+
tab: OgTabItem<TKey, TData>;
|
|
350
|
+
}) => VNodeChild;
|
|
351
|
+
tabAfter?: (props: {
|
|
352
|
+
tab: OgTabItem<TKey, TData>;
|
|
353
|
+
}) => VNodeChild;
|
|
354
|
+
status?: (props: {
|
|
355
|
+
tab: OgTabItem<TKey, TData>;
|
|
356
|
+
}) => VNodeChild;
|
|
357
|
+
contextMenuTop?: (props: OgTabsActionContext<TKey, TData>) => VNodeChild;
|
|
358
|
+
contextMenuBottom?: (props: OgTabsActionContext<TKey, TData>) => VNodeChild;
|
|
359
|
+
header?: () => VNodeChild;
|
|
360
|
+
extra?: () => VNodeChild;
|
|
361
|
+
empty?: () => VNodeChild;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export declare type OgTabsStatus = 'loading' | 'success' | 'warning' | 'error';
|
|
365
|
+
|
|
366
|
+
export declare type OgTabsVariant = 'default' | 'workspace';
|
|
367
|
+
|
|
368
|
+
export declare function operationForCloseScope(scope: OgTabsCloseScope): OgTabsOperation;
|
|
369
|
+
|
|
370
|
+
export declare function orderTabs<TKey extends TabKey, TData>(items: readonly OgTabItem<TKey, TData>[]): OgTabItem<TKey, TData>[];
|
|
371
|
+
|
|
372
|
+
export declare function removeTabs<TKey extends TabKey, TData>(items: readonly OgTabItem<TKey, TData>[], keys: ReadonlySet<TKey>): OgTabItem<TKey, TData>[];
|
|
373
|
+
|
|
374
|
+
export declare function resolveNextActive<TKey extends TabKey, TData>(items: readonly OgTabItem<TKey, TData>[], remaining: readonly OgTabItem<TKey, TData>[], closedKey: TKey): TKey | undefined;
|
|
375
|
+
|
|
376
|
+
export declare function setTabPinned<TKey extends TabKey, TData>(items: readonly OgTabItem<TKey, TData>[], key: TKey, pinned: boolean): OgTabItem<TKey, TData>[];
|
|
377
|
+
|
|
378
|
+
export declare type TabKey = string | number;
|
|
379
|
+
|
|
380
|
+
/** Returns the app-scoped defaults for read-only consumption. */
|
|
381
|
+
export declare function useOgTabsGlobalConfig(): Readonly<OgTabsGlobalConfig> | undefined;
|
|
382
|
+
|
|
383
|
+
export declare function useTabsController<TKey extends TabKey, TData>(options: UseTabsControllerOptions<TKey, TData>): OgTabsController<TKey, TData>;
|
|
384
|
+
|
|
385
|
+
export declare interface UseTabsControllerOptions<TKey extends TabKey, TData> {
|
|
386
|
+
getItems: () => readonly OgTabItem<TKey, TData>[];
|
|
387
|
+
getActiveKey: () => TKey | undefined;
|
|
388
|
+
getProps: () => OgTabsProps<TKey, TData>;
|
|
389
|
+
getDeniedReason: (operation: OgTabsOperation, tab?: OgTabItem<TKey, TData>) => OgTabsDeniedReason | undefined;
|
|
390
|
+
onRequest: (context: OgTabsActionContext<TKey, TData>) => void;
|
|
391
|
+
onDenied: (operation: OgTabsOperation, tab: OgTabItem<TKey, TData> | undefined, reason: OgTabsDeniedReason) => void;
|
|
392
|
+
onError: (context: OgTabsActionContext<TKey, TData>, error: unknown) => void;
|
|
393
|
+
onScrollTo: (key: TKey) => void;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export { }
|