1
1
import * as React from "react" ;
2
2
import { Story , Meta } from "@storybook/react/types-6-0" ;
3
- import { createEmptyMatrix , Spreadsheet , Props , CellBase } from ".." ;
3
+ import {
4
+ createEmptyMatrix ,
5
+ Spreadsheet ,
6
+ Props ,
7
+ CellBase ,
8
+ createColorScaleDataViewer ,
9
+ } from ".." ;
4
10
import * as Matrix from "../matrix" ;
5
11
import { AsyncCellDataEditor , AsyncCellDataViewer } from "./AsyncCellData" ;
6
12
import CustomCell from "./CustomCell" ;
7
13
import { RangeEdit , RangeView } from "./RangeDataComponents" ;
8
14
import { SelectEdit , SelectView } from "./SelectDataComponents" ;
9
15
import { CustomCornerIndicator } from "./CustomCornerIndicator" ;
10
- import createColorScaleDataViewer from "../ColorScaleDataViewer" ;
11
16
12
17
type StringCell = CellBase < string | undefined > ;
13
18
type NumberCell = CellBase < number | undefined > ;
@@ -145,9 +150,7 @@ export const WithCornerIndicator: Story<Props<StringCell>> = (props) => (
145
150
) ;
146
151
147
152
export const Filter : Story < Props < StringCell > > = ( props ) => {
148
- const [ data , setData ] = React . useState (
149
- EMPTY_DATA as Matrix . Matrix < StringCell >
150
- ) ;
153
+ const [ data , setData ] = React . useState ( EMPTY_DATA ) ;
151
154
const [ filter , setFilter ] = React . useState ( "" ) ;
152
155
153
156
const handleFilterChange = React . useCallback (
@@ -166,7 +169,7 @@ export const Filter: Story<Props<StringCell>> = (props) => {
166
169
if ( filter . length === 0 ) {
167
170
return data ;
168
171
}
169
- const filtered : Matrix . Matrix < StringCell > = [ ] ;
172
+ const filtered = createEmptyMatrix < StringCell > ( 0 , 0 ) ;
170
173
for ( let row = 0 ; row < data . length ; row ++ ) {
171
174
if ( data . length !== 0 ) {
172
175
for ( let column = 0 ; column < data [ 0 ] . length ; column ++ ) {
0 commit comments