@univerjs-pro/slicer 0.0.0-stage → 1.3.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/README.md +44 -2
- package/lib/cjs/index.js +1 -0
- package/lib/es/index.js +1 -0
- package/lib/index.js +1 -0
- package/lib/types/config/config.d.ts +5 -0
- package/lib/types/definition.d.ts +134 -0
- package/lib/types/index.d.ts +17 -0
- package/lib/types/member-index.d.ts +20 -0
- package/lib/types/name.d.ts +1 -0
- package/lib/types/plugin.d.ts +13 -0
- package/lib/types/rendering/canvas-icons.d.ts +5 -0
- package/lib/types/rendering/canvas-icons.generated.d.ts +76 -0
- package/lib/types/rendering/control.d.ts +54 -0
- package/lib/types/rendering/layout.d.ts +59 -0
- package/lib/types/rendering/slicer.d.ts +43 -0
- package/lib/types/rendering/status.d.ts +10 -0
- package/lib/types/rendering/theme.d.ts +19 -0
- package/lib/types/rendering/timeline.d.ts +123 -0
- package/lib/types/rendering/types.d.ts +220 -0
- package/lib/types/resource.d.ts +5 -0
- package/lib/types/selection.d.ts +4 -0
- package/lib/types/style.d.ts +65 -0
- package/lib/umd/index.js +1 -0
- package/package.json +68 -3
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export declare const SLICER_ICONS: {
|
|
2
|
+
readonly clearFilter: readonly [{
|
|
3
|
+
readonly d: "M2 2.5H13L9 7.2V10L6.5 11.5V7.2L2 2.5Z";
|
|
4
|
+
readonly fill: false;
|
|
5
|
+
readonly fillRule: "nonzero";
|
|
6
|
+
readonly strokeWidth: 1.2;
|
|
7
|
+
readonly lineCap: "round";
|
|
8
|
+
readonly lineJoin: "round";
|
|
9
|
+
}, {
|
|
10
|
+
readonly d: "M10.5 10.5L14 14M14 10.5L10.5 14";
|
|
11
|
+
readonly fill: false;
|
|
12
|
+
readonly fillRule: "nonzero";
|
|
13
|
+
readonly strokeWidth: 1.2;
|
|
14
|
+
readonly lineCap: "round";
|
|
15
|
+
readonly lineJoin: "miter";
|
|
16
|
+
}];
|
|
17
|
+
readonly multiSelect: readonly [{
|
|
18
|
+
readonly d: "M4.96372 2.59116C5.19803 2.35684 5.19803 1.97695 4.96372 1.74263C4.7294 1.50832 4.3495 1.50832 4.11519 1.74263L2.53945 3.31837L1.96372 2.74263C1.7294 2.50832 1.3495 2.50832 1.11519 2.74263C0.880874 2.97695 0.880874 3.35684 1.11519 3.59116L2.11519 4.59116C2.3495 4.82547 2.7294 4.82547 2.96372 4.59116L4.96372 2.59116Z";
|
|
19
|
+
readonly fill: true;
|
|
20
|
+
readonly fillRule: "nonzero";
|
|
21
|
+
readonly strokeWidth: 0;
|
|
22
|
+
readonly lineCap: "butt";
|
|
23
|
+
readonly lineJoin: "miter";
|
|
24
|
+
}, {
|
|
25
|
+
readonly d: "M14.4605 2.56689H6.8981C6.56672 2.56689 6.2981 2.83552 6.2981 3.16689C6.2981 3.49827 6.56672 3.76689 6.8981 3.76689H14.4605C14.7918 3.76689 15.0605 3.49827 15.0605 3.16689C15.0605 2.83552 14.7918 2.56689 14.4605 2.56689Z";
|
|
26
|
+
readonly fill: true;
|
|
27
|
+
readonly fillRule: "nonzero";
|
|
28
|
+
readonly strokeWidth: 0;
|
|
29
|
+
readonly lineCap: "butt";
|
|
30
|
+
readonly lineJoin: "miter";
|
|
31
|
+
}, {
|
|
32
|
+
readonly d: "M6.8981 7.2334C6.56672 7.2334 6.2981 7.50203 6.2981 7.8334C6.2981 8.16477 6.56672 8.4334 6.8981 8.4334H14.4605C14.7918 8.4334 15.0605 8.16477 15.0605 7.8334C15.0605 7.50203 14.7918 7.2334 14.4605 7.2334H6.8981Z";
|
|
33
|
+
readonly fill: true;
|
|
34
|
+
readonly fillRule: "nonzero";
|
|
35
|
+
readonly strokeWidth: 0;
|
|
36
|
+
readonly lineCap: "butt";
|
|
37
|
+
readonly lineJoin: "miter";
|
|
38
|
+
}, {
|
|
39
|
+
readonly d: "M6.2981 12.4999C6.2981 12.1685 6.56672 11.8999 6.8981 11.8999H14.4605C14.7918 11.8999 15.0605 12.1685 15.0605 12.4999C15.0605 12.8313 14.7918 13.0999 14.4605 13.0999H6.8981C6.56672 13.0999 6.2981 12.8313 6.2981 12.4999Z";
|
|
40
|
+
readonly fill: true;
|
|
41
|
+
readonly fillRule: "nonzero";
|
|
42
|
+
readonly strokeWidth: 0;
|
|
43
|
+
readonly lineCap: "butt";
|
|
44
|
+
readonly lineJoin: "miter";
|
|
45
|
+
}, {
|
|
46
|
+
readonly d: "M2.87279 5.8999C1.80504 5.8999 0.939453 6.76549 0.939453 7.83324C0.939453 8.90099 1.80504 9.76657 2.87279 9.76657C3.94054 9.76657 4.80612 8.90099 4.80612 7.83324C4.80612 6.76549 3.94054 5.8999 2.87279 5.8999ZM2.13945 7.83324C2.13945 7.42823 2.46778 7.0999 2.87279 7.0999C3.2778 7.0999 3.60612 7.42823 3.60612 7.83324C3.60612 8.23824 3.2778 8.56657 2.87279 8.56657C2.46778 8.56657 2.13945 8.23824 2.13945 7.83324Z";
|
|
47
|
+
readonly fill: true;
|
|
48
|
+
readonly fillRule: "evenodd";
|
|
49
|
+
readonly strokeWidth: 0;
|
|
50
|
+
readonly lineCap: "butt";
|
|
51
|
+
readonly lineJoin: "miter";
|
|
52
|
+
}, {
|
|
53
|
+
readonly d: "M0.939453 12.5002C0.939453 11.4325 1.80504 10.5669 2.87279 10.5669C3.94054 10.5669 4.80612 11.4325 4.80612 12.5002C4.80612 13.568 3.94054 14.4336 2.87279 14.4336C1.80504 14.4336 0.939453 13.568 0.939453 12.5002ZM2.87279 11.7669C2.46778 11.7669 2.13945 12.0952 2.13945 12.5002C2.13945 12.9052 2.46778 13.2336 2.87279 13.2336C3.2778 13.2336 3.60612 12.9052 3.60612 12.5002C3.60612 12.0952 3.2778 11.7669 2.87279 11.7669Z";
|
|
54
|
+
readonly fill: true;
|
|
55
|
+
readonly fillRule: "evenodd";
|
|
56
|
+
readonly strokeWidth: 0;
|
|
57
|
+
readonly lineCap: "butt";
|
|
58
|
+
readonly lineJoin: "miter";
|
|
59
|
+
}];
|
|
60
|
+
readonly moreUp: readonly [{
|
|
61
|
+
readonly d: "M4.64645 9.85355C4.45118 9.65829 4.45118 9.34171 4.64645 9.14645L7.64645 6.14645C7.84171 5.95118 8.15829 5.95118 8.35355 6.14645L11.3536 9.14645C11.5488 9.34171 11.5488 9.65829 11.3536 9.85355C11.1583 10.0488 10.8417 10.0488 10.6464 9.85355L8 7.20711L5.35355 9.85355C5.15829 10.0488 4.84171 10.0488 4.64645 9.85355Z";
|
|
62
|
+
readonly fill: true;
|
|
63
|
+
readonly fillRule: "evenodd";
|
|
64
|
+
readonly strokeWidth: 0;
|
|
65
|
+
readonly lineCap: "butt";
|
|
66
|
+
readonly lineJoin: "miter";
|
|
67
|
+
}];
|
|
68
|
+
readonly moreDown: readonly [{
|
|
69
|
+
readonly d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z";
|
|
70
|
+
readonly fill: true;
|
|
71
|
+
readonly fillRule: "evenodd";
|
|
72
|
+
readonly strokeWidth: 0;
|
|
73
|
+
readonly lineCap: "butt";
|
|
74
|
+
readonly lineJoin: "miter";
|
|
75
|
+
}];
|
|
76
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { IShapeProps } from '@univerjs/engine-render';
|
|
2
|
+
import type { Observable } from 'rxjs';
|
|
3
|
+
import type { IControlStatusShapeProps, SlicerCanvasPresentation, SlicerShapeIntent, TimelineShapeIntent } from './types';
|
|
4
|
+
import { Disposable } from '@univerjs/core';
|
|
5
|
+
import { SlicerControlKind } from '../definition';
|
|
6
|
+
import { SlicerShape } from './slicer';
|
|
7
|
+
import { ControlStatusShape } from './status';
|
|
8
|
+
import { TimelineShape } from './timeline';
|
|
9
|
+
import { SlicerShapeIntentType } from './types';
|
|
10
|
+
export type SlicerCanvasShape = ControlStatusShape | SlicerShape | TimelineShape;
|
|
11
|
+
export type SlicerCanvasIntent = Exclude<SlicerShapeIntent | TimelineShapeIntent, {
|
|
12
|
+
type: SlicerShapeIntentType.RequestWindow | SlicerShapeIntentType.RequestPeriods;
|
|
13
|
+
}>;
|
|
14
|
+
export interface ISlicerCanvasWindowRequest {
|
|
15
|
+
start: number;
|
|
16
|
+
count: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ISlicerCanvasStatusPresentation extends Pick<IControlStatusShapeProps, 'caption' | 'state' | 'style' | 'rtl'> {
|
|
19
|
+
canConfigure: boolean;
|
|
20
|
+
lockedPosition: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface ISlicerCanvasAdapter {
|
|
23
|
+
kind: SlicerControlKind;
|
|
24
|
+
changed$: Observable<unknown>;
|
|
25
|
+
getPresentation(request: ISlicerCanvasWindowRequest | undefined, signal: AbortSignal): Promise<SlicerCanvasPresentation>;
|
|
26
|
+
getStatus(state: IControlStatusShapeProps['state'], error?: unknown): ISlicerCanvasStatusPresentation;
|
|
27
|
+
execute(intent: SlicerCanvasIntent): Promise<boolean>;
|
|
28
|
+
}
|
|
29
|
+
export interface ISlicerCanvasHost {
|
|
30
|
+
getShape(): SlicerCanvasShape | undefined;
|
|
31
|
+
getShapeProps(): IShapeProps & {
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
};
|
|
35
|
+
/** Owns replacement/disposal and synchronizes Transformer changes idempotently for an existing object. */
|
|
36
|
+
mountShape(shape: SlicerCanvasShape, transformable: boolean): void;
|
|
37
|
+
isCurrent(): boolean;
|
|
38
|
+
}
|
|
39
|
+
/** Binds a local-coordinate Canvas control to data and layout without a Sheet/Pivot dependency. */
|
|
40
|
+
export declare class SlicerCanvasControl extends Disposable {
|
|
41
|
+
private readonly _key;
|
|
42
|
+
private readonly _adapter;
|
|
43
|
+
private readonly _host;
|
|
44
|
+
private _request?;
|
|
45
|
+
constructor(_key: string, _adapter: ISlicerCanvasAdapter, _host: ISlicerCanvasHost);
|
|
46
|
+
dispose(): void;
|
|
47
|
+
render(request?: ISlicerCanvasWindowRequest): Promise<SlicerCanvasShape | undefined>;
|
|
48
|
+
private _render;
|
|
49
|
+
private _renderPresentation;
|
|
50
|
+
private _renderStatus;
|
|
51
|
+
private _applyHostProps;
|
|
52
|
+
private _handleIntent;
|
|
53
|
+
private _isCurrent;
|
|
54
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ICanvasPoint, ICanvasRect } from './types';
|
|
2
|
+
import { SlicerHitTargetType, SlicerScrollbarPart } from './types';
|
|
3
|
+
export interface ISlicerLayoutInput {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
showCaption: boolean;
|
|
7
|
+
columnCount: number;
|
|
8
|
+
rowHeight: number;
|
|
9
|
+
totalItems: number;
|
|
10
|
+
scrollItem: number;
|
|
11
|
+
windowStart: number;
|
|
12
|
+
windowItemCount: number;
|
|
13
|
+
overscanRows: number;
|
|
14
|
+
rtl: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface ISlicerLayoutItem {
|
|
17
|
+
index: number;
|
|
18
|
+
windowIndex: number;
|
|
19
|
+
rect: ICanvasRect;
|
|
20
|
+
}
|
|
21
|
+
export interface ISlicerLayout {
|
|
22
|
+
bounds: ICanvasRect;
|
|
23
|
+
header?: ICanvasRect;
|
|
24
|
+
content: ICanvasRect;
|
|
25
|
+
clearButton?: ICanvasRect;
|
|
26
|
+
multiSelectButton?: ICanvasRect;
|
|
27
|
+
items: ISlicerLayoutItem[];
|
|
28
|
+
scrollbar?: {
|
|
29
|
+
track: ICanvasRect;
|
|
30
|
+
thumb: ICanvasRect;
|
|
31
|
+
};
|
|
32
|
+
windowRequest: {
|
|
33
|
+
start: number;
|
|
34
|
+
count: number;
|
|
35
|
+
};
|
|
36
|
+
scrollItem: number;
|
|
37
|
+
visibleRowCount: number;
|
|
38
|
+
visibleItemCount: number;
|
|
39
|
+
}
|
|
40
|
+
export type SlicerHitTarget = {
|
|
41
|
+
type: SlicerHitTargetType.Clear;
|
|
42
|
+
} | {
|
|
43
|
+
type: SlicerHitTargetType.MultiSelect;
|
|
44
|
+
} | {
|
|
45
|
+
type: SlicerHitTargetType.Item;
|
|
46
|
+
index: number;
|
|
47
|
+
} | {
|
|
48
|
+
type: SlicerHitTargetType.Scrollbar;
|
|
49
|
+
part: SlicerScrollbarPart.Track | SlicerScrollbarPart.Thumb;
|
|
50
|
+
} | {
|
|
51
|
+
type: SlicerHitTargetType.Header;
|
|
52
|
+
} | {
|
|
53
|
+
type: SlicerHitTargetType.Background;
|
|
54
|
+
} | {
|
|
55
|
+
type: SlicerHitTargetType.None;
|
|
56
|
+
};
|
|
57
|
+
export declare function computeSlicerLayout(input: ISlicerLayoutInput): ISlicerLayout;
|
|
58
|
+
export declare function hitTestSlicerLayout(layout: ISlicerLayout, point: ICanvasPoint): SlicerHitTarget;
|
|
59
|
+
export declare function contains(rect: ICanvasRect, point: ICanvasPoint): boolean;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { UniverRenderingContext } from '@univerjs/engine-render';
|
|
2
|
+
import { Shape } from '@univerjs/engine-render';
|
|
3
|
+
import type { ISlicerLayout, SlicerHitTarget } from './layout';
|
|
4
|
+
import type { ICanvasPoint, IInteractionModifiers, ISlicerShapeProps } from './types';
|
|
5
|
+
interface ISetDataOptions {
|
|
6
|
+
preserveScrollPosition?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class SlicerShape extends Shape<ISlicerShapeProps> {
|
|
9
|
+
private _data;
|
|
10
|
+
private _layout;
|
|
11
|
+
private _pressed?;
|
|
12
|
+
private _ignorePointerUp;
|
|
13
|
+
private _hoveredIndex?;
|
|
14
|
+
private _hoveredAction?;
|
|
15
|
+
private _focusIndex?;
|
|
16
|
+
private _anchorIndex?;
|
|
17
|
+
private _multiSelect;
|
|
18
|
+
private _navigationItem;
|
|
19
|
+
private _committedScrollItem;
|
|
20
|
+
constructor(key: string, props: ISlicerShapeProps);
|
|
21
|
+
setData(props: Partial<ISlicerShapeProps>, options?: ISetDataOptions): void;
|
|
22
|
+
getLayout(): ISlicerLayout;
|
|
23
|
+
hitTest(point: ICanvasPoint): SlicerHitTarget;
|
|
24
|
+
handlePointerDown(point: ICanvasPoint, modifiers?: IInteractionModifiers): void;
|
|
25
|
+
handlePointerMove(point: ICanvasPoint): void;
|
|
26
|
+
handlePointerUp(point: ICanvasPoint, modifiers?: IInteractionModifiers): void;
|
|
27
|
+
handlePointerCancel(): void;
|
|
28
|
+
handleWheel(deltaY: number): void;
|
|
29
|
+
commitScroll(): void;
|
|
30
|
+
handleKeyDown(key: string, modifiers?: IInteractionModifiers): boolean;
|
|
31
|
+
protected _draw(context: UniverRenderingContext): void;
|
|
32
|
+
private _commitItem;
|
|
33
|
+
private _getRangeValues;
|
|
34
|
+
private _getItem;
|
|
35
|
+
private _loadedIndexes;
|
|
36
|
+
private _computeLayout;
|
|
37
|
+
private _setScrollItem;
|
|
38
|
+
private _scrollToTrackPoint;
|
|
39
|
+
private _maxScrollItem;
|
|
40
|
+
private _syncLayoutToTransform;
|
|
41
|
+
private _toLocalPoint;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UniverRenderingContext } from '@univerjs/engine-render';
|
|
2
|
+
import type { IControlStatusShapeProps } from './types';
|
|
3
|
+
import { Shape } from '@univerjs/engine-render';
|
|
4
|
+
export declare class ControlStatusShape extends Shape<IControlStatusShapeProps> {
|
|
5
|
+
private _data;
|
|
6
|
+
constructor(key: string, props: IControlStatusShapeProps);
|
|
7
|
+
setData(props: Partial<IControlStatusShapeProps>): void;
|
|
8
|
+
getStatus(): IControlStatusShapeProps['state'];
|
|
9
|
+
protected _draw(context: UniverRenderingContext): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Disposable, ThemeService } from '@univerjs/core';
|
|
2
|
+
import type { ISlicerStyleDefinition, ITimelineStyleDefinition } from '../style';
|
|
3
|
+
import type { ISlicerResolvedStyle, ITimelineResolvedStyle } from './types';
|
|
4
|
+
export declare class SlicerThemeService extends Disposable {
|
|
5
|
+
private readonly _theme;
|
|
6
|
+
private readonly _slicerCache;
|
|
7
|
+
private readonly _timelineCache;
|
|
8
|
+
constructor(_theme: ThemeService);
|
|
9
|
+
resolveSlicerStyle(definition?: ISlicerStyleDefinition, styleName?: string): ISlicerResolvedStyle;
|
|
10
|
+
resolveTimelineStyle(definition?: ITimelineStyleDefinition, styleName?: string): ITimelineResolvedStyle;
|
|
11
|
+
private _baseStyle;
|
|
12
|
+
private _defaultSlicerItem;
|
|
13
|
+
private _defaultTimelineElement;
|
|
14
|
+
private _resolveBuiltInPalette;
|
|
15
|
+
private _createBuiltInPalette;
|
|
16
|
+
private _themeColor;
|
|
17
|
+
private _resolveFormatting;
|
|
18
|
+
private _invalidate;
|
|
19
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { UniverRenderingContext } from '@univerjs/engine-render';
|
|
2
|
+
import { Shape } from '@univerjs/engine-render';
|
|
3
|
+
import type { ITimelineRange } from '../definition';
|
|
4
|
+
import type { ICanvasPoint, ICanvasRect, ITimelinePeriod, ITimelineShapeProps } from './types';
|
|
5
|
+
import { TimelineLevel } from '../definition';
|
|
6
|
+
import { SlicerHitTargetType, SlicerScrollbarPart } from './types';
|
|
7
|
+
export interface IBuildTimelinePeriodWindowOptions {
|
|
8
|
+
minDate: number;
|
|
9
|
+
maxDate: number;
|
|
10
|
+
level: TimelineLevel;
|
|
11
|
+
dateSystem: ITimelineShapeProps['dateSystem'];
|
|
12
|
+
start: number;
|
|
13
|
+
count: number;
|
|
14
|
+
locale: string;
|
|
15
|
+
quarterLabel: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ITimelinePeriodWindow {
|
|
18
|
+
total: number;
|
|
19
|
+
start: number;
|
|
20
|
+
periods: ITimelinePeriod[];
|
|
21
|
+
}
|
|
22
|
+
export interface ITimelineLayoutPeriod {
|
|
23
|
+
period: ITimelinePeriod;
|
|
24
|
+
rect: ICanvasRect;
|
|
25
|
+
selected: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface ITimelineLevelMenuOption {
|
|
28
|
+
level: TimelineLevel;
|
|
29
|
+
label: string;
|
|
30
|
+
selected: boolean;
|
|
31
|
+
rect: ICanvasRect;
|
|
32
|
+
}
|
|
33
|
+
export interface ITimelineLayout {
|
|
34
|
+
bounds: ICanvasRect;
|
|
35
|
+
header?: ICanvasRect;
|
|
36
|
+
clearButton?: ICanvasRect;
|
|
37
|
+
selectionLabel?: ICanvasRect;
|
|
38
|
+
timeLevel?: ICanvasRect;
|
|
39
|
+
periodBand: ICanvasRect;
|
|
40
|
+
groupLabelBand: ICanvasRect;
|
|
41
|
+
periodLabelBand: ICanvasRect;
|
|
42
|
+
axisTrack: ICanvasRect;
|
|
43
|
+
periods: ITimelineLayoutPeriod[];
|
|
44
|
+
levelMenu?: {
|
|
45
|
+
bounds: ICanvasRect;
|
|
46
|
+
options: ITimelineLevelMenuOption[];
|
|
47
|
+
};
|
|
48
|
+
startHandle?: ICanvasRect;
|
|
49
|
+
endHandle?: ICanvasRect;
|
|
50
|
+
scrollbar?: {
|
|
51
|
+
track: ICanvasRect;
|
|
52
|
+
thumb: ICanvasRect;
|
|
53
|
+
};
|
|
54
|
+
request: {
|
|
55
|
+
position: number;
|
|
56
|
+
start: number;
|
|
57
|
+
count: number;
|
|
58
|
+
};
|
|
59
|
+
total: number;
|
|
60
|
+
visiblePeriodCount: number;
|
|
61
|
+
}
|
|
62
|
+
export type TimelineHitTarget = {
|
|
63
|
+
type: SlicerHitTargetType.Clear;
|
|
64
|
+
} | {
|
|
65
|
+
type: SlicerHitTargetType.TimeLevel;
|
|
66
|
+
} | {
|
|
67
|
+
type: SlicerHitTargetType.TimeLevelOption;
|
|
68
|
+
level: TimelineLevel;
|
|
69
|
+
} | {
|
|
70
|
+
type: SlicerHitTargetType.Period;
|
|
71
|
+
index: number;
|
|
72
|
+
} | {
|
|
73
|
+
type: SlicerHitTargetType.StartHandle;
|
|
74
|
+
} | {
|
|
75
|
+
type: SlicerHitTargetType.EndHandle;
|
|
76
|
+
} | {
|
|
77
|
+
type: SlicerHitTargetType.Scrollbar;
|
|
78
|
+
part: SlicerScrollbarPart.Track | SlicerScrollbarPart.Thumb;
|
|
79
|
+
} | {
|
|
80
|
+
type: SlicerHitTargetType.Header;
|
|
81
|
+
} | {
|
|
82
|
+
type: SlicerHitTargetType.Background;
|
|
83
|
+
} | {
|
|
84
|
+
type: SlicerHitTargetType.None;
|
|
85
|
+
};
|
|
86
|
+
export declare function buildTimelinePeriodWindow(options: IBuildTimelinePeriodWindowOptions): ITimelinePeriodWindow;
|
|
87
|
+
export declare class TimelineShape extends Shape<ITimelineShapeProps> {
|
|
88
|
+
private _data;
|
|
89
|
+
private _layout;
|
|
90
|
+
private _pressed?;
|
|
91
|
+
private _previewRange?;
|
|
92
|
+
private _navigationPosition;
|
|
93
|
+
private _hoveredPeriod?;
|
|
94
|
+
private _hoveredLevel?;
|
|
95
|
+
private _hoveredAction?;
|
|
96
|
+
private _focusedPeriod?;
|
|
97
|
+
private _levelMenuOpen;
|
|
98
|
+
private _ignorePointerUp;
|
|
99
|
+
constructor(key: string, props: ITimelineShapeProps);
|
|
100
|
+
setData(props: Partial<ITimelineShapeProps>): void;
|
|
101
|
+
getLayout(): ITimelineLayout;
|
|
102
|
+
getPreviewRange(): ITimelineRange | undefined;
|
|
103
|
+
hitTest(point: ICanvasPoint): TimelineHitTarget;
|
|
104
|
+
handlePointerDown(point: ICanvasPoint): void;
|
|
105
|
+
handlePointerMove(point: ICanvasPoint): void;
|
|
106
|
+
handlePointerUp(point: ICanvasPoint): void;
|
|
107
|
+
handlePointerCancel(): void;
|
|
108
|
+
handleWheel(deltaY: number): void;
|
|
109
|
+
commitScroll(): void;
|
|
110
|
+
handleKeyDown(key: string): boolean;
|
|
111
|
+
protected _draw(context: UniverRenderingContext): void;
|
|
112
|
+
private _drawPeriod;
|
|
113
|
+
private _getSelectionLabel;
|
|
114
|
+
private _computeLayout;
|
|
115
|
+
private _setLevelMenuOpen;
|
|
116
|
+
private _periodAtPoint;
|
|
117
|
+
private _getPeriod;
|
|
118
|
+
private _moveScrollbar;
|
|
119
|
+
private _setNavigationPosition;
|
|
120
|
+
private _maxScrollPosition;
|
|
121
|
+
private _syncLayoutToTransform;
|
|
122
|
+
private _toLocalPoint;
|
|
123
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import type { DateSystem, RecordSelection, RecordValue } from '@univerjs/core';
|
|
2
|
+
import type { IShapeProps } from '@univerjs/engine-render';
|
|
3
|
+
import type { ISlicerViewConfig, ITimelineRange, ITimelineViewConfig, SlicerControlKind, SlicerPresentationStatus, TimelineLevel } from '../definition';
|
|
4
|
+
import type { ISlicerStyleDefinition, ITimelineStyleDefinition, SlicerStyleType, TimelineStyleType } from '../style';
|
|
5
|
+
export declare enum SlicerShapeIntentType {
|
|
6
|
+
RequestWindow = "requestWindow",
|
|
7
|
+
CommitSelection = "commitSelection",
|
|
8
|
+
CommitScrollItem = "commitScrollItem",
|
|
9
|
+
Clear = "clear",
|
|
10
|
+
RequestPeriods = "requestPeriods",
|
|
11
|
+
CommitRange = "commitRange",
|
|
12
|
+
CommitScrollPosition = "commitScrollPosition",
|
|
13
|
+
ChangeLevel = "changeLevel"
|
|
14
|
+
}
|
|
15
|
+
export declare enum SlicerHitTargetType {
|
|
16
|
+
Clear = "clear",
|
|
17
|
+
MultiSelect = "multiSelect",
|
|
18
|
+
Item = "item",
|
|
19
|
+
Scrollbar = "scrollbar",
|
|
20
|
+
Header = "header",
|
|
21
|
+
Background = "background",
|
|
22
|
+
None = "none",
|
|
23
|
+
TimeLevel = "timeLevel",
|
|
24
|
+
TimeLevelOption = "timeLevelOption",
|
|
25
|
+
Period = "period",
|
|
26
|
+
StartHandle = "startHandle",
|
|
27
|
+
EndHandle = "endHandle"
|
|
28
|
+
}
|
|
29
|
+
export declare enum SlicerScrollbarPart {
|
|
30
|
+
Track = "track",
|
|
31
|
+
Thumb = "thumb"
|
|
32
|
+
}
|
|
33
|
+
export interface ICanvasPoint {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
}
|
|
37
|
+
export interface ICanvasRect extends ICanvasPoint {
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
}
|
|
41
|
+
export interface IResolvedCanvasStyle {
|
|
42
|
+
background: string;
|
|
43
|
+
border: string;
|
|
44
|
+
text: string;
|
|
45
|
+
bold: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface IControlStatusShapeProps extends IShapeProps {
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
caption: string;
|
|
51
|
+
state: {
|
|
52
|
+
status: SlicerPresentationStatus.Loading;
|
|
53
|
+
} | {
|
|
54
|
+
status: SlicerPresentationStatus.Error;
|
|
55
|
+
message: string;
|
|
56
|
+
};
|
|
57
|
+
style: {
|
|
58
|
+
container: IResolvedCanvasStyle;
|
|
59
|
+
header: IResolvedCanvasStyle;
|
|
60
|
+
};
|
|
61
|
+
rtl: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface ISlicerResolvedStyle {
|
|
64
|
+
container: IResolvedCanvasStyle;
|
|
65
|
+
header: IResolvedCanvasStyle;
|
|
66
|
+
items: Record<SlicerStyleType, IResolvedCanvasStyle>;
|
|
67
|
+
}
|
|
68
|
+
export interface ITimelineResolvedStyle {
|
|
69
|
+
container: IResolvedCanvasStyle;
|
|
70
|
+
header: IResolvedCanvasStyle;
|
|
71
|
+
elements: Record<TimelineStyleType, IResolvedCanvasStyle>;
|
|
72
|
+
rangeOutline?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface ISlicerCanvasItem {
|
|
75
|
+
key: string;
|
|
76
|
+
value: RecordValue;
|
|
77
|
+
label: string;
|
|
78
|
+
selected: boolean;
|
|
79
|
+
hasData: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface ISlicerCanvasPresentation {
|
|
82
|
+
kind: SlicerControlKind.Slicer;
|
|
83
|
+
caption: string;
|
|
84
|
+
start: number;
|
|
85
|
+
total: number;
|
|
86
|
+
items: Array<Omit<ISlicerCanvasItem, 'selected'> & {
|
|
87
|
+
selected?: boolean;
|
|
88
|
+
}>;
|
|
89
|
+
selection: RecordSelection;
|
|
90
|
+
capabilities: {
|
|
91
|
+
canFilter: boolean;
|
|
92
|
+
canConfigure: boolean;
|
|
93
|
+
};
|
|
94
|
+
/** Layout dimensions are CSS pixels, independent of the host's stored drawing units. */
|
|
95
|
+
settings: Required<Pick<ISlicerViewConfig, 'showCaption' | 'columnCount' | 'rowHeight' | 'lockedPosition'>>;
|
|
96
|
+
documentStyle: {
|
|
97
|
+
name?: string;
|
|
98
|
+
definition?: ISlicerStyleDefinition;
|
|
99
|
+
};
|
|
100
|
+
resolvedStyle: ISlicerResolvedStyle;
|
|
101
|
+
labels: ISlicerShapeProps['labels'];
|
|
102
|
+
rtl: boolean;
|
|
103
|
+
}
|
|
104
|
+
export interface ITimelineCanvasPresentation {
|
|
105
|
+
kind: SlicerControlKind.Timeline;
|
|
106
|
+
caption: string;
|
|
107
|
+
minDate: number;
|
|
108
|
+
maxDate: number;
|
|
109
|
+
dateSystem: DateSystem;
|
|
110
|
+
selection?: ITimelineRange;
|
|
111
|
+
capabilities: {
|
|
112
|
+
canFilter: boolean;
|
|
113
|
+
canConfigure: boolean;
|
|
114
|
+
};
|
|
115
|
+
settings: Required<Pick<ITimelineViewConfig, 'level' | 'selectionLevel' | 'showHeader' | 'showSelectionLabel' | 'showTimeLevel' | 'showHorizontalScrollbar'>> & Pick<ITimelineViewConfig, 'scrollPosition'>;
|
|
116
|
+
documentStyle: {
|
|
117
|
+
name?: string;
|
|
118
|
+
definition?: ITimelineStyleDefinition;
|
|
119
|
+
};
|
|
120
|
+
resolvedStyle: ITimelineResolvedStyle;
|
|
121
|
+
locale: string;
|
|
122
|
+
labels: ITimelineShapeProps['labels'];
|
|
123
|
+
rtl: boolean;
|
|
124
|
+
}
|
|
125
|
+
export type SlicerCanvasPresentation = ISlicerCanvasPresentation | ITimelineCanvasPresentation;
|
|
126
|
+
export type SlicerShapeIntent = {
|
|
127
|
+
type: SlicerShapeIntentType.RequestWindow;
|
|
128
|
+
start: number;
|
|
129
|
+
count: number;
|
|
130
|
+
scrollItem: number;
|
|
131
|
+
} | {
|
|
132
|
+
type: SlicerShapeIntentType.CommitSelection;
|
|
133
|
+
selection: RecordSelection;
|
|
134
|
+
} | {
|
|
135
|
+
type: SlicerShapeIntentType.CommitScrollItem;
|
|
136
|
+
startItem: number;
|
|
137
|
+
} | {
|
|
138
|
+
type: SlicerShapeIntentType.Clear;
|
|
139
|
+
};
|
|
140
|
+
export interface ISlicerShapeProps extends IShapeProps {
|
|
141
|
+
width: number;
|
|
142
|
+
height: number;
|
|
143
|
+
caption: string;
|
|
144
|
+
showCaption: boolean;
|
|
145
|
+
columnCount: number;
|
|
146
|
+
rowHeight: number;
|
|
147
|
+
total: number;
|
|
148
|
+
windowStart: number;
|
|
149
|
+
scrollItem: number;
|
|
150
|
+
items: ISlicerCanvasItem[];
|
|
151
|
+
selection: RecordSelection;
|
|
152
|
+
style: ISlicerResolvedStyle;
|
|
153
|
+
documentStyle?: ISlicerStyleDefinition;
|
|
154
|
+
labels: {
|
|
155
|
+
clear: string;
|
|
156
|
+
multiSelect: string;
|
|
157
|
+
};
|
|
158
|
+
rtl: boolean;
|
|
159
|
+
canFilter: boolean;
|
|
160
|
+
canConfigure: boolean;
|
|
161
|
+
onIntent: (intent: SlicerShapeIntent) => void;
|
|
162
|
+
}
|
|
163
|
+
export interface ITimelinePeriod {
|
|
164
|
+
index: number;
|
|
165
|
+
startDate: number;
|
|
166
|
+
endDate: number;
|
|
167
|
+
label: string;
|
|
168
|
+
groupLabel: string;
|
|
169
|
+
}
|
|
170
|
+
export type TimelineShapeIntent = {
|
|
171
|
+
type: SlicerShapeIntentType.RequestPeriods;
|
|
172
|
+
position: number;
|
|
173
|
+
start: number;
|
|
174
|
+
count: number;
|
|
175
|
+
} | {
|
|
176
|
+
type: SlicerShapeIntentType.CommitRange;
|
|
177
|
+
range: ITimelineRange;
|
|
178
|
+
} | {
|
|
179
|
+
type: SlicerShapeIntentType.CommitScrollPosition;
|
|
180
|
+
position: number;
|
|
181
|
+
} | {
|
|
182
|
+
type: SlicerShapeIntentType.ChangeLevel;
|
|
183
|
+
level: TimelineLevel;
|
|
184
|
+
} | {
|
|
185
|
+
type: SlicerShapeIntentType.Clear;
|
|
186
|
+
};
|
|
187
|
+
export interface ITimelineShapeProps extends IShapeProps {
|
|
188
|
+
width: number;
|
|
189
|
+
height: number;
|
|
190
|
+
caption: string;
|
|
191
|
+
minDate: number;
|
|
192
|
+
maxDate: number;
|
|
193
|
+
dateSystem: DateSystem;
|
|
194
|
+
level: TimelineLevel;
|
|
195
|
+
selectionLevel: TimelineLevel;
|
|
196
|
+
scrollPosition: number;
|
|
197
|
+
selection?: ITimelineRange;
|
|
198
|
+
showHeader: boolean;
|
|
199
|
+
showSelectionLabel: boolean;
|
|
200
|
+
showTimeLevel: boolean;
|
|
201
|
+
showHorizontalScrollbar: boolean;
|
|
202
|
+
locale: string;
|
|
203
|
+
labels: {
|
|
204
|
+
allPeriods: string;
|
|
205
|
+
clear: string;
|
|
206
|
+
quarter: string;
|
|
207
|
+
levels: Record<TimelineLevel, string>;
|
|
208
|
+
};
|
|
209
|
+
style: ITimelineResolvedStyle;
|
|
210
|
+
documentStyle?: ITimelineStyleDefinition;
|
|
211
|
+
rtl: boolean;
|
|
212
|
+
canFilter: boolean;
|
|
213
|
+
canConfigure: boolean;
|
|
214
|
+
onIntent: (intent: TimelineShapeIntent) => void;
|
|
215
|
+
}
|
|
216
|
+
export interface IInteractionModifiers {
|
|
217
|
+
ctrlKey?: boolean;
|
|
218
|
+
metaKey?: boolean;
|
|
219
|
+
shiftKey?: boolean;
|
|
220
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ISlicerResource } from './definition';
|
|
2
|
+
export declare const MAX_SLICER_UNSIGNED_INT = 4294967295;
|
|
3
|
+
export declare const MAX_SLICER_COLUMN_COUNT = 20000;
|
|
4
|
+
export declare function createEmptySlicerResource(): ISlicerResource;
|
|
5
|
+
export declare function parseSlicerResource(_value: unknown): ISlicerResource | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RecordSelection, RecordValue } from '@univerjs/core';
|
|
2
|
+
import type { ITimelineRange } from './definition';
|
|
3
|
+
export declare function compileSlicerSelection(_selection: RecordSelection): (value: RecordValue) => boolean;
|
|
4
|
+
export declare function compileTimelineRange(_range: ITimelineRange): (value: RecordValue) => boolean;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { IStyleData } from '@univerjs/core';
|
|
2
|
+
export declare enum SlicerStyleType {
|
|
3
|
+
UnselectedItemWithData = "unselectedItemWithData",
|
|
4
|
+
SelectedItemWithData = "selectedItemWithData",
|
|
5
|
+
UnselectedItemWithNoData = "unselectedItemWithNoData",
|
|
6
|
+
SelectedItemWithNoData = "selectedItemWithNoData",
|
|
7
|
+
HoveredUnselectedItemWithData = "hoveredUnselectedItemWithData",
|
|
8
|
+
HoveredSelectedItemWithData = "hoveredSelectedItemWithData",
|
|
9
|
+
HoveredUnselectedItemWithNoData = "hoveredUnselectedItemWithNoData",
|
|
10
|
+
HoveredSelectedItemWithNoData = "hoveredSelectedItemWithNoData"
|
|
11
|
+
}
|
|
12
|
+
export declare enum TimelineStyleType {
|
|
13
|
+
SelectionLabel = "selectionLabel",
|
|
14
|
+
TimeLevel = "timeLevel",
|
|
15
|
+
PeriodLabel1 = "periodLabel1",
|
|
16
|
+
PeriodLabel2 = "periodLabel2",
|
|
17
|
+
SelectedTimeBlock = "selectedTimeBlock",
|
|
18
|
+
UnselectedTimeBlock = "unselectedTimeBlock",
|
|
19
|
+
SelectedTimeBlockSpace = "selectedTimeBlockSpace"
|
|
20
|
+
}
|
|
21
|
+
export declare const BUILT_IN_SLICER_STYLE_NAMES: readonly ["SlicerStyleLight1", "SlicerStyleLight2", "SlicerStyleLight3", "SlicerStyleLight4", "SlicerStyleLight5", "SlicerStyleLight6", "SlicerStyleOther1", "SlicerStyleOther2", "SlicerStyleDark1", "SlicerStyleDark2", "SlicerStyleDark3", "SlicerStyleDark4", "SlicerStyleDark5", "SlicerStyleDark6"];
|
|
22
|
+
export declare const BUILT_IN_TIMELINE_STYLE_NAMES: readonly ["TimelineStyleLight1", "TimelineStyleLight2", "TimelineStyleLight3", "TimelineStyleLight4", "TimelineStyleLight5", "TimelineStyleLight6", "TimelineStyleDark1", "TimelineStyleDark2", "TimelineStyleDark3", "TimelineStyleDark4", "TimelineStyleDark5", "TimelineStyleDark6"];
|
|
23
|
+
export type BuiltInSlicerStyleName = (typeof BUILT_IN_SLICER_STYLE_NAMES)[number];
|
|
24
|
+
export type BuiltInTimelineStyleName = (typeof BUILT_IN_TIMELINE_STYLE_NAMES)[number];
|
|
25
|
+
export type SlicerStyleFormatting = Pick<IStyleData, 'bg' | 'ol' | 'bd' | 'cl' | 'ht' | 'vt' | 'bl'>;
|
|
26
|
+
export interface ISlicerStyleElement {
|
|
27
|
+
type: SlicerStyleType;
|
|
28
|
+
formatting?: SlicerStyleFormatting;
|
|
29
|
+
}
|
|
30
|
+
export interface ITimelineStyleElement {
|
|
31
|
+
type: TimelineStyleType;
|
|
32
|
+
formatting?: SlicerStyleFormatting;
|
|
33
|
+
}
|
|
34
|
+
export interface ISlicerStyleDefinition {
|
|
35
|
+
name: string;
|
|
36
|
+
wholeStyle?: SlicerStyleFormatting;
|
|
37
|
+
headerRowStyle?: SlicerStyleFormatting;
|
|
38
|
+
slicerStyleElements: ISlicerStyleElement[];
|
|
39
|
+
}
|
|
40
|
+
export interface ITimelineStyleDefinition {
|
|
41
|
+
name: string;
|
|
42
|
+
wholeStyle?: SlicerStyleFormatting;
|
|
43
|
+
headerRowStyle?: SlicerStyleFormatting;
|
|
44
|
+
timelineStyleElements: ITimelineStyleElement[];
|
|
45
|
+
}
|
|
46
|
+
export interface ISlicerStylesDefinition {
|
|
47
|
+
defaultSlicerStyle: string;
|
|
48
|
+
styles: ISlicerStyleDefinition[];
|
|
49
|
+
}
|
|
50
|
+
export interface ITimelineStylesDefinition {
|
|
51
|
+
defaultTimelineStyle: string;
|
|
52
|
+
styles: ITimelineStyleDefinition[];
|
|
53
|
+
}
|
|
54
|
+
export interface ISlicerItemStyleState {
|
|
55
|
+
selected: boolean;
|
|
56
|
+
hasData: boolean;
|
|
57
|
+
hovered: boolean;
|
|
58
|
+
}
|
|
59
|
+
export declare function isBuiltInSlicerStyleName(value: string): value is BuiltInSlicerStyleName;
|
|
60
|
+
export declare function isBuiltInTimelineStyleName(value: string): value is BuiltInTimelineStyleName;
|
|
61
|
+
export declare function getSlicerStyleType(state: ISlicerItemStyleState): SlicerStyleType;
|
|
62
|
+
export declare function isSlicerStyleReference(value: string, styles?: ISlicerStylesDefinition): boolean;
|
|
63
|
+
export declare function isTimelineStyleReference(value: string, styles?: ITimelineStylesDefinition): boolean;
|
|
64
|
+
export declare function projectSlicerStyles(value: unknown): ISlicerStylesDefinition | undefined;
|
|
65
|
+
export declare function projectTimelineStyles(value: unknown): ITimelineStylesDefinition | undefined;
|