@synopackageland/ui 0.20.3 → 0.20.4
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/CHANGELOG.md +22 -0
- package/LICENSES/ux-foundation.md +83 -0
- package/LICENSES/ux-grid-baserow.md +35 -0
- package/LICENSES/ux-grid-teable.md +48 -0
- package/README.md +3 -0
- package/dist/cli.js +0 -0
- package/dist/components/app/app-layout/AppLayout.vue.d.ts +31 -4
- package/dist/components/app/app-root/AppRoot.vue.d.ts +9 -0
- package/dist/components/app/aside-panel/AsidePanel.vue.d.ts +69 -0
- package/dist/components/app/aside-panel/asidePreference.d.ts +28 -0
- package/dist/components/composite/adaptive-panel/AdaptivePanel.vue.d.ts +61 -0
- package/dist/components/composite/connection-topology/ConnectionTopology.vue.d.ts +1 -1
- package/dist/components/composite/file-picker/FilePicker.vue.d.ts +1 -1
- package/dist/components/composite/mention-list/MentionList.vue.d.ts +2 -2
- package/dist/components/composite/overflow-toolbar/OverflowToolbar.vue.d.ts +2 -2
- package/dist/components/composite/record-panel/RecordPanel.vue.d.ts +77 -0
- package/dist/components/composite/record-panel/recordPanelWidth.d.ts +54 -0
- package/dist/components/composite/summary-card/SummaryCard.vue.d.ts +1 -1
- package/dist/components/composite/tag-editor/TagEditor.vue.d.ts +2 -2
- package/dist/components/composite/tree-view/TreeView.vue.d.ts +1 -1
- package/dist/components/composite/wizard/Wizard.vue.d.ts +2 -2
- package/dist/components/composite/wizard/WizardDialog.vue.d.ts +2 -2
- package/dist/components/containers/card/Card.vue.d.ts +1 -1
- package/dist/components/containers/card/CardField.vue.d.ts +26 -0
- package/dist/components/containers/card-grid/CardCover.vue.d.ts +16 -0
- package/dist/components/containers/card-grid/CardGrid.vue.d.ts +1 -1
- package/dist/components/containers/card-grid/VirtualCardGrid.vue.d.ts +71 -0
- package/dist/components/containers/expandable-item/ExpandableItem.vue.d.ts +1 -1
- package/dist/components/containers/fieldset/Fieldset.vue.d.ts +1 -1
- package/dist/components/containers/list-detail/ListDetail.vue.d.ts +1 -1
- package/dist/components/containers/split-pane/SplitPane.vue.d.ts +1 -1
- package/dist/components/feedback/notification/Notification.vue.d.ts +1 -1
- package/dist/components/feedback/notification/NotificationProvider.vue.d.ts +1 -1
- package/dist/components/primitives/breadcrumb/Breadcrumb.vue.d.ts +2 -2
- package/dist/components/primitives/context-menu/ContextMenu.vue.d.ts +3 -0
- package/dist/components/primitives/context-menu/ContextMenuItems.vue.d.ts +4 -5
- package/dist/components/primitives/dialog/Dialog.vue.d.ts +2 -2
- package/dist/components/primitives/dropdown-menu/DropdownMenu.vue.d.ts +4 -0
- package/dist/components/primitives/dropdown-menu/DropdownMenuItems.vue.d.ts +6 -3
- package/dist/components/primitives/popover/Popover.vue.d.ts +10 -2
- package/dist/components/primitives/popover/floating.d.ts +27 -0
- package/dist/components/primitives/popover/overlay.d.ts +36 -0
- package/dist/components/primitives/segment-control/SegmentControl.vue.d.ts +4 -1
- package/dist/components/primitives/segment-control/context.d.ts +3 -0
- package/dist/components/primitives/select/Select.vue.d.ts +4 -0
- package/dist/components/primitives/select/internal/ComboboxField.vue.d.ts +1 -0
- package/dist/components/primitives/select/internal/types.d.ts +2 -0
- package/dist/components/primitives/skeleton/SectionSkeleton.vue.d.ts +25 -4
- package/dist/components/primitives/skeleton/Skeleton.vue.d.ts +3 -0
- package/dist/components/primitives/tag/Tag.vue.d.ts +2 -2
- package/dist/components/primitives/toast/ToastProvider.vue.d.ts +0 -2
- package/dist/components/primitives/toast/toast.d.ts +21 -1
- package/dist/components/primitives/tooltip/Tooltip.vue.d.ts +8 -3
- package/dist/components/primitives/tooltip/tooltipStyle.d.ts +11 -1
- package/dist/composables/backDismiss.d.ts +19 -0
- package/dist/composables/phone.d.ts +8 -0
- package/dist/composables/softKeyboard.d.ts +26 -4
- package/dist/composables/visualViewport.d.ts +31 -0
- package/dist/dnd/autoScroll.d.ts +57 -0
- package/dist/dnd/dragKit.d.ts +111 -0
- package/dist/dnd/index.d.ts +4 -0
- package/dist/dnd/layout.d.ts +57 -0
- package/dist/dnd/vue.d.ts +16 -0
- package/dist/feedback/StatusSlot.vue.d.ts +24 -0
- package/dist/feedback/showAfter.d.ts +15 -0
- package/dist/feedback/stackMotion.d.ts +13 -0
- package/dist/feedback/timing.d.ts +23 -0
- package/dist/grid/cells/draw.d.ts +57 -0
- package/dist/grid/cells/images.d.ts +5 -0
- package/dist/grid/cells/index.d.ts +7 -0
- package/dist/grid/cells/number.d.ts +5 -0
- package/dist/grid/cells/registry.d.ts +56 -0
- package/dist/grid/cells/renderers.d.ts +8 -0
- package/dist/grid/cells/status.d.ts +6 -0
- package/dist/grid/cells/types.d.ts +200 -0
- package/dist/grid/cells/use.d.ts +7 -0
- package/dist/grid/clipboard/copy.d.ts +17 -0
- package/dist/grid/clipboard/index.d.ts +4 -0
- package/dist/grid/clipboard/proposal.d.ts +35 -0
- package/dist/grid/clipboard/tsv.d.ts +14 -0
- package/dist/grid/clipboard/write.d.ts +21 -0
- package/dist/grid/contracts.d.ts +200 -0
- package/dist/grid/edit/cell-status.d.ts +33 -0
- package/dist/grid/edit/edit-session.d.ts +97 -0
- package/dist/grid/edit/use-grid-edit.d.ts +48 -0
- package/dist/grid/focus/editor-style.d.ts +67 -0
- package/dist/grid/host/GridHost.vue.d.ts +137 -0
- package/dist/grid/host/controller.d.ts +219 -0
- package/dist/grid/host/dom.d.ts +10 -0
- package/dist/grid/index.d.ts +8 -0
- package/dist/grid/range/block.d.ts +30 -0
- package/dist/grid/range/fill.d.ts +27 -0
- package/dist/grid/range/index.d.ts +2 -0
- package/dist/grid/theme.d.ts +61 -0
- package/dist/grid-core/auto-scroll.d.ts +67 -0
- package/dist/grid-core/column-resize.d.ts +43 -0
- package/dist/grid-core/config.d.ts +39 -0
- package/dist/grid-core/coordinate.d.ts +64 -0
- package/dist/grid-core/drag.d.ts +46 -0
- package/dist/grid-core/freeze.d.ts +11 -0
- package/dist/grid-core/index.d.ts +17 -0
- package/dist/grid-core/keyboard.d.ts +34 -0
- package/dist/grid-core/keys.d.ts +38 -0
- package/dist/grid-core/lru.d.ts +10 -0
- package/dist/grid-core/range.d.ts +28 -0
- package/dist/grid-core/region.d.ts +73 -0
- package/dist/grid-core/renderer/base.d.ts +92 -0
- package/dist/grid-core/renderer/layout.d.ts +129 -0
- package/dist/grid-core/selection-controller.d.ts +62 -0
- package/dist/grid-core/selection.d.ts +35 -0
- package/dist/grid-core/theme.d.ts +81 -0
- package/dist/grid-core/types.d.ts +178 -0
- package/dist/grid.js +6173 -0
- package/dist/i18n/text.d.ts +6 -0
- package/dist/index.d.ts +32 -2
- package/dist/index.js +17647 -13630
- package/dist/interaction/editSession.d.ts +49 -0
- package/dist/interaction/focus.d.ts +28 -0
- package/dist/interaction/gesture.d.ts +49 -0
- package/dist/interaction/ime.d.ts +55 -0
- package/dist/interaction/index.d.ts +6 -0
- package/dist/interaction/outside.d.ts +40 -0
- package/dist/interaction/vue.d.ts +21 -0
- package/dist/json-ai-prompt.md +1 -1
- package/dist/json-preview/preview.js +8523 -7814
- package/dist/json.js +10 -10
- package/dist/lib/adaptiveLayout.d.ts +32 -2
- package/dist/lib/deviceViewport.d.ts +2 -1
- package/dist/lib/motion.d.ts +12 -0
- package/dist/reka-runtime.json +1 -1
- package/dist/theme.css +1 -1
- package/dist/themes/dsm7-embedded-theme.css +1 -1
- package/dist/themes/dsm7-embedded.css +1 -1
- package/dist/themes/dsm7.css +1 -1
- package/dist/virtual/cardHeight.d.ts +39 -0
- package/dist/virtual/galleryColumns.d.ts +11 -0
- package/dist/virtual/layoutMotion.d.ts +30 -0
- package/docs/adaptive-layout.md +137 -16
- package/docs/callout.md +22 -1
- package/docs/list-detail.md +54 -0
- package/docs/mobile-native.md +214 -0
- package/docs/release-checks.md +23 -0
- package/docs/theme-hooks.md +28 -7
- package/docs/ux-foundation.md +133 -0
- package/docs/ux-grid.md +217 -0
- package/package.json +94 -3
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { CoordinateManager } from '../coordinate';
|
|
2
|
+
import { CombinedSelection } from '../selection';
|
|
3
|
+
import { IGridTheme } from '../theme';
|
|
4
|
+
import { IActiveCellBound, ICellItem, IColumnFreezeState, IColumnResizeState, IDragState, IGridColumn, ILinearRow, IMouseState, IRectangle, IRowControlItem, IScrollState } from '../types';
|
|
5
|
+
export interface IVisibleRegion {
|
|
6
|
+
startRowIndex: number;
|
|
7
|
+
stopRowIndex: number;
|
|
8
|
+
startColumnIndex: number;
|
|
9
|
+
stopColumnIndex: number;
|
|
10
|
+
}
|
|
11
|
+
/** Rows and columns that intersect the viewport (one extra row below for partial rows). */
|
|
12
|
+
export declare const getVisibleRegion: (coordInstance: CoordinateManager, scrollState: Pick<IScrollState, "scrollTop" | "scrollLeft">) => IVisibleRegion;
|
|
13
|
+
/** What the host's `drawCell` gets: the cell rect (in canvas px) and its state. */
|
|
14
|
+
export interface ICellDrawContext extends IRectangle {
|
|
15
|
+
theme: IGridTheme;
|
|
16
|
+
/** Data row index. */
|
|
17
|
+
rowIndex: number;
|
|
18
|
+
columnIndex: number;
|
|
19
|
+
isActive: boolean;
|
|
20
|
+
}
|
|
21
|
+
export type IGridIconKind = 'drag' | 'expand' | 'add' | 'primary' | 'description' | 'column';
|
|
22
|
+
export interface IIconDrawContext {
|
|
23
|
+
kind: IGridIconKind;
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
size: number;
|
|
27
|
+
theme: IGridTheme;
|
|
28
|
+
/** For `column` and `description` icons. */
|
|
29
|
+
column?: IGridColumn;
|
|
30
|
+
}
|
|
31
|
+
export interface IGridRenderProps {
|
|
32
|
+
coordInstance: CoordinateManager;
|
|
33
|
+
scrollState: IScrollState;
|
|
34
|
+
visibleRegion: IVisibleRegion;
|
|
35
|
+
theme: IGridTheme;
|
|
36
|
+
columns: IGridColumn[];
|
|
37
|
+
/** Canvas height in CSS px (container height plus any footer). */
|
|
38
|
+
height: number;
|
|
39
|
+
mouseState: IMouseState;
|
|
40
|
+
selection: CombinedSelection;
|
|
41
|
+
isSelecting: boolean;
|
|
42
|
+
isEditing: boolean;
|
|
43
|
+
/** Selecting, dragging, resizing or freezing: hides hover tints. */
|
|
44
|
+
isInteracting: boolean;
|
|
45
|
+
activeCell: ICellItem | null;
|
|
46
|
+
activeCellBound: IActiveCellBound | null;
|
|
47
|
+
rowControls: IRowControlItem[];
|
|
48
|
+
rowControlPaddingX?: number;
|
|
49
|
+
/** Show the row number until the row is hovered or checked. */
|
|
50
|
+
rowIndexVisible?: boolean;
|
|
51
|
+
highlightedRowIndex?: number | null;
|
|
52
|
+
dragState: IDragState;
|
|
53
|
+
columnResizeState: IColumnResizeState;
|
|
54
|
+
hoveredColumnResizeIndex: number;
|
|
55
|
+
columnFreezeState: IColumnFreezeState;
|
|
56
|
+
isColumnResizable?: boolean;
|
|
57
|
+
isColumnHeaderMenuVisible?: boolean;
|
|
58
|
+
isColumnAppendEnable?: boolean;
|
|
59
|
+
isMultiSelectionEnable?: boolean;
|
|
60
|
+
isFilling?: boolean;
|
|
61
|
+
isFillEnabled?: boolean;
|
|
62
|
+
getLinearRow?: (index: number) => ILinearRow;
|
|
63
|
+
real2RowIndex?: (index: number) => number;
|
|
64
|
+
drawCell: (ctx: CanvasRenderingContext2D, cell: ICellDrawContext) => void;
|
|
65
|
+
drawIcon?: (ctx: CanvasRenderingContext2D, icon: IIconDrawContext) => void;
|
|
66
|
+
/** Change to force the cached cell content to redraw (data changed). */
|
|
67
|
+
forceRenderFlag?: unknown;
|
|
68
|
+
}
|
|
69
|
+
interface IResolvedProps extends IGridRenderProps {
|
|
70
|
+
getLinearRow: (index: number) => ILinearRow;
|
|
71
|
+
real2RowIndex: (index: number) => number;
|
|
72
|
+
shouldRerender?: boolean;
|
|
73
|
+
}
|
|
74
|
+
interface ICellProps extends ICellDrawContext {
|
|
75
|
+
fill: string;
|
|
76
|
+
}
|
|
77
|
+
interface IRowHeaderProps extends IRectangle {
|
|
78
|
+
displayIndex: string;
|
|
79
|
+
isHover: boolean;
|
|
80
|
+
isChecked: boolean;
|
|
81
|
+
}
|
|
82
|
+
interface IAppendRowProps extends IRectangle {
|
|
83
|
+
isHover: boolean;
|
|
84
|
+
}
|
|
85
|
+
type IRenderRegion = 'freeze' | 'other';
|
|
86
|
+
/** Cell and row-header draw lists for the frozen or the scrolling region. */
|
|
87
|
+
export declare const calcCells: (p: IResolvedProps, region: IRenderRegion) => {
|
|
88
|
+
cellPropList: ICellProps[];
|
|
89
|
+
rowHeaderPropList: IRowHeaderProps[];
|
|
90
|
+
appendRowList: IAppendRowProps[];
|
|
91
|
+
};
|
|
92
|
+
export declare const drawRowHeader: (ctx: CanvasRenderingContext2D, props: IRowHeaderProps, p: IResolvedProps) => void;
|
|
93
|
+
/** Backgrounds and grid lines on the main canvas; cell content on the cache canvas when `shouldRerender`. */
|
|
94
|
+
export declare const drawCells: (mainCtx: CanvasRenderingContext2D, cacheCtx: CanvasRenderingContext2D, p: IResolvedProps) => void;
|
|
95
|
+
/** The active cell: cell background, a 1 px neutral ring with radius 2 (Teable style), and its content on top. */
|
|
96
|
+
export declare const drawActiveCell: (ctx: CanvasRenderingContext2D, p: IResolvedProps) => void;
|
|
97
|
+
/** While dragging the fill handle: a tinted box over the target rows only, above or below the range. */
|
|
98
|
+
export declare const drawFillPreview: (ctx: CanvasRenderingContext2D, p: IResolvedProps) => void;
|
|
99
|
+
/** A 5 px square (7 px with its stroke) on the range's bottom-right corner; hidden while editing or selecting. */
|
|
100
|
+
export declare const drawFillHandler: (ctx: CanvasRenderingContext2D, p: IResolvedProps) => void;
|
|
101
|
+
export declare const drawColumnHeader: (ctx: CanvasRenderingContext2D, props: IRectangle & {
|
|
102
|
+
column: IGridColumn;
|
|
103
|
+
fill?: string;
|
|
104
|
+
hasMenu?: boolean;
|
|
105
|
+
}, p: IResolvedProps) => void;
|
|
106
|
+
/** The corner above the row headers, with the select-all checkbox. */
|
|
107
|
+
export declare const drawGridHeader: (ctx: CanvasRenderingContext2D, props: IRectangle & {
|
|
108
|
+
isChecked: boolean;
|
|
109
|
+
}, p: IResolvedProps) => void;
|
|
110
|
+
export declare const drawColumnHeaders: (ctx: CanvasRenderingContext2D, p: IResolvedProps, region: IRenderRegion) => void;
|
|
111
|
+
export declare const drawAppendColumn: (ctx: CanvasRenderingContext2D, p: IResolvedProps) => void;
|
|
112
|
+
/** The bar on the column edge being hovered or resized. */
|
|
113
|
+
export declare const drawColumnResizeHandler: (ctx: CanvasRenderingContext2D, p: IResolvedProps) => void;
|
|
114
|
+
/** Ghost of the dragged column following the pointer, and a 2 px drop line. */
|
|
115
|
+
export declare const drawColumnDraggingRegion: (ctx: CanvasRenderingContext2D, p: IResolvedProps) => void;
|
|
116
|
+
/** Ghost band of the dragged row and a 2 px drop line. */
|
|
117
|
+
export declare const drawRowDraggingRegion: (ctx: CanvasRenderingContext2D, p: IResolvedProps) => void;
|
|
118
|
+
export declare const drawColumnFreezeHandler: (ctx: CanvasRenderingContext2D, p: IResolvedProps) => void;
|
|
119
|
+
/** Line after the frozen columns; a soft shadow once the body scrolls under it. */
|
|
120
|
+
export declare const drawFreezeRegionDivider: (ctx: CanvasRenderingContext2D, p: IResolvedProps) => void;
|
|
121
|
+
/** Whether cached cell content must be redrawn. */
|
|
122
|
+
export declare const computeShouldRerender: (current: IGridRenderProps, last?: IGridRenderProps) => boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Paints one frame. `mainCanvas` is the visible canvas; `cacheCanvas` is an
|
|
125
|
+
* offscreen canvas that keeps cell content between frames. Pass the previous
|
|
126
|
+
* frame's props as `lastProps` so unchanged content is not redrawn.
|
|
127
|
+
*/
|
|
128
|
+
export declare const drawGrid: (mainCanvas: HTMLCanvasElement, cacheCanvas: HTMLCanvasElement, props: IGridRenderProps, lastProps?: IGridRenderProps, pixelRatio?: number) => void;
|
|
129
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { CombinedSelection } from './selection';
|
|
2
|
+
import { RowControlType, SelectableType, ICellItem, ILinearRow, IMouseState, IPosition, IRange } from './types';
|
|
3
|
+
/** Modifier keys of a pointer event. Pass the platform's command key as `metaKey` (Cmd on macOS, Ctrl elsewhere). */
|
|
4
|
+
export interface IPointerModifiers {
|
|
5
|
+
shiftKey: boolean;
|
|
6
|
+
metaKey: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ISelectionControllerOptions {
|
|
9
|
+
/** Data row count, for the corner checkbox. */
|
|
10
|
+
getPureRowCount: () => number;
|
|
11
|
+
selectable?: SelectableType;
|
|
12
|
+
isMultiSelectionEnable?: boolean;
|
|
13
|
+
/** With `selectable: Row`, whether clicking a cell toggles its row. */
|
|
14
|
+
isRowClickSelectionEnabled?: boolean;
|
|
15
|
+
getLinearRow?: (index: number) => ILinearRow;
|
|
16
|
+
/** Called once per change of the selection or the active cell. */
|
|
17
|
+
onChange?: (state: {
|
|
18
|
+
selection: CombinedSelection;
|
|
19
|
+
activeCell: ICellItem | null;
|
|
20
|
+
}) => void;
|
|
21
|
+
onRowControlClick?: (rowIndex: number, type: RowControlType, checked: boolean) => void;
|
|
22
|
+
/** Rows selected in one go (Shift or the corner checkbox), so the host can load ids it has not fetched. */
|
|
23
|
+
onRowRangeSelected?: (ranges: IRange[]) => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Pointer rules for the selection, as a plain state holder (Teable's
|
|
27
|
+
* `useSelection` without React). Selection starts on pointerdown on a cell;
|
|
28
|
+
* header, checkbox and corner selection happen on click.
|
|
29
|
+
*
|
|
30
|
+
* - Shift+click on a cell keeps the anchor and moves the head; Cmd+click is a plain click.
|
|
31
|
+
* - Column header: click selects, Shift extends from the first selected column, Cmd toggles.
|
|
32
|
+
* - Row checkbox: toggles; Shift selects the run from the last toggled row.
|
|
33
|
+
* - Corner checkbox: selects all rows; a second click clears.
|
|
34
|
+
*/
|
|
35
|
+
export declare class SelectionController {
|
|
36
|
+
selection: CombinedSelection;
|
|
37
|
+
activeCell: ICellItem | null;
|
|
38
|
+
isSelecting: boolean;
|
|
39
|
+
private prevSelectedRowIndex;
|
|
40
|
+
private readonly options;
|
|
41
|
+
constructor(options: ISelectionControllerOptions);
|
|
42
|
+
private get selectable();
|
|
43
|
+
private get isMultiSelectionEnable();
|
|
44
|
+
private getLinearRow;
|
|
45
|
+
/** Replaces the selection and/or the active cell; notifies once if either changed. */
|
|
46
|
+
update(next: {
|
|
47
|
+
selection?: CombinedSelection;
|
|
48
|
+
activeCell?: ICellItem | null;
|
|
49
|
+
}): void;
|
|
50
|
+
/** Clears selection, active cell and the drag-select state (click outside the grid). */
|
|
51
|
+
reset(): void;
|
|
52
|
+
onSelectionStart(event: IPointerModifiers, mouseState: IMouseState): void;
|
|
53
|
+
/** Moves the head to the cell under the pointer while drag-selecting. Positions above or left of the grid clamp to 0. */
|
|
54
|
+
onSelectionChange(mouseState: Pick<IMouseState, 'rowIndex' | 'columnIndex'>): void;
|
|
55
|
+
onSelectionEnd(): void;
|
|
56
|
+
onSelectionClick(event: IPointerModifiers, mouseState: IMouseState): void;
|
|
57
|
+
/**
|
|
58
|
+
* Right click: keeps the selection when the pointer is inside it, otherwise
|
|
59
|
+
* selects the cell or column under the pointer; then calls `callback`.
|
|
60
|
+
*/
|
|
61
|
+
onSelectionContextMenu(mouseState: IMouseState, callback: (selection: CombinedSelection, position: IPosition) => void): void;
|
|
62
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SelectionRegionType, IRange } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* One selection of a single kind. Immutable: every change returns a new object,
|
|
4
|
+
* so a host can hold it in a `shallowRef` and compare by identity.
|
|
5
|
+
*
|
|
6
|
+
* - Cells: `ranges = [anchor, head]`, each `[column, row]`, one rectangle.
|
|
7
|
+
* - Rows / Columns: `ranges` is a list of `[from, to]` index runs.
|
|
8
|
+
*
|
|
9
|
+
* Select-all is a Cells selection from `[0, 0]` to the last cell; the corner
|
|
10
|
+
* checkbox is a Rows selection of every row.
|
|
11
|
+
*/
|
|
12
|
+
export declare class CombinedSelection {
|
|
13
|
+
readonly type: SelectionRegionType;
|
|
14
|
+
readonly ranges: IRange[];
|
|
15
|
+
constructor(type?: SelectionRegionType, ranges?: IRange[]);
|
|
16
|
+
get isColumnSelection(): boolean;
|
|
17
|
+
get isRowSelection(): boolean;
|
|
18
|
+
get isCellSelection(): boolean;
|
|
19
|
+
get isNoneSelection(): boolean;
|
|
20
|
+
reset(): CombinedSelection;
|
|
21
|
+
set(type: SelectionRegionType, ranges: IRange[]): CombinedSelection;
|
|
22
|
+
setRanges(ranges: IRange[]): CombinedSelection;
|
|
23
|
+
private isOverlap;
|
|
24
|
+
/** Adds a run (rows/columns, merged with any it overlaps) or moves the head (cells). */
|
|
25
|
+
expand(range: IRange): CombinedSelection;
|
|
26
|
+
/** Toggles a run (rows/columns; empty result clears) or moves the head (cells). */
|
|
27
|
+
merge(range: IRange): CombinedSelection;
|
|
28
|
+
flatten(): number[];
|
|
29
|
+
/** Runs merged and sorted, or the cell rectangle as `[topLeft, bottomRight]`. */
|
|
30
|
+
serialize(): IRange[];
|
|
31
|
+
/** For cells, whether `[column, row]` is inside the rectangle; for rows/columns, whether the run is inside. */
|
|
32
|
+
includes(range?: IRange): boolean;
|
|
33
|
+
equals(comparisonRanges: IRange[]): boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare const emptySelection: CombinedSelection;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export interface IGridTheme {
|
|
2
|
+
staticWhite: string;
|
|
3
|
+
staticBlack: string;
|
|
4
|
+
iconFgCommon: string;
|
|
5
|
+
iconBgSelected: string;
|
|
6
|
+
iconFgSelected: string;
|
|
7
|
+
iconSizeXS: number;
|
|
8
|
+
iconSizeSM: number;
|
|
9
|
+
iconSizeMD: number;
|
|
10
|
+
iconSizeLG: number;
|
|
11
|
+
fontSizeXXS: number;
|
|
12
|
+
fontSizeXS: number;
|
|
13
|
+
fontSizeSM: number;
|
|
14
|
+
fontSizeMD: number;
|
|
15
|
+
fontSizeLG: number;
|
|
16
|
+
fontFamily: string;
|
|
17
|
+
cellBg: string;
|
|
18
|
+
cellBgHovered: string;
|
|
19
|
+
cellBgSelected: string;
|
|
20
|
+
cellBgLoading: string;
|
|
21
|
+
cellLineColor: string;
|
|
22
|
+
/** The active cell's ring: 1 px, neutral (Teable style). */
|
|
23
|
+
cellLineColorActived: string;
|
|
24
|
+
cellTextColor: string;
|
|
25
|
+
cellTextColorHighlight: string;
|
|
26
|
+
cellOptionBg: string;
|
|
27
|
+
cellOptionBgHighlight: string;
|
|
28
|
+
cellOptionTextColor: string;
|
|
29
|
+
groupHeaderBgPrimary: string;
|
|
30
|
+
groupHeaderBgSecondary: string;
|
|
31
|
+
groupHeaderBgTertiary: string;
|
|
32
|
+
columnHeaderBg: string;
|
|
33
|
+
columnHeaderBgHovered: string;
|
|
34
|
+
columnHeaderBgSelected: string;
|
|
35
|
+
columnHeaderNameColor: string;
|
|
36
|
+
columnResizeHandlerBg: string;
|
|
37
|
+
columnDraggingPlaceholderBg: string;
|
|
38
|
+
rowHeaderTextColor: string;
|
|
39
|
+
appendRowBg: string;
|
|
40
|
+
appendRowBgHovered: string;
|
|
41
|
+
avatarBg: string;
|
|
42
|
+
avatarTextColor: string;
|
|
43
|
+
scrollBarBg: string;
|
|
44
|
+
interactionLineColorCommon: string;
|
|
45
|
+
interactionLineColorHighlight: string;
|
|
46
|
+
/** 'light' or 'dark'; renderers that cache by theme include it in the key. */
|
|
47
|
+
themeKey: string;
|
|
48
|
+
}
|
|
49
|
+
export type IGridThemeColorKey = {
|
|
50
|
+
[K in keyof IGridTheme]: IGridTheme[K] extends string ? K : never;
|
|
51
|
+
}[keyof IGridTheme];
|
|
52
|
+
/** Teable's light theme values. */
|
|
53
|
+
export declare const teableGridTheme: IGridTheme;
|
|
54
|
+
/**
|
|
55
|
+
* Which UI library token feeds each theme colour. Task 08 owns the token
|
|
56
|
+
* values; this only names them. The active-cell ring uses the text colour for a
|
|
57
|
+
* 1 px neutral ring, as in Teable.
|
|
58
|
+
*/
|
|
59
|
+
export declare const GRID_THEME_TOKENS: Record<Exclude<IGridThemeColorKey, 'themeKey' | 'fontFamily'>, string>;
|
|
60
|
+
export declare const GRID_FONT_TOKENS: {
|
|
61
|
+
readonly fontFamily: "--ui-font-sans";
|
|
62
|
+
readonly fontSizeSM: "--ui-font-size";
|
|
63
|
+
readonly fontSizeXS: "--ui-font-size-sm";
|
|
64
|
+
};
|
|
65
|
+
/** Looks up a CSS custom property, returning an empty string or undefined when it is not set. */
|
|
66
|
+
export type IGridTokenSource = (token: string) => string | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Builds the theme from token values. Colours come back as the source resolved
|
|
69
|
+
* them; missing tokens keep Teable's value.
|
|
70
|
+
*/
|
|
71
|
+
export declare const createGridTheme: (source: IGridTokenSource, overrides?: Partial<IGridTheme>) => IGridTheme;
|
|
72
|
+
/**
|
|
73
|
+
* Token source that reads computed tokens on `el` and resolves each colour to
|
|
74
|
+
* an `rgb()`/`rgba()` string through a hidden probe, so canvas never sees
|
|
75
|
+
* `var()` or `color-mix()`. Call `dispose` when done; re-read on theme change.
|
|
76
|
+
*/
|
|
77
|
+
export declare const cssTokenSource: (el: Element) => IGridTokenSource & {
|
|
78
|
+
dispose: () => void;
|
|
79
|
+
};
|
|
80
|
+
/** Theme from the tokens in effect on `el` (light or dark, by whatever the page sets). */
|
|
81
|
+
export declare const readGridTheme: (el: Element, overrides?: Partial<IGridTheme>) => IGridTheme;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
export interface IPosition {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export interface IRectangle {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
/** A pointer position with the row and column under it. Row -1 is the column header, column -1 the row header, column -2 the append column; -Infinity is above or left of the grid. */
|
|
12
|
+
export interface IRegionPosition extends IPosition {
|
|
13
|
+
rowIndex: number;
|
|
14
|
+
columnIndex: number;
|
|
15
|
+
}
|
|
16
|
+
export interface IScrollState {
|
|
17
|
+
scrollTop: number;
|
|
18
|
+
scrollLeft: number;
|
|
19
|
+
isScrolling: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare enum SelectionRegionType {
|
|
22
|
+
Rows = "Rows",
|
|
23
|
+
Columns = "Columns",
|
|
24
|
+
Cells = "Cells",
|
|
25
|
+
None = "None"
|
|
26
|
+
}
|
|
27
|
+
export declare enum RegionType {
|
|
28
|
+
Cell = "Cell",
|
|
29
|
+
ActiveCell = "ActiveCell",
|
|
30
|
+
AppendRow = "AppendRow",
|
|
31
|
+
AppendColumn = "AppendColumn",
|
|
32
|
+
ColumnHeader = "ColumnHeader",
|
|
33
|
+
ColumnHeaderMenu = "ColumnHeaderMenu",
|
|
34
|
+
ColumnPrimaryIcon = "ColumnPrimaryIcon",
|
|
35
|
+
ColumnDescription = "ColumnDescription",
|
|
36
|
+
ColumnResizeHandler = "ColumnResizeHandler",
|
|
37
|
+
ColumnFreezeHandler = "ColumnFreezeHandler",
|
|
38
|
+
RowHeaderDragHandler = "RowHeaderDragHandler",
|
|
39
|
+
RowHeaderExpandHandler = "RowHeaderExpandHandler",
|
|
40
|
+
RowHeaderCheckbox = "RowHeaderCheckbox",
|
|
41
|
+
RowGroupControl = "RowGroupControl",
|
|
42
|
+
RowGroupHeader = "RowGroupHeader",
|
|
43
|
+
RowHeader = "RowHeader",
|
|
44
|
+
AllCheckbox = "AllCheckbox",
|
|
45
|
+
FillHandler = "FillHandler",
|
|
46
|
+
Blank = "Blank",
|
|
47
|
+
None = "None"
|
|
48
|
+
}
|
|
49
|
+
/** A cell as `[columnIndex, rowIndex]`, or a run of rows or columns as `[start, end]`. Cell selections hold `[anchor, head]`. */
|
|
50
|
+
export type ICellRange = [colIndex: number, rowIndex: number];
|
|
51
|
+
export type IColumnRange = [colStartIndex: number, colEndIndex: number];
|
|
52
|
+
export type IRowRange = [rowStartIndex: number, rowEndIndex: number];
|
|
53
|
+
export type IRange = ICellRange | IColumnRange | IRowRange;
|
|
54
|
+
export type ICellItem = [colIndex: number, rowIndex: number];
|
|
55
|
+
export interface IMouseState extends IRegionPosition {
|
|
56
|
+
type: RegionType;
|
|
57
|
+
isOutOfBounds: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface IGridColumn {
|
|
60
|
+
id?: string;
|
|
61
|
+
name: string;
|
|
62
|
+
width?: number;
|
|
63
|
+
hasMenu?: boolean;
|
|
64
|
+
readonly?: boolean;
|
|
65
|
+
isPrimary?: boolean;
|
|
66
|
+
description?: string;
|
|
67
|
+
/** Space for a type icon before the name; the host draws it through `drawColumnIcon`. */
|
|
68
|
+
hasIcon?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface IColumnResizeState {
|
|
71
|
+
columnIndex: number;
|
|
72
|
+
width: number;
|
|
73
|
+
x: number;
|
|
74
|
+
}
|
|
75
|
+
export interface IColumnFreezeState {
|
|
76
|
+
sourceIndex: number;
|
|
77
|
+
targetIndex: number;
|
|
78
|
+
isFreezing: boolean;
|
|
79
|
+
}
|
|
80
|
+
export declare enum DragRegionType {
|
|
81
|
+
Rows = "Rows",
|
|
82
|
+
Columns = "Columns",
|
|
83
|
+
None = "None"
|
|
84
|
+
}
|
|
85
|
+
export interface IDragState {
|
|
86
|
+
type: DragRegionType;
|
|
87
|
+
/** Pointer distance from the dragged item's leading edge, so the ghost keeps its grip point. */
|
|
88
|
+
delta: number;
|
|
89
|
+
ranges: IRange[];
|
|
90
|
+
isDragging: boolean;
|
|
91
|
+
}
|
|
92
|
+
export type IScrollDirection = -1 | 0 | 1;
|
|
93
|
+
export declare enum MouseButtonType {
|
|
94
|
+
Left = 0,
|
|
95
|
+
Center = 1,
|
|
96
|
+
Right = 2
|
|
97
|
+
}
|
|
98
|
+
export declare enum RowControlType {
|
|
99
|
+
Spacer = "Spacer",
|
|
100
|
+
Drag = "Drag",
|
|
101
|
+
Expand = "Expand",
|
|
102
|
+
Checkbox = "Checkbox"
|
|
103
|
+
}
|
|
104
|
+
export interface IRowControlItem {
|
|
105
|
+
type: RowControlType;
|
|
106
|
+
}
|
|
107
|
+
export declare enum DraggableType {
|
|
108
|
+
All = "all",
|
|
109
|
+
None = "none",
|
|
110
|
+
Column = "column",
|
|
111
|
+
Row = "row"
|
|
112
|
+
}
|
|
113
|
+
export declare enum SelectableType {
|
|
114
|
+
All = "all",
|
|
115
|
+
None = "none",
|
|
116
|
+
Column = "column",
|
|
117
|
+
Row = "row",
|
|
118
|
+
Cell = "cell"
|
|
119
|
+
}
|
|
120
|
+
/** Size of the active cell, which can grow downward past its row for long text. */
|
|
121
|
+
export interface IActiveCellBound {
|
|
122
|
+
rowIndex: number;
|
|
123
|
+
columnIndex: number;
|
|
124
|
+
width: number;
|
|
125
|
+
height: number;
|
|
126
|
+
}
|
|
127
|
+
export declare enum LinearRowType {
|
|
128
|
+
Group = 0,
|
|
129
|
+
Row = 1,
|
|
130
|
+
Append = 2
|
|
131
|
+
}
|
|
132
|
+
/** A visual row. `realIndex` is the data row index; group headers and the append row have their own types. */
|
|
133
|
+
export type ILinearRow = {
|
|
134
|
+
type: LinearRowType.Row;
|
|
135
|
+
displayIndex: number;
|
|
136
|
+
realIndex: number;
|
|
137
|
+
} | {
|
|
138
|
+
type: LinearRowType.Group;
|
|
139
|
+
id: string;
|
|
140
|
+
value: unknown;
|
|
141
|
+
depth: number;
|
|
142
|
+
realIndex: number;
|
|
143
|
+
isCollapsed: boolean;
|
|
144
|
+
} | {
|
|
145
|
+
type: LinearRowType.Append;
|
|
146
|
+
value: unknown;
|
|
147
|
+
realIndex: number;
|
|
148
|
+
};
|
|
149
|
+
/** Plain grid without groups: the visual row is the data row. */
|
|
150
|
+
export declare const identityLinearRow: (index: number) => ILinearRow;
|
|
151
|
+
export declare const identityRowIndex: (index: number) => number;
|
|
152
|
+
export declare enum ItemType {
|
|
153
|
+
Row = "Row",
|
|
154
|
+
Column = "Column"
|
|
155
|
+
}
|
|
156
|
+
export type IIndicesMap = Record<number, number>;
|
|
157
|
+
export interface ICellMetaData {
|
|
158
|
+
size: number;
|
|
159
|
+
offset: number;
|
|
160
|
+
}
|
|
161
|
+
export type ICellMetaDataMap = Record<number, ICellMetaData>;
|
|
162
|
+
export interface ICoordinate {
|
|
163
|
+
rowCount: number;
|
|
164
|
+
/** Data rows only, without group headers or the append row. */
|
|
165
|
+
pureRowCount: number;
|
|
166
|
+
columnCount: number;
|
|
167
|
+
containerWidth: number;
|
|
168
|
+
containerHeight: number;
|
|
169
|
+
rowHeight: number;
|
|
170
|
+
columnWidth: number;
|
|
171
|
+
rowHeightMap?: IIndicesMap;
|
|
172
|
+
columnWidthMap?: IIndicesMap;
|
|
173
|
+
/** Column header height. */
|
|
174
|
+
rowInitSize?: number;
|
|
175
|
+
/** Row header width. */
|
|
176
|
+
columnInitSize?: number;
|
|
177
|
+
freezeColumnCount?: number;
|
|
178
|
+
}
|