@clickhouse/click-ui 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/click-ui.css +362 -0
- package/dist/cjs/components/Assets/Icons/Horizontal-Loading.cjs +13 -49
- package/dist/cjs/components/Assets/Icons/Horizontal-Loading.cjs.map +1 -1
- package/dist/cjs/components/Assets/Icons/Loaders.css +94 -0
- package/dist/cjs/components/Assets/Icons/Loaders.module.css.cjs +13 -0
- package/dist/cjs/components/Assets/Icons/Loaders.module.css.cjs.map +1 -0
- package/dist/cjs/components/Assets/Icons/Loading-Animated.cjs +8 -12
- package/dist/cjs/components/Assets/Icons/Loading-Animated.cjs.map +1 -1
- package/dist/cjs/components/Assets/Icons/Loading.cjs +13 -6
- package/dist/cjs/components/Assets/Icons/Loading.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/DateRangePicker.cjs +12 -2
- package/dist/cjs/components/DatePicker/DateRangePicker.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/index.cjs +1 -3
- package/dist/cjs/components/DatePicker/index.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/utils.cjs +3 -0
- package/dist/cjs/components/DatePicker/utils.cjs.map +1 -1
- package/dist/cjs/components/Grid/Cell.cjs +1 -3
- package/dist/cjs/components/Grid/Cell.cjs.map +1 -1
- package/dist/cjs/components/Grid/ColumnResizer.cjs +18 -15
- package/dist/cjs/components/Grid/ColumnResizer.cjs.map +1 -1
- package/dist/cjs/components/Grid/ColumnResizer.css +22 -0
- package/dist/cjs/components/Grid/ColumnResizer.module.css.cjs +11 -0
- package/dist/cjs/components/Grid/ColumnResizer.module.css.cjs.map +1 -0
- package/dist/cjs/components/Grid/Grid.css +34 -0
- package/dist/cjs/components/Grid/Grid.module.css.cjs +21 -0
- package/dist/cjs/components/Grid/Grid.module.css.cjs.map +1 -0
- package/dist/cjs/components/Grid/Header.cjs +22 -43
- package/dist/cjs/components/Grid/Header.cjs.map +1 -1
- package/dist/cjs/components/Grid/Header.css +44 -0
- package/dist/cjs/components/Grid/Header.module.css.cjs +19 -0
- package/dist/cjs/components/Grid/Header.module.css.cjs.map +1 -0
- package/dist/cjs/components/Grid/RowNumberColumn.cjs +12 -29
- package/dist/cjs/components/Grid/RowNumberColumn.cjs.map +1 -1
- package/dist/cjs/components/Grid/RowNumberColumn.css +22 -0
- package/dist/cjs/components/Grid/RowNumberColumn.module.css.cjs +12 -0
- package/dist/cjs/components/Grid/RowNumberColumn.module.css.cjs.map +1 -0
- package/dist/cjs/components/Grid/StyledCell.cjs +84 -56
- package/dist/cjs/components/Grid/StyledCell.cjs.map +1 -1
- package/dist/cjs/components/Grid/StyledCell.css +146 -0
- package/dist/cjs/components/Grid/StyledCell.module.css.cjs +47 -0
- package/dist/cjs/components/Grid/StyledCell.module.css.cjs.map +1 -0
- package/dist/cjs/components/Grid/index.cjs +30 -30
- package/dist/cjs/components/Grid/index.cjs.map +1 -1
- package/dist/esm/click-ui.css +362 -0
- package/dist/esm/components/Assets/Icons/Horizontal-Loading.js +13 -49
- package/dist/esm/components/Assets/Icons/Horizontal-Loading.js.map +1 -1
- package/dist/esm/components/Assets/Icons/Loaders.css +94 -0
- package/dist/esm/components/Assets/Icons/Loaders.module.css.js +8 -0
- package/dist/esm/components/Assets/Icons/Loaders.module.css.js.map +1 -0
- package/dist/esm/components/Assets/Icons/Loading-Animated.js +9 -13
- package/dist/esm/components/Assets/Icons/Loading-Animated.js.map +1 -1
- package/dist/esm/components/Assets/Icons/Loading.js +13 -6
- package/dist/esm/components/Assets/Icons/Loading.js.map +1 -1
- package/dist/esm/components/Assets/Icons/system/IconsLight.js +2 -2
- package/dist/esm/components/Assets/Icons/system/IconsLight.js.map +1 -1
- package/dist/esm/components/DatePicker/DateRangePicker.js +14 -4
- package/dist/esm/components/DatePicker/DateRangePicker.js.map +1 -1
- package/dist/esm/components/DatePicker/index.js +2 -4
- package/dist/esm/components/DatePicker/index.js.map +1 -1
- package/dist/esm/components/DatePicker/utils.js +3 -1
- package/dist/esm/components/DatePicker/utils.js.map +1 -1
- package/dist/esm/components/Grid/Cell.js +1 -3
- package/dist/esm/components/Grid/Cell.js.map +1 -1
- package/dist/esm/components/Grid/ColumnResizer.css +22 -0
- package/dist/esm/components/Grid/ColumnResizer.js +18 -15
- package/dist/esm/components/Grid/ColumnResizer.js.map +1 -1
- package/dist/esm/components/Grid/ColumnResizer.module.css.js +7 -0
- package/dist/esm/components/Grid/ColumnResizer.module.css.js.map +1 -0
- package/dist/esm/components/Grid/Grid.css +34 -0
- package/dist/esm/components/Grid/Grid.module.css.js +13 -0
- package/dist/esm/components/Grid/Grid.module.css.js.map +1 -0
- package/dist/esm/components/Grid/Header.css +44 -0
- package/dist/esm/components/Grid/Header.js +22 -43
- package/dist/esm/components/Grid/Header.js.map +1 -1
- package/dist/esm/components/Grid/Header.module.css.js +13 -0
- package/dist/esm/components/Grid/Header.module.css.js.map +1 -0
- package/dist/esm/components/Grid/RowNumberColumn.css +22 -0
- package/dist/esm/components/Grid/RowNumberColumn.js +12 -29
- package/dist/esm/components/Grid/RowNumberColumn.js.map +1 -1
- package/dist/esm/components/Grid/RowNumberColumn.module.css.js +8 -0
- package/dist/esm/components/Grid/RowNumberColumn.module.css.js.map +1 -0
- package/dist/esm/components/Grid/StyledCell.css +146 -0
- package/dist/esm/components/Grid/StyledCell.js +84 -56
- package/dist/esm/components/Grid/StyledCell.js.map +1 -1
- package/dist/esm/components/Grid/StyledCell.module.css.js +32 -0
- package/dist/esm/components/Grid/StyledCell.module.css.js.map +1 -0
- package/dist/esm/components/Grid/index.js +30 -30
- package/dist/esm/components/Grid/index.js.map +1 -1
- package/dist/types/components/Assets/Icons/Horizontal-Loading.d.ts +2 -3
- package/dist/types/components/Assets/Icons/Loading-Animated.d.ts +2 -3
- package/dist/types/components/Assets/Icons/Loading.d.ts +2 -4
- package/dist/types/components/DatePicker/DateRangePicker.d.ts +2 -1
- package/dist/types/components/DatePicker/utils.d.ts +1 -0
- package/dist/types/components/Grid/RowNumberColumn.d.ts +1 -2
- package/dist/types/components/Grid/StyledCell.d.ts +10 -5
- package/package.json +1 -1
|
@@ -1,66 +1,94 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./StyledCell.css";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cn } from '../../lib/cva.js';
|
|
4
|
+
import styles from './StyledCell.module.css.js';
|
|
5
|
+
import { cva } from 'class-variance-authority';
|
|
2
6
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
const cellVariants = cva(styles.cell, {
|
|
8
|
+
variants: {
|
|
9
|
+
type: {
|
|
10
|
+
body: styles.cell_type_body,
|
|
11
|
+
header: styles.cell_type_header
|
|
12
|
+
},
|
|
13
|
+
selection: {
|
|
14
|
+
default: null,
|
|
15
|
+
selectDirect: styles["cell_selection_direct"],
|
|
16
|
+
selectIndirect: styles["cell_selection_indirect"]
|
|
17
|
+
},
|
|
18
|
+
noBorder: {
|
|
19
|
+
true: styles["cell_no-border"]
|
|
20
|
+
},
|
|
21
|
+
focused: {
|
|
22
|
+
true: styles.cell_focused
|
|
23
|
+
},
|
|
24
|
+
lastRow: {
|
|
25
|
+
true: styles["cell_last-row"]
|
|
26
|
+
},
|
|
27
|
+
lastColumn: {
|
|
28
|
+
true: styles["cell_last-column"]
|
|
29
|
+
},
|
|
30
|
+
rowAutoHeight: {
|
|
31
|
+
true: styles["cell_row-auto-height"]
|
|
32
|
+
},
|
|
33
|
+
overlay: {
|
|
34
|
+
true: styles.cell__overlay
|
|
35
|
+
},
|
|
36
|
+
overlayTop: {
|
|
37
|
+
true: styles["cell__overlay_selected_top"]
|
|
38
|
+
},
|
|
39
|
+
overlayLeft: {
|
|
40
|
+
true: styles["cell__overlay_selected_left"]
|
|
41
|
+
},
|
|
42
|
+
overlayBottom: {
|
|
43
|
+
true: styles["cell__overlay_selected_bottom"]
|
|
44
|
+
},
|
|
45
|
+
overlayRight: {
|
|
46
|
+
true: styles["cell__overlay_selected_right"]
|
|
47
|
+
},
|
|
48
|
+
overlayAutoHeight: {
|
|
49
|
+
true: styles["cell__overlay_row-auto-height"]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const StyledCell = ({
|
|
54
|
+
as,
|
|
7
55
|
$isFocused,
|
|
56
|
+
$selectionType,
|
|
57
|
+
$isSelectedTop,
|
|
58
|
+
$isSelectedLeft,
|
|
8
59
|
$isLastRow,
|
|
9
60
|
$isLastColumn,
|
|
10
|
-
$selectionType,
|
|
11
61
|
$height,
|
|
12
62
|
$type = "body",
|
|
13
63
|
$showBorder,
|
|
14
|
-
$rowAutoHeight
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
$
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
$isLastRow,
|
|
43
|
-
$isLastColumn,
|
|
44
|
-
$selectionType,
|
|
45
|
-
$type = "body",
|
|
46
|
-
$isSelectedTop,
|
|
47
|
-
$isSelectedLeft,
|
|
48
|
-
$rowAutoHeight
|
|
49
|
-
}) => $isSelectedTop || $isSelectedLeft || $selectionType === "selectDirect" && ($isLastRow || $isLastColumn) || $rowAutoHeight ? `
|
|
50
|
-
&::before {
|
|
51
|
-
content: "";
|
|
52
|
-
position: absolute;
|
|
53
|
-
top: 0;
|
|
54
|
-
bottom: 0;
|
|
55
|
-
right: 0;
|
|
56
|
-
left: 0;
|
|
57
|
-
${$isSelectedTop ? `border-top: 1px solid ${theme.click.grid[$type].cell.color.stroke.selectDirect};` : ""}
|
|
58
|
-
${$isSelectedLeft ? `border-left: 1px solid ${theme.click.grid[$type].cell.color.stroke.selectDirect};` : ""}
|
|
59
|
-
${$selectionType === "selectDirect" && $isLastRow ? `border-bottom: 1px solid ${theme.click.grid[$type].cell.color.stroke.selectDirect};` : ""}
|
|
60
|
-
${$selectionType === "selectDirect" && $isLastColumn ? `border-right: 1px solid ${theme.click.grid[$type].cell.color.stroke.selectDirect};` : ""}
|
|
61
|
-
${$rowAutoHeight && "border: none;"}
|
|
62
|
-
}
|
|
63
|
-
` : "");
|
|
64
|
+
$rowAutoHeight,
|
|
65
|
+
className,
|
|
66
|
+
style,
|
|
67
|
+
children,
|
|
68
|
+
...props
|
|
69
|
+
}) => {
|
|
70
|
+
const Component = as ?? "div";
|
|
71
|
+
const hasOverlay = $isSelectedTop || $isSelectedLeft || $selectionType === "selectDirect" && ($isLastRow || $isLastColumn) || !!$rowAutoHeight;
|
|
72
|
+
const mergedStyle = {
|
|
73
|
+
height: $rowAutoHeight ? "100%" : `${$height}px`,
|
|
74
|
+
...style
|
|
75
|
+
};
|
|
76
|
+
return /* @__PURE__ */ jsx(Component, { className: cn(cellVariants({
|
|
77
|
+
type: $type,
|
|
78
|
+
selection: $selectionType,
|
|
79
|
+
noBorder: $type === "header" && !$showBorder,
|
|
80
|
+
focused: $isFocused,
|
|
81
|
+
lastRow: $isLastRow,
|
|
82
|
+
lastColumn: $isLastColumn,
|
|
83
|
+
rowAutoHeight: !!$rowAutoHeight,
|
|
84
|
+
overlay: hasOverlay,
|
|
85
|
+
overlayTop: $isSelectedTop,
|
|
86
|
+
overlayLeft: $isSelectedLeft,
|
|
87
|
+
overlayBottom: $selectionType === "selectDirect" && $isLastRow,
|
|
88
|
+
overlayRight: $selectionType === "selectDirect" && $isLastColumn,
|
|
89
|
+
overlayAutoHeight: !!$rowAutoHeight
|
|
90
|
+
}), className), style: mergedStyle, ...props, children });
|
|
91
|
+
};
|
|
64
92
|
|
|
65
93
|
export { StyledCell };
|
|
66
94
|
//# sourceMappingURL=StyledCell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyledCell.js","sources":["../../../../src/components/Grid/StyledCell.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"StyledCell.js","sources":["../../../../src/components/Grid/StyledCell.tsx"],"sourcesContent":["import { ComponentProps, CSSProperties, ElementType, ReactNode } from 'react';\nimport { cn, cva } from '@/lib/cva';\nimport styles from './StyledCell.module.css';\nimport { SelectionType } from './types';\n\ninterface StyledCellOwnProps {\n $isFocused: boolean;\n $selectionType: SelectionType;\n $isSelectedTop: boolean;\n $isSelectedLeft: boolean;\n $isLastRow: boolean;\n $isLastColumn: boolean;\n $height: number;\n $type?: 'body' | 'header';\n $showBorder: boolean;\n $rowAutoHeight?: boolean;\n}\n\nconst cellVariants = cva(styles.cell, {\n variants: {\n type: {\n body: styles.cell_type_body,\n header: styles.cell_type_header,\n },\n selection: {\n default: null,\n selectDirect: styles['cell_selection_direct'],\n selectIndirect: styles['cell_selection_indirect'],\n },\n noBorder: { true: styles['cell_no-border'] },\n focused: { true: styles.cell_focused },\n lastRow: { true: styles['cell_last-row'] },\n lastColumn: { true: styles['cell_last-column'] },\n rowAutoHeight: { true: styles['cell_row-auto-height'] },\n overlay: { true: styles.cell__overlay },\n overlayTop: { true: styles['cell__overlay_selected_top'] },\n overlayLeft: { true: styles['cell__overlay_selected_left'] },\n overlayBottom: { true: styles['cell__overlay_selected_bottom'] },\n overlayRight: { true: styles['cell__overlay_selected_right'] },\n overlayAutoHeight: { true: styles['cell__overlay_row-auto-height'] },\n },\n});\n\ntype StyledCellProps<T extends ElementType> = StyledCellOwnProps & {\n as?: T;\n children?: ReactNode;\n} & Omit<ComponentProps<T>, keyof StyledCellOwnProps | 'as' | 'children'>;\n\nexport const StyledCell = <T extends ElementType = 'div'>({\n as,\n $isFocused,\n $selectionType,\n $isSelectedTop,\n $isSelectedLeft,\n $isLastRow,\n $isLastColumn,\n $height,\n $type = 'body',\n $showBorder,\n $rowAutoHeight,\n className,\n style,\n children,\n ...props\n}: StyledCellProps<T>) => {\n const Component = (as ?? 'div') as ElementType;\n // A single overlay `::before` is drawn whenever any selection/focus edge or\n // auto-height needs to paint on top of the cell (see Grid.module.css).\n const hasOverlay =\n $isSelectedTop ||\n $isSelectedLeft ||\n ($selectionType === 'selectDirect' && ($isLastRow || $isLastColumn)) ||\n !!$rowAutoHeight;\n const mergedStyle = {\n height: $rowAutoHeight ? '100%' : `${$height}px`,\n ...style,\n } as CSSProperties;\n return (\n <Component\n className={cn(\n cellVariants({\n type: $type,\n selection: $selectionType,\n noBorder: $type === 'header' && !$showBorder,\n focused: $isFocused,\n lastRow: $isLastRow,\n lastColumn: $isLastColumn,\n rowAutoHeight: !!$rowAutoHeight,\n overlay: hasOverlay,\n overlayTop: $isSelectedTop,\n overlayLeft: $isSelectedLeft,\n overlayBottom: $selectionType === 'selectDirect' && $isLastRow,\n overlayRight: $selectionType === 'selectDirect' && $isLastColumn,\n overlayAutoHeight: !!$rowAutoHeight,\n }),\n className\n )}\n style={mergedStyle}\n {...props}\n >\n {children}\n </Component>\n );\n};\n"],"names":["cellVariants","cva","styles","cell","variants","type","body","cell_type_body","header","cell_type_header","selection","default","selectDirect","selectIndirect","noBorder","true","focused","cell_focused","lastRow","lastColumn","rowAutoHeight","overlay","cell__overlay","overlayTop","overlayLeft","overlayBottom","overlayRight","overlayAutoHeight","StyledCell","as","$isFocused","$selectionType","$isSelectedTop","$isSelectedLeft","$isLastRow","$isLastColumn","$height","$type","$showBorder","$rowAutoHeight","className","style","children","props","Component","hasOverlay","mergedStyle","height","cn"],"mappings":";;;;;AAkBA,MAAMA,YAAAA,GAAeC,GAAAA,CAAIC,MAAAA,CAAOC,IAAAA,EAAM;AAAA,EACpCC,QAAAA,EAAU;AAAA,IACRC,IAAAA,EAAM;AAAA,MACJC,MAAMJ,MAAAA,CAAOK,cAAAA;AAAAA,MACbC,QAAQN,MAAAA,CAAOO;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AAOM,WAAAA,EACP,GAAIH,OAEHD,QAAAA,EACH,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const cell = "cell__OXAxg";
|
|
2
|
+
const cell_type_body = "cell_type_body__SohuF";
|
|
3
|
+
const cell_selection_indirect = "cell_selection_indirect__6e6yy";
|
|
4
|
+
const cell_selection_direct = "cell_selection_direct__QEL9m";
|
|
5
|
+
const cell_type_header = "cell_type_header__3tsr-";
|
|
6
|
+
const cell_focused = "cell_focused__cmh-b";
|
|
7
|
+
const cell__overlay = "cell__overlay__U9XGO";
|
|
8
|
+
const cell__overlay_selected_top = "cell__overlay_selected_top__OMUJB";
|
|
9
|
+
const cell__overlay_selected_left = "cell__overlay_selected_left__MiimG";
|
|
10
|
+
const cell__overlay_selected_bottom = "cell__overlay_selected_bottom__2ra9F";
|
|
11
|
+
const cell__overlay_selected_right = "cell__overlay_selected_right__Dt-g5";
|
|
12
|
+
const styles = {
|
|
13
|
+
cell: cell,
|
|
14
|
+
cell_type_body: cell_type_body,
|
|
15
|
+
cell_selection_indirect: cell_selection_indirect,
|
|
16
|
+
cell_selection_direct: cell_selection_direct,
|
|
17
|
+
cell_type_header: cell_type_header,
|
|
18
|
+
"cell_no-border": "cell_no-border__9gXDK",
|
|
19
|
+
cell_focused: cell_focused,
|
|
20
|
+
"cell_last-row": "cell_last-row__DoJdk",
|
|
21
|
+
"cell_last-column": "cell_last-column__LgKM7",
|
|
22
|
+
"cell_row-auto-height": "cell_row-auto-height__yzQUR",
|
|
23
|
+
cell__overlay: cell__overlay,
|
|
24
|
+
cell__overlay_selected_top: cell__overlay_selected_top,
|
|
25
|
+
cell__overlay_selected_left: cell__overlay_selected_left,
|
|
26
|
+
cell__overlay_selected_bottom: cell__overlay_selected_bottom,
|
|
27
|
+
cell__overlay_selected_right: cell__overlay_selected_right,
|
|
28
|
+
"cell__overlay_row-auto-height": "cell__overlay_row-auto-height__teKk1"
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { cell, cell__overlay, cell__overlay_selected_bottom, cell__overlay_selected_left, cell__overlay_selected_right, cell__overlay_selected_top, cell_focused, cell_selection_direct, cell_selection_indirect, cell_type_body, cell_type_header, styles as default };
|
|
32
|
+
//# sourceMappingURL=StyledCell.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StyledCell.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import "./Grid.css";
|
|
1
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
3
|
import { forwardRef, useState, useCallback, useRef, useMemo, useEffect } from 'react';
|
|
3
4
|
import { VariableSizeGrid } from 'react-window';
|
|
4
5
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
5
6
|
import RowNumberColumn from './RowNumberColumn.js';
|
|
6
7
|
import Header from './Header.js';
|
|
7
|
-
import {
|
|
8
|
+
import { cn } from '../../lib/cva.js';
|
|
9
|
+
import styles from './Grid.module.css.js';
|
|
8
10
|
import { useSelectionActions } from './useSelectionActions.js';
|
|
9
11
|
import { mergeRefs } from '../../utils/mergeRefs.js';
|
|
10
12
|
import { Cell } from './Cell.js';
|
|
@@ -13,13 +15,18 @@ import copyGridElements from './copyGridElements.js';
|
|
|
13
15
|
import useColumns from './useColumns.js';
|
|
14
16
|
import useResizingState from './useResizingState.js';
|
|
15
17
|
import { ContextMenu } from '../ContextMenu/index.js';
|
|
18
|
+
import { cva } from 'class-variance-authority';
|
|
16
19
|
|
|
20
|
+
const gridVariants = cva(styles["grid"], {
|
|
21
|
+
variants: {
|
|
22
|
+
bordered: {
|
|
23
|
+
true: styles["grid_bordered"]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
17
27
|
const NO_BUTTONS_PRESSED = 0;
|
|
18
28
|
const LEFT_BUTTON_PRESSED = 1;
|
|
19
29
|
const RIGHT_BUTTON_PRESSED = 2;
|
|
20
|
-
const GridContainer = styled.div.withConfig({
|
|
21
|
-
componentId: "sc-175eneg-0"
|
|
22
|
-
})(["display:flex;flex-direction:column-reverse;user-select:none;overflow-anchor:none;"]);
|
|
23
30
|
const getRenderedCursor = (children) => children.reduce(([minRow, maxRow, minColumn, maxColumn], {
|
|
24
31
|
props: {
|
|
25
32
|
columnIndex,
|
|
@@ -40,28 +47,12 @@ const getRenderedCursor = (children) => children.reduce(([minRow, maxRow, minCol
|
|
|
40
47
|
}
|
|
41
48
|
return [minRow, maxRow, minColumn, maxColumn];
|
|
42
49
|
}, [Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY]);
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
margin-top: ${$top}px;
|
|
50
|
-
margin-left: ${$left}px;
|
|
51
|
-
`);
|
|
52
|
-
const ContextMenuTrigger = styled.div.withConfig({
|
|
53
|
-
componentId: "sc-175eneg-2"
|
|
54
|
-
})(["outline:none;overflow:hidden;height:", ";width:100%;background:", ";border-radius:", ";", ";"], ({
|
|
55
|
-
$height
|
|
56
|
-
}) => $height ? `${$height}px` : "100%", ({
|
|
57
|
-
theme
|
|
58
|
-
}) => theme.click.grid.body.cell.color.background.default, ({
|
|
59
|
-
theme,
|
|
60
|
-
$rounded
|
|
61
|
-
}) => theme.click.grid.radii[$rounded], ({
|
|
62
|
-
$showBorder,
|
|
63
|
-
theme
|
|
64
|
-
}) => $showBorder && `border: 1px solid ${theme.click.grid.header.cell.color.stroke.default}`);
|
|
50
|
+
const roundedRadii = {
|
|
51
|
+
none: "var(--click-grid-radii-none)",
|
|
52
|
+
lg: "var(--click-grid-radii-lg)",
|
|
53
|
+
md: "var(--click-grid-radii-md)",
|
|
54
|
+
sm: "var(--click-grid-radii-sm)"
|
|
55
|
+
};
|
|
65
56
|
const OuterElementType = forwardRef((props, ref) => /* @__PURE__ */ jsx("div", { ref, "data-testid": "grid-outer-element", tabIndex: 0, ...props }));
|
|
66
57
|
const Grid = forwardRef(({
|
|
67
58
|
autoFocus,
|
|
@@ -331,9 +322,12 @@ const Grid = forwardRef(({
|
|
|
331
322
|
...containerProps
|
|
332
323
|
}, ref) => {
|
|
333
324
|
const [minRow, maxRow, minColumn, maxColumn] = getRenderedCursor(children);
|
|
334
|
-
return /* @__PURE__ */ jsxs(
|
|
335
|
-
/* @__PURE__ */ jsx(
|
|
336
|
-
|
|
325
|
+
return /* @__PURE__ */ jsxs("div", { ...containerProps, className: cn(styles["grid__inner"], `sticky-grid__container grid-outer ${props.className ?? ""}`), children: [
|
|
326
|
+
/* @__PURE__ */ jsx("div", { className: styles["grid__data"], style: {
|
|
327
|
+
"--grid-data-top": `${showHeader ? headerHeight : 0}px`,
|
|
328
|
+
"--grid-data-left": `${showRowNumber ? rowNumberWidth : 0}px`
|
|
329
|
+
}, ref, children }),
|
|
330
|
+
showRowNumber && /* @__PURE__ */ jsx(RowNumberColumn, { scrolledHorizontal, minRow, maxRow, rowHeight, headerHeight, rowWidth: rowNumberWidth, rowCount, getSelectionType, rowStart, showBorder, rowAutoHeight }),
|
|
337
331
|
showHeader && /* @__PURE__ */ jsx(Header, { scrolledVertical, scrolledHorizontal, showRowNumber, minColumn, maxColumn, height: headerHeight, getColumnWidth: columnWidth, cell, rowNumberWidth, getSelectionType, columnCount, onColumnResize, getColumnHorizontalPosition, getResizerPosition, showBorder, resizingState })
|
|
338
332
|
] });
|
|
339
333
|
});
|
|
@@ -587,8 +581,14 @@ const Grid = forwardRef(({
|
|
|
587
581
|
gridRef.current.resetAfterRowIndex(0);
|
|
588
582
|
}
|
|
589
583
|
}, [rowCount, columnCount]);
|
|
584
|
+
const contextMenuTriggerHeight = autoHeight ? rowCount * rowHeight + (showHeader ? headerHeight : 0) + elementBorderRef.current.scrollBarHeight : void 0;
|
|
590
585
|
return /* @__PURE__ */ jsxs(ContextMenu, { modal: false, onOpenChange: setContextMenuOpen, children: [
|
|
591
|
-
/* @__PURE__ */ jsx(
|
|
586
|
+
/* @__PURE__ */ jsx(ContextMenu.Trigger, { className: gridVariants({
|
|
587
|
+
bordered: showBorder
|
|
588
|
+
}), style: {
|
|
589
|
+
"--grid-radius": roundedRadii[rounded],
|
|
590
|
+
"--grid-height": contextMenuTriggerHeight ? `${contextMenuTriggerHeight}px` : "100%"
|
|
591
|
+
}, ref: mergeRefs([forwardedRef, containerRef]), tabIndex: 0, onMouseDown, onMouseMove, onKeyDown, onPointerDown, onPointerUp, onPointerLeave: setPointerCapture, onPointerEnter: setPointerCapture, onContextMenu, children: /* @__PURE__ */ jsx(AutoSizer, { onResize, children: ({
|
|
592
592
|
height,
|
|
593
593
|
width
|
|
594
594
|
}) => /* @__PURE__ */ jsx(VariableSizeGrid, { ref: forwardedGridRef ? mergeRefs([forwardedGridRef, gridRef]) : gridRef, height, width, columnCount, rowHeight: getRowHeight, useIsScrolling, innerElementType: InnerElementType, itemData: data, initialScrollTop: focus.row < rowStart ? focus.row * rowHeight : (focus.row - rowStart) * rowHeight, initialScrollLeft: getColumnHorizontalPosition(focus.column), columnWidth, rowCount, onScroll, outerRef, outerElementType: OuterElementType, onItemsRendered, ...props, children: CellWithWidth }) }) }),
|