@dou-ui/dashboard 0.0.0-stage → 0.1.0-alpha.1
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 +10 -2
- package/dist/chart/chart-settings.js +6 -0
- package/dist/chart/chart-settings.js.map +1 -0
- package/dist/chart/chart-settings.vue_vue_type_script_setup_true_lang.js +122 -0
- package/dist/chart/chart-settings.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/chart/chart.js +6 -0
- package/dist/chart/chart.js.map +1 -0
- package/dist/chart/chart.vue_vue_type_script_setup_true_lang.js +99 -0
- package/dist/chart/chart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/chart/index.js +33 -0
- package/dist/chart/index.js.map +1 -0
- package/dist/collaboration/index.js +281 -0
- package/dist/collaboration/index.js.map +1 -0
- package/dist/collaboration/order.js +88 -0
- package/dist/collaboration/order.js.map +1 -0
- package/dist/core/document.js +128 -0
- package/dist/core/document.js.map +1 -0
- package/dist/core/history.js +66 -0
- package/dist/core/history.js.map +1 -0
- package/dist/core/transaction.js +218 -0
- package/dist/core/transaction.js.map +1 -0
- package/dist/dashboard/dashboard.js +6 -0
- package/dist/dashboard/dashboard.js.map +1 -0
- package/dist/dashboard/dashboard.vue_vue_type_script_setup_true_lang.js +1072 -0
- package/dist/dashboard/dashboard.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/dashboard/export.js +77 -0
- package/dist/dashboard/export.js.map +1 -0
- package/dist/dashboard/filter-bar.js +6 -0
- package/dist/dashboard/filter-bar.js.map +1 -0
- package/dist/dashboard/filter-bar.vue_vue_type_script_setup_true_lang.js +150 -0
- package/dist/dashboard/filter-bar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/dashboard/frame-context.js +5 -0
- package/dist/dashboard/frame-context.js.map +1 -0
- package/dist/dashboard/observers.js +48 -0
- package/dist/dashboard/observers.js.map +1 -0
- package/dist/dashboard/palette.js +6 -0
- package/dist/dashboard/palette.js.map +1 -0
- package/dist/dashboard/palette.vue_vue_type_script_setup_true_lang.js +54 -0
- package/dist/dashboard/palette.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/dashboard/widget-body.js +6 -0
- package/dist/dashboard/widget-body.js.map +1 -0
- package/dist/dashboard/widget-body.vue_vue_type_script_setup_true_lang.js +96 -0
- package/dist/dashboard/widget-body.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/dashboard/widget-frame.js +6 -0
- package/dist/dashboard/widget-frame.js.map +1 -0
- package/dist/dashboard/widget-frame.vue_vue_type_script_setup_true_lang.js +300 -0
- package/dist/dashboard/widget-frame.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/dashboard/widget-settings.js +6 -0
- package/dist/dashboard/widget-settings.js.map +1 -0
- package/dist/dashboard/widget-settings.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/dashboard/widget-settings.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/data/context.js +5 -0
- package/dist/data/context.js.map +1 -0
- package/dist/data/filters.js +31 -0
- package/dist/data/filters.js.map +1 -0
- package/dist/data/store.js +214 -0
- package/dist/data/store.js.map +1 -0
- package/dist/grid/grid-handle.js +6 -0
- package/dist/grid/grid-handle.js.map +1 -0
- package/dist/grid/grid-handle.vue_vue_type_script_setup_true_lang.js +21 -0
- package/dist/grid/grid-handle.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/grid/grid-item.js +80 -0
- package/dist/grid/grid-item.js.map +1 -0
- package/dist/grid/grid-layout.js +6 -0
- package/dist/grid/grid-layout.js.map +1 -0
- package/dist/grid/grid-layout.vue_vue_type_script_setup_true_lang.js +767 -0
- package/dist/grid/grid-layout.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/grid/tiers.js +31 -0
- package/dist/grid/tiers.js.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/layout/engine.js +284 -0
- package/dist/layout/engine.js.map +1 -0
- package/dist/layout/index.js +1 -0
- package/dist/locale.js +245 -0
- package/dist/locale.js.map +1 -0
- package/dist/pivot/index.js +47 -0
- package/dist/pivot/index.js.map +1 -0
- package/dist/pivot/pivot-settings.js +6 -0
- package/dist/pivot/pivot-settings.js.map +1 -0
- package/dist/pivot/pivot-settings.vue_vue_type_script_setup_true_lang.js +64 -0
- package/dist/pivot/pivot-settings.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/pivot/pivot.js +6 -0
- package/dist/pivot/pivot.js.map +1 -0
- package/dist/pivot/pivot.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/pivot/pivot.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/style.d.ts +1 -0
- package/dist/style.js +12 -0
- package/dist/types/chart/chart-settings.vue.d.ts +11 -0
- package/dist/types/chart/chart.vue.d.ts +3 -0
- package/dist/types/chart/index.d.ts +9 -0
- package/dist/types/chart/types.d.ts +23 -0
- package/dist/types/collaboration/index.d.ts +53 -0
- package/dist/types/collaboration/order.d.ts +20 -0
- package/dist/types/core/collaboration.d.ts +51 -0
- package/dist/types/core/document.d.ts +35 -0
- package/dist/types/core/history.d.ts +15 -0
- package/dist/types/core/transaction.d.ts +86 -0
- package/dist/types/core/types.d.ts +27 -0
- package/dist/types/dashboard/dashboard.vue.d.ts +33 -0
- package/dist/types/dashboard/export.d.ts +11 -0
- package/dist/types/dashboard/filter-bar.vue.d.ts +19 -0
- package/dist/types/dashboard/frame-context.d.ts +54 -0
- package/dist/types/dashboard/observers.d.ts +15 -0
- package/dist/types/dashboard/palette.vue.d.ts +20 -0
- package/dist/types/dashboard/types.d.ts +190 -0
- package/dist/types/dashboard/widget-body.vue.d.ts +19 -0
- package/dist/types/dashboard/widget-frame.vue.d.ts +6 -0
- package/dist/types/dashboard/widget-settings.vue.d.ts +16 -0
- package/dist/types/data/context.d.ts +18 -0
- package/dist/types/data/filters.d.ts +9 -0
- package/dist/types/data/store.d.ts +48 -0
- package/dist/types/data/types.d.ts +67 -0
- package/dist/types/grid/grid-handle.vue.d.ts +18 -0
- package/dist/types/grid/grid-item.d.ts +78 -0
- package/dist/types/grid/grid-layout.vue.d.ts +46 -0
- package/dist/types/grid/tiers.d.ts +12 -0
- package/dist/types/grid/types.d.ts +113 -0
- package/dist/types/index.d.ts +295 -0
- package/dist/types/layout/engine.d.ts +50 -0
- package/dist/types/layout/index.d.ts +2 -0
- package/dist/types/layout/types.d.ts +39 -0
- package/dist/types/locale.d.ts +117 -0
- package/dist/types/pivot/index.d.ts +14 -0
- package/dist/types/pivot/pivot-settings.vue.d.ts +16 -0
- package/dist/types/pivot/pivot.vue.d.ts +7 -0
- package/dist/types/pivot/types.d.ts +11 -0
- package/dist/types/widget/context.d.ts +91 -0
- package/dist/types/widget/define.d.ts +50 -0
- package/dist/types/widgets/field-select.vue.d.ts +18 -0
- package/dist/types/widgets/index.d.ts +15 -0
- package/dist/types/widgets/settings-field.vue.d.ts +17 -0
- package/dist/types/widgets/shared.d.ts +20 -0
- package/dist/types/widgets/source-field.vue.d.ts +15 -0
- package/dist/types/widgets/stat-settings.vue.d.ts +11 -0
- package/dist/types/widgets/stat.vue.d.ts +3 -0
- package/dist/types/widgets/table-settings.vue.d.ts +11 -0
- package/dist/types/widgets/table.vue.d.ts +3 -0
- package/dist/types/widgets/text-settings.vue.d.ts +11 -0
- package/dist/types/widgets/text.vue.d.ts +3 -0
- package/dist/types/widgets/types.d.ts +38 -0
- package/dist/widget/context.js +88 -0
- package/dist/widget/context.js.map +1 -0
- package/dist/widget/define.js +32 -0
- package/dist/widget/define.js.map +1 -0
- package/dist/widgets/field-select.js +6 -0
- package/dist/widgets/field-select.js.map +1 -0
- package/dist/widgets/field-select.vue_vue_type_script_setup_true_lang.js +54 -0
- package/dist/widgets/field-select.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/widgets/index.js +74 -0
- package/dist/widgets/index.js.map +1 -0
- package/dist/widgets/settings-field.js +6 -0
- package/dist/widgets/settings-field.js.map +1 -0
- package/dist/widgets/settings-field.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/widgets/settings-field.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/widgets/shared.js +68 -0
- package/dist/widgets/shared.js.map +1 -0
- package/dist/widgets/source-field.js +6 -0
- package/dist/widgets/source-field.js.map +1 -0
- package/dist/widgets/source-field.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/widgets/source-field.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/widgets/stat-settings.js +6 -0
- package/dist/widgets/stat-settings.js.map +1 -0
- package/dist/widgets/stat-settings.vue_vue_type_script_setup_true_lang.js +107 -0
- package/dist/widgets/stat-settings.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/widgets/stat.js +6 -0
- package/dist/widgets/stat.js.map +1 -0
- package/dist/widgets/stat.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/widgets/stat.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/widgets/table-settings.js +6 -0
- package/dist/widgets/table-settings.js.map +1 -0
- package/dist/widgets/table-settings.vue_vue_type_script_setup_true_lang.js +90 -0
- package/dist/widgets/table-settings.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/widgets/table.js +6 -0
- package/dist/widgets/table.js.map +1 -0
- package/dist/widgets/table.vue_vue_type_script_setup_true_lang.js +91 -0
- package/dist/widgets/table.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/widgets/text-settings.js +6 -0
- package/dist/widgets/text-settings.js.map +1 -0
- package/dist/widgets/text-settings.vue_vue_type_script_setup_true_lang.js +63 -0
- package/dist/widgets/text-settings.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/widgets/text.js +6 -0
- package/dist/widgets/text.js.map +1 -0
- package/dist/widgets/text.vue_vue_type_script_setup_true_lang.js +16 -0
- package/dist/widgets/text.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/package.json +98 -4
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SheetWorkbook } from '@dou-ui/sheet/core';
|
|
2
|
+
import type { DashboardWidget } from '../core/types';
|
|
3
|
+
import type { DashboardMessages } from '../locale';
|
|
4
|
+
import type { DashboardWidgetType } from '../widget/define';
|
|
5
|
+
type __VLS_Props = {
|
|
6
|
+
widget: DashboardWidget;
|
|
7
|
+
type?: DashboardWidgetType<any>;
|
|
8
|
+
editing: boolean;
|
|
9
|
+
fullscreen?: boolean;
|
|
10
|
+
messages: DashboardMessages;
|
|
11
|
+
setProps: (id: string, patch: Record<string, unknown>, options?: {
|
|
12
|
+
group?: string;
|
|
13
|
+
}) => void;
|
|
14
|
+
/** Where the widget's workbook goes, for its export menu; the full-screen copy has none. */
|
|
15
|
+
setWorkbook?: (id: string, get: () => SheetWorkbook | undefined) => () => void;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DashboardWidget } from '../core/types';
|
|
2
|
+
import type { DashboardWidgetType } from '../widget/define';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
widget: DashboardWidget;
|
|
5
|
+
type: DashboardWidgetType<any>;
|
|
6
|
+
setProps: (id: string, patch: Record<string, unknown>, options?: {
|
|
7
|
+
group?: string;
|
|
8
|
+
}) => void;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:props": (props: Record<string, unknown>) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
+
"onUpdate:props"?: ((props: Record<string, unknown>) => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { InjectionKey } from 'vue';
|
|
2
|
+
import type { SourceStore } from './store';
|
|
3
|
+
import type { DashboardFilters, DashboardLinkedFilter, DashboardSetFilterOptions } from './types';
|
|
4
|
+
/** What widgets read from their dashboard about data and filters. */
|
|
5
|
+
export interface DataContext {
|
|
6
|
+
store: SourceStore;
|
|
7
|
+
/** The names of the dashboard's sources. */
|
|
8
|
+
sourceNames: () => string[];
|
|
9
|
+
/** Every filter value, as bound with `v-model:filters`. */
|
|
10
|
+
filters: () => DashboardFilters;
|
|
11
|
+
/** The keys of the filters a widget set itself, which it doesn't see. */
|
|
12
|
+
emitted: (id: string) => ReadonlySet<string>;
|
|
13
|
+
/** The filters a widget set itself, for its title bar. */
|
|
14
|
+
linked: (id: string) => DashboardLinkedFilter[];
|
|
15
|
+
/** Sets (or clears, with an empty value) a filter; `widget` is the widget setting it, if any. */
|
|
16
|
+
setFilter: (widget: string | undefined, key: string, value: unknown, options?: DashboardSetFilterOptions) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const dataContextKey: InjectionKey<DataContext>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DashboardFilters } from './types';
|
|
2
|
+
/** Whether a filter value filters nothing: `undefined`, `null`, `''` or an empty array. */
|
|
3
|
+
export declare function isEmptyFilter(value: unknown): boolean;
|
|
4
|
+
/** The filters without empty values and without `skip`, limited to `keys` when given. */
|
|
5
|
+
export declare function pickFilters(filters: DashboardFilters, keys?: readonly string[], skip?: ReadonlySet<string>): DashboardFilters;
|
|
6
|
+
/** JSON with object keys in order, so equal filters give equal text. */
|
|
7
|
+
export declare function stableKey(value: unknown): string;
|
|
8
|
+
/** How a filter value reads when no label is given: lists joined with `、`. */
|
|
9
|
+
export declare function filterText(value: unknown): string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ShallowRef } from 'vue';
|
|
2
|
+
import type { DashboardFilters, DashboardSourceLoad, DashboardSourceOptions, DashboardSources } from './types';
|
|
3
|
+
export type SourceState = {
|
|
4
|
+
status: 'idle';
|
|
5
|
+
} | {
|
|
6
|
+
status: 'loading';
|
|
7
|
+
data?: unknown;
|
|
8
|
+
error?: unknown;
|
|
9
|
+
} | {
|
|
10
|
+
status: 'ready';
|
|
11
|
+
data: unknown;
|
|
12
|
+
} | {
|
|
13
|
+
status: 'error';
|
|
14
|
+
data?: unknown;
|
|
15
|
+
error: unknown;
|
|
16
|
+
};
|
|
17
|
+
/** One source loaded with one set of filters, shared by every widget showing it. */
|
|
18
|
+
export interface SourceEntry {
|
|
19
|
+
readonly key: string;
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly filters: DashboardFilters;
|
|
22
|
+
readonly state: ShallowRef<SourceState>;
|
|
23
|
+
/** Whether a load is running for data already shown (a refresh), not for new data. */
|
|
24
|
+
readonly refreshing: ShallowRef<boolean>;
|
|
25
|
+
}
|
|
26
|
+
export declare function optionsOf(source: DashboardSourceLoad<any> | DashboardSourceOptions<any>): DashboardSourceOptions<any>;
|
|
27
|
+
/** Whether two definitions of a source load the same way. */
|
|
28
|
+
export declare function sameSource(a: DashboardSourceLoad<any> | DashboardSourceOptions<any> | undefined, b: DashboardSourceLoad<any> | DashboardSourceOptions<any> | undefined): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Loads the dashboard's sources: once for each source and set of filters,
|
|
31
|
+
* however many widgets show it. Results nobody shows any more are kept a
|
|
32
|
+
* while; loads nobody waits for are aborted.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createSourceStore(sources: () => DashboardSources | undefined): {
|
|
35
|
+
use: (name: string, filters: DashboardFilters) => {
|
|
36
|
+
entry: SourceEntry;
|
|
37
|
+
release(): void;
|
|
38
|
+
};
|
|
39
|
+
reload: (name?: string) => void;
|
|
40
|
+
retry: (entry: SourceEntry) => void;
|
|
41
|
+
busy: () => boolean;
|
|
42
|
+
dispose: () => void;
|
|
43
|
+
keyOf: (name: string, filters: DashboardFilters) => {
|
|
44
|
+
key: string;
|
|
45
|
+
scoped: DashboardFilters;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export type SourceStore = ReturnType<typeof createSourceStore>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** The values of a dashboard's filters, by key. Bound with `v-model:filters`. */
|
|
2
|
+
export type DashboardFilters = Record<string, unknown>;
|
|
3
|
+
export interface DashboardSourceContext {
|
|
4
|
+
/** The filters in effect for the widgets asking: only the keys the source uses, without empty ones. */
|
|
5
|
+
filters: DashboardFilters;
|
|
6
|
+
/** Aborted when no widget needs the result any more, e.g. after the filters changed. */
|
|
7
|
+
signal: AbortSignal;
|
|
8
|
+
/** The source's name. */
|
|
9
|
+
source: string;
|
|
10
|
+
}
|
|
11
|
+
/** Loads a source's data; called once for each set of filters, however many widgets show it. */
|
|
12
|
+
export type DashboardSourceLoad<T = unknown> = (context: DashboardSourceContext) => T | PromiseLike<T>;
|
|
13
|
+
export interface DashboardSourceOptions<T = unknown> {
|
|
14
|
+
load: DashboardSourceLoad<T>;
|
|
15
|
+
/**
|
|
16
|
+
* The filter keys it uses; other filters neither reach it nor load it
|
|
17
|
+
* again. Defaults to every filter.
|
|
18
|
+
*/
|
|
19
|
+
filters?: string[];
|
|
20
|
+
/** Loads again every this many ms while it is shown; paused while the page is hidden. */
|
|
21
|
+
interval?: number;
|
|
22
|
+
}
|
|
23
|
+
/** Where widgets get their data, by name. A widget names its source in `props.source`. */
|
|
24
|
+
export type DashboardSources = Record<string, DashboardSourceLoad<any> | DashboardSourceOptions<any>>;
|
|
25
|
+
/** A filter set by a widget, e.g. by clicking a bar of its chart. */
|
|
26
|
+
export interface DashboardLinkedFilter {
|
|
27
|
+
key: string;
|
|
28
|
+
value: unknown;
|
|
29
|
+
/** How the value is shown, e.g. a name for an id. Defaults to the value. */
|
|
30
|
+
label: string;
|
|
31
|
+
/** The widget that set it, which itself keeps showing everything. */
|
|
32
|
+
widget: string;
|
|
33
|
+
}
|
|
34
|
+
export interface DashboardSetFilterOptions {
|
|
35
|
+
/** How the value is shown in the title bar and the filter bar. Defaults to the value. */
|
|
36
|
+
label?: string;
|
|
37
|
+
}
|
|
38
|
+
interface FilterFieldBase {
|
|
39
|
+
/** The filter's key in `v-model:filters`. */
|
|
40
|
+
key: string;
|
|
41
|
+
/** Shown before the control, and its accessible name. */
|
|
42
|
+
label: string;
|
|
43
|
+
}
|
|
44
|
+
/** A dropdown of values; with `multiple`, the value is an array. */
|
|
45
|
+
export interface DashboardSelectFilterField extends FilterFieldBase {
|
|
46
|
+
type: 'select';
|
|
47
|
+
/** Strings and numbers serve as both value and label. */
|
|
48
|
+
options: ({
|
|
49
|
+
value: string | number;
|
|
50
|
+
label?: string;
|
|
51
|
+
} | string | number)[];
|
|
52
|
+
multiple?: boolean;
|
|
53
|
+
/** Shown while nothing is picked. Defaults to the locale's. */
|
|
54
|
+
placeholder?: string;
|
|
55
|
+
}
|
|
56
|
+
/** A range of days; the value is `['YYYY-MM-DD', 'YYYY-MM-DD']`. */
|
|
57
|
+
export interface DashboardDateRangeFilterField extends FilterFieldBase {
|
|
58
|
+
type: 'date-range';
|
|
59
|
+
}
|
|
60
|
+
/** Typed text, applied once typing pauses. */
|
|
61
|
+
export interface DashboardSearchFilterField extends FilterFieldBase {
|
|
62
|
+
type: 'search';
|
|
63
|
+
placeholder?: string;
|
|
64
|
+
}
|
|
65
|
+
/** A control in the filter bar. */
|
|
66
|
+
export type DashboardFilterField = DashboardSelectFilterField | DashboardDateRangeFilterField | DashboardSearchFilterField;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** The element to render, such as `header`. */
|
|
3
|
+
as?: string;
|
|
4
|
+
};
|
|
5
|
+
type __VLS_Slots = {
|
|
6
|
+
default?: () => unknown;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
9
|
+
as: string;
|
|
10
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type InjectionKey, type PropType, type Slots } from 'vue';
|
|
2
|
+
import type { GridItem } from '../layout/types';
|
|
3
|
+
import type { GridResizeHandle } from './types';
|
|
4
|
+
export interface GridItemContext {
|
|
5
|
+
slots: Slots;
|
|
6
|
+
/** The id the description of every item is read from. */
|
|
7
|
+
hintId: string;
|
|
8
|
+
resizeLabel: () => string;
|
|
9
|
+
}
|
|
10
|
+
export declare const gridItemKey: InjectionKey<GridItemContext>;
|
|
11
|
+
/**
|
|
12
|
+
* One item of the grid. A component of its own so that moving one item
|
|
13
|
+
* re-renders that item alone: the others get the same `item` object back
|
|
14
|
+
* from the layout engine, and their slot content isn't run again.
|
|
15
|
+
*/
|
|
16
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
17
|
+
item: {
|
|
18
|
+
type: PropType<GridItem>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
state: {
|
|
22
|
+
type: PropType<"idle" | "dragging" | "resizing">;
|
|
23
|
+
default: string;
|
|
24
|
+
};
|
|
25
|
+
editable: BooleanConstructor;
|
|
26
|
+
/** -1, 0, or undefined when the item itself isn't focusable. */
|
|
27
|
+
tabindex: {
|
|
28
|
+
type: NumberConstructor;
|
|
29
|
+
default: undefined;
|
|
30
|
+
};
|
|
31
|
+
label: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
required: true;
|
|
34
|
+
};
|
|
35
|
+
roleDescription: {
|
|
36
|
+
type: StringConstructor;
|
|
37
|
+
required: true;
|
|
38
|
+
};
|
|
39
|
+
handles: {
|
|
40
|
+
type: PropType<GridResizeHandle[]>;
|
|
41
|
+
default: () => never[];
|
|
42
|
+
};
|
|
43
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
46
|
+
item: {
|
|
47
|
+
type: PropType<GridItem>;
|
|
48
|
+
required: true;
|
|
49
|
+
};
|
|
50
|
+
state: {
|
|
51
|
+
type: PropType<"idle" | "dragging" | "resizing">;
|
|
52
|
+
default: string;
|
|
53
|
+
};
|
|
54
|
+
editable: BooleanConstructor;
|
|
55
|
+
/** -1, 0, or undefined when the item itself isn't focusable. */
|
|
56
|
+
tabindex: {
|
|
57
|
+
type: NumberConstructor;
|
|
58
|
+
default: undefined;
|
|
59
|
+
};
|
|
60
|
+
label: {
|
|
61
|
+
type: StringConstructor;
|
|
62
|
+
required: true;
|
|
63
|
+
};
|
|
64
|
+
roleDescription: {
|
|
65
|
+
type: StringConstructor;
|
|
66
|
+
required: true;
|
|
67
|
+
};
|
|
68
|
+
handles: {
|
|
69
|
+
type: PropType<GridResizeHandle[]>;
|
|
70
|
+
default: () => never[];
|
|
71
|
+
};
|
|
72
|
+
}>> & Readonly<{}>, {
|
|
73
|
+
editable: boolean;
|
|
74
|
+
state: "idle" | "dragging" | "resizing";
|
|
75
|
+
tabindex: number;
|
|
76
|
+
handles: GridResizeHandle[];
|
|
77
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
78
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { GridItem } from '../layout/types';
|
|
2
|
+
import type { GridItemSlotProps, GridLayouts, GridLayoutExpose, GridLayoutProps, GridResizeHandle } from './types';
|
|
3
|
+
type __VLS_Props = Omit<GridLayoutProps, 'modelValue' | 'layouts'>;
|
|
4
|
+
type __VLS_Slots = {
|
|
5
|
+
item?: (props: GridItemSlotProps) => unknown;
|
|
6
|
+
placeholder?: (props: {
|
|
7
|
+
item: GridItem;
|
|
8
|
+
}) => unknown;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_ModelProps = {
|
|
11
|
+
modelValue?: GridItem[];
|
|
12
|
+
'layouts'?: GridLayouts;
|
|
13
|
+
};
|
|
14
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
15
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, GridLayoutExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
drop: (event: import("./types").GridDropEvent) => any;
|
|
17
|
+
change: (event: import("./types").GridChangeEvent) => any;
|
|
18
|
+
"update:modelValue": (value: GridItem[]) => any;
|
|
19
|
+
"update:layouts": (value: Partial<Record<string, import("./types").GridPlace[]>>) => any;
|
|
20
|
+
dragStart: (event: import("./types").GridDragEvent) => any;
|
|
21
|
+
dragEnd: (event: import("./types").GridDragEndEvent) => any;
|
|
22
|
+
breakpointChange: (breakpoint: string) => any;
|
|
23
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
24
|
+
onDrop?: ((event: import("./types").GridDropEvent) => any) | undefined;
|
|
25
|
+
onChange?: ((event: import("./types").GridChangeEvent) => any) | undefined;
|
|
26
|
+
"onUpdate:modelValue"?: ((value: GridItem[]) => any) | undefined;
|
|
27
|
+
"onUpdate:layouts"?: ((value: Partial<Record<string, import("./types").GridPlace[]>>) => any) | undefined;
|
|
28
|
+
onDragStart?: ((event: import("./types").GridDragEvent) => any) | undefined;
|
|
29
|
+
onDragEnd?: ((event: import("./types").GridDragEndEvent) => any) | undefined;
|
|
30
|
+
onBreakpointChange?: ((breakpoint: string) => any) | undefined;
|
|
31
|
+
}>, {
|
|
32
|
+
resize: boolean | GridResizeHandle[];
|
|
33
|
+
columns: number | Record<string, number>;
|
|
34
|
+
breakpoints: Record<string, number>;
|
|
35
|
+
rowHeight: number;
|
|
36
|
+
gap: number | [number, number];
|
|
37
|
+
compact: import("..").GridCompact;
|
|
38
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
39
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
40
|
+
declare const _default: typeof __VLS_export;
|
|
41
|
+
export default _default;
|
|
42
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
43
|
+
new (): {
|
|
44
|
+
$slots: S;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** One breakpoint of a grid: its name, the narrowest width it applies at, and its columns. */
|
|
2
|
+
export interface GridTier {
|
|
3
|
+
name: string;
|
|
4
|
+
min: number;
|
|
5
|
+
columns: number;
|
|
6
|
+
}
|
|
7
|
+
/** The breakpoint name used when `columns` is one number. */
|
|
8
|
+
export declare const SINGLE_TIER = "default";
|
|
9
|
+
/** A grid's breakpoints, widest first. */
|
|
10
|
+
export declare function gridTiers(columns: number | Record<string, number>, breakpoints: Record<string, number>): GridTier[];
|
|
11
|
+
export declare const DEFAULT_COLUMNS: Record<string, number>;
|
|
12
|
+
export declare const DEFAULT_BREAKPOINTS: Record<string, number>;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { GridCompact, GridItem } from '../layout/types';
|
|
2
|
+
import type { DashboardMessagesOverride } from '../locale';
|
|
3
|
+
/** An edge or corner of an item that can be dragged to resize it. */
|
|
4
|
+
export type GridResizeHandle = 'e' | 's' | 'se';
|
|
5
|
+
/** An item's place on one breakpoint's grid. */
|
|
6
|
+
export type GridPlace = Pick<GridItem, 'id' | 'x' | 'y' | 'w' | 'h'>;
|
|
7
|
+
/** The places items were given on the narrower breakpoints, by breakpoint name. */
|
|
8
|
+
export type GridLayouts = Partial<Record<string, GridPlace[]>>;
|
|
9
|
+
/** A new item dragged in from outside the grid; it gets its place where it is dropped. */
|
|
10
|
+
export type GridDropItem = Omit<GridItem, 'x' | 'y'>;
|
|
11
|
+
export interface GridLayoutProps {
|
|
12
|
+
/**
|
|
13
|
+
* The items, laid out on the widest breakpoint; `v-model` is updated once
|
|
14
|
+
* each move or resize ends.
|
|
15
|
+
*/
|
|
16
|
+
modelValue?: GridItem[];
|
|
17
|
+
/**
|
|
18
|
+
* Where items were moved on the narrower breakpoints (`v-model:layouts`).
|
|
19
|
+
* A breakpoint without one, or an item missing from one, is laid out from
|
|
20
|
+
* `modelValue`.
|
|
21
|
+
*/
|
|
22
|
+
layouts?: GridLayouts;
|
|
23
|
+
/**
|
|
24
|
+
* How many columns the grid has: one number, or one per breakpoint.
|
|
25
|
+
* Defaults to `{ lg: 12, md: 6, sm: 1 }`.
|
|
26
|
+
*/
|
|
27
|
+
columns?: number | Record<string, number>;
|
|
28
|
+
/**
|
|
29
|
+
* The narrowest width of the grid itself (not the window) at which each
|
|
30
|
+
* breakpoint applies, in px. Defaults to `{ lg: 1024, md: 640, sm: 0 }`.
|
|
31
|
+
*/
|
|
32
|
+
breakpoints?: Record<string, number>;
|
|
33
|
+
/** The height of a row, in px. Defaults to 80. */
|
|
34
|
+
rowHeight?: number;
|
|
35
|
+
/** The space between items, in px: one number, or `[across, down]`. Defaults to 16. */
|
|
36
|
+
gap?: number | [number, number];
|
|
37
|
+
/** `'vertical'` (the default) floats items up into gaps; `false` leaves them where they are put. */
|
|
38
|
+
compact?: GridCompact;
|
|
39
|
+
/** Whether items can be moved and resized, with the pointer and the keyboard. */
|
|
40
|
+
editable?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Moves start only from a `DouGridLayoutHandle` inside the item, such as
|
|
43
|
+
* its title bar. Defaults to `false`: the whole item.
|
|
44
|
+
*/
|
|
45
|
+
handle?: boolean;
|
|
46
|
+
/** Which edges resize an item; `false` turns resizing off. Defaults to `['e', 's', 'se']`. */
|
|
47
|
+
resize?: boolean | GridResizeHandle[];
|
|
48
|
+
/** The name an item is read out by. Defaults to its id. */
|
|
49
|
+
itemLabel?: (item: GridItem) => string;
|
|
50
|
+
/** The layout's accessible name. */
|
|
51
|
+
label?: string;
|
|
52
|
+
/** Overrides of the built-in texts. */
|
|
53
|
+
messages?: DashboardMessagesOverride;
|
|
54
|
+
}
|
|
55
|
+
/** Why the layout changed. */
|
|
56
|
+
export type GridChangeReason = 'move' | 'resize' | 'keyboard' | 'drop';
|
|
57
|
+
export interface GridChangeEvent {
|
|
58
|
+
/** The layout after the change (the same as the new `v-model`). */
|
|
59
|
+
items: GridItem[];
|
|
60
|
+
/** The item that was moved, resized or dropped. */
|
|
61
|
+
id: string;
|
|
62
|
+
reason: GridChangeReason;
|
|
63
|
+
/** The breakpoint whose layout changed. */
|
|
64
|
+
breakpoint: string;
|
|
65
|
+
}
|
|
66
|
+
export interface GridDropEvent {
|
|
67
|
+
/** The new item, in its place on the widest breakpoint (as added to `v-model`). */
|
|
68
|
+
item: GridItem;
|
|
69
|
+
/** What was passed to `startDrop`. */
|
|
70
|
+
data: unknown;
|
|
71
|
+
/** The breakpoint it was dropped on. */
|
|
72
|
+
breakpoint: string;
|
|
73
|
+
}
|
|
74
|
+
export interface GridDragEvent {
|
|
75
|
+
id: string;
|
|
76
|
+
kind: 'move' | 'resize' | 'drop';
|
|
77
|
+
}
|
|
78
|
+
export interface GridDragEndEvent extends GridDragEvent {
|
|
79
|
+
/** Whether the drag was undone with Escape (or the pointer was lost). */
|
|
80
|
+
cancelled: boolean;
|
|
81
|
+
}
|
|
82
|
+
export interface GridLayoutEmits {
|
|
83
|
+
'update:modelValue': [items: GridItem[]];
|
|
84
|
+
change: [event: GridChangeEvent];
|
|
85
|
+
dragStart: [event: GridDragEvent];
|
|
86
|
+
dragEnd: [event: GridDragEndEvent];
|
|
87
|
+
drop: [event: GridDropEvent];
|
|
88
|
+
'update:layouts': [layouts: GridLayouts];
|
|
89
|
+
breakpointChange: [breakpoint: string];
|
|
90
|
+
}
|
|
91
|
+
export interface GridLayoutExpose {
|
|
92
|
+
/** Moves keyboard focus to an item (when the layout is editable, the item itself; else its first focusable part). */
|
|
93
|
+
focusItem: (id: string) => void;
|
|
94
|
+
/** Scrolls an item into view. */
|
|
95
|
+
scrollToItem: (id: string, options?: ScrollIntoViewOptions) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Starts dragging a new item in from outside, such as from a list of
|
|
98
|
+
* widgets: call it in that element's `pointerdown`. A mouse starts after
|
|
99
|
+
* moving a little, a finger after resting on it. Dropped over the grid,
|
|
100
|
+
* the item is added to `v-model` and `drop` is emitted; Escape or a drop
|
|
101
|
+
* elsewhere cancels.
|
|
102
|
+
*/
|
|
103
|
+
startDrop: (event: PointerEvent, item: GridDropItem, data?: unknown) => void;
|
|
104
|
+
/** The breakpoint in use, from the grid's own width. */
|
|
105
|
+
readonly breakpoint: string;
|
|
106
|
+
}
|
|
107
|
+
export interface GridItemSlotProps {
|
|
108
|
+
item: GridItem;
|
|
109
|
+
/** Being moved with the pointer or the keyboard. */
|
|
110
|
+
dragging: boolean;
|
|
111
|
+
/** Being resized with the pointer. */
|
|
112
|
+
resizing: boolean;
|
|
113
|
+
}
|