@@ -30,7 +30,7 @@ const univerPresetsSheets = import("@univerjs/presets/preset-sheets-core");
30
30
const univerPresetsSheetsLocale = import (
31
31
"@univerjs/presets/preset-sheets-core/locales/en-US"
32
32
) ;
33
- const zod = import ( "zod" ) ;
33
+ const zod = import ( "zod/v4-mini " ) ;
34
34
35
35
const NUMBER_CELL_TYPE : typeof CellValueType . NUMBER = 2 ;
36
36
const DEBUG = window ?. location ?. search ?. includes ( "_debug_spreadsheet" ) ;
@@ -299,33 +299,35 @@ function handleSetRangeValues(
299
299
}
300
300
}
301
301
302
- type Zod = typeof import ( "zod" ) ;
302
+ import type * as ZodNS from "zod/v4-mini" ;
303
+ type Zod = typeof ZodNS . z ;
303
304
304
305
const PropsSchema = ( z : Zod ) =>
305
306
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 ) ,
313
314
} ) ;
314
315
315
- type Props = Zod . infer < ReturnType < typeof PropsSchema > > ;
316
+ type Props = ZodNS . infer < ReturnType < typeof PropsSchema > > ;
316
317
317
318
const CellPropsSchema = ( z : Zod ) => z . union ( [ z . string ( ) , z . number ( ) ] ) ;
318
319
319
320
const 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 ( ) ) ,
324
325
z . union ( [ z . string ( ) , z . number ( ) , z . null ( ) ] ) ,
325
- ] )
326
- . rest ( CellPropsSchema ( z ) ) ;
326
+ ] ,
327
+ CellPropsSchema ( z ) ,
328
+ ) ;
327
329
328
- type CellProps = Zod . infer < ReturnType < typeof CellPropsSchema > > ;
330
+ type CellProps = ZodNS . infer < ReturnType < typeof CellPropsSchema > > ;
329
331
330
332
export async function renderSpreadsheetToElement ( element : HTMLElement ) {
331
333
try {
0 commit comments