@updog/data-editor-wc 0.1.85 → 0.1.87

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 +50 -4
  3. package/index.js +11747 -10643
  4. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -65,6 +65,8 @@ declare var export_default = {
65
65
  clearField: "Clear field",
66
66
  showPassword: "Show password",
67
67
  hidePassword: "Hide password",
68
+ switchToAm: "Switch to AM",
69
+ switchToPm: "Switch to PM",
68
70
  },
69
71
  select: {
70
72
  noResults: "No results",
@@ -412,10 +414,12 @@ declare var export_default = {
412
414
  invalidFormat: "Invalid format",
413
415
  invalidNumber: "Invalid number",
414
416
  invalidOption: "Invalid option",
417
+ invalidTime: "Invalid time",
415
418
  outOfRange: "Out of range",
416
419
  required: "This field is required",
417
420
  structuralMismatch: "This might be in the wrong column.",
418
421
  tooManyDecimals: "Too many decimal places",
422
+ tooPreciseTime: "Too precise for this column",
419
423
  valueMustBeUnique: "Value must be unique",
420
424
  },
421
425
  license: {
@@ -663,6 +667,16 @@ type TextEditorCell = {
663
667
  type DateEditorCell = {
664
668
  type: "date";
665
669
  };
670
+ /** Time-of-day cell. Bounds come from the column's `{ type: "time" }` validator. */
671
+ type TimeEditorCell = {
672
+ type: "time";
673
+ /**
674
+ * The clock the cell draws, `h23` for `18:00` and `h12` for `6:00 PM`.
675
+ * Defaults to the clock the reader's own browser uses. Whichever is drawn,
676
+ * both forms stay readable when the person types.
677
+ */
678
+ hourCycle?: "h12" | "h23";
679
+ };
666
680
  /** Dropdown select cell. The user picks from a fixed list of options. */
667
681
  type SelectEditorCell = {
668
682
  type: "select";
@@ -697,11 +711,12 @@ type NumberEditorCell = {
697
711
  *
698
712
  * - `"text"` — plain text input (default).
699
713
  * - `"date"` — date picker; the calendar honours the column's date validator bounds.
714
+ * - `"time"` — plain text input for a time of day; the column is checked against `{ type: "time" }`.
700
715
  * - `"select"` — dropdown with a fixed list of options.
701
716
  * - `"multiselect"` — dropdown allowing zero or more options; stored as `string[]`.
702
717
  * - `"number"` — number input with locale-aware formatting.
703
718
  */
704
- type CellEditor = TextEditorCell | DateEditorCell | SelectEditorCell | MultiSelectEditorCell | NumberEditorCell;
719
+ type CellEditor = TextEditorCell | DateEditorCell | TimeEditorCell | SelectEditorCell | MultiSelectEditorCell | NumberEditorCell;
705
720
  /** Dropdown filter shown in the sidebar Filters panel. */
706
721
  type SelectColumnFilter = {
707
722
  type: "select";
@@ -726,14 +741,21 @@ type DateRangeColumnFilter = {
726
741
  /** Label displayed above the filter. */
727
742
  label?: string;
728
743
  };
744
+ /** Time-of-day min/max range filter shown in the sidebar Filters panel. */
745
+ type TimeRangeColumnFilter = {
746
+ type: "time-range";
747
+ /** Label displayed above the filter. */
748
+ label?: string;
749
+ };
729
750
  /**
730
751
  * Filter control shown in the sidebar Filters panel for a column.
731
752
  *
732
753
  * - `"select"` — dropdown to pick one or more values.
733
754
  * - `"number-range"` — two inputs for min and max number.
734
755
  * - `"date-range"` — two date pickers for start and end date.
756
+ * - `"time-range"` — two time fields for the earliest and latest time of day.
735
757
  */
736
- type ColumnFilter = SelectColumnFilter | NumberRangeColumnFilter | DateRangeColumnFilter;
758
+ type ColumnFilter = SelectColumnFilter | NumberRangeColumnFilter | DateRangeColumnFilter | TimeRangeColumnFilter;
737
759
  /** Lock mode for a column. `"all"` locks for every row; `"default"` locks only default-source rows. */
738
760
  type ColumnLockMode = "all" | "default";
739
761
  /**
@@ -769,8 +791,21 @@ type DataEditorColumn = {
769
791
  /** Format the display value without changing stored data. E.g. add `$` prefix. */
770
792
  formatter?: (value: string) => string;
771
793
  /**
772
- * Transform a value before it enters the store. Runs when rows are uploaded
773
- * to the data editor.
794
+ * Transform a value on its way into the store. Runs on every value arriving
795
+ * from outside the editor, so `loadData`, a file import, a remote source, a
796
+ * custom format, and a paste of text from another app all call it. A value
797
+ * moving inside the grid is left alone, so a manual edit, a fill, a paste of
798
+ * cells copied from the grid itself, undo, and redo never call it.
799
+ *
800
+ * The value arrives in the shape the cell is stored in. Numbers and dates
801
+ * canonicalize first, and a `select` value resolves through value matching
802
+ * first, so the transformer sees the option the user confirmed. On a
803
+ * `multiselect` column it runs once per token, the way `formatter` already
804
+ * reads that column. A token it empties leaves the list, and two tokens it
805
+ * makes equal collapse into one.
806
+ *
807
+ * It runs before validation, so a transformer that moves a value outside
808
+ * `editor.options` makes its own column fail a `oneOf` rule.
774
809
  */
775
810
  transformer?: (value: unknown) => unknown;
776
811
  /** How the cell is edited. Defaults to text input. */
@@ -795,6 +830,8 @@ type DataEditorColumn = {
795
830
  locked?: boolean | ColumnLockMode;
796
831
  };
797
832
 
833
+ /** How precisely a time-of-day column is written. */
834
+ type TimePrecision = "minutes" | "seconds" | "milliseconds";
798
835
  /**
799
836
  * A built-in declarative validator — a declarative object the SDK interprets.
800
837
  */
@@ -827,6 +864,15 @@ type BuiltInValidator = {
827
864
  min?: string;
828
865
  max?: string;
829
866
  message?: string;
867
+ } | {
868
+ type: "time";
869
+ /** Inclusive lower bound, canonical, any of the three precisions. */
870
+ min?: string;
871
+ /** Inclusive upper bound, canonical, any of the three precisions. */
872
+ max?: string;
873
+ /** The finest the column is written. A value carrying more is flagged, never trimmed. */
874
+ precision?: TimePrecision;
875
+ message?: string;
830
876
  } | {
831
877
  type: "unique";
832
878
  message?: string;