@updog/data-editor 0.1.86 → 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.
package/index.d.ts CHANGED
@@ -67,6 +67,8 @@ declare var export_default = {
67
67
  clearField: "Clear field",
68
68
  showPassword: "Show password",
69
69
  hidePassword: "Hide password",
70
+ switchToAm: "Switch to AM",
71
+ switchToPm: "Switch to PM",
70
72
  },
71
73
  select: {
72
74
  noResults: "No results",
@@ -414,10 +416,12 @@ declare var export_default = {
414
416
  invalidFormat: "Invalid format",
415
417
  invalidNumber: "Invalid number",
416
418
  invalidOption: "Invalid option",
419
+ invalidTime: "Invalid time",
417
420
  outOfRange: "Out of range",
418
421
  required: "This field is required",
419
422
  structuralMismatch: "This might be in the wrong column.",
420
423
  tooManyDecimals: "Too many decimal places",
424
+ tooPreciseTime: "Too precise for this column",
421
425
  valueMustBeUnique: "Value must be unique",
422
426
  },
423
427
  license: {
@@ -708,6 +712,11 @@ type Filters = {
708
712
  min?: string;
709
713
  max?: string;
710
714
  }>;
715
+ /** Per-column time-of-day range filters. Key = column ID, values are canonical times. */
716
+ columnTimeRangeFilters: Record<string, {
717
+ min?: string;
718
+ max?: string;
719
+ }>;
711
720
  };
712
721
 
713
722
  /**
@@ -752,6 +761,16 @@ type TextEditorCell = {
752
761
  type DateEditorCell = {
753
762
  type: "date";
754
763
  };
764
+ /** Time-of-day cell. Bounds come from the column's `{ type: "time" }` validator. */
765
+ type TimeEditorCell = {
766
+ type: "time";
767
+ /**
768
+ * The clock the cell draws, `h23` for `18:00` and `h12` for `6:00 PM`.
769
+ * Defaults to the clock the reader's own browser uses. Whichever is drawn,
770
+ * both forms stay readable when the person types.
771
+ */
772
+ hourCycle?: "h12" | "h23";
773
+ };
755
774
  /** Dropdown select cell. The user picks from a fixed list of options. */
756
775
  type SelectEditorCell = {
757
776
  type: "select";
@@ -786,11 +805,12 @@ type NumberEditorCell = {
786
805
  *
787
806
  * - `"text"` — plain text input (default).
788
807
  * - `"date"` — date picker; the calendar honours the column's date validator bounds.
808
+ * - `"time"` — plain text input for a time of day; the column is checked against `{ type: "time" }`.
789
809
  * - `"select"` — dropdown with a fixed list of options.
790
810
  * - `"multiselect"` — dropdown allowing zero or more options; stored as `string[]`.
791
811
  * - `"number"` — number input with locale-aware formatting.
792
812
  */
793
- type CellEditor = TextEditorCell | DateEditorCell | SelectEditorCell | MultiSelectEditorCell | NumberEditorCell;
813
+ type CellEditor = TextEditorCell | DateEditorCell | TimeEditorCell | SelectEditorCell | MultiSelectEditorCell | NumberEditorCell;
794
814
  /** Dropdown filter shown in the sidebar Filters panel. */
795
815
  type SelectColumnFilter = {
796
816
  type: "select";
@@ -815,14 +835,21 @@ type DateRangeColumnFilter = {
815
835
  /** Label displayed above the filter. */
816
836
  label?: string;
817
837
  };
838
+ /** Time-of-day min/max range filter shown in the sidebar Filters panel. */
839
+ type TimeRangeColumnFilter = {
840
+ type: "time-range";
841
+ /** Label displayed above the filter. */
842
+ label?: string;
843
+ };
818
844
  /**
819
845
  * Filter control shown in the sidebar Filters panel for a column.
820
846
  *
821
847
  * - `"select"` — dropdown to pick one or more values.
822
848
  * - `"number-range"` — two inputs for min and max number.
823
849
  * - `"date-range"` — two date pickers for start and end date.
850
+ * - `"time-range"` — two time fields for the earliest and latest time of day.
824
851
  */
825
- type ColumnFilter = SelectColumnFilter | NumberRangeColumnFilter | DateRangeColumnFilter;
852
+ type ColumnFilter = SelectColumnFilter | NumberRangeColumnFilter | DateRangeColumnFilter | TimeRangeColumnFilter;
826
853
  /** Lock mode for a column. `"all"` locks for every row; `"default"` locks only default-source rows. */
827
854
  type ColumnLockMode = "all" | "default";
828
855
  /**
@@ -897,6 +924,8 @@ type DataEditorColumn = {
897
924
  locked?: boolean | ColumnLockMode;
898
925
  };
899
926
 
927
+ /** How precisely a time-of-day column is written. */
928
+ type TimePrecision = "minutes" | "seconds" | "milliseconds";
900
929
  /**
901
930
  * A built-in declarative validator — a declarative object the SDK interprets.
902
931
  */
@@ -929,6 +958,15 @@ type BuiltInValidator = {
929
958
  min?: string;
930
959
  max?: string;
931
960
  message?: string;
961
+ } | {
962
+ type: "time";
963
+ /** Inclusive lower bound, canonical, any of the three precisions. */
964
+ min?: string;
965
+ /** Inclusive upper bound, canonical, any of the three precisions. */
966
+ max?: string;
967
+ /** The finest the column is written. A value carrying more is flagged, never trimmed. */
968
+ precision?: TimePrecision;
969
+ message?: string;
932
970
  } | {
933
971
  type: "unique";
934
972
  message?: string;
@@ -1352,6 +1390,7 @@ type NormalizedColumn = Omit<DataEditorColumn, "validators"> & {
1352
1390
  asyncConfig?: AsyncFunctionValidator[];
1353
1391
  numberConfig?: NumberConfig;
1354
1392
  dateConfig?: DateConfig;
1393
+ timeConfig?: TimeConfig;
1355
1394
  };
1356
1395
  type NumberConfig = {
1357
1396
  min?: number;
@@ -1362,6 +1401,11 @@ type DateConfig = {
1362
1401
  min?: string;
1363
1402
  max?: string;
1364
1403
  };
1404
+ type TimeConfig = {
1405
+ min?: string;
1406
+ max?: string;
1407
+ precision?: TimePrecision;
1408
+ };
1365
1409
 
1366
1410
  type PrimaryKeyInput = string | readonly string[];
1367
1411
 
@@ -2355,7 +2399,7 @@ type ColumnDelta = {
2355
2399
 
2356
2400
  /** Numeric row identifier. V8 stores small integers (Smi) inline — no heap allocation. */
2357
2401
  type TRowId = number;
2358
- type SortType = "text" | "number" | "date";
2402
+ type SortType = "text" | "number" | "date" | "time";
2359
2403
 
2360
2404
  /** A pointer to a specific cell in the grid. */
2361
2405
  type CellLocation = {