@updog/data-editor-wc 0.1.80 → 0.1.81

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.
Files changed (4) hide show
  1. package/index.css +1 -1
  2. package/index.d.ts +28 -3
  3. package/index.js +16047 -15606
  4. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1305,10 +1305,24 @@ type CustomImportFormat = {
1305
1305
  * Returns rows, named tables, or a `File` in a format the SDK already reads.
1306
1306
  * Throw to fail the import; the thrown message is shown to the user.
1307
1307
  */
1308
- handle: (file: File, ctx: {
1309
- signal: AbortSignal;
1310
- }) => Promise<File | Record<string, unknown>[] | CustomImportTable[]>;
1308
+ handle: FileHandler;
1311
1309
  };
1310
+ /**
1311
+ * What client code may hand back for a file the SDK will not read itself: rows,
1312
+ * named tables, or a `File` in a format the SDK already reads.
1313
+ */
1314
+ type FileHandlerResult = File | Record<string, unknown>[] | CustomImportTable[];
1315
+ /** Claims a file by extension and turns it into tables the SDK can stage. */
1316
+ type FileHandler = (file: File, ctx: {
1317
+ signal: AbortSignal;
1318
+ }) => Promise<FileHandlerResult>;
1319
+ /**
1320
+ * Takes over a readable file that holds no single table. `null` declines the
1321
+ * file, leaving it to be staged the ordinary way.
1322
+ */
1323
+ type UnstructuredFileHandler = (file: File, ctx: {
1324
+ signal: AbortSignal;
1325
+ }) => Promise<FileHandlerResult | null>;
1312
1326
  /**
1313
1327
  * Controls the initial view when the editor opens.
1314
1328
  *
@@ -1429,6 +1443,17 @@ type DataEditorBaseProps<TRow extends DataEditorRow = DataEditorRow> = {
1429
1443
  * the file and stages whatever `handle()` returns.
1430
1444
  */
1431
1445
  customFormats?: CustomImportFormat[];
1446
+ /**
1447
+ * Called when a file the SDK can read turns out to hold no single table —
1448
+ * a report with a banner, several tables on one sheet, a sheet that is really
1449
+ * a document. You get the `File` and return tables, exactly as a
1450
+ * `customFormats` handler does.
1451
+ *
1452
+ * Return `null`, throw, or take longer than 30 seconds and the file is staged
1453
+ * the ordinary way, as if this prop were absent. Nothing about the file
1454
+ * reaches Updog.
1455
+ */
1456
+ onUnstructuredFile?: UnstructuredFileHandler;
1432
1457
  /**
1433
1458
  * Which file formats the user can export to. `undefined` allows all
1434
1459
  * formats, `false` disables export entirely.