@freegridjs/core 1.9.5 → 1.11.0

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.
@@ -283,7 +283,7 @@ type EditorSpec = {
283
283
  | {
284
284
  type: 'datetime';
285
285
  } | ((params: EditorParams) => CustomEditor);
286
- type KeyAction = 'edit' | 'clear' | 'undo' | 'redo' | 'copy' | 'cut' | 'paste' | 'selectAll' | 'find' | 'none';
286
+ type KeyAction = 'edit' | 'clear' | 'undo' | 'redo' | 'copy' | 'cut' | 'paste' | 'selectAll' | 'find' | 'columnMenu' | 'none';
287
287
  interface ColumnState {
288
288
  colId: string;
289
289
  width: number;
@@ -296,6 +296,10 @@ interface Messages {
296
296
  apply: string;
297
297
  reset: string;
298
298
  selectAll: string;
299
+ /** Filter row list when a set filter passes more than one value: '({n} selected)'. */
300
+ setSelected: string;
301
+ /** Column menu with rollup: the entry that removes a column's aggregate. */
302
+ noAggregate: string;
299
303
  search: string;
300
304
  blanks: string;
301
305
  value: string;
@@ -384,18 +388,6 @@ interface Messages {
384
388
  /** Context menu: download a PDF of the rows. */
385
389
  exportPdf: string;
386
390
  exportJson: string;
387
- /** The assistant panel. */
388
- ai: {
389
- title: string;
390
- placeholder: string;
391
- send: string;
392
- thinking: string;
393
- undo: string;
394
- undone: string;
395
- failed: string;
396
- skipped: string;
397
- done: string;
398
- };
399
391
  /** Conditional formatting dialog. */
400
392
  cf: {
401
393
  title: string;
@@ -602,118 +594,9 @@ interface ConditionalFormat {
602
594
  min?: number;
603
595
  max?: number;
604
596
  }
605
- /** The AI assistant: the grid asks your server, your server asks the model and answers with actions. */
606
- interface AssistantOptions {
607
- /** Your endpoint (POST JSON). It holds the model API key; the browser never sees it. */
608
- url: string;
609
- headers?: Record<string, string> | (() => Record<string, string>);
610
- credentials?: RequestCredentials;
611
- /** Rows sent as examples (default 5, max 50; 0 sends none). Columns always go as summaries, not rows. */
612
- sampleRows?: number;
613
- /** Extra facts for the model, such as what the screen is for. */
614
- context?: () => Record<string, unknown>;
615
- /** Ideas shown under the input. */
616
- suggestions?: string[];
617
- }
618
- /** A column as the assistant sees it. */
619
- interface AssistantColumn {
620
- id: string;
621
- header: string;
622
- type?: string;
623
- formula?: string;
624
- aggFunc?: string;
625
- hidden?: boolean;
626
- blanks?: number;
627
- distinct?: number;
628
- min?: number | string;
629
- max?: number | string;
630
- avg?: number;
631
- /** Most frequent values of text columns. */
632
- top?: {
633
- value: string;
634
- count: number;
635
- }[];
636
- }
637
- /** What the grid sends to the assistant endpoint. */
638
- interface AssistantRequest {
639
- prompt: string;
640
- locale: string;
641
- /** Rows after the filters. */
642
- rowCount: number;
643
- totalRows: number;
644
- columns: AssistantColumn[];
645
- sample: Row[];
646
- state: {
647
- sort: SortItem[];
648
- filters: Record<string, FilterModel>;
649
- quickFilter: string;
650
- advancedFilter: AdvancedFilter | null;
651
- groupBy: string[];
652
- pivot: PivotConfig | null;
653
- conditionalFormats: ConditionalFormat[];
654
- };
655
- context?: Record<string, unknown>;
656
- }
657
- /** What the assistant endpoint answers with: { message?, actions? }. */
658
- type AssistantAction = {
659
- type: 'sort';
660
- sort: SortItem[];
661
- } | {
662
- type: 'filter';
663
- colId: string;
664
- model: FilterModel | null;
665
- } | {
666
- type: 'clearFilters';
667
- } | {
668
- type: 'quickFilter';
669
- text: string;
670
- } | {
671
- type: 'advancedFilter';
672
- filter: AdvancedFilter | null;
673
- } | {
674
- type: 'groupBy';
675
- colIds: string[];
676
- expand?: boolean;
677
- } | {
678
- type: 'pivot';
679
- pivot: PivotConfig | null;
680
- } | {
681
- type: 'showColumns' | 'hideColumns';
682
- colIds: string[];
683
- } | {
684
- type: 'conditionalFormat';
685
- format: ConditionalFormat;
686
- } | {
687
- type: 'clearConditionalFormats';
688
- } | {
689
- type: 'addColumn';
690
- column: {
691
- id: string;
692
- header?: string;
693
- formula: string;
694
- type?: 'number' | 'text' | 'date';
695
- };
696
- } | {
697
- type: 'summary';
698
- summary: SummaryOptions | null;
699
- } | {
700
- type: 'chart';
701
- chartType?: ChartOptions['type'];
702
- colIds: string[];
703
- title?: string;
704
- } | {
705
- type: 'message';
706
- text: string;
707
- };
708
- interface AssistantResult {
709
- message: string;
710
- applied: AssistantAction[];
711
- skipped: {
712
- action: unknown;
713
- reason: string;
714
- }[];
715
- /** Put the grid back as it was before these actions. */
716
- undo(): void;
597
+ interface RollupOptions {
598
+ /** Columns the rows merge by; only the shown ones count, so hiding one merges the rows by the rest. */
599
+ by: string[];
717
600
  }
718
601
  interface PivotConfig {
719
602
  /** Row fields; every field but the last becomes a group level. */
@@ -757,6 +640,16 @@ interface GridOptions {
757
640
  fontSize?: number;
758
641
  /** CSS font-family list (default: the theme's system font stack). */
759
642
  fontFamily?: string;
643
+ /** Space in px on the left and right inside every cell and header cell (default: the theme's, 12 at normal density). Wins over `density`. */
644
+ cellPadding?: number;
645
+ /**
646
+ * Merge rows by columns. `{ by: ['country', 'name', 'company'] }`: rows that agree on the shown `by` columns
647
+ * become one row; hide or remove one of them and the rows merge by the others, show it again and they split.
648
+ * `true`: every shown column without an `aggFunc` is a `by` column. Columns with an `aggFunc` show the aggregate
649
+ * of the merged rows; any other column shows its value when the merged rows share it, else stays empty. Merged
650
+ * rows cannot be edited. Change it later with setRollup; set a column's aggregate with setColumnAggFunc.
651
+ */
652
+ rollup?: boolean | RollupOptions;
760
653
  /** Dock a Columns panel on the right. `{ open: true }` starts expanded. */
761
654
  sideBar?: boolean | {
762
655
  open?: boolean;
@@ -810,8 +703,6 @@ interface GridOptions {
810
703
  editType?: 'cell' | 'row';
811
704
  /** Briefly highlight cells whose value changed through applyTransaction (default true). */
812
705
  flashCells?: boolean;
813
- /** An AI assistant answered by your server (see AssistantOptions). */
814
- assistant?: AssistantOptions;
815
706
  /** Rules that colour cells by their values, and data bars, colour scales and icon sets. */
816
707
  conditionalFormats?: ConditionalFormat[];
817
708
  /** Show "Conditional formatting…" in the column menu (default true). */
@@ -1009,16 +900,6 @@ interface GridEvents {
1009
900
  conditionalFormatsChange: {
1010
901
  formats: ConditionalFormat[];
1011
902
  };
1012
- /** The assistant answered and its actions were applied. */
1013
- assistantAnswer: {
1014
- prompt: string;
1015
- message: string;
1016
- applied: AssistantAction[];
1017
- skipped: {
1018
- action: unknown;
1019
- reason: string;
1020
- }[];
1021
- };
1022
903
  /** A row was dropped on this grid (also from another grid of the same drag group). */
1023
904
  rowDrop: RowDropParams & {
1024
905
  fromGrid: GridApi | null;
@@ -1125,10 +1006,6 @@ interface GridApi {
1125
1006
  flushAsyncTransactions(): void;
1126
1007
  setConditionalFormats(formats: ConditionalFormat[]): void;
1127
1008
  getConditionalFormats(): ConditionalFormat[];
1128
- /** Ask the assistant (options.assistant) and apply its answer. */
1129
- askAssistant(prompt: string): Promise<AssistantResult>;
1130
- /** The assistant panel. */
1131
- openAssistant(): void;
1132
1009
  /** The conditional formatting dialog for a column. */
1133
1010
  openConditionalFormats(colId: string): void;
1134
1011
  /** Conditions across columns, applied together with the column filters; null clears it. */
@@ -1185,6 +1062,15 @@ interface GridApi {
1185
1062
  size?: number;
1186
1063
  family?: string | null;
1187
1064
  }): void;
1065
+ /** Left and right space inside every cell and header cell, in px; `null` goes back to the theme / density value. */
1066
+ setCellPadding(px: number | null): void;
1067
+ /** The cell padding in use, in px. */
1068
+ getCellPadding(): number;
1069
+ /** Change the `rollup` option: `{ by }`, `true`, or `false` for the original rows. */
1070
+ setRollup(rollup: boolean | RollupOptions): void;
1071
+ getRollup(): boolean | RollupOptions;
1072
+ /** Set a column's aggregate (group rows, rollup); null removes it, so with rollup the rows merge by that column. */
1073
+ setColumnAggFunc(colId: string, aggFunc: Aggregator | null): void;
1188
1074
  setColumnVisible(colId: string, visible: boolean): void;
1189
1075
  autoSizeColumns(colIds?: string[]): void;
1190
1076
  resetColumnState(): void;
@@ -1301,4 +1187,4 @@ interface GridApi {
1301
1187
  destroy(): void;
1302
1188
  }
1303
1189
 
1304
- export { type SavedGridState as $, type AdvancedFilter as A, type EditorSpec as B, type CellEvent as C, type Datasource as D, type ExportOptions as E, type FilterModel as F, type GridOptions as G, type FilterOp as H, type FilterType as I, type GridEvents as J, type GridRange as K, type LocalePack as L, type InvalidCell as M, type JsonExportOptions as N, type KeyAction as O, type MergeSelectionGroup as P, type Messages as Q, type Row as R, type NumberFilterModel as S, type NumberOp as T, type PdfOptions as U, type PivotConfig as V, type PrintOptions as W, type Region as X, type RowDragOptions as Y, type RowDropParams as Z, type RowDropPosition as _, type GridApi as a, type SavedStatePart as a0, type ScrollPosition as a1, type SelectOption as a2, type ServerParams as a3, type SetFilterModel as a4, type SortDir as a5, type SortItem as a6, type SpanParams as a7, type SummaryCell as a8, type SummaryOptions as a9, type SummaryRowDef as aa, type TextFilterModel as ab, type TextOp as ac, type TransactionResult as ad, type XlsxCell as ae, type XlsxSheet as af, readXlsx as ag, writeXlsx as ah, type RowTransaction as b, type AdvancedFilterCondition as c, type Aggregator as d, type AssistantAction as e, type AssistantColumn as f, type AssistantOptions as g, type AssistantRequest as h, type AssistantResult as i, type CellParams as j, type CellStyle as k, type ChartHandle as l, type ChartOptions as m, type ColumnDef as n, type ColumnState as o, type ColumnType as p, type CombinedFilterModel as q, type ConditionalFormat as r, type ConditionalFormatType as s, type ConditionalOp as t, type ContextMenuItem as u, type ContextMenuParams as v, type CustomEditor as w, type DateFilterModel as x, type DateOp as y, type EditorParams as z };
1190
+ export { type ServerParams as $, type AdvancedFilter as A, type Messages as B, type CellEvent as C, type Datasource as D, type ExportOptions as E, type FilterModel as F, type GridOptions as G, type NumberOp as H, type InvalidCell as I, type JsonExportOptions as J, type KeyAction as K, type LocalePack as L, type MergeSelectionGroup as M, type NumberFilterModel as N, type PivotConfig as O, type PdfOptions as P, type PrintOptions as Q, type Row as R, type Region as S, type RollupOptions as T, type RowDragOptions as U, type RowDropParams as V, type RowDropPosition as W, type SavedGridState as X, type SavedStatePart as Y, type ScrollPosition as Z, type SelectOption as _, type GridApi as a, type SetFilterModel as a0, type SortDir as a1, type SortItem as a2, type SpanParams as a3, type SummaryCell as a4, type SummaryOptions as a5, type SummaryRowDef as a6, type TextFilterModel as a7, type TextOp as a8, type TransactionResult as a9, type XlsxCell as aa, type XlsxSheet as ab, readXlsx as ac, writeXlsx as ad, type RowTransaction as b, type AdvancedFilterCondition as c, type Aggregator as d, type CellParams as e, type CellStyle as f, type ChartHandle as g, type ChartOptions as h, type ColumnDef as i, type ColumnState as j, type ColumnType as k, type CombinedFilterModel as l, type ConditionalFormat as m, type ConditionalFormatType as n, type ConditionalOp as o, type ContextMenuItem as p, type ContextMenuParams as q, type CustomEditor as r, type DateFilterModel as s, type DateOp as t, type EditorParams as u, type EditorSpec as v, type FilterOp as w, type FilterType as x, type GridEvents as y, type GridRange as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freegridjs/core",
3
- "version": "1.9.5",
3
+ "version": "1.11.0",
4
4
  "description": "FreeGrid — a fast data grid for the web: virtual scrolling, grouping, pivot, charts, Excel export, 7 languages. Free core; paid features free with a personal key.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",