@updog/data-editor-wc 0.1.95 → 0.1.97

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
@@ -416,6 +416,7 @@ declare var export_default = {
416
416
  invalidEmail: "Invalid email address",
417
417
  invalidFormat: "Invalid format",
418
418
  invalidNumber: "Invalid number",
419
+ invalidPhone: "Invalid phone number",
419
420
  invalidOption: "Invalid option",
420
421
  invalidTime: "Invalid time",
421
422
  invalidUrl: "Invalid URL",
@@ -565,11 +566,15 @@ declare var export_default = {
565
566
  },
566
567
  },
567
568
  chat: {
568
- emptyTitle: "What would you like to fix?",
569
- header: "Chat with AI",
569
+ cancelRequest: "Cancel request",
570
570
  inputLabel: "Ask AI about your data",
571
571
  placeholder: "Ask AI...",
572
+ requestCancelled: "Cancelled",
573
+ requestDone: "Applied",
574
+ requestFailed: "Failed",
572
575
  send: "Send",
576
+ toggle: "AI",
577
+ toggleLabel: "Toggle AI assistant",
573
578
  },
574
579
  common: {
575
580
  cancel: "Cancel",
@@ -688,6 +693,22 @@ type EmailEditorCell = {
688
693
  type UrlEditorCell = {
689
694
  type: "url";
690
695
  };
696
+ /**
697
+ * Phone cell. A plain text input; the column is checked against
698
+ * `{ type: "phone" }` even when it declares no validator. On the way in a
699
+ * number is read with libphonenumber and stored in E.164 (`+4915112345678`);
700
+ * the screen shows it spaced (`+49 1511 2345678`). What does not read as
701
+ * one possible number stays as it came, trimmed, and is flagged.
702
+ */
703
+ type PhoneEditorCell = {
704
+ type: "phone";
705
+ /**
706
+ * ISO 3166-1 alpha-2 region a number without a country code belongs to,
707
+ * `"DE"`. Omitted: only numbers carrying `+` (or digits that read as
708
+ * `+digits`) are recognised.
709
+ */
710
+ defaultRegion?: string;
711
+ };
691
712
  /** Date picker cell. Bounds come from the column's `{ type: "date" }` validator. */
692
713
  type DateEditorCell = {
693
714
  type: "date";
@@ -788,6 +809,7 @@ type NumberEditorCell = {
788
809
  * - `"text"` — plain text input (default).
789
810
  * - `"email"` — plain text input; the column is checked against `{ type: "email" }`, spaces cut and the domain lower-cased on the way in.
790
811
  * - `"url"` — plain text input; the column is checked against `{ type: "url" }`, a bare host such as `acme.com` becomes `https://acme.com` on the way in.
812
+ * - `"phone"` — plain text input; the column is checked against `{ type: "phone" }`, a number is stored in E.164 and shown spaced.
791
813
  * - `"date"` — date picker; the calendar honours the column's date validator bounds.
792
814
  * - `"time"` — plain text input for a time of day; the column is checked against `{ type: "time" }`.
793
815
  * - `"select"` — dropdown with a fixed list of options.
@@ -797,7 +819,7 @@ type NumberEditorCell = {
797
819
  * - `"number"` — number input with locale-aware formatting.
798
820
  * - `"boolean"` — stores a real `true`/`false`; reads yes/no, 1/0, on/off and Excel's localized TRUE/FALSE.
799
821
  */
800
- type CellEditor = TextEditorCell | EmailEditorCell | UrlEditorCell | DateEditorCell | TimeEditorCell | SelectEditorCell | MultiSelectEditorCell | CountryEditorCell | CurrencyEditorCell | NumberEditorCell | BooleanEditorCell;
822
+ type CellEditor = TextEditorCell | EmailEditorCell | UrlEditorCell | PhoneEditorCell | DateEditorCell | TimeEditorCell | SelectEditorCell | MultiSelectEditorCell | CountryEditorCell | CurrencyEditorCell | NumberEditorCell | BooleanEditorCell;
801
823
  /** Dropdown filter shown in the sidebar Filters panel. */
802
824
  type SelectColumnFilter = {
803
825
  type: "select";
@@ -965,6 +987,11 @@ type BuiltInValidator = {
965
987
  | {
966
988
  type: "url";
967
989
  message?: string;
990
+ }
991
+ /** The cell holds one possible phone number in E.164. Implicit on every phone column. */
992
+ | {
993
+ type: "phone";
994
+ message?: string;
968
995
  } | {
969
996
  type: "date";
970
997
  min?: string;
@@ -1088,10 +1115,17 @@ type ChatErrorSummary = {
1088
1115
  examples: string[];
1089
1116
  };
1090
1117
  /**
1091
- * Context about the current dataset, passed to `loadSuggestions` and extended
1092
- * into `ChatContext` for `onMessage`.
1118
+ * The full context passed to `DataEditorChat.onMessage` when the user sends
1119
+ * a prompt. Includes the prompt itself and all dataset context.
1093
1120
  */
1094
- type ChatDataContext<TRow extends DataEditorRow = DataEditorRow> = {
1121
+ type ChatContext<TRow extends DataEditorRow = DataEditorRow> = {
1122
+ /** The user's chat prompt. */
1123
+ message: string;
1124
+ /**
1125
+ * Aborted when the user cancels the request. Pass it to `fetch` so the
1126
+ * in-flight call stops; the SDK stops reading the stream on its own.
1127
+ */
1128
+ signal: AbortSignal;
1095
1129
  /** Full column definitions. */
1096
1130
  columns: DataEditorColumn[];
1097
1131
  /** Row identifier field, or the list of fields that identify a row together. */
@@ -1107,19 +1141,11 @@ type ChatDataContext<TRow extends DataEditorRow = DataEditorRow> = {
1107
1141
  /** Access all rows. Use for full-dataset operations. */
1108
1142
  getRows: () => ChatRow<TRow>[];
1109
1143
  };
1110
- /**
1111
- * The full context passed to `DataEditorChat.onMessage` when the user sends
1112
- * a prompt. Includes the prompt itself and all dataset context.
1113
- */
1114
- type ChatContext<TRow extends DataEditorRow = DataEditorRow> = ChatDataContext<TRow> & {
1115
- /** The user's chat prompt. */
1116
- message: string;
1117
- };
1118
1144
  /**
1119
1145
  * Bring-your-own-AI chat configuration. When provided via the `chat` prop,
1120
- * the editor shows a chat panel alongside the grid. You own the AI
1121
- * integration; the SDK hands you dataset context and renders the streamed
1122
- * response.
1146
+ * the editor footer gains an AI button that opens the assistant over the grid.
1147
+ * You own the AI integration; the SDK hands you dataset context, applies the
1148
+ * streamed row changes and shows each request with its status.
1123
1149
  *
1124
1150
  * @example
1125
1151
  * ```ts
@@ -1149,19 +1175,16 @@ type DataEditorChat<TRow extends DataEditorRow = DataEditorRow> = {
1149
1175
  * representative slice including rows with errors. When omitted, the SDK decides.
1150
1176
  */
1151
1177
  sampleSize?: number;
1152
- /** Title shown above the suggestion list when the chat is empty. */
1153
- emptyTitle?: string;
1154
- /** How many suggestions to request from `loadSuggestions`. */
1155
- suggestionsCount?: number;
1156
- /** Optional prompt generator for the empty-state suggestion chips. */
1157
- loadSuggestions?: (context: ChatDataContext<TRow>) => Promise<string[]>;
1158
1178
  /**
1159
1179
  * Called when the user sends a message. Receives full dataset context.
1160
1180
  * Returns an async iterable of response chunks — the SDK streams them
1161
1181
  * into the UI.
1162
1182
  */
1163
1183
  onMessage: (context: ChatContext<TRow>) => AsyncIterable<ChatResponseChunk<TRow>>;
1164
- /** Called when the user cancels a pending request. Use to abort your API call. */
1184
+ /**
1185
+ * Called when the user cancels a pending request, after `context.signal`
1186
+ * is aborted. Use for cleanup the signal cannot reach.
1187
+ */
1165
1188
  onCancel?: () => void;
1166
1189
  };
1167
1190