@updog/data-editor 0.1.36 → 0.1.38

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 (5) hide show
  1. package/README.md +1 -1
  2. package/index.css +1 -1
  3. package/index.d.ts +52 -12
  4. package/index.js +4370 -3949
  5. package/package.json +2 -2
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: {
@@ -497,7 +500,8 @@ declare var export_default = {
497
500
  title: "Select primary key",
498
501
  text: "Choose the column that uniquely identifies each row",
499
502
  none: "No primary key",
500
- noneHint: "All rows will be appended as new entries without deduplication.",
503
+ noneHint:
504
+ "All rows will be appended as new entries without deduplication.",
501
505
  },
502
506
  },
503
507
  chat: {
@@ -509,6 +513,7 @@ declare var export_default = {
509
513
  common: {
510
514
  cancel: "Cancel",
511
515
  collapse: "Collapse",
516
+ dropToImport: "Drop file to import",
512
517
  expand: "Expand",
513
518
  remove: "Remove",
514
519
  search: "Search",
@@ -530,13 +535,22 @@ type DeepPartial<T> = {
530
535
  * e.g. `{ createRows_one: string; createRows_other: string }` becomes
531
536
  * `{ createRows_zero?: string; createRows_one?: string; createRows_two?: string; ... }`
532
537
  */
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;
538
+ type ExpandPluralKeys<T> =
539
+ T extends Record<string, unknown>
540
+ ? {
541
+ [K in keyof T as K extends `${infer Base}${PluralSuffixes}`
542
+ ?
543
+ | `${Base}_zero`
544
+ | `${Base}_one`
545
+ | `${Base}_two`
546
+ | `${Base}_few`
547
+ | `${Base}_many`
548
+ | `${Base}_other`
549
+ : K]: T[K] extends Record<string, unknown>
550
+ ? ExpandPluralKeys<T[K]>
551
+ : T[K];
552
+ }
553
+ : T;
540
554
 
541
555
  /**
542
556
  * Consumer-facing translations type. All keys optional — consumers override only what they need.
@@ -572,6 +586,8 @@ type Filters = {
572
586
  showOnlyNewRows: boolean;
573
587
  showOnlyEditedRows: boolean;
574
588
  showOnlyEmptyCells: boolean;
589
+ /** When true, show only rows with a cell flagged as misplaced after ragged-row realignment. */
590
+ showOnlyMisplacedRows: boolean;
575
591
  /** When true, show only rows flagged for deletion (bin mode). All other filters are bypassed. */
576
592
  showOnlyDeletedRows: boolean;
577
593
  filterColumns: string[] | null;
@@ -649,8 +665,13 @@ type FunctionValidator = {
649
665
  */
650
666
  type ValidatorRule = BuiltInValidator | ExpressionValidator | FunctionValidator;
651
667
 
652
- /** Severity level for a validation message. */
653
- type ValidationLevel = "error";
668
+ /**
669
+ * Severity level for a validation message.
670
+ * - `"error"` — a validation failure: marks the row invalid, counts as an error.
671
+ * - `"misplaced"` — a structural suspicion after ragged-row realignment: flags
672
+ * the cell to check, but is not an error and does not invalidate the row.
673
+ */
674
+ type ValidationLevel = "error" | "misplaced";
654
675
  /**
655
676
  * A single validation message attached to a cell.
656
677
  * Return this from a `CellValidator` to flag a problem.
@@ -1596,6 +1617,7 @@ interface FlagReader {
1596
1617
  isNew(id: TRowId): boolean;
1597
1618
  isEdited(id: TRowId): boolean;
1598
1619
  hasEmptyCells(id: TRowId): boolean;
1620
+ getRowsWithMisplaced(): ReadonlySet<TRowId>;
1599
1621
  isDeleted(id: TRowId): boolean;
1600
1622
  hasDeletedRows(): boolean;
1601
1623
  getSourceId(id: TRowId): string;
@@ -1731,6 +1753,7 @@ interface SnapshotStateReader {
1731
1753
  getEditedRowIds(): ReadonlySet<TRowId>;
1732
1754
  getRowsWithErrors(): ReadonlySet<TRowId>;
1733
1755
  getRowsWithEmptyCells(): ReadonlySet<TRowId>;
1756
+ getRowsWithMisplaced(): ReadonlySet<TRowId>;
1734
1757
  getDeletedCount(): number;
1735
1758
  isDeleted(id: TRowId): boolean;
1736
1759
  getSources(): DataSourceState[];
@@ -1763,6 +1786,7 @@ declare class SnapshotManager {
1763
1786
  private _visibleDirtyCount;
1764
1787
  private _visibleErrorCount;
1765
1788
  private _visibleEmptyCount;
1789
+ private _visibleMisplacedCount;
1766
1790
  private _countsDirty;
1767
1791
  private _filteredDirtyCount;
1768
1792
  private _filteredNewCount;
@@ -1781,6 +1805,7 @@ declare class SnapshotManager {
1781
1805
  markCountsDirty(): void;
1782
1806
  markFilteredCountsDirty(): void;
1783
1807
  adjustVisibleErrorCount(delta: number): void;
1808
+ adjustVisibleMisplacedCount(delta: number): void;
1784
1809
  adjustVisibleNewCount(delta: number): void;
1785
1810
  adjustVisibleEditedCount(delta: number): void;
1786
1811
  adjustVisibleDirtyCount(delta: number): void;
@@ -1819,6 +1844,7 @@ declare class SnapshotManager {
1819
1844
  type ValidationDelta = {
1820
1845
  errorDelta: number;
1821
1846
  rowErrorChanged: boolean;
1847
+ rowMisplacedChanged: boolean;
1822
1848
  };
1823
1849
  type IValidationStore = {
1824
1850
  setCellValidation(rowId: TRowId, field: string, result: ValidationResult): ValidationDelta;
@@ -1826,6 +1852,8 @@ type IValidationStore = {
1826
1852
  clearRowValidations(rowId: TRowId): void;
1827
1853
  hasRowErrors(rowId: TRowId): boolean;
1828
1854
  getRowsWithErrors(): ReadonlySet<TRowId>;
1855
+ hasMisplaced(rowId: TRowId): boolean;
1856
+ getRowsWithMisplaced(): ReadonlySet<TRowId>;
1829
1857
  getRowsWithEmptyCells(): ReadonlySet<TRowId>;
1830
1858
  hasEmptyCells(rowId: TRowId): boolean;
1831
1859
  checkRowEmptyCells(rowId: TRowId, row: Record<string, unknown> | undefined, fieldOrder: string[]): boolean;
@@ -2394,7 +2422,7 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
2394
2422
  * Server-mode insert: send insert request to server, wait for response,
2395
2423
  * then ingest the returned row locally. Non-optimistic.
2396
2424
  */
2397
- insertRowServer(row: TRow, localPosition: number, anchorRowId: TRowId | undefined, insertPosition: 'above' | 'below', columnIds: string[]): Promise<TRowId>;
2425
+ insertRowServer(row: TRow, localPosition: number, anchorRowId: TRowId | undefined, insertPosition: "above" | "below", columnIds: string[]): Promise<TRowId>;
2398
2426
  appendRows(sourceId: DataSourceId, newRows: TRow[], rowIdMap?: Map<number, TRowId>): TRowId[];
2399
2427
  seedInitialChanges(assignedRowIds: TRowId[], currentRows: TRow[], changes: InitialRowChange<TRow>[]): void;
2400
2428
  upsertRows(sourceId: DataSourceId, newRows: TRow[], options?: {
@@ -2450,6 +2478,14 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
2450
2478
  syncWorkerFlags(): void;
2451
2479
  setCellValidation(rowId: TRowId, field: string, result: ValidationResult): void;
2452
2480
  getCellValidation(rowId: TRowId, field: string): ValidationResult;
2481
+ /** Strips "misplaced" from one cell, keeping any error-level entries. */
2482
+ private clearCellMisplaced;
2483
+ /**
2484
+ * "Mark as correct" — clears misplaced flags across a region (cell/row/range).
2485
+ * Errors are preserved. Not an undoable command: it's an acknowledgement, not
2486
+ * a data mutation.
2487
+ */
2488
+ clearMisplacedInRects(rects: readonly SelectionRect[]): void;
2453
2489
  private clearRowValidations;
2454
2490
  updateRow(rowId: TRowId, field: string, value: unknown): void;
2455
2491
  updateRowDirect(rowId: TRowId, field: string, value: unknown): void;
@@ -2479,6 +2515,8 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
2479
2515
  isCellDirty(rowId: TRowId, field: string): boolean;
2480
2516
  hasRowErrors(rowId: TRowId): boolean;
2481
2517
  hasEmptyCells(rowId: TRowId): boolean;
2518
+ hasRowMisplaced(rowId: TRowId): boolean;
2519
+ getRowsWithMisplaced(): ReadonlySet<TRowId>;
2482
2520
  private checkRowEmptyCells;
2483
2521
  getValidAndInvalidRows(): {
2484
2522
  valid: TRow[];
@@ -2500,7 +2538,7 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
2500
2538
  private buildChatOpsCommand;
2501
2539
  applyChatOps(ops: ChatOp[], ctx: {
2502
2540
  opts: Record<string, Set<string>>;
2503
- }, enableDeleteRow: 'all' | 'new' | false): Promise<void>;
2541
+ }, enableDeleteRow: "all" | "new" | false): Promise<void>;
2504
2542
  private filterDeleteIdsByPolicy;
2505
2543
  private _applyChatOpsViaWorker;
2506
2544
  private _applyChatOpsSync;
@@ -2744,6 +2782,8 @@ type DataStoreSnapshot = {
2744
2782
  errorMessageCounts: Record<string, number>;
2745
2783
  emptyRowCount: number;
2746
2784
  filteredEmptyRowCount: number;
2785
+ /** Visible non-deleted rows with a cell flagged as misplaced after ragged-row realignment. */
2786
+ misplacedRowCount: number;
2747
2787
  isLoading: boolean;
2748
2788
  isFiltering: boolean;
2749
2789
  /** Unified phase state machine. Controls what actions are allowed. */