@freegridjs/core 1.0.1 → 1.6.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.
- package/dist/cdn/freegrid.css +51 -2
- package/dist/cdn/freegrid.esm.js +49 -15
- package/dist/cdn/freegrid.min.js +49 -15
- package/dist/index.d.ts +71 -4
- package/dist/index.js +2590 -273
- package/dist/locales/de.d.ts +1 -1
- package/dist/locales/de.js +17 -0
- package/dist/locales/en.d.ts +1 -1
- package/dist/locales/en.js +17 -0
- package/dist/locales/es.d.ts +1 -1
- package/dist/locales/es.js +17 -0
- package/dist/locales/fr.d.ts +1 -1
- package/dist/locales/fr.js +17 -0
- package/dist/locales/id.d.ts +1 -1
- package/dist/locales/id.js +17 -0
- package/dist/locales/it.d.ts +1 -1
- package/dist/locales/it.js +17 -0
- package/dist/locales/ja.d.ts +1 -1
- package/dist/locales/ja.js +17 -0
- package/dist/locales/ko.d.ts +1 -1
- package/dist/locales/ko.js +17 -0
- package/dist/locales/pt-BR.d.ts +1 -1
- package/dist/locales/pt-BR.js +17 -0
- package/dist/locales/ru.d.ts +1 -1
- package/dist/locales/ru.js +17 -0
- package/dist/locales/th.d.ts +1 -1
- package/dist/locales/th.js +17 -0
- package/dist/locales/vi.d.ts +1 -1
- package/dist/locales/vi.js +17 -0
- package/dist/locales/zh-CN.d.ts +1 -1
- package/dist/locales/zh-CN.js +17 -0
- package/dist/locales/zh-TW.d.ts +1 -1
- package/dist/locales/zh-TW.js +17 -0
- package/dist/styles.css +51 -2
- package/dist/{types-bFz-Q6ac.d.ts → types-DPOWDM8R.d.ts} +286 -8
- package/package.json +1 -1
package/dist/styles.css
CHANGED
|
@@ -130,6 +130,16 @@
|
|
|
130
130
|
font: 600 var(--fg-font-size) var(--fg-font); cursor: pointer;
|
|
131
131
|
}
|
|
132
132
|
.fg-sidebar-tab[aria-expanded="true"] { color: var(--fg-accent); box-shadow: inset 2px 0 var(--fg-accent); }
|
|
133
|
+
.fg-sidebar-open .fg-sidebar-tabs { width: 32px; gap: 4px; padding: 8px 4px 8px 0; }
|
|
134
|
+
.fg-sidebar-open .fg-sidebar-tab {
|
|
135
|
+
position: relative; margin-left: -1px; padding: 14px 0; border: 1px solid var(--fg-border); border-left-color: transparent;
|
|
136
|
+
border-radius: 0 7px 7px 0; background: var(--fg-header-bg); color: var(--fg-muted);
|
|
137
|
+
}
|
|
138
|
+
.fg-sidebar-open .fg-sidebar-tab:hover { color: var(--fg-header-fg); background: var(--fg-row-hover); }
|
|
139
|
+
.fg-sidebar-open .fg-sidebar-tab[aria-expanded="true"] {
|
|
140
|
+
background: var(--fg-bg); color: var(--fg-accent); border-left-color: var(--fg-bg); box-shadow: inset -3px 0 var(--fg-accent); z-index: 1;
|
|
141
|
+
}
|
|
142
|
+
.fg-sidebar-open .fg-sidebar-tab:focus-visible { outline: 2px solid var(--fg-accent); outline-offset: -2px; }
|
|
133
143
|
.fg-chooser { display: flex; flex-direction: column; gap: 6px; padding: 8px; min-height: 0; flex: 1; }
|
|
134
144
|
.fg-chooser-dialog { width: 280px; }
|
|
135
145
|
.fg-chooser-dialog .fg-chooser { max-height: 420px; }
|
|
@@ -195,6 +205,7 @@
|
|
|
195
205
|
.fg-theme-classic .fg-sort-icon, .fg-theme-classic .fg-menu-btn.fg-filter-active { color: #ffd166; }
|
|
196
206
|
.fg-theme-classic .fg-sidebar-tab { color: #c9d2e0; }
|
|
197
207
|
.fg-theme-classic .fg-sidebar-tab[aria-expanded="true"] { color: #ffd166; box-shadow: inset 2px 0 #ffd166; }
|
|
208
|
+
.fg-theme-classic .fg-sidebar-open .fg-sidebar-tab[aria-expanded="true"] { color: var(--fg-accent); box-shadow: inset -3px 0 var(--fg-accent); }
|
|
198
209
|
.fg-theme-board .fg-header-cell, .fg-theme-erp .fg-header-cell, .fg-theme-excel .fg-header-cell, .fg-theme-classic .fg-header-cell { flex-direction: row; justify-content: center; }
|
|
199
210
|
.fg-theme-board .fg-menu-btn, .fg-theme-erp .fg-menu-btn, .fg-theme-excel .fg-menu-btn, .fg-theme-classic .fg-menu-btn {
|
|
200
211
|
position: absolute; right: 6px; top: 50%; transform: translateY(-50%); margin: 0;
|
|
@@ -439,9 +450,15 @@ textarea.fg-editor-control { padding-top: 8px; resize: none; }
|
|
|
439
450
|
.fg-tooltip.fg-theme-dark { background: #e6e9f0; color: #11141b; }
|
|
440
451
|
|
|
441
452
|
/* cells changed by applyTransaction */
|
|
442
|
-
.fg-cell-flash { animation: fg-flash 1s ease-out; }
|
|
453
|
+
.fg-cell-flash { animation: fg-flash var(--fg-flash-duration, 1s) ease-out; }
|
|
443
454
|
@keyframes fg-flash { from { background: color-mix(in srgb, var(--fg-accent) 35%, transparent); } to { background: transparent; } }
|
|
444
|
-
|
|
455
|
+
.fg-cell-flash-up { animation-name: fg-flash-up; }
|
|
456
|
+
.fg-cell-flash-down { animation-name: fg-flash-down; }
|
|
457
|
+
@keyframes fg-flash-up { from { background: color-mix(in srgb, var(--fg-up, #16a34a) 32%, transparent); } to { background: transparent; } }
|
|
458
|
+
@keyframes fg-flash-down { from { background: color-mix(in srgb, var(--fg-down, #dc2626) 32%, transparent); } to { background: transparent; } }
|
|
459
|
+
@media (prefers-reduced-motion: reduce) { .fg-cell-flash { animation: none; outline: 1px solid var(--fg-accent); outline-offset: -1px; }
|
|
460
|
+
.fg-cell-flash-up { outline-color: var(--fg-up, #16a34a); }
|
|
461
|
+
.fg-cell-flash-down { outline-color: var(--fg-down, #dc2626); } }
|
|
445
462
|
|
|
446
463
|
/* editType 'row': the row being edited */
|
|
447
464
|
.fg-row-editing { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--fg-accent) 45%, transparent); background: color-mix(in srgb, var(--fg-accent) 5%, var(--fg-bg)); }
|
|
@@ -468,3 +485,35 @@ textarea.fg-editor-control { padding-top: 8px; resize: none; }
|
|
|
468
485
|
/* density */
|
|
469
486
|
.fg-density-compact { --fg-cell-px: 7px; }
|
|
470
487
|
.fg-density-comfortable { --fg-cell-px: 14px; }
|
|
488
|
+
|
|
489
|
+
/* conditional formats */
|
|
490
|
+
.fg-cf-bar { background-image: linear-gradient(to right, transparent var(--fg-bar-from), color-mix(in srgb, var(--fg-bar-color) 38%, transparent) var(--fg-bar-from), color-mix(in srgb, var(--fg-bar-color) 38%, transparent) var(--fg-bar-to), transparent var(--fg-bar-to)); background-repeat: no-repeat; background-size: 100% 70%; background-position: 0 50%; }
|
|
491
|
+
.fg-cf-icon { display: inline-block; margin-inline-end: 6px; font-size: .9em; line-height: 1; }
|
|
492
|
+
.fg-cf-dialog { width: 340px; }
|
|
493
|
+
.fg-cf-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 10px; }
|
|
494
|
+
.fg-cf-rule { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border: 1px solid var(--fg-border); border-radius: 6px; }
|
|
495
|
+
.fg-cf-rule-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
496
|
+
.fg-cf-sample { flex: none; width: 34px; height: 18px; border-radius: 4px; border: 1px solid var(--fg-border); display: grid; place-items: center; font-size: 11px; }
|
|
497
|
+
.fg-cf-form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
|
|
498
|
+
.fg-cf-form > .fg-cf-wide { grid-column: 1 / -1; }
|
|
499
|
+
.fg-cf-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
500
|
+
.fg-cf-swatch { width: 30px; height: 22px; border-radius: 5px; border: 1px solid var(--fg-border); cursor: pointer; font: 600 11px/1 var(--fg-font); padding: 0; }
|
|
501
|
+
.fg-cf-swatch[aria-pressed="true"] { outline: 2px solid var(--fg-accent); outline-offset: 1px; }
|
|
502
|
+
.fg-cf-empty { color: var(--fg-muted); padding: 4px 0; }
|
|
503
|
+
|
|
504
|
+
/* AI assistant */
|
|
505
|
+
.fg-ai-panel { width: 360px; display: flex; flex-direction: column; gap: 8px; }
|
|
506
|
+
.fg-ai-log { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
|
|
507
|
+
.fg-ai-log:empty { display: none; }
|
|
508
|
+
.fg-ai-msg { padding: 7px 10px; border-radius: 10px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 92%; }
|
|
509
|
+
.fg-ai-user { align-self: flex-end; background: var(--fg-accent); color: var(--fg-accent-fg); border-bottom-right-radius: 3px; }
|
|
510
|
+
.fg-ai-ai { align-self: flex-start; background: var(--fg-header-bg); border: 1px solid var(--fg-border); border-bottom-left-radius: 3px; }
|
|
511
|
+
.fg-ai-error { align-self: flex-start; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; }
|
|
512
|
+
.fg-ai-wait { color: var(--fg-muted); }
|
|
513
|
+
.fg-ai-note { margin-top: 4px; font-size: .9em; color: var(--fg-muted); }
|
|
514
|
+
.fg-ai-undo { margin-top: 6px; height: 24px; padding: 0 10px; }
|
|
515
|
+
.fg-ai-form { display: flex; gap: 6px; align-items: flex-end; }
|
|
516
|
+
.fg-ai-input { flex: 1; resize: vertical; min-height: 40px; max-height: 140px; padding: 6px 8px; font: inherit; }
|
|
517
|
+
.fg-ai-tips { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
518
|
+
.fg-ai-tip { border: 1px solid var(--fg-border); border-radius: 999px; background: none; color: inherit; font: inherit; font-size: .92em; padding: 3px 10px; cursor: pointer; }
|
|
519
|
+
.fg-ai-tip:hover { background: var(--fg-row-hover); }
|
|
@@ -22,6 +22,8 @@ interface XlsxSheet {
|
|
|
22
22
|
/** Rows frozen at the top (also the AutoFilter row when `autoFilter` is set). */
|
|
23
23
|
freezeRows?: number;
|
|
24
24
|
autoFilter?: boolean;
|
|
25
|
+
/** Rows printed at the top of every page (Excel's "rows to repeat at top"). */
|
|
26
|
+
printTitleRows?: number;
|
|
25
27
|
}
|
|
26
28
|
/** Build an .xlsx workbook (stored zip) from rows of values. */
|
|
27
29
|
declare function writeXlsx(sheets: XlsxSheet[]): Uint8Array;
|
|
@@ -136,6 +138,8 @@ interface ColumnDef {
|
|
|
136
138
|
required?: boolean;
|
|
137
139
|
/** Cells may hold formulas like `=qty*price` (same-row fields); the result is shown, sorted and exported. */
|
|
138
140
|
formulas?: boolean;
|
|
141
|
+
/** A computed column: this formula (like `=qty*price`) is worked out for every row; the column needs no field. */
|
|
142
|
+
formula?: string;
|
|
139
143
|
/** Reject a value another row already has in this column (blank values are allowed). */
|
|
140
144
|
unique?: boolean;
|
|
141
145
|
/** Set false (or return false) to keep values out of copies: blocked cells copy as empty text. */
|
|
@@ -203,6 +207,7 @@ interface SavedGridState {
|
|
|
203
207
|
pageSize?: number;
|
|
204
208
|
/** Selected row ids (needs getRowId to survive reloads). */
|
|
205
209
|
selected?: string[];
|
|
210
|
+
conditionalFormats?: ConditionalFormat[];
|
|
206
211
|
}
|
|
207
212
|
type SavedStatePart = keyof SavedGridState;
|
|
208
213
|
/** Row changes from outside (a server push, a websocket): matched by getRowId, not undoable, not tracked as edits. */
|
|
@@ -214,6 +219,8 @@ interface RowTransaction {
|
|
|
214
219
|
update?: Row[];
|
|
215
220
|
/** Rows (or objects with the id fields) to take out. */
|
|
216
221
|
remove?: Row[];
|
|
222
|
+
/** Rows to update when a row with their id exists, else to add (live feeds that send whole rows). */
|
|
223
|
+
upsert?: Row[];
|
|
217
224
|
}
|
|
218
225
|
interface TransactionResult {
|
|
219
226
|
added: Row[];
|
|
@@ -353,6 +360,7 @@ interface Messages {
|
|
|
353
360
|
clearFilters: string;
|
|
354
361
|
exportCsv: string;
|
|
355
362
|
exportExcel: string;
|
|
363
|
+
print: string;
|
|
356
364
|
pivot: string;
|
|
357
365
|
pivotMode: string;
|
|
358
366
|
pivotRows: string;
|
|
@@ -369,6 +377,38 @@ interface Messages {
|
|
|
369
377
|
chartArea: string;
|
|
370
378
|
chartPie: string;
|
|
371
379
|
freeBadge: string;
|
|
380
|
+
/** Context menu: download a PDF of the rows. */
|
|
381
|
+
exportPdf: string;
|
|
382
|
+
exportJson: string;
|
|
383
|
+
/** The assistant panel. */
|
|
384
|
+
ai: {
|
|
385
|
+
title: string;
|
|
386
|
+
placeholder: string;
|
|
387
|
+
send: string;
|
|
388
|
+
thinking: string;
|
|
389
|
+
undo: string;
|
|
390
|
+
undone: string;
|
|
391
|
+
failed: string;
|
|
392
|
+
skipped: string;
|
|
393
|
+
done: string;
|
|
394
|
+
};
|
|
395
|
+
/** Conditional formatting dialog. */
|
|
396
|
+
cf: {
|
|
397
|
+
title: string;
|
|
398
|
+
add: string;
|
|
399
|
+
clear: string;
|
|
400
|
+
none: string;
|
|
401
|
+
type: string;
|
|
402
|
+
style: string;
|
|
403
|
+
wholeRow: string;
|
|
404
|
+
count: string;
|
|
405
|
+
types: Record<ConditionalFormatType, string>;
|
|
406
|
+
ops: {
|
|
407
|
+
notBetween: string;
|
|
408
|
+
notContains: string;
|
|
409
|
+
};
|
|
410
|
+
styles: Record<'red' | 'yellow' | 'green' | 'blue' | 'redText' | 'bold', string>;
|
|
411
|
+
};
|
|
372
412
|
ops: Record<FilterOp, string>;
|
|
373
413
|
}
|
|
374
414
|
interface LocalePack extends Messages {
|
|
@@ -447,6 +487,10 @@ interface Datasource {
|
|
|
447
487
|
}>;
|
|
448
488
|
}
|
|
449
489
|
interface ExportOptions {
|
|
490
|
+
/** xlsx and print: header rows on every printed page (default true). */
|
|
491
|
+
repeatHeader?: boolean;
|
|
492
|
+
/** xlsx and print: the first n data rows also on every printed page. */
|
|
493
|
+
repeatRows?: number;
|
|
450
494
|
/** Column ids in order (hidden columns allowed); default: the displayed data columns. */
|
|
451
495
|
columns?: string[];
|
|
452
496
|
/** 'filtered' (default, current sort and filters), 'all' (source order) or 'selected' (checked rows). */
|
|
@@ -460,6 +504,203 @@ interface ExportOptions {
|
|
|
460
504
|
/** xlsx: carry column align and the text color, background and bold of `cellClass` into the file. Default true. */
|
|
461
505
|
styles?: boolean;
|
|
462
506
|
}
|
|
507
|
+
/** print() and getPrintHtml(): the export options plus how the page looks. */
|
|
508
|
+
interface PdfOptions extends PrintOptions {
|
|
509
|
+
/** Pixels per CSS pixel in the page images (default 2; higher is sharper and larger). */
|
|
510
|
+
resolution?: number;
|
|
511
|
+
/** JPEG quality of the page images, 0–1 (default 0.92). */
|
|
512
|
+
quality?: number;
|
|
513
|
+
}
|
|
514
|
+
interface JsonExportOptions extends ExportOptions {
|
|
515
|
+
/** Object keys: column ids (default) or column headers. */
|
|
516
|
+
keys?: 'id' | 'header';
|
|
517
|
+
/** Values as shown in the grid (formatted text) instead of the raw values. */
|
|
518
|
+
formatted?: boolean;
|
|
519
|
+
/** Indentation (default 2; 0 for one line). */
|
|
520
|
+
space?: number;
|
|
521
|
+
}
|
|
522
|
+
interface PrintOptions extends ExportOptions {
|
|
523
|
+
/** Heading above the table; also the document title. */
|
|
524
|
+
title?: string;
|
|
525
|
+
/** A line under the title, such as the period or the filters used. */
|
|
526
|
+
subtitle?: string;
|
|
527
|
+
/** Text at the bottom left of every page. */
|
|
528
|
+
footer?: string;
|
|
529
|
+
/** Default 'A4'. */
|
|
530
|
+
paper?: 'A4' | 'A3' | 'A5' | 'B4' | 'B5' | 'letter' | 'legal';
|
|
531
|
+
/** 'auto' (default) turns the page sideways when the columns are too wide for portrait. */
|
|
532
|
+
orientation?: 'portrait' | 'landscape' | 'auto';
|
|
533
|
+
/** Scale the columns to the page width, keeping their proportions. Default true. */
|
|
534
|
+
fitToWidth?: boolean;
|
|
535
|
+
/** Print group rows with their counts and totals (every group, open or not). Default true. */
|
|
536
|
+
groups?: boolean;
|
|
537
|
+
/** Print the summary rows. Default true. */
|
|
538
|
+
summary?: boolean;
|
|
539
|
+
/** Shade every other row. Default true. */
|
|
540
|
+
striped?: boolean;
|
|
541
|
+
/** "1 / 3" at the bottom right of every page. Default true. */
|
|
542
|
+
pageNumbers?: boolean;
|
|
543
|
+
/** The print date and time at the top right. Default true. */
|
|
544
|
+
printedAt?: boolean;
|
|
545
|
+
/** A row number column. Default: when the grid shows row numbers. */
|
|
546
|
+
rowNumbers?: boolean;
|
|
547
|
+
/** Repeat the title block on every page. Default false. */
|
|
548
|
+
repeatTitle?: boolean;
|
|
549
|
+
}
|
|
550
|
+
/** Look of a cell set by a conditional format. Colours: #hex, rgb(), hsl(), names or var(--x). */
|
|
551
|
+
interface CellStyle {
|
|
552
|
+
color?: string;
|
|
553
|
+
background?: string;
|
|
554
|
+
bold?: boolean;
|
|
555
|
+
italic?: boolean;
|
|
556
|
+
strike?: boolean;
|
|
557
|
+
}
|
|
558
|
+
type ConditionalFormatType = 'value' | 'formula' | 'top' | 'bottom' | 'aboveAverage' | 'belowAverage' | 'duplicate' | 'unique' | 'dataBar' | 'colorScale' | 'iconSet';
|
|
559
|
+
type ConditionalOp = 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'between' | 'notBetween' | 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'blank' | 'notBlank';
|
|
560
|
+
/** A conditional format: a rule that styles cells, or a scale drawn over a column. Later rules win on conflicts. */
|
|
561
|
+
interface ConditionalFormat {
|
|
562
|
+
/** Column ids the format applies to. */
|
|
563
|
+
columns: string[];
|
|
564
|
+
/** Default 'value'. */
|
|
565
|
+
type?: ConditionalFormatType;
|
|
566
|
+
/** 'value': how the cell is compared with value (and valueTo for between). */
|
|
567
|
+
op?: ConditionalOp;
|
|
568
|
+
value?: unknown;
|
|
569
|
+
valueTo?: unknown;
|
|
570
|
+
/** 'formula': a formula over the row, true to apply, e.g. '=amount > target'. */
|
|
571
|
+
formula?: string;
|
|
572
|
+
/** 'top' / 'bottom': how many cells (default 10), or a percentage with percent: true. */
|
|
573
|
+
rank?: number;
|
|
574
|
+
percent?: boolean;
|
|
575
|
+
/** The look of matching cells. */
|
|
576
|
+
style?: CellStyle;
|
|
577
|
+
/** Style every cell of the row when the first column (or the formula) matches. */
|
|
578
|
+
row?: boolean;
|
|
579
|
+
/** Matching cells get no styles from later rules. */
|
|
580
|
+
stopIfTrue?: boolean;
|
|
581
|
+
/** 'dataBar': the bar colour (default the accent colour). */
|
|
582
|
+
color?: string;
|
|
583
|
+
/** 'colorScale': two or three #hex colours from the lowest to the highest value. */
|
|
584
|
+
colors?: string[];
|
|
585
|
+
/** 'iconSet': default 'arrows'. */
|
|
586
|
+
icons?: 'arrows' | 'traffic' | 'signs';
|
|
587
|
+
/** Scales: the values the bar or colours run between (default the column's lowest and highest). */
|
|
588
|
+
min?: number;
|
|
589
|
+
max?: number;
|
|
590
|
+
}
|
|
591
|
+
/** The AI assistant: the grid asks your server, your server asks the model and answers with actions. */
|
|
592
|
+
interface AssistantOptions {
|
|
593
|
+
/** Your endpoint (POST JSON). It holds the model API key; the browser never sees it. */
|
|
594
|
+
url: string;
|
|
595
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
596
|
+
credentials?: RequestCredentials;
|
|
597
|
+
/** Rows sent as examples (default 5, max 50; 0 sends none). Columns always go as summaries, not rows. */
|
|
598
|
+
sampleRows?: number;
|
|
599
|
+
/** Extra facts for the model, such as what the screen is for. */
|
|
600
|
+
context?: () => Record<string, unknown>;
|
|
601
|
+
/** Ideas shown under the input. */
|
|
602
|
+
suggestions?: string[];
|
|
603
|
+
}
|
|
604
|
+
/** A column as the assistant sees it. */
|
|
605
|
+
interface AssistantColumn {
|
|
606
|
+
id: string;
|
|
607
|
+
header: string;
|
|
608
|
+
type?: string;
|
|
609
|
+
formula?: string;
|
|
610
|
+
aggFunc?: string;
|
|
611
|
+
hidden?: boolean;
|
|
612
|
+
blanks?: number;
|
|
613
|
+
distinct?: number;
|
|
614
|
+
min?: number | string;
|
|
615
|
+
max?: number | string;
|
|
616
|
+
avg?: number;
|
|
617
|
+
/** Most frequent values of text columns. */
|
|
618
|
+
top?: {
|
|
619
|
+
value: string;
|
|
620
|
+
count: number;
|
|
621
|
+
}[];
|
|
622
|
+
}
|
|
623
|
+
/** What the grid sends to the assistant endpoint. */
|
|
624
|
+
interface AssistantRequest {
|
|
625
|
+
prompt: string;
|
|
626
|
+
locale: string;
|
|
627
|
+
/** Rows after the filters. */
|
|
628
|
+
rowCount: number;
|
|
629
|
+
totalRows: number;
|
|
630
|
+
columns: AssistantColumn[];
|
|
631
|
+
sample: Row[];
|
|
632
|
+
state: {
|
|
633
|
+
sort: SortItem[];
|
|
634
|
+
filters: Record<string, FilterModel>;
|
|
635
|
+
quickFilter: string;
|
|
636
|
+
advancedFilter: AdvancedFilter | null;
|
|
637
|
+
groupBy: string[];
|
|
638
|
+
pivot: PivotConfig | null;
|
|
639
|
+
conditionalFormats: ConditionalFormat[];
|
|
640
|
+
};
|
|
641
|
+
context?: Record<string, unknown>;
|
|
642
|
+
}
|
|
643
|
+
/** What the assistant endpoint answers with: { message?, actions? }. */
|
|
644
|
+
type AssistantAction = {
|
|
645
|
+
type: 'sort';
|
|
646
|
+
sort: SortItem[];
|
|
647
|
+
} | {
|
|
648
|
+
type: 'filter';
|
|
649
|
+
colId: string;
|
|
650
|
+
model: FilterModel | null;
|
|
651
|
+
} | {
|
|
652
|
+
type: 'clearFilters';
|
|
653
|
+
} | {
|
|
654
|
+
type: 'quickFilter';
|
|
655
|
+
text: string;
|
|
656
|
+
} | {
|
|
657
|
+
type: 'advancedFilter';
|
|
658
|
+
filter: AdvancedFilter | null;
|
|
659
|
+
} | {
|
|
660
|
+
type: 'groupBy';
|
|
661
|
+
colIds: string[];
|
|
662
|
+
expand?: boolean;
|
|
663
|
+
} | {
|
|
664
|
+
type: 'pivot';
|
|
665
|
+
pivot: PivotConfig | null;
|
|
666
|
+
} | {
|
|
667
|
+
type: 'showColumns' | 'hideColumns';
|
|
668
|
+
colIds: string[];
|
|
669
|
+
} | {
|
|
670
|
+
type: 'conditionalFormat';
|
|
671
|
+
format: ConditionalFormat;
|
|
672
|
+
} | {
|
|
673
|
+
type: 'clearConditionalFormats';
|
|
674
|
+
} | {
|
|
675
|
+
type: 'addColumn';
|
|
676
|
+
column: {
|
|
677
|
+
id: string;
|
|
678
|
+
header?: string;
|
|
679
|
+
formula: string;
|
|
680
|
+
type?: 'number' | 'text' | 'date';
|
|
681
|
+
};
|
|
682
|
+
} | {
|
|
683
|
+
type: 'summary';
|
|
684
|
+
summary: SummaryOptions | null;
|
|
685
|
+
} | {
|
|
686
|
+
type: 'chart';
|
|
687
|
+
chartType?: ChartOptions['type'];
|
|
688
|
+
colIds: string[];
|
|
689
|
+
title?: string;
|
|
690
|
+
} | {
|
|
691
|
+
type: 'message';
|
|
692
|
+
text: string;
|
|
693
|
+
};
|
|
694
|
+
interface AssistantResult {
|
|
695
|
+
message: string;
|
|
696
|
+
applied: AssistantAction[];
|
|
697
|
+
skipped: {
|
|
698
|
+
action: unknown;
|
|
699
|
+
reason: string;
|
|
700
|
+
}[];
|
|
701
|
+
/** Put the grid back as it was before these actions. */
|
|
702
|
+
undo(): void;
|
|
703
|
+
}
|
|
463
704
|
interface PivotConfig {
|
|
464
705
|
/** Row fields; every field but the last becomes a group level. */
|
|
465
706
|
rows: string[];
|
|
@@ -553,6 +794,16 @@ interface GridOptions {
|
|
|
553
794
|
editType?: 'cell' | 'row';
|
|
554
795
|
/** Briefly highlight cells whose value changed through applyTransaction (default true). */
|
|
555
796
|
flashCells?: boolean;
|
|
797
|
+
/** An AI assistant answered by your server (see AssistantOptions). */
|
|
798
|
+
assistant?: AssistantOptions;
|
|
799
|
+
/** Rules that colour cells by their values, and data bars, colour scales and icon sets. */
|
|
800
|
+
conditionalFormats?: ConditionalFormat[];
|
|
801
|
+
/** Show "Conditional formatting…" in the column menu (default true). */
|
|
802
|
+
conditionalFormatMenu?: boolean;
|
|
803
|
+
/** How long a changed cell flashes, in ms (default 1000). Numbers flash green going up and red going down. */
|
|
804
|
+
flashDuration?: number;
|
|
805
|
+
/** applyTransactionAsync: how long to collect transactions before applying them together, in ms (default 50). */
|
|
806
|
+
asyncTransactionWait?: number;
|
|
556
807
|
/** Row spacing: 'compact', 'normal' (default) or 'comfortable'. Fixed rowHeight / headerHeight win. */
|
|
557
808
|
density?: 'compact' | 'normal' | 'comfortable';
|
|
558
809
|
/** Shown when there are no rows: text, or a function returning text or an element (filtered: the filters hide every row). */
|
|
@@ -724,6 +975,19 @@ interface GridEvents {
|
|
|
724
975
|
};
|
|
725
976
|
/** applyTransaction (or a batch of applyTransactionAsync) finished. */
|
|
726
977
|
transactionApplied: TransactionResult;
|
|
978
|
+
conditionalFormatsChange: {
|
|
979
|
+
formats: ConditionalFormat[];
|
|
980
|
+
};
|
|
981
|
+
/** The assistant answered and its actions were applied. */
|
|
982
|
+
assistantAnswer: {
|
|
983
|
+
prompt: string;
|
|
984
|
+
message: string;
|
|
985
|
+
applied: AssistantAction[];
|
|
986
|
+
skipped: {
|
|
987
|
+
action: unknown;
|
|
988
|
+
reason: string;
|
|
989
|
+
}[];
|
|
990
|
+
};
|
|
727
991
|
/** A row was dropped on this grid (also from another grid of the same drag group). */
|
|
728
992
|
rowDrop: RowDropParams & {
|
|
729
993
|
fromGrid: GridApi | null;
|
|
@@ -817,6 +1081,16 @@ interface GridApi {
|
|
|
817
1081
|
applyTransaction(tx: RowTransaction): TransactionResult;
|
|
818
1082
|
/** Queue a transaction; queued ones are merged and applied together about every 50 ms. */
|
|
819
1083
|
applyTransactionAsync(tx: RowTransaction): void;
|
|
1084
|
+
/** Apply the queued applyTransactionAsync transactions now. */
|
|
1085
|
+
flushAsyncTransactions(): void;
|
|
1086
|
+
setConditionalFormats(formats: ConditionalFormat[]): void;
|
|
1087
|
+
getConditionalFormats(): ConditionalFormat[];
|
|
1088
|
+
/** Ask the assistant (options.assistant) and apply its answer. */
|
|
1089
|
+
askAssistant(prompt: string): Promise<AssistantResult>;
|
|
1090
|
+
/** The assistant panel. */
|
|
1091
|
+
openAssistant(): void;
|
|
1092
|
+
/** The conditional formatting dialog for a column. */
|
|
1093
|
+
openConditionalFormats(colId: string): void;
|
|
820
1094
|
/** Conditions across columns, applied together with the column filters; null clears it. */
|
|
821
1095
|
setAdvancedFilter(filter: AdvancedFilter | null): void;
|
|
822
1096
|
getAdvancedFilter(): AdvancedFilter | null;
|
|
@@ -831,14 +1105,14 @@ interface GridApi {
|
|
|
831
1105
|
getDensity(): 'compact' | 'normal' | 'comfortable';
|
|
832
1106
|
/** Show the 'loading' or 'noRows' overlay yourself (for example while your own request runs); null goes back to automatic. */
|
|
833
1107
|
showOverlay(kind: 'loading' | 'noRows' | null): void;
|
|
834
|
-
/** Print the rows as a table (current sort and filters
|
|
835
|
-
print(options?:
|
|
836
|
-
|
|
837
|
-
|
|
1108
|
+
/** Print the rows as a table (current sort and filters, group rows and summary rows) on the paper you choose. */
|
|
1109
|
+
print(options?: PrintOptions): void;
|
|
1110
|
+
/** The print page as a PDF file (null when the browser cannot draw on a canvas). */
|
|
1111
|
+
getPdf(options?: PdfOptions): Uint8Array | null;
|
|
1112
|
+
/** Download getPdf() as a .pdf file. */
|
|
1113
|
+
exportPdf(filename?: string, options?: PdfOptions): void;
|
|
838
1114
|
/** The HTML page print() would print. */
|
|
839
|
-
getPrintHtml(options?:
|
|
840
|
-
title?: string;
|
|
841
|
-
}): string;
|
|
1115
|
+
getPrintHtml(options?: PrintOptions): string;
|
|
842
1116
|
/** Check every editable cell against required, unique and validate. Empty when all rows are valid. */
|
|
843
1117
|
validate(): InvalidCell[];
|
|
844
1118
|
/** Scroll offsets of the rows area in px. */
|
|
@@ -950,6 +1224,10 @@ interface GridApi {
|
|
|
950
1224
|
getCsv(options?: ExportOptions): string;
|
|
951
1225
|
/** Download a CSV file (UTF-8 with BOM so Excel reads non-Latin text). */
|
|
952
1226
|
exportCsv(filename?: string, options?: ExportOptions): void;
|
|
1227
|
+
/** The rows as a JSON array of objects. */
|
|
1228
|
+
getJson(options?: JsonExportOptions): string;
|
|
1229
|
+
/** Download getJson() as a .json file. */
|
|
1230
|
+
exportJson(filename?: string, options?: JsonExportOptions): void;
|
|
953
1231
|
/** An .xlsx workbook of the rows. */
|
|
954
1232
|
getXlsx(options?: ExportOptions): Uint8Array;
|
|
955
1233
|
exportXlsx(filename?: string, options?: ExportOptions): void;
|
|
@@ -965,4 +1243,4 @@ interface GridApi {
|
|
|
965
1243
|
destroy(): void;
|
|
966
1244
|
}
|
|
967
1245
|
|
|
968
|
-
export { type
|
|
1246
|
+
export { type SavedStatePart 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 Messages as P, type NumberFilterModel as Q, type Row as R, type NumberOp as S, type PdfOptions as T, type PivotConfig as U, type PrintOptions as V, type Region as W, type RowDragOptions as X, type RowDropParams as Y, type RowDropPosition as Z, type SavedGridState as _, type GridApi as a, type ScrollPosition as a0, type SelectOption as a1, type ServerParams as a2, type SetFilterModel as a3, type SortDir as a4, type SortItem as a5, type SpanParams as a6, type SummaryCell as a7, type SummaryOptions as a8, type SummaryRowDef as a9, type TextFilterModel as aa, type TextOp as ab, type TransactionResult as ac, type XlsxCell as ad, type XlsxSheet as ae, readXlsx as af, writeXlsx as ag, 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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@freegridjs/core",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "FreeGrid — a fast data grid for the web (free for personal use): virtual scrolling, grouping, pivot, charts, Excel export, 7 languages.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|