@extend-ai/react-xlsx 0.14.0 → 0.14.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 CHANGED
@@ -360,6 +360,31 @@ export function CustomWorkbook({ file }: { file: ArrayBuffer }) {
360
360
 
361
361
  Apply `triggerProps` to the table-header trigger button so clicks do not leak into grid selection.
362
362
 
363
+ Use `renderFormControl` to replace the built-in worksheet widgets. The callback receives the parsed `control`, resolved `items` and `label`, calculated `style`, read-only state, and `activate`, `setState`, `setSelected`, and `setValue` helpers. Apply `style` to the custom root and call `stopPropagation` from pointer/click handlers. The helpers keep Duke mutations, linked cells, undo/redo, export, and `onFormControlChange` in sync.
364
+
365
+ ```tsx
366
+ <XlsxViewer
367
+ file={file}
368
+ renderFormControl={({ checked, control, disabled, label, setState, stopPropagation, style }) => {
369
+ if (control.kind === "checkbox" || control.kind === "radio") {
370
+ return (
371
+ <label onPointerDown={stopPropagation} style={style}>
372
+ <input
373
+ checked={checked}
374
+ disabled={disabled}
375
+ onChange={(event) => setState(event.currentTarget.checked ? "checked" : "unchecked")}
376
+ type={control.kind === "radio" ? "radio" : "checkbox"}
377
+ />
378
+ {label}
379
+ </label>
380
+ );
381
+ }
382
+
383
+ return <div style={style}>{label}</div>;
384
+ }}
385
+ />
386
+ ```
387
+
363
388
  ## Large Files
364
389
 
365
390
  `XlsxViewer` includes guardrails for large workbooks.
@@ -437,6 +462,7 @@ Common rendering props:
437
462
  - `renderImage?: (props: XlsxImageRenderProps) => React.ReactNode`
438
463
  - `renderImageSelection?: (props: XlsxImageSelectionRenderProps) => React.ReactNode`
439
464
  - `renderChartLoading?: (props: XlsxChartLoadingRenderProps) => React.ReactNode`
465
+ - `renderFormControl?: (props: XlsxFormControlRenderProps) => React.ReactNode`
440
466
  - `renderTableHeaderMenu?: (props: XlsxTableHeaderMenuRenderProps) => React.ReactNode`
441
467
  - `renderScroller?: (props: XlsxScrollerRenderProps) => React.ReactNode`
442
468
 
@@ -607,6 +633,7 @@ The package exports the main types you are likely to use for custom integrations
607
633
  - `XlsxChart`, `XlsxChartSeries`, `XlsxChartAxis`, `XlsxChartElementSelection`, `XlsxChartsheet`
608
634
  - `XlsxFormulaTarget`
609
635
  - `XlsxImage`, `XlsxImageRect`, `XlsxImageRenderProps`, `XlsxImageSelectionRenderProps`
636
+ - `XlsxFormControl`, `XlsxFormControlRenderProps`
610
637
  - `XlsxTable`, `XlsxTableColumn`, `XlsxTableHeaderMenuRenderProps`
611
638
  - `XlsxWorkbookTab`, `XlsxCellAddress`, `XlsxCellRange`
612
639