@are-visual/virtual-table 0.0.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 +548 -0
- package/index.d.ts +311 -0
- package/index.esm.js +1771 -0
- package/index.esm.js.map +1 -0
- package/middleware/column-resize/index.d.ts +19 -0
- package/middleware/column-resize/index.js +130 -0
- package/middleware/column-resize/index.js.map +1 -0
- package/middleware/column-resize/styles.css +8 -0
- package/middleware/column-resize/styles.scss +10 -0
- package/middleware/empty/index.d.ts +10 -0
- package/middleware/empty/index.js +73 -0
- package/middleware/empty/index.js.map +1 -0
- package/middleware/expandable/index.d.ts +37 -0
- package/middleware/expandable/index.js +239 -0
- package/middleware/expandable/index.js.map +1 -0
- package/middleware/expandable/styles.css +49 -0
- package/middleware/expandable/styles.scss +73 -0
- package/middleware/horizontal-scroll-bar/index.d.ts +15 -0
- package/middleware/horizontal-scroll-bar/index.js +90 -0
- package/middleware/horizontal-scroll-bar/index.js.map +1 -0
- package/middleware/horizontal-scroll-bar/styles.css +11 -0
- package/middleware/horizontal-scroll-bar/styles.scss +13 -0
- package/middleware/loading/index.d.ts +7 -0
- package/middleware/loading/index.js +73 -0
- package/middleware/loading/index.js.map +1 -0
- package/middleware/loading/styles.css +17 -0
- package/middleware/loading/styles.scss +27 -0
- package/middleware/selection/index.d.ts +47 -0
- package/middleware/selection/index.js +282 -0
- package/middleware/selection/index.js.map +1 -0
- package/middleware/selection/styles.css +13 -0
- package/middleware/selection/styles.scss +20 -0
- package/middleware/summary/index.d.ts +36 -0
- package/middleware/summary/index.js +203 -0
- package/middleware/summary/index.js.map +1 -0
- package/middleware/summary/styles.css +36 -0
- package/middleware/summary/styles.scss +45 -0
- package/middleware/utils/getScrollbarSize.d.ts +5 -0
- package/middleware/utils/getScrollbarSize.js +15 -0
- package/middleware/utils/getScrollbarSize.js.map +1 -0
- package/middleware/utils/useControllableValue.d.ts +16 -0
- package/middleware/utils/useControllableValue.js +28 -0
- package/middleware/utils/useControllableValue.js.map +1 -0
- package/package.json +34 -0
- package/styles/table.css +142 -0
- package/styles/table.scss +186 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
2
|
+
import { useHorizontalScrollContext, Colgroup, useTableSticky, isValidFixedLeft, isValidFixedRight, isValidFixed, createMiddleware } from '@are-visual/virtual-table';
|
|
3
|
+
import { createContext, useState, useRef, useEffect, memo, useMemo, useContext, Fragment, isValidElement, useCallback } from 'react';
|
|
4
|
+
import { getScrollbarSize } from '@are-visual/virtual-table/middleware/utils/getScrollbarSize';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
|
|
7
|
+
const SummaryContext = /*#__PURE__*/createContext(null);
|
|
8
|
+
|
|
9
|
+
const Footer = props => {
|
|
10
|
+
const {
|
|
11
|
+
columns,
|
|
12
|
+
fixed,
|
|
13
|
+
children
|
|
14
|
+
} = props;
|
|
15
|
+
const {
|
|
16
|
+
listen,
|
|
17
|
+
notify
|
|
18
|
+
} = useHorizontalScrollContext();
|
|
19
|
+
const [scrollbarHeight] = useState(() => getScrollbarSize().height);
|
|
20
|
+
const wrapperRef = useRef(null);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const node = wrapperRef.current;
|
|
23
|
+
if (node == null) return;
|
|
24
|
+
const key = 'virtual-table-summary';
|
|
25
|
+
const onScroll = () => {
|
|
26
|
+
const nextScrollLeft = node.scrollLeft;
|
|
27
|
+
notify(key, nextScrollLeft, node);
|
|
28
|
+
};
|
|
29
|
+
const dispose = listen(key, scrollLeft => {
|
|
30
|
+
node.scrollLeft = scrollLeft;
|
|
31
|
+
});
|
|
32
|
+
node.addEventListener('scroll', onScroll);
|
|
33
|
+
return () => {
|
|
34
|
+
node.removeEventListener('scroll', onScroll);
|
|
35
|
+
dispose();
|
|
36
|
+
};
|
|
37
|
+
}, [listen, notify]);
|
|
38
|
+
return jsx("div", {
|
|
39
|
+
className: clsx('virtual-table-summary-wrapper', fixed && 'virtual-table-summary-sticky-bottom virtual-table-summary-top-border'),
|
|
40
|
+
style: {
|
|
41
|
+
paddingBottom: scrollbarHeight
|
|
42
|
+
},
|
|
43
|
+
ref: wrapperRef,
|
|
44
|
+
children: jsxs("table", {
|
|
45
|
+
className: "virtual-table-summary",
|
|
46
|
+
children: [jsx(Colgroup, {
|
|
47
|
+
columns: columns
|
|
48
|
+
}), jsx("tfoot", {
|
|
49
|
+
className: "virtual-table-summary-tfoot",
|
|
50
|
+
children: children
|
|
51
|
+
})]
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
function Cell(props) {
|
|
57
|
+
const {
|
|
58
|
+
className,
|
|
59
|
+
style,
|
|
60
|
+
children,
|
|
61
|
+
align,
|
|
62
|
+
colSpan,
|
|
63
|
+
columnKey,
|
|
64
|
+
...restProps
|
|
65
|
+
} = props;
|
|
66
|
+
const {
|
|
67
|
+
size: stickySizes,
|
|
68
|
+
fixed: columnsFixed
|
|
69
|
+
} = useTableSticky();
|
|
70
|
+
const stickySize = stickySizes.get(columnKey);
|
|
71
|
+
const fixed = columnsFixed.find(x => x.key === columnKey)?.fixed;
|
|
72
|
+
const {
|
|
73
|
+
left: lastFixedLeftColumnKey,
|
|
74
|
+
right: firstFixedRightColumnKey
|
|
75
|
+
} = useMemo(() => {
|
|
76
|
+
const left = columnsFixed.reduce((result, x) => {
|
|
77
|
+
if (isValidFixedLeft(x.fixed)) {
|
|
78
|
+
return x.key;
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}, undefined);
|
|
82
|
+
const right = columnsFixed.find(x => isValidFixedRight(x.fixed))?.key;
|
|
83
|
+
return {
|
|
84
|
+
left,
|
|
85
|
+
right
|
|
86
|
+
};
|
|
87
|
+
}, [columnsFixed]);
|
|
88
|
+
if (colSpan === 0) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
return jsx("td", {
|
|
92
|
+
...restProps,
|
|
93
|
+
colSpan: colSpan,
|
|
94
|
+
className: clsx('virtual-table-cell virtual-table-summary-cell', align != null && `virtual-table-align-${align}`, isValidFixed(fixed) && 'virtual-table-sticky-cell', lastFixedLeftColumnKey === columnKey && 'virtual-table-cell-fix-left-last', firstFixedRightColumnKey === columnKey && 'virtual-table-cell-fix-right-first', className),
|
|
95
|
+
style: {
|
|
96
|
+
...style,
|
|
97
|
+
left: isValidFixedLeft(fixed) ? stickySize : undefined,
|
|
98
|
+
right: isValidFixedRight(fixed) ? stickySize : undefined
|
|
99
|
+
},
|
|
100
|
+
children: children
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
var Cell$1 = /*#__PURE__*/memo(Cell);
|
|
104
|
+
|
|
105
|
+
const SummaryRow = _ref => {
|
|
106
|
+
let {
|
|
107
|
+
children,
|
|
108
|
+
...props
|
|
109
|
+
} = _ref;
|
|
110
|
+
const descriptor = useContext(SummaryContext);
|
|
111
|
+
if (typeof children === 'function') {
|
|
112
|
+
if (descriptor != null) {
|
|
113
|
+
return jsx("tr", {
|
|
114
|
+
...props,
|
|
115
|
+
children: descriptor.map(item => {
|
|
116
|
+
const {
|
|
117
|
+
key
|
|
118
|
+
} = item;
|
|
119
|
+
if (item.type === 'blank') {
|
|
120
|
+
return jsx("td", {}, key);
|
|
121
|
+
}
|
|
122
|
+
const {
|
|
123
|
+
column
|
|
124
|
+
} = item;
|
|
125
|
+
return jsx(Fragment, {
|
|
126
|
+
children: children(column, key)
|
|
127
|
+
}, key);
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
throw new Error('SummaryRow is missing the columns context and cannot use children as a function.');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return jsx("tr", {
|
|
135
|
+
...props,
|
|
136
|
+
children: children
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
function Summary(_ref) {
|
|
141
|
+
let {
|
|
142
|
+
children
|
|
143
|
+
} = _ref;
|
|
144
|
+
return children;
|
|
145
|
+
}
|
|
146
|
+
Summary.Row = SummaryRow;
|
|
147
|
+
Summary.Cell = Cell$1;
|
|
148
|
+
|
|
149
|
+
function useTableSummary(ctx, options) {
|
|
150
|
+
const {
|
|
151
|
+
summary
|
|
152
|
+
} = options ?? {};
|
|
153
|
+
const {
|
|
154
|
+
dataSource
|
|
155
|
+
} = ctx;
|
|
156
|
+
const summaryNode = summary?.(dataSource);
|
|
157
|
+
const fixed = /*#__PURE__*/isValidElement(summaryNode) && summaryNode.type === Summary && summaryNode.props.fixed;
|
|
158
|
+
const renderHeader = useCallback((children, _ref) => {
|
|
159
|
+
let {
|
|
160
|
+
columnDescriptor
|
|
161
|
+
} = _ref;
|
|
162
|
+
return jsxs(Fragment$1, {
|
|
163
|
+
children: [children, jsx("tfoot", {
|
|
164
|
+
className: "virtual-table-summary-tfoot",
|
|
165
|
+
children: jsx(SummaryContext.Provider, {
|
|
166
|
+
value: columnDescriptor,
|
|
167
|
+
children: summaryNode
|
|
168
|
+
})
|
|
169
|
+
})]
|
|
170
|
+
});
|
|
171
|
+
}, [summaryNode]);
|
|
172
|
+
if (summary == null) {
|
|
173
|
+
return ctx;
|
|
174
|
+
}
|
|
175
|
+
if (fixed === 'top') {
|
|
176
|
+
return {
|
|
177
|
+
...ctx,
|
|
178
|
+
renderHeader
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
...ctx,
|
|
183
|
+
renderContent(children, _ref2) {
|
|
184
|
+
let {
|
|
185
|
+
columnDescriptor
|
|
186
|
+
} = _ref2;
|
|
187
|
+
return jsxs(Fragment$1, {
|
|
188
|
+
children: [children, jsx(Footer, {
|
|
189
|
+
fixed: fixed === 'bottom' || fixed,
|
|
190
|
+
columns: columnDescriptor,
|
|
191
|
+
children: jsx(SummaryContext.Provider, {
|
|
192
|
+
value: columnDescriptor,
|
|
193
|
+
children: summaryNode
|
|
194
|
+
})
|
|
195
|
+
})]
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
const tableSummary = createMiddleware(useTableSummary);
|
|
201
|
+
|
|
202
|
+
export { Summary, tableSummary };
|
|
203
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../packages/virtual-table/src/middleware/summary/context/columns.tsx","../../../../packages/virtual-table/src/middleware/summary/footer.tsx","../../../../packages/virtual-table/src/middleware/summary/cell.tsx","../../../../packages/virtual-table/src/middleware/summary/row.tsx","../../../../packages/virtual-table/src/middleware/summary/summary.tsx","../../../../packages/virtual-table/src/middleware/summary/index.tsx"],"sourcesContent":["import type { ColumnDescriptor } from '@are-visual/virtual-table'\nimport { createContext } from 'react'\n\nexport const SummaryContext = createContext<ColumnDescriptor[] | null>(null)\n","import type { ColumnDescriptor } from '@are-visual/virtual-table'\nimport type { FC, ReactNode } from 'react'\nimport { Colgroup, useHorizontalScrollContext } from '@are-visual/virtual-table'\nimport { getScrollbarSize } from '@are-visual/virtual-table/middleware/utils/getScrollbarSize'\nimport clsx from 'clsx'\nimport { useEffect, useRef, useState } from 'react'\n\nexport interface FooterProps {\n columns: ColumnDescriptor[]\n fixed?: boolean\n children?: ReactNode\n}\n\nconst Footer: FC<FooterProps> = (props) => {\n const { columns, fixed, children } = props\n\n const { listen, notify } = useHorizontalScrollContext()\n const [scrollbarHeight] = useState(() => getScrollbarSize().height)\n\n const wrapperRef = useRef<HTMLDivElement>(null)\n useEffect(() => {\n const node = wrapperRef.current\n if (node == null) return\n const key = 'virtual-table-summary'\n const onScroll = () => {\n const nextScrollLeft = node.scrollLeft\n notify(key, nextScrollLeft, node)\n }\n const dispose = listen(key, (scrollLeft) => {\n node.scrollLeft = scrollLeft\n })\n node.addEventListener('scroll', onScroll)\n return () => {\n node.removeEventListener('scroll', onScroll)\n dispose()\n }\n }, [listen, notify])\n\n return (\n <div\n className={clsx(\n 'virtual-table-summary-wrapper',\n fixed && 'virtual-table-summary-sticky-bottom virtual-table-summary-top-border',\n )}\n style={{ paddingBottom: scrollbarHeight }}\n ref={wrapperRef}\n >\n <table className=\"virtual-table-summary\">\n <Colgroup columns={columns} />\n <tfoot className=\"virtual-table-summary-tfoot\">{children}</tfoot>\n </table>\n </div>\n )\n}\n\nexport default Footer\n","import type { ColumnType } from '@are-visual/virtual-table'\nimport type { DetailedHTMLProps, HTMLAttributes, Key } from 'react'\nimport { isValidFixed, isValidFixedLeft, isValidFixedRight, useTableSticky } from '@are-visual/virtual-table'\nimport clsx from 'clsx'\nimport { memo, useMemo } from 'react'\n\ntype NativeProps = DetailedHTMLProps<\n HTMLAttributes<HTMLTableCellElement>,\n HTMLTableCellElement\n>\n\nexport interface CellProps extends NativeProps, Pick<ColumnType<unknown>, 'align'> {\n columnKey: Key\n colSpan?: number\n}\n\nfunction Cell(props: CellProps) {\n const {\n className,\n style,\n children,\n align,\n colSpan,\n columnKey,\n ...restProps\n } = props\n\n const { size: stickySizes, fixed: columnsFixed } = useTableSticky()\n\n const stickySize = stickySizes.get(columnKey)\n const fixed = columnsFixed.find((x) => x.key === columnKey)?.fixed\n\n const { left: lastFixedLeftColumnKey, right: firstFixedRightColumnKey } = useMemo(() => {\n const left = columnsFixed.reduce<Key | undefined>((result, x) => {\n if (isValidFixedLeft(x.fixed)) {\n return x.key\n }\n return result\n }, undefined)\n const right = columnsFixed.find((x) => isValidFixedRight(x.fixed))?.key\n return { left, right }\n }, [columnsFixed])\n\n if (colSpan === 0) {\n return null\n }\n\n return (\n <td\n {...restProps}\n colSpan={colSpan}\n className={clsx(\n 'virtual-table-cell virtual-table-summary-cell',\n align != null && `virtual-table-align-${align}`,\n isValidFixed(fixed) && 'virtual-table-sticky-cell',\n lastFixedLeftColumnKey === columnKey && 'virtual-table-cell-fix-left-last',\n firstFixedRightColumnKey === columnKey && 'virtual-table-cell-fix-right-first',\n className,\n )}\n style={{\n ...style,\n left: isValidFixedLeft(fixed) ? stickySize : undefined,\n right: isValidFixedRight(fixed) ? stickySize : undefined,\n }}\n >\n {children}\n </td>\n )\n}\n\nexport default memo(Cell)\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { ColumnType } from '@are-visual/virtual-table'\nimport type { CSSProperties, FC, Key, MouseEvent, ReactNode } from 'react'\nimport { Fragment, useContext } from 'react'\nimport { SummaryContext } from './context/columns'\n\nexport interface SummaryRowProps {\n children?: ReactNode | ((column: ColumnType<any>, key: Key) => ReactNode)\n className?: string\n style?: CSSProperties\n onClick?: (e?: MouseEvent<HTMLElement>) => void\n}\n\nconst SummaryRow: FC<SummaryRowProps> = ({ children, ...props }) => {\n const descriptor = useContext(SummaryContext)\n\n if (typeof children === 'function') {\n if (descriptor != null) {\n return (\n <tr {...props}>\n {descriptor.map((item) => {\n const { key } = item\n if (item.type === 'blank') {\n return <td key={key} />\n }\n const { column } = item\n return <Fragment key={key}>{children(column, key)}</Fragment>\n })}\n </tr>\n )\n } else {\n throw new Error('SummaryRow is missing the columns context and cannot use children as a function.')\n }\n }\n\n return <tr {...props}>{children}</tr>\n}\n\nexport default SummaryRow\n","import type { ReactElement, ReactNode } from 'react'\n\nimport Cell from './cell'\nimport Row from './row'\n\nexport interface SummaryProps {\n fixed?: boolean | 'top' | 'bottom'\n children?: ReactNode\n}\n\nfunction Summary({ children }: SummaryProps) {\n return children as ReactElement\n}\n\nSummary.Row = Row\nSummary.Cell = Cell\n\nexport default Summary\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { MiddlewareContext, MiddlewareRenderHeader, MiddlewareResult } from '@are-visual/virtual-table'\nimport type { ReactNode } from 'react'\nimport type { SummaryProps } from './summary'\nimport { createMiddleware } from '@are-visual/virtual-table'\nimport { isValidElement, useCallback } from 'react'\nimport { SummaryContext } from './context/columns'\nimport Footer from './footer'\nimport Summary from './summary'\n\nexport interface TableSummaryOptions<T = any> {\n summary: (data: readonly T[]) => ReactNode\n}\n\nfunction useTableSummary<T = any>(\n ctx: MiddlewareContext<T>,\n options?: TableSummaryOptions<T>,\n): MiddlewareResult<T> {\n const { summary } = options ?? {}\n const { dataSource } = ctx\n\n const summaryNode = summary?.(dataSource)\n const fixed = isValidElement(summaryNode)\n && summaryNode.type === Summary\n && (summaryNode.props as SummaryProps).fixed\n\n const renderHeader: MiddlewareRenderHeader = useCallback((children, { columnDescriptor }) => {\n return (\n <>\n {children}\n <tfoot className=\"virtual-table-summary-tfoot\">\n <SummaryContext.Provider value={columnDescriptor}>\n {summaryNode}\n </SummaryContext.Provider>\n </tfoot>\n </>\n )\n }, [summaryNode])\n\n if (summary == null) {\n return ctx\n }\n\n if (fixed === 'top') {\n return { ...ctx, renderHeader }\n }\n\n return {\n ...ctx,\n renderContent(children, { columnDescriptor }) {\n return (\n <>\n {children}\n <Footer fixed={fixed === 'bottom' || fixed} columns={columnDescriptor}>\n <SummaryContext.Provider value={columnDescriptor}>\n {summaryNode}\n </SummaryContext.Provider>\n </Footer>\n </>\n )\n },\n }\n}\n\nexport { default as Summary } from './summary'\nexport const tableSummary = createMiddleware(useTableSummary)\n"],"names":["SummaryContext","createContext","Footer","props","columns","fixed","children","listen","notify","useHorizontalScrollContext","scrollbarHeight","useState","getScrollbarSize","height","wrapperRef","useRef","useEffect","node","current","key","onScroll","nextScrollLeft","scrollLeft","dispose","addEventListener","removeEventListener","_jsx","className","clsx","style","paddingBottom","ref","_jsxs","Colgroup","Cell","align","colSpan","columnKey","restProps","size","stickySizes","columnsFixed","useTableSticky","stickySize","get","find","x","left","lastFixedLeftColumnKey","right","firstFixedRightColumnKey","useMemo","reduce","result","isValidFixedLeft","undefined","isValidFixedRight","isValidFixed","memo","SummaryRow","_ref","descriptor","useContext","map","item","type","column","Fragment","Error","Summary","Row","useTableSummary","ctx","options","summary","dataSource","summaryNode","isValidElement","renderHeader","useCallback","columnDescriptor","Provider","value","renderContent","_ref2","_Fragment","tableSummary","createMiddleware"],"mappings":";;;;;;AAGO,MAAMA,cAAc,gBAAGC,aAAa,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4
|
+
}
|
|
5
|
+
.virtual-table-summary-wrapper::-webkit-scrollbar {
|
|
6
|
+
display: none;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.virtual-table-summary-top-border {
|
|
10
|
+
box-shadow: var(--virtual-table-summary-border-color, var(--virtual-table-border-color, #f0f0f0)) 0px -1px 0px 0px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.virtual-table-summary {
|
|
14
|
+
border-spacing: 0;
|
|
15
|
+
table-layout: fixed;
|
|
16
|
+
width: 100%;
|
|
17
|
+
min-width: 100%;
|
|
18
|
+
box-shadow: 0 -1px 0 var(--virtual-table-border-color);
|
|
19
|
+
}
|
|
20
|
+
.virtual-table-summary-sticky-bottom {
|
|
21
|
+
position: sticky;
|
|
22
|
+
bottom: 0;
|
|
23
|
+
left: 0;
|
|
24
|
+
z-index: 2;
|
|
25
|
+
}
|
|
26
|
+
.virtual-table-summary-tfoot {
|
|
27
|
+
background-color: var(--virtual-table-summary-background, #fff);
|
|
28
|
+
}
|
|
29
|
+
.virtual-table-summary-cell {
|
|
30
|
+
background-color: var(--virtual-table-summary-background, #fff);
|
|
31
|
+
border-bottom: 1px solid var(--virtual-table-border-color);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.virtual-table-has-fix-left .virtual-table-summary-cell {
|
|
35
|
+
background-color: var(--virtual-table-summary-background, #fff);
|
|
36
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
$virtual-table-summary-background: var(--virtual-table-summary-background, #fff);
|
|
2
|
+
$virtual-table-summary-border-color: var(--virtual-table-summary-border-color, var(--virtual-table-border-color, #f0f0f0));
|
|
3
|
+
|
|
4
|
+
.virtual-table-summary-wrapper {
|
|
5
|
+
overflow: auto hidden;
|
|
6
|
+
scrollbar-width: none;
|
|
7
|
+
|
|
8
|
+
&::-webkit-scrollbar {
|
|
9
|
+
display: none;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.virtual-table-summary-top-border {
|
|
14
|
+
box-shadow: $virtual-table-summary-border-color 0px -1px 0px 0px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.virtual-table-summary {
|
|
18
|
+
border-spacing: 0;
|
|
19
|
+
table-layout: fixed;
|
|
20
|
+
width: 100%;
|
|
21
|
+
min-width: 100%;
|
|
22
|
+
box-shadow: 0 -1px 0 var(--virtual-table-border-color);
|
|
23
|
+
|
|
24
|
+
&-sticky-bottom {
|
|
25
|
+
position: sticky;
|
|
26
|
+
bottom: 0;
|
|
27
|
+
left: 0;
|
|
28
|
+
z-index: 2;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&-tfoot {
|
|
32
|
+
background-color: $virtual-table-summary-background;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&-cell {
|
|
36
|
+
background-color: $virtual-table-summary-background;
|
|
37
|
+
border-bottom: 1px solid var(--virtual-table-border-color);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.virtual-table-has-fix-left {
|
|
42
|
+
.virtual-table-summary-cell {
|
|
43
|
+
background-color: $virtual-table-summary-background;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** 获取默认的滚动条大小 */
|
|
2
|
+
export function getScrollbarSize() {
|
|
3
|
+
const scrollDiv = document.createElement('div');
|
|
4
|
+
scrollDiv.style.position = 'absolute';
|
|
5
|
+
scrollDiv.style.width = '100px';
|
|
6
|
+
scrollDiv.style.height = '100px';
|
|
7
|
+
scrollDiv.style.overflow = 'scroll';
|
|
8
|
+
scrollDiv.style.top = '-9999px';
|
|
9
|
+
document.body.appendChild(scrollDiv);
|
|
10
|
+
const scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
|
|
11
|
+
const scrollbarHeight = scrollDiv.offsetHeight - scrollDiv.clientHeight;
|
|
12
|
+
document.body.removeChild(scrollDiv);
|
|
13
|
+
return { width: scrollbarWidth, height: scrollbarHeight };
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=getScrollbarSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getScrollbarSize.js","sourceRoot":"","sources":["../../../../packages/virtual-table/src/middleware/utils/getScrollbarSize.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,MAAM,UAAU,gBAAgB;IAC9B,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;IAE/C,SAAS,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAA;IACrC,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG,OAAO,CAAA;IAC/B,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,OAAO,CAAA;IAChC,SAAS,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAA;IACnC,SAAS,CAAC,KAAK,CAAC,GAAG,GAAG,SAAS,CAAA;IAE/B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;IACpC,MAAM,cAAc,GAAG,SAAS,CAAC,WAAW,GAAG,SAAS,CAAC,WAAW,CAAA;IACpE,MAAM,eAAe,GAAG,SAAS,CAAC,YAAY,GAAG,SAAS,CAAC,YAAY,CAAA;IACvE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;IAEpC,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,CAAA;AAC3D,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SetStateAction } from 'react';
|
|
2
|
+
export type Props = Record<string, any>;
|
|
3
|
+
interface UseControllableValueOptions<T> {
|
|
4
|
+
valuePropName?: string;
|
|
5
|
+
defaultValue?: T;
|
|
6
|
+
trigger?: string;
|
|
7
|
+
}
|
|
8
|
+
interface Safe<T> {
|
|
9
|
+
valuePropName?: string;
|
|
10
|
+
defaultValue: T;
|
|
11
|
+
trigger?: string;
|
|
12
|
+
}
|
|
13
|
+
type Trigger<T> = (action: SetStateAction<T>, ...args: unknown[]) => unknown;
|
|
14
|
+
declare function useControllableValue<T = any>(props: Props, options: Safe<T>): [T, Trigger<T>];
|
|
15
|
+
declare function useControllableValue<T = any>(props: Props, options: UseControllableValueOptions<T>): [T | undefined, Trigger<T | undefined>];
|
|
16
|
+
export { useControllableValue };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useCallback, useRef, useState } from 'react';
|
|
2
|
+
function useControllableValue(props, options) {
|
|
3
|
+
const { valuePropName = 'value', defaultValue, trigger = 'onChange' } = options ?? {};
|
|
4
|
+
const isControlled = valuePropName in props;
|
|
5
|
+
const value = props[valuePropName];
|
|
6
|
+
const initialValue = value ?? defaultValue;
|
|
7
|
+
const [state, setState] = useState(initialValue);
|
|
8
|
+
const stateRef = useRef(initialValue);
|
|
9
|
+
if (isControlled) {
|
|
10
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
11
|
+
stateRef.current = value;
|
|
12
|
+
}
|
|
13
|
+
const onChange = props[trigger];
|
|
14
|
+
const updateState = useCallback((action, ...args) => {
|
|
15
|
+
if (typeof action === 'function') {
|
|
16
|
+
onChange?.(action(stateRef.current), ...args);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
onChange?.(action, ...args);
|
|
20
|
+
}
|
|
21
|
+
}, [onChange]);
|
|
22
|
+
if (isControlled) {
|
|
23
|
+
return [value, updateState];
|
|
24
|
+
}
|
|
25
|
+
return [state, setState];
|
|
26
|
+
}
|
|
27
|
+
export { useControllableValue };
|
|
28
|
+
//# sourceMappingURL=useControllableValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useControllableValue.js","sourceRoot":"","sources":["../../../../packages/virtual-table/src/middleware/utils/useControllableValue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAoBrD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virtual-table",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./index.esm.js",
|
|
5
|
+
"types": "./index.d.ts",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"author": "Y-Hui",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"react",
|
|
11
|
+
"virtual",
|
|
12
|
+
"table",
|
|
13
|
+
"list",
|
|
14
|
+
"virtual-table",
|
|
15
|
+
"virtual-list"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/Y-Hui/virtualize.git"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://y-hui.github.io/virtualize",
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"react": ">=16.14.0",
|
|
24
|
+
"react-dom": ">=16.14.0"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"clsx": "^2.1.1"
|
|
28
|
+
},
|
|
29
|
+
"peerDependenciesMeta": {
|
|
30
|
+
"react-resizable": {
|
|
31
|
+
"optional": true
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
package/styles/table.css
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--virtual-table-header-bg: #fafafa;
|
|
3
|
+
--virtual-table-border-color: #f0f0f0;
|
|
4
|
+
--virtual-table-row-hover-bg: #fafafa;
|
|
5
|
+
--virtual-table-font-size: 14px;
|
|
6
|
+
--virtual-table-split-shadow: rgba(5, 5, 5, 0.06);
|
|
7
|
+
--virtual-table-header-split: #c2c2c2;
|
|
8
|
+
--virtual-table-fixed-cell-background: #fff;
|
|
9
|
+
--virtual-table-cell-padding: 8px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
[class^=virtual-table] {
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.virtual-table {
|
|
17
|
+
width: 100%;
|
|
18
|
+
text-align: left;
|
|
19
|
+
font-size: var(--virtual-table-font-size);
|
|
20
|
+
line-height: 1.57142;
|
|
21
|
+
}
|
|
22
|
+
.virtual-table table {
|
|
23
|
+
border-collapse: separate;
|
|
24
|
+
}
|
|
25
|
+
.virtual-table-header {
|
|
26
|
+
overflow: auto hidden;
|
|
27
|
+
scrollbar-width: none;
|
|
28
|
+
}
|
|
29
|
+
.virtual-table-header::-webkit-scrollbar {
|
|
30
|
+
display: none;
|
|
31
|
+
}
|
|
32
|
+
.virtual-table-header > table {
|
|
33
|
+
border-spacing: 0;
|
|
34
|
+
table-layout: fixed;
|
|
35
|
+
width: 100%;
|
|
36
|
+
}
|
|
37
|
+
.virtual-table-header-sticky {
|
|
38
|
+
position: sticky;
|
|
39
|
+
top: 0;
|
|
40
|
+
left: 0;
|
|
41
|
+
z-index: 2;
|
|
42
|
+
background-color: var(--virtual-table-fixed-cell-background);
|
|
43
|
+
}
|
|
44
|
+
.virtual-table-header-cell {
|
|
45
|
+
position: relative;
|
|
46
|
+
padding: var(--virtual-table-cell-padding);
|
|
47
|
+
text-align: start;
|
|
48
|
+
background-color: var(--virtual-table-header-bg);
|
|
49
|
+
border-bottom: 1px solid var(--virtual-table-border-color);
|
|
50
|
+
font-weight: 600;
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
}
|
|
53
|
+
.virtual-table-header-cell:not(:last-child, :first-child.virtual-table-selection-column, :first-child.virtual-table-expand-column, :first-child.virtual-table-expand-column + .virtual-table-selection-column, .no-split)::before {
|
|
54
|
+
position: absolute;
|
|
55
|
+
top: 50%;
|
|
56
|
+
inset-inline-end: 0;
|
|
57
|
+
width: 1px;
|
|
58
|
+
height: 1.2em;
|
|
59
|
+
background-color: var(--virtual-table-header-split);
|
|
60
|
+
transform: translateY(-50%);
|
|
61
|
+
transition: background-color 0.2s;
|
|
62
|
+
content: "";
|
|
63
|
+
}
|
|
64
|
+
.virtual-table-body-wrapper {
|
|
65
|
+
overflow: auto hidden;
|
|
66
|
+
scrollbar-width: none;
|
|
67
|
+
}
|
|
68
|
+
.virtual-table-body-wrapper::-webkit-scrollbar {
|
|
69
|
+
display: none;
|
|
70
|
+
}
|
|
71
|
+
.virtual-table-body {
|
|
72
|
+
table-layout: fixed;
|
|
73
|
+
width: 100%;
|
|
74
|
+
border-spacing: 0;
|
|
75
|
+
}
|
|
76
|
+
.virtual-table-row:not(.no-hover):hover > .virtual-table-cell {
|
|
77
|
+
background-color: var(--virtual-table-row-hover-bg);
|
|
78
|
+
}
|
|
79
|
+
.virtual-table-cell {
|
|
80
|
+
position: relative;
|
|
81
|
+
padding: var(--virtual-table-cell-padding);
|
|
82
|
+
transition: background 0.2s, border-color 0.2s;
|
|
83
|
+
border-bottom: 1px solid var(--virtual-table-border-color);
|
|
84
|
+
overflow-wrap: break-word;
|
|
85
|
+
}
|
|
86
|
+
.virtual-table-sticky-cell {
|
|
87
|
+
position: sticky !important;
|
|
88
|
+
z-index: 1;
|
|
89
|
+
}
|
|
90
|
+
.virtual-table-sticky-cell:not(.virtual-table-header-cell) {
|
|
91
|
+
background-color: var(--virtual-table-fixed-cell-background);
|
|
92
|
+
}
|
|
93
|
+
.virtual-table-cell-fix-left-last::after {
|
|
94
|
+
content: "";
|
|
95
|
+
position: absolute;
|
|
96
|
+
top: 0;
|
|
97
|
+
right: 0;
|
|
98
|
+
bottom: -1px;
|
|
99
|
+
width: 30px;
|
|
100
|
+
transform: translateX(100%);
|
|
101
|
+
transition: box-shadow 0.3s;
|
|
102
|
+
pointer-events: none;
|
|
103
|
+
}
|
|
104
|
+
.virtual-table-cell-fix-right-first::after {
|
|
105
|
+
content: "";
|
|
106
|
+
position: absolute;
|
|
107
|
+
top: 0;
|
|
108
|
+
bottom: -1px;
|
|
109
|
+
left: 0;
|
|
110
|
+
width: 30px;
|
|
111
|
+
transform: translateX(-100%);
|
|
112
|
+
transition: box-shadow 0.3s;
|
|
113
|
+
pointer-events: none;
|
|
114
|
+
}
|
|
115
|
+
.virtual-table-has-fix-left .virtual-table-sticky-cell:not(.virtual-table-header-cell) {
|
|
116
|
+
background-color: var(--virtual-table-fixed-cell-background);
|
|
117
|
+
}
|
|
118
|
+
.virtual-table-has-fix-left .virtual-table-cell-fix-left-last::after {
|
|
119
|
+
box-shadow: inset 10px 0 8px -8px var(--virtual-table-split-shadow);
|
|
120
|
+
}
|
|
121
|
+
.virtual-table-has-fix-left .virtual-table-cell-fix-left-last::before {
|
|
122
|
+
background-color: transparent !important;
|
|
123
|
+
}
|
|
124
|
+
.virtual-table-has-fix-right .virtual-table-cell-fix-right-first::after {
|
|
125
|
+
box-shadow: inset -10px 0 8px -8px var(--virtual-table-split-shadow);
|
|
126
|
+
}
|
|
127
|
+
.virtual-table-has-fix-right .virtual-table-cell-fix-right-first::after {
|
|
128
|
+
background-color: transparent;
|
|
129
|
+
}
|
|
130
|
+
.virtual-table-align-right {
|
|
131
|
+
text-align: end;
|
|
132
|
+
}
|
|
133
|
+
.virtual-table-align-center {
|
|
134
|
+
text-align: center;
|
|
135
|
+
}
|
|
136
|
+
.virtual-table-bordered .virtual-table-cell,
|
|
137
|
+
.virtual-table-bordered .virtual-table-header-cell {
|
|
138
|
+
border-inline-end: 1px solid var(--virtual-table-border-color);
|
|
139
|
+
}
|
|
140
|
+
.virtual-table-bordered .virtual-table-header-cell::before {
|
|
141
|
+
background-color: transparent !important;
|
|
142
|
+
}
|