@updog/data-editor 0.1.46 → 0.1.48

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 +34 -1
  3. package/index.js +3369 -2892
  4. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -498,6 +498,9 @@ declare var export_default = {
498
498
  createOptionNamePlaceholder: "Enter option name",
499
499
  createOptionNameTaken: "This option already exists",
500
500
  createOptionSubmit: "Create",
501
+ reapplySeparator: "Reset to auto-detected separator",
502
+ separator: "Separator",
503
+ separatedBy: "Values separated by",
501
504
  },
502
505
  primaryKey: {
503
506
  none: "No primary key",
@@ -723,6 +726,16 @@ type SelectEditorCell = {
723
726
  */
724
727
  enableCustomValue?: boolean;
725
728
  };
729
+ /** Multi-select cell. The user picks zero or more options; stored value is `string[]`. */
730
+ type MultiSelectEditorCell = {
731
+ type: "multiselect";
732
+ /** Options shown in the dropdown. Each string is both stored value and label. */
733
+ options: string[];
734
+ /** Let users add options via "Create option". Defaults to true. */
735
+ enableCustomValue?: boolean;
736
+ /** Splits a raw imported cell and joins on export. Omitted: import auto-detects, export joins with `", "`. */
737
+ delimiter?: string;
738
+ };
726
739
  /** Number input cell with locale-aware formatting. */
727
740
  type NumberEditorCell = {
728
741
  type: "number";
@@ -741,9 +754,10 @@ type NumberEditorCell = {
741
754
  * - `"text"` — plain text input (default).
742
755
  * - `"date"` — date picker with optional min/max bounds.
743
756
  * - `"select"` — dropdown with a fixed list of options.
757
+ * - `"multiselect"` — dropdown allowing zero or more options; stored as `string[]`.
744
758
  * - `"number"` — number input with locale-aware formatting.
745
759
  */
746
- type CellEditor = TextEditorCell | DateEditorCell | SelectEditorCell | NumberEditorCell;
760
+ type CellEditor = TextEditorCell | DateEditorCell | SelectEditorCell | MultiSelectEditorCell | NumberEditorCell;
747
761
  /** Dropdown filter shown in the sidebar Filters panel. */
748
762
  type SelectColumnFilter = {
749
763
  type: "select";
@@ -2534,6 +2548,9 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
2534
2548
  };
2535
2549
  getValidRows(): TRow[];
2536
2550
  getInvalidRows(): TRow[];
2551
+ private learnedSynonyms;
2552
+ private learnedSynonymKeys;
2553
+ recordLearnedSynonyms(delta: LearnedSynonyms): void;
2537
2554
  getResultBySource(): DataEditorResult<TRow>;
2538
2555
  private isRowVisible;
2539
2556
  applyFormula(formulaOrName: string | CellFormula, params: Record<string, unknown>, rects: SelectionRect[], options?: ApplyFormulaOptions): Promise<void>;
@@ -2702,6 +2719,16 @@ type DataEditorSourceResult<TRow extends DataEditorRow = DataEditorRow> = {
2702
2719
  * }}
2703
2720
  * ```
2704
2721
  */
2722
+ /** A user-confirmed import mapping: `source` (imported) → `target` (canonical). */
2723
+ type LearnedSynonym = {
2724
+ source: string;
2725
+ target: string;
2726
+ };
2727
+ /** User-confirmed import mappings, split by where they were matched. */
2728
+ type LearnedSynonyms = {
2729
+ columns: LearnedSynonym[];
2730
+ values: LearnedSynonym[];
2731
+ };
2705
2732
  type DataEditorResult<TRow extends DataEditorRow = DataEditorRow> = {
2706
2733
  sources: DataEditorSourceResult<TRow>[];
2707
2734
  counts: {
@@ -2710,6 +2737,12 @@ type DataEditorResult<TRow extends DataEditorRow = DataEditorRow> = {
2710
2737
  deleted: number;
2711
2738
  invalid: number;
2712
2739
  };
2740
+ /**
2741
+ * Import mappings the user confirmed that weren't already known, split into
2742
+ * `columns` and `values`. Persist and feed back through `synonyms` so repeat
2743
+ * imports auto-match. Each list is `[]` when nothing new was learned.
2744
+ */
2745
+ learnedSynonyms: LearnedSynonyms;
2713
2746
  };
2714
2747
  /**
2715
2748
  * Describes the change state of a single row within a chunk, used to seed