@updog/data-editor-wc 0.1.79 → 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 +31 -3
  3. package/index.js +7252 -6726
  4. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -527,6 +527,9 @@ declare var export_default = {
527
527
  editColumnTitle: "Edit column",
528
528
  createColumnWarning: "A matching column already exists",
529
529
  newColumnTag: "New",
530
+ sampleValues: "Example values",
531
+ sampleValuesEmpty: "No values in this column",
532
+ showSampleValues: "Show example values from {{column}}",
530
533
  unmatchedWarning:
531
534
  "Unmatched columns won't be imported. Match this column to keep the data. You can transform columns after importing.",
532
535
  },
@@ -1302,10 +1305,24 @@ type CustomImportFormat = {
1302
1305
  * Returns rows, named tables, or a `File` in a format the SDK already reads.
1303
1306
  * Throw to fail the import; the thrown message is shown to the user.
1304
1307
  */
1305
- handle: (file: File, ctx: {
1306
- signal: AbortSignal;
1307
- }) => Promise<File | Record<string, unknown>[] | CustomImportTable[]>;
1308
+ handle: FileHandler;
1308
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>;
1309
1326
  /**
1310
1327
  * Controls the initial view when the editor opens.
1311
1328
  *
@@ -1426,6 +1443,17 @@ type DataEditorBaseProps<TRow extends DataEditorRow = DataEditorRow> = {
1426
1443
  * the file and stages whatever `handle()` returns.
1427
1444
  */
1428
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;
1429
1457
  /**
1430
1458
  * Which file formats the user can export to. `undefined` allows all
1431
1459
  * formats, `false` disables export entirely.