@updog/data-editor-wc 0.1.80 → 0.1.82
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/THIRD_PARTY_NOTICES.txt +18 -14
- package/index.css +1 -1
- package/index.d.ts +112 -131
- package/index.js +18466 -18186
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -446,24 +446,6 @@ declare var export_default = {
|
|
|
446
446
|
text: "Your subscription is no longer active. Please renew to continue.",
|
|
447
447
|
},
|
|
448
448
|
},
|
|
449
|
-
scale: {
|
|
450
|
-
bootstrap_failed: {
|
|
451
|
-
title: "Couldn't connect to the server",
|
|
452
|
-
text: "The server returned an error. Please refresh the page or contact support.",
|
|
453
|
-
},
|
|
454
|
-
workspace_lost: {
|
|
455
|
-
title: "Connection lost",
|
|
456
|
-
text: "The session ended unexpectedly. Refresh the page to reconnect.",
|
|
457
|
-
},
|
|
458
|
-
unreachable: {
|
|
459
|
-
title: "Server unreachable",
|
|
460
|
-
text: "Check your connection and refresh the page.",
|
|
461
|
-
},
|
|
462
|
-
server_error: {
|
|
463
|
-
title: "Server error",
|
|
464
|
-
text: "The server returned an error. Please refresh the page or contact support.",
|
|
465
|
-
},
|
|
466
|
-
},
|
|
467
449
|
},
|
|
468
450
|
uploader: {
|
|
469
451
|
steps: {
|
|
@@ -638,98 +620,6 @@ type DataEditorTranslations = DeepPartial<ExpandPluralKeys<typeof export_default
|
|
|
638
620
|
*/
|
|
639
621
|
type DataEditorRow = Record<string, unknown>;
|
|
640
622
|
|
|
641
|
-
/**
|
|
642
|
-
* A built-in declarative validator. Mode-symmetric: the SDK ships a TS
|
|
643
|
-
* interpreter, the Updog Scale Go binary ships a Go interpreter, and both
|
|
644
|
-
* agree on pass/fail outcomes per `api/validators.json`.
|
|
645
|
-
*/
|
|
646
|
-
type BuiltInValidator = {
|
|
647
|
-
type: "required";
|
|
648
|
-
message?: string;
|
|
649
|
-
} | {
|
|
650
|
-
type: "regex";
|
|
651
|
-
pattern: string;
|
|
652
|
-
flags?: string;
|
|
653
|
-
message?: string;
|
|
654
|
-
} | {
|
|
655
|
-
type: "oneOf";
|
|
656
|
-
values: string[];
|
|
657
|
-
message?: string;
|
|
658
|
-
} | {
|
|
659
|
-
type: "range";
|
|
660
|
-
min?: number;
|
|
661
|
-
max?: number;
|
|
662
|
-
message?: string;
|
|
663
|
-
} | {
|
|
664
|
-
type: "email";
|
|
665
|
-
message?: string;
|
|
666
|
-
} | {
|
|
667
|
-
type: "date";
|
|
668
|
-
format?: "YYYY-MM-DD" | "DD/MM/YYYY";
|
|
669
|
-
message?: string;
|
|
670
|
-
} | {
|
|
671
|
-
type: "numeric";
|
|
672
|
-
message?: string;
|
|
673
|
-
} | {
|
|
674
|
-
type: "unique";
|
|
675
|
-
message?: string;
|
|
676
|
-
fn?: UniqueRemoteFn;
|
|
677
|
-
};
|
|
678
|
-
/** One cell in an asyncFunction batch. Row is passed by reference. */
|
|
679
|
-
type AsyncValidatorCell = {
|
|
680
|
-
/** Value of the validated column for this cell. */
|
|
681
|
-
value: unknown;
|
|
682
|
-
/** The full row — for row-dependent checks. */
|
|
683
|
-
row: DataEditorRow;
|
|
684
|
-
};
|
|
685
|
-
/**
|
|
686
|
-
* Remote existence check for `{ type: "unique" }`. Called once per sweep
|
|
687
|
-
* with all distinct candidate values; report the subset that already exists —
|
|
688
|
-
* return it and/or stream it via onChunk (results are unioned). `signal`
|
|
689
|
-
* fires only when results can no longer be used. Client-mode only.
|
|
690
|
-
*/
|
|
691
|
-
type UniqueRemoteFn = (values: unknown[], onChunk: (existing: unknown[]) => void, signal: AbortSignal) => Promise<unknown[] | void>;
|
|
692
|
-
type AsyncFunctionValidator = {
|
|
693
|
-
type: "asyncFunction";
|
|
694
|
-
/**
|
|
695
|
-
* Called once per column per operation with every affected cell. Report
|
|
696
|
-
* failures by `index` into `cells`: return an array aligned with the input
|
|
697
|
-
* (null = valid) and/or stream sparse failures via onChunk (unioned, any
|
|
698
|
-
* order). `signal` fires only when results can no longer be used.
|
|
699
|
-
* Client-mode only. For uniqueness use `unique.fn`, not this.
|
|
700
|
-
*/
|
|
701
|
-
fn: (cells: AsyncValidatorCell[], onChunk: (failures: {
|
|
702
|
-
index: number;
|
|
703
|
-
error: ValidationError;
|
|
704
|
-
}[]) => void, signal: AbortSignal) => Promise<(ValidationError | null)[] | void>;
|
|
705
|
-
};
|
|
706
|
-
/**
|
|
707
|
-
* Server-mode-only escape hatch: an expression evaluated by the Go binary
|
|
708
|
-
* via expr-lang. Skipped at runtime in client mode (warned at mount).
|
|
709
|
-
*/
|
|
710
|
-
type ExpressionValidator = {
|
|
711
|
-
type: "expression";
|
|
712
|
-
expr: string;
|
|
713
|
-
message?: string;
|
|
714
|
-
};
|
|
715
|
-
/**
|
|
716
|
-
* Client-mode-only escape hatch: a JS predicate run inline. Dropped (with
|
|
717
|
-
* one warn per column) when the SDK serializes the schema for server mode.
|
|
718
|
-
*/
|
|
719
|
-
type FunctionValidator = {
|
|
720
|
-
type: "function";
|
|
721
|
-
fn: CellValidator;
|
|
722
|
-
};
|
|
723
|
-
/**
|
|
724
|
-
* The validator-rule union accepted by `DataEditorColumn.validators`.
|
|
725
|
-
* - Built-ins and `expression` are declarative objects (cross the wire).
|
|
726
|
-
* - `function` wraps a `CellValidator`; client-mode-only, dropped+warned in server mode.
|
|
727
|
-
*
|
|
728
|
-
* Named `ValidatorRule` (not `Validator`) so it doesn't clash with the
|
|
729
|
-
* runtime `Validator` class in `core/Validator.ts`.
|
|
730
|
-
*/
|
|
731
|
-
type ValidatorRule = BuiltInValidator | ExpressionValidator | FunctionValidator | AsyncFunctionValidator;
|
|
732
|
-
|
|
733
623
|
/**
|
|
734
624
|
* Severity level for a validation message.
|
|
735
625
|
* - `"error"` — a validation failure: marks the row invalid, counts as an error.
|
|
@@ -873,10 +763,8 @@ type DataEditorColumn = {
|
|
|
873
763
|
/**
|
|
874
764
|
* One or more validators run on every edit. Accepts:
|
|
875
765
|
* - Built-in object literals: `{ type: "required" | "email" | "regex" | "range" | "oneOf" | "date" | "numeric" | "unique", ... }`.
|
|
876
|
-
* - `{ type: "
|
|
877
|
-
* - `{ type: "
|
|
878
|
-
*
|
|
879
|
-
* See `_specs/VALIDATIONS.md` §4.5 for the per-mode support matrix.
|
|
766
|
+
* - `{ type: "function", fn }` — a JS predicate run inline.
|
|
767
|
+
* - `{ type: "asyncFunction", fn }` — batched remote checks.
|
|
880
768
|
*/
|
|
881
769
|
validators?: ValidatorRule[];
|
|
882
770
|
/**
|
|
@@ -913,6 +801,85 @@ type DataEditorColumn = {
|
|
|
913
801
|
locked?: boolean | ColumnLockMode;
|
|
914
802
|
};
|
|
915
803
|
|
|
804
|
+
/**
|
|
805
|
+
* A built-in declarative validator — a declarative object the SDK interprets,
|
|
806
|
+
* per `api/validators.json`.
|
|
807
|
+
*/
|
|
808
|
+
type BuiltInValidator = {
|
|
809
|
+
type: "required";
|
|
810
|
+
message?: string;
|
|
811
|
+
} | {
|
|
812
|
+
type: "regex";
|
|
813
|
+
pattern: string;
|
|
814
|
+
flags?: string;
|
|
815
|
+
message?: string;
|
|
816
|
+
} | {
|
|
817
|
+
type: "oneOf";
|
|
818
|
+
values: string[];
|
|
819
|
+
message?: string;
|
|
820
|
+
} | {
|
|
821
|
+
type: "range";
|
|
822
|
+
min?: number;
|
|
823
|
+
max?: number;
|
|
824
|
+
message?: string;
|
|
825
|
+
} | {
|
|
826
|
+
type: "email";
|
|
827
|
+
message?: string;
|
|
828
|
+
} | {
|
|
829
|
+
type: "date";
|
|
830
|
+
format?: "YYYY-MM-DD" | "DD/MM/YYYY";
|
|
831
|
+
message?: string;
|
|
832
|
+
} | {
|
|
833
|
+
type: "numeric";
|
|
834
|
+
message?: string;
|
|
835
|
+
} | {
|
|
836
|
+
type: "unique";
|
|
837
|
+
message?: string;
|
|
838
|
+
fn?: UniqueRemoteFn;
|
|
839
|
+
};
|
|
840
|
+
/** One cell in an asyncFunction batch. Row is passed by reference. */
|
|
841
|
+
type AsyncValidatorCell = {
|
|
842
|
+
/** Value of the validated column for this cell. */
|
|
843
|
+
value: unknown;
|
|
844
|
+
/** The full row — for row-dependent checks. */
|
|
845
|
+
row: DataEditorRow;
|
|
846
|
+
};
|
|
847
|
+
/**
|
|
848
|
+
* Remote existence check for `{ type: "unique" }`. Called once per sweep
|
|
849
|
+
* with all distinct candidate values; report the subset that already exists —
|
|
850
|
+
* return it and/or stream it via onChunk (results are unioned). `signal`
|
|
851
|
+
* fires only when results can no longer be used. Client-mode only.
|
|
852
|
+
*/
|
|
853
|
+
type UniqueRemoteFn = (values: unknown[], onChunk: (existing: unknown[]) => void, signal: AbortSignal) => Promise<unknown[] | void>;
|
|
854
|
+
type AsyncFunctionValidator = {
|
|
855
|
+
type: "asyncFunction";
|
|
856
|
+
/**
|
|
857
|
+
* Called once per column per operation with every affected cell. Report
|
|
858
|
+
* failures by `index` into `cells`: return an array aligned with the input
|
|
859
|
+
* (null = valid) and/or stream sparse failures via onChunk (unioned, any
|
|
860
|
+
* order). `signal` fires only when results can no longer be used.
|
|
861
|
+
* Client-mode only. For uniqueness use `unique.fn`, not this.
|
|
862
|
+
*/
|
|
863
|
+
fn: (cells: AsyncValidatorCell[], onChunk: (failures: {
|
|
864
|
+
index: number;
|
|
865
|
+
error: ValidationError;
|
|
866
|
+
}[]) => void, signal: AbortSignal) => Promise<(ValidationError | null)[] | void>;
|
|
867
|
+
};
|
|
868
|
+
/**
|
|
869
|
+
* Escape hatch: a JS predicate run inline against the cell value and its row.
|
|
870
|
+
*/
|
|
871
|
+
type FunctionValidator = {
|
|
872
|
+
type: "function";
|
|
873
|
+
fn: CellValidator;
|
|
874
|
+
};
|
|
875
|
+
/**
|
|
876
|
+
* The validator-rule union accepted by `DataEditorColumn.validators`.
|
|
877
|
+
*
|
|
878
|
+
* Named `ValidatorRule` (not `Validator`) so it doesn't clash with the
|
|
879
|
+
* runtime `Validator` class in `core/Validator.ts`.
|
|
880
|
+
*/
|
|
881
|
+
type ValidatorRule = BuiltInValidator | FunctionValidator | AsyncFunctionValidator;
|
|
882
|
+
|
|
916
883
|
/**
|
|
917
884
|
* A single operation the LLM wants to apply to rows in the current filtered view.
|
|
918
885
|
*
|
|
@@ -1053,12 +1020,10 @@ type DataEditorChat<TRow extends DataEditorRow = DataEditorRow> = {
|
|
|
1053
1020
|
|
|
1054
1021
|
/**
|
|
1055
1022
|
* Categories of internal errors surfaced through the `onError` callback.
|
|
1056
|
-
*
|
|
1057
|
-
*
|
|
1058
|
-
* server-mode (Updog Scale) failures. `license.*` codes cover license
|
|
1059
|
-
* validation failures (previously a separate `LicenseErrorCode` enum).
|
|
1023
|
+
* `license.*` codes cover license validation failures (previously a separate
|
|
1024
|
+
* `LicenseErrorCode` enum).
|
|
1060
1025
|
*/
|
|
1061
|
-
type UpdogErrorCode = "PARSE_ERROR" | "RENDER_ERROR" | "TRANSFORM_ERROR" | "VALIDATION_ERROR" | "WORKER_ERROR" | "COMMAND_ERROR" | "OPERATION_ERROR" | "license.invalid" | "license.missing" | "license.domain_not_allowed" | "license.subscription_inactive" | "license.trial_expired"
|
|
1026
|
+
type UpdogErrorCode = "PARSE_ERROR" | "RENDER_ERROR" | "TRANSFORM_ERROR" | "VALIDATION_ERROR" | "WORKER_ERROR" | "COMMAND_ERROR" | "OPERATION_ERROR" | "license.invalid" | "license.missing" | "license.domain_not_allowed" | "license.subscription_inactive" | "license.trial_expired";
|
|
1062
1027
|
/**
|
|
1063
1028
|
* An internal error caught by the SDK and passed to `onError`. The SDK
|
|
1064
1029
|
* recovers gracefully where possible — `onError` is for your logging and
|
|
@@ -1084,10 +1049,6 @@ type UpdogError = {
|
|
|
1084
1049
|
originalError?: unknown;
|
|
1085
1050
|
};
|
|
1086
1051
|
|
|
1087
|
-
type ScaleServerConfig = {
|
|
1088
|
-
url: string;
|
|
1089
|
-
};
|
|
1090
|
-
|
|
1091
1052
|
/**
|
|
1092
1053
|
* A single row in the submit result, with orthogonal flags describing its state.
|
|
1093
1054
|
*
|
|
@@ -1305,10 +1266,24 @@ type CustomImportFormat = {
|
|
|
1305
1266
|
* Returns rows, named tables, or a `File` in a format the SDK already reads.
|
|
1306
1267
|
* Throw to fail the import; the thrown message is shown to the user.
|
|
1307
1268
|
*/
|
|
1308
|
-
handle:
|
|
1309
|
-
signal: AbortSignal;
|
|
1310
|
-
}) => Promise<File | Record<string, unknown>[] | CustomImportTable[]>;
|
|
1269
|
+
handle: FileHandler;
|
|
1311
1270
|
};
|
|
1271
|
+
/**
|
|
1272
|
+
* What client code may hand back for a file the SDK will not read itself: rows,
|
|
1273
|
+
* named tables, or a `File` in a format the SDK already reads.
|
|
1274
|
+
*/
|
|
1275
|
+
type FileHandlerResult = File | Record<string, unknown>[] | CustomImportTable[];
|
|
1276
|
+
/** Claims a file by extension and turns it into tables the SDK can stage. */
|
|
1277
|
+
type FileHandler = (file: File, ctx: {
|
|
1278
|
+
signal: AbortSignal;
|
|
1279
|
+
}) => Promise<FileHandlerResult>;
|
|
1280
|
+
/**
|
|
1281
|
+
* Takes over a readable file that holds no single table. `null` declines the
|
|
1282
|
+
* file, leaving it to be staged the ordinary way.
|
|
1283
|
+
*/
|
|
1284
|
+
type UnstructuredFileHandler = (file: File, ctx: {
|
|
1285
|
+
signal: AbortSignal;
|
|
1286
|
+
}) => Promise<FileHandlerResult | null>;
|
|
1312
1287
|
/**
|
|
1313
1288
|
* Controls the initial view when the editor opens.
|
|
1314
1289
|
*
|
|
@@ -1429,6 +1404,17 @@ type DataEditorBaseProps<TRow extends DataEditorRow = DataEditorRow> = {
|
|
|
1429
1404
|
* the file and stages whatever `handle()` returns.
|
|
1430
1405
|
*/
|
|
1431
1406
|
customFormats?: CustomImportFormat[];
|
|
1407
|
+
/**
|
|
1408
|
+
* Called when a file the SDK can read turns out to hold no single table —
|
|
1409
|
+
* a report with a banner, several tables on one sheet, a sheet that is really
|
|
1410
|
+
* a document. You get the `File` and return tables, exactly as a
|
|
1411
|
+
* `customFormats` handler does.
|
|
1412
|
+
*
|
|
1413
|
+
* Return `null`, throw, or take longer than 30 seconds and the file is staged
|
|
1414
|
+
* the ordinary way, as if this prop were absent. Nothing about the file
|
|
1415
|
+
* reaches Updog.
|
|
1416
|
+
*/
|
|
1417
|
+
onUnstructuredFile?: UnstructuredFileHandler;
|
|
1432
1418
|
/**
|
|
1433
1419
|
* Which file formats the user can export to. `undefined` allows all
|
|
1434
1420
|
* formats, `false` disables export entirely.
|
|
@@ -1539,11 +1525,6 @@ type DataEditorMode = "modal" | "inline";
|
|
|
1539
1525
|
type DataEditorCommonProps<TRow extends DataEditorRow = DataEditorRow> = DataEditorBaseProps<TRow> & {
|
|
1540
1526
|
/** Your Updog license key. Validated on each open. */
|
|
1541
1527
|
apiKey: string;
|
|
1542
|
-
/**
|
|
1543
|
-
* @internal
|
|
1544
|
-
* Reserved for future server-delegated mode. Not part of the public API.
|
|
1545
|
-
*/
|
|
1546
|
-
__server?: ScaleServerConfig;
|
|
1547
1528
|
/**
|
|
1548
1529
|
* Controls what the editor stores in `localStorage`. Set to `false` to
|
|
1549
1530
|
* disable all local storage usage.
|