@updog/data-editor 0.1.37 → 0.1.39

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/index.d.ts CHANGED
@@ -217,6 +217,7 @@ declare var export_default = {
217
217
  formula: "Formula",
218
218
  lockedCannotFormula: "Can't apply a formula to a locked column",
219
219
  revertChanges: "Revert changes",
220
+ markAsCorrect: "Mark as correct",
220
221
  },
221
222
  formulaModal: {
222
223
  title: "Apply formula",
@@ -354,6 +355,7 @@ declare var export_default = {
354
355
  editedRows: "Changed rows",
355
356
  newRows: "New rows",
356
357
  rowsWithEmptyCells: "Rows with empty cells",
358
+ rowsWithMisplacedValues: "Rows with misplaced values",
357
359
  deletedRows: "Deleted rows",
358
360
  previousOccurrence: "Previous occurrence",
359
361
  nextOccurrence: "Next occurrence",
@@ -381,6 +383,7 @@ declare var export_default = {
381
383
  invalidOption: "Invalid option",
382
384
  outOfRange: "Out of range",
383
385
  required: "This field is required",
386
+ structuralMismatch: "This might be in the wrong column.",
384
387
  valueMustBeUnique: "Value must be unique",
385
388
  },
386
389
  license: {
@@ -447,7 +450,11 @@ declare var export_default = {
447
450
  clickToUpload: "Click to upload",
448
451
  orDragAndDrop: "or drag and drop",
449
452
  formats: "CSV, TSV, XLSX, JSON, XML",
453
+ csvWarning_one: "{{count}} row had formatting issues (row {{rows}})",
454
+ csvWarning_other:
455
+ "{{count}} rows had formatting issues (rows {{rows}})",
450
456
  downloadExample: "Download sample file",
457
+ uploading: "Uploading file",
451
458
  },
452
459
  remoteSources: {
453
460
  browseFile: "Browse file",
@@ -497,7 +504,8 @@ declare var export_default = {
497
504
  title: "Select primary key",
498
505
  text: "Choose the column that uniquely identifies each row",
499
506
  none: "No primary key",
500
- noneHint: "All rows will be appended as new entries without deduplication.",
507
+ noneHint:
508
+ "All rows will be appended as new entries without deduplication.",
501
509
  },
502
510
  },
503
511
  chat: {
@@ -509,6 +517,7 @@ declare var export_default = {
509
517
  common: {
510
518
  cancel: "Cancel",
511
519
  collapse: "Collapse",
520
+ dropToImport: "Drop file to import",
512
521
  expand: "Expand",
513
522
  remove: "Remove",
514
523
  search: "Search",
@@ -530,13 +539,22 @@ type DeepPartial<T> = {
530
539
  * e.g. `{ createRows_one: string; createRows_other: string }` becomes
531
540
  * `{ createRows_zero?: string; createRows_one?: string; createRows_two?: string; ... }`
532
541
  */
533
- type ExpandPluralKeys<T> = T extends Record<string, unknown>
534
- ? {
535
- [K in keyof T as K extends `${infer Base}${PluralSuffixes}`
536
- ? `${Base}_zero` | `${Base}_one` | `${Base}_two` | `${Base}_few` | `${Base}_many` | `${Base}_other`
537
- : K]: T[K] extends Record<string, unknown> ? ExpandPluralKeys<T[K]> : T[K];
538
- }
539
- : T;
542
+ type ExpandPluralKeys<T> =
543
+ T extends Record<string, unknown>
544
+ ? {
545
+ [K in keyof T as K extends `${infer Base}${PluralSuffixes}`
546
+ ?
547
+ | `${Base}_zero`
548
+ | `${Base}_one`
549
+ | `${Base}_two`
550
+ | `${Base}_few`
551
+ | `${Base}_many`
552
+ | `${Base}_other`
553
+ : K]: T[K] extends Record<string, unknown>
554
+ ? ExpandPluralKeys<T[K]>
555
+ : T[K];
556
+ }
557
+ : T;
540
558
 
541
559
  /**
542
560
  * Consumer-facing translations type. All keys optional — consumers override only what they need.
@@ -572,6 +590,8 @@ type Filters = {
572
590
  showOnlyNewRows: boolean;
573
591
  showOnlyEditedRows: boolean;
574
592
  showOnlyEmptyCells: boolean;
593
+ /** When true, show only rows with a cell flagged as misplaced after ragged-row realignment. */
594
+ showOnlyMisplacedRows: boolean;
575
595
  /** When true, show only rows flagged for deletion (bin mode). All other filters are bypassed. */
576
596
  showOnlyDeletedRows: boolean;
577
597
  filterColumns: string[] | null;
@@ -649,8 +669,13 @@ type FunctionValidator = {
649
669
  */
650
670
  type ValidatorRule = BuiltInValidator | ExpressionValidator | FunctionValidator;
651
671
 
652
- /** Severity level for a validation message. */
653
- type ValidationLevel = "error";
672
+ /**
673
+ * Severity level for a validation message.
674
+ * - `"error"` — a validation failure: marks the row invalid, counts as an error.
675
+ * - `"misplaced"` — a structural suspicion after ragged-row realignment: flags
676
+ * the cell to check, but is not an error and does not invalidate the row.
677
+ */
678
+ type ValidationLevel = "error" | "misplaced";
654
679
  /**
655
680
  * A single validation message attached to a cell.
656
681
  * Return this from a `CellValidator` to flag a problem.
@@ -1596,6 +1621,7 @@ interface FlagReader {
1596
1621
  isNew(id: TRowId): boolean;
1597
1622
  isEdited(id: TRowId): boolean;
1598
1623
  hasEmptyCells(id: TRowId): boolean;
1624
+ getRowsWithMisplaced(): ReadonlySet<TRowId>;
1599
1625
  isDeleted(id: TRowId): boolean;
1600
1626
  hasDeletedRows(): boolean;
1601
1627
  getSourceId(id: TRowId): string;
@@ -1731,6 +1757,7 @@ interface SnapshotStateReader {
1731
1757
  getEditedRowIds(): ReadonlySet<TRowId>;
1732
1758
  getRowsWithErrors(): ReadonlySet<TRowId>;
1733
1759
  getRowsWithEmptyCells(): ReadonlySet<TRowId>;
1760
+ getRowsWithMisplaced(): ReadonlySet<TRowId>;
1734
1761
  getDeletedCount(): number;
1735
1762
  isDeleted(id: TRowId): boolean;
1736
1763
  getSources(): DataSourceState[];
@@ -1763,6 +1790,7 @@ declare class SnapshotManager {
1763
1790
  private _visibleDirtyCount;
1764
1791
  private _visibleErrorCount;
1765
1792
  private _visibleEmptyCount;
1793
+ private _visibleMisplacedCount;
1766
1794
  private _countsDirty;
1767
1795
  private _filteredDirtyCount;
1768
1796
  private _filteredNewCount;
@@ -1781,6 +1809,7 @@ declare class SnapshotManager {
1781
1809
  markCountsDirty(): void;
1782
1810
  markFilteredCountsDirty(): void;
1783
1811
  adjustVisibleErrorCount(delta: number): void;
1812
+ adjustVisibleMisplacedCount(delta: number): void;
1784
1813
  adjustVisibleNewCount(delta: number): void;
1785
1814
  adjustVisibleEditedCount(delta: number): void;
1786
1815
  adjustVisibleDirtyCount(delta: number): void;
@@ -1819,6 +1848,7 @@ declare class SnapshotManager {
1819
1848
  type ValidationDelta = {
1820
1849
  errorDelta: number;
1821
1850
  rowErrorChanged: boolean;
1851
+ rowMisplacedChanged: boolean;
1822
1852
  };
1823
1853
  type IValidationStore = {
1824
1854
  setCellValidation(rowId: TRowId, field: string, result: ValidationResult): ValidationDelta;
@@ -1826,6 +1856,8 @@ type IValidationStore = {
1826
1856
  clearRowValidations(rowId: TRowId): void;
1827
1857
  hasRowErrors(rowId: TRowId): boolean;
1828
1858
  getRowsWithErrors(): ReadonlySet<TRowId>;
1859
+ hasMisplaced(rowId: TRowId): boolean;
1860
+ getRowsWithMisplaced(): ReadonlySet<TRowId>;
1829
1861
  getRowsWithEmptyCells(): ReadonlySet<TRowId>;
1830
1862
  hasEmptyCells(rowId: TRowId): boolean;
1831
1863
  checkRowEmptyCells(rowId: TRowId, row: Record<string, unknown> | undefined, fieldOrder: string[]): boolean;
@@ -2394,7 +2426,7 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
2394
2426
  * Server-mode insert: send insert request to server, wait for response,
2395
2427
  * then ingest the returned row locally. Non-optimistic.
2396
2428
  */
2397
- insertRowServer(row: TRow, localPosition: number, anchorRowId: TRowId | undefined, insertPosition: 'above' | 'below', columnIds: string[]): Promise<TRowId>;
2429
+ insertRowServer(row: TRow, localPosition: number, anchorRowId: TRowId | undefined, insertPosition: "above" | "below", columnIds: string[]): Promise<TRowId>;
2398
2430
  appendRows(sourceId: DataSourceId, newRows: TRow[], rowIdMap?: Map<number, TRowId>): TRowId[];
2399
2431
  seedInitialChanges(assignedRowIds: TRowId[], currentRows: TRow[], changes: InitialRowChange<TRow>[]): void;
2400
2432
  upsertRows(sourceId: DataSourceId, newRows: TRow[], options?: {
@@ -2450,6 +2482,14 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
2450
2482
  syncWorkerFlags(): void;
2451
2483
  setCellValidation(rowId: TRowId, field: string, result: ValidationResult): void;
2452
2484
  getCellValidation(rowId: TRowId, field: string): ValidationResult;
2485
+ /** Strips "misplaced" from one cell, keeping any error-level entries. */
2486
+ private clearCellMisplaced;
2487
+ /**
2488
+ * "Mark as correct" — clears misplaced flags across a region (cell/row/range).
2489
+ * Errors are preserved. Not an undoable command: it's an acknowledgement, not
2490
+ * a data mutation.
2491
+ */
2492
+ clearMisplacedInRects(rects: readonly SelectionRect[]): void;
2453
2493
  private clearRowValidations;
2454
2494
  updateRow(rowId: TRowId, field: string, value: unknown): void;
2455
2495
  updateRowDirect(rowId: TRowId, field: string, value: unknown): void;
@@ -2479,6 +2519,8 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
2479
2519
  isCellDirty(rowId: TRowId, field: string): boolean;
2480
2520
  hasRowErrors(rowId: TRowId): boolean;
2481
2521
  hasEmptyCells(rowId: TRowId): boolean;
2522
+ hasRowMisplaced(rowId: TRowId): boolean;
2523
+ getRowsWithMisplaced(): ReadonlySet<TRowId>;
2482
2524
  private checkRowEmptyCells;
2483
2525
  getValidAndInvalidRows(): {
2484
2526
  valid: TRow[];
@@ -2500,7 +2542,7 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
2500
2542
  private buildChatOpsCommand;
2501
2543
  applyChatOps(ops: ChatOp[], ctx: {
2502
2544
  opts: Record<string, Set<string>>;
2503
- }, enableDeleteRow: 'all' | 'new' | false): Promise<void>;
2545
+ }, enableDeleteRow: "all" | "new" | false): Promise<void>;
2504
2546
  private filterDeleteIdsByPolicy;
2505
2547
  private _applyChatOpsViaWorker;
2506
2548
  private _applyChatOpsSync;
@@ -2744,6 +2786,8 @@ type DataStoreSnapshot = {
2744
2786
  errorMessageCounts: Record<string, number>;
2745
2787
  emptyRowCount: number;
2746
2788
  filteredEmptyRowCount: number;
2789
+ /** Visible non-deleted rows with a cell flagged as misplaced after ragged-row realignment. */
2790
+ misplacedRowCount: number;
2747
2791
  isLoading: boolean;
2748
2792
  isFiltering: boolean;
2749
2793
  /** Unified phase state machine. Controls what actions are allowed. */