@@ -30,7 +30,7 @@ const univerPresetsSheets = import("@univerjs/presets/preset-sheets-core");
3030const univerPresetsSheetsLocale = import (
3131 "@univerjs/presets/preset-sheets-core/locales/en-US"
3232) ;
33- const zod = import ( "zod" ) ;
33+ const zod = import ( "zod/v4-mini " ) ;
3434
3535const NUMBER_CELL_TYPE : typeof CellValueType . NUMBER = 2 ;
3636const DEBUG = window ?. location ?. search ?. includes ( "_debug_spreadsheet" ) ;
@@ -299,33 +299,35 @@ function handleSetRangeValues(
299299 }
300300}
301301
302- type Zod = typeof import ( "zod" ) ;
302+ import type * as ZodNS from "zod/v4-mini" ;
303+ type Zod = typeof ZodNS . z ;
303304
304305const PropsSchema = ( z : Zod ) =>
305306 z . object ( {
306- update_link : z . string ( ) . optional ( ) ,
307- sheet_name : z . string ( ) . default ( "SQLPage Data" ) ,
308- freeze_x : z . number ( ) . int ( ) . nonnegative ( ) . default ( 0 ) ,
309- freeze_y : z . number ( ) . int ( ) . nonnegative ( ) . default ( 0 ) ,
310- column_width : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
311- row_height : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
312- show_grid : z . boolean ( ) . default ( true ) ,
307+ update_link : z . optional ( z . string ( ) ) ,
308+ sheet_name : z . _default ( z . string ( ) , "SQLPage Data" ) ,
309+ freeze_x : z . _default ( z . number ( ) . check ( z . int ( ) , z . nonnegative ( ) ) , 0 ) ,
310+ freeze_y : z . _default ( z . number ( ) . check ( z . int ( ) , z . nonnegative ( ) ) , 0 ) ,
311+ column_width : z . _default ( z . number ( ) . check ( z . int ( ) , z . nonnegative ( ) ) , 100 ) ,
312+ row_height : z . _default ( z . number ( ) . check ( z . int ( ) , z . nonnegative ( ) ) , 20 ) ,
313+ show_grid : z . _default ( z . boolean ( ) , true ) ,
313314 } ) ;
314315
315- type Props = Zod . infer < ReturnType < typeof PropsSchema > > ;
316+ type Props = ZodNS . infer < ReturnType < typeof PropsSchema > > ;
316317
317318const CellPropsSchema = ( z : Zod ) => z . union ( [ z . string ( ) , z . number ( ) ] ) ;
318319
319320const DataArraySchema = ( z : Zod ) =>
320- z
321- . tuple ( [
322- z . number ( ) . int ( ) . nonnegative ( ) ,
323- z . number ( ) . int ( ) . nonnegative ( ) ,
321+ z . tuple (
322+ [
323+ z . number ( ) . check ( z . int ( ) , z . nonnegative ( ) ) ,
324+ z . number ( ) . check ( z . int ( ) , z . nonnegative ( ) ) ,
324325 z . union ( [ z . string ( ) , z . number ( ) , z . null ( ) ] ) ,
325- ] )
326- . rest ( CellPropsSchema ( z ) ) ;
326+ ] ,
327+ CellPropsSchema ( z ) ,
328+ ) ;
327329
328- type CellProps = Zod . infer < ReturnType < typeof CellPropsSchema > > ;
330+ type CellProps = ZodNS . infer < ReturnType < typeof CellPropsSchema > > ;
329331
330332export async function renderSpreadsheetToElement ( element : HTMLElement ) {
331333 try {
0 commit comments