@everygrid/grid 0.4.7

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.

Potentially problematic release.


This version of @everygrid/grid might be problematic. Click here for more details.

Files changed (74) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +680 -0
  3. package/dist/Everygrid.css +3 -0
  4. package/dist/everygrid-config.json +7 -0
  5. package/dist/everygrid.standalone.js +401 -0
  6. package/dist/i18n/en.json.d.ts +86 -0
  7. package/dist/i18n/ko.json.d.ts +86 -0
  8. package/dist/index.d.ts +2 -0
  9. package/dist/index.js +24227 -0
  10. package/dist/src/components/ColumnSelectorComponent.d.ts +8 -0
  11. package/dist/src/components/DiffPopupComponent.d.ts +14 -0
  12. package/dist/src/components/EmptyGridPlaceholderComponent.d.ts +15 -0
  13. package/dist/src/components/EverygridComponent.d.ts +5 -0
  14. package/dist/src/components/ExcelViewComponent.d.ts +20 -0
  15. package/dist/src/components/GridTableComponent.d.ts +28 -0
  16. package/dist/src/components/GridToolbarComponent.d.ts +49 -0
  17. package/dist/src/components/HiddenColumnSelectorComponent.d.ts +7 -0
  18. package/dist/src/components/InsertedRowsComponent.d.ts +21 -0
  19. package/dist/src/components/MobileColumnSelectorComponent.d.ts +8 -0
  20. package/dist/src/components/NestedTableComponent.d.ts +10 -0
  21. package/dist/src/components/PaginationComponent.d.ts +21 -0
  22. package/dist/src/components/PinnedTableComponent.d.ts +26 -0
  23. package/dist/src/components/PopupComponent.d.ts +29 -0
  24. package/dist/src/components/RowCountComponent.d.ts +18 -0
  25. package/dist/src/components/RowDetailComponent.d.ts +8 -0
  26. package/dist/src/components/TableCellComponent.d.ts +18 -0
  27. package/dist/src/components/TextEditorPopupComponent.d.ts +6 -0
  28. package/dist/src/core/Everygrid.d.ts +568 -0
  29. package/dist/src/core/ExcelView.d.ts +28 -0
  30. package/dist/src/core/GridHandle.d.ts +214 -0
  31. package/dist/src/core/GridHandle.test.d.ts +1 -0
  32. package/dist/src/core/ResizeUtils.d.ts +3 -0
  33. package/dist/src/core/highlightUtils.d.ts +4 -0
  34. package/dist/src/core/normalizeOptions.d.ts +13 -0
  35. package/dist/src/core/normalizeOptions.test.d.ts +1 -0
  36. package/dist/src/core/types.d.ts +361 -0
  37. package/dist/src/core/useVirtualWindow.d.ts +89 -0
  38. package/dist/src/core/useVirtualWindow.test.d.ts +1 -0
  39. package/dist/src/core/utils.d.ts +19 -0
  40. package/dist/src/i18n/I18n.d.ts +16 -0
  41. package/dist/src/icons/ChevronDownIcon.d.ts +2 -0
  42. package/dist/src/icons/ColumnWidthIcon.d.ts +3 -0
  43. package/dist/src/icons/ColumnsIcon.d.ts +3 -0
  44. package/dist/src/icons/CommaIcon.d.ts +1 -0
  45. package/dist/src/icons/ConfigIcon.d.ts +4 -0
  46. package/dist/src/icons/DiffIcon.d.ts +4 -0
  47. package/dist/src/icons/DownloadIcon.d.ts +3 -0
  48. package/dist/src/icons/EditIcon.d.ts +1 -0
  49. package/dist/src/icons/ExcelIcon.d.ts +3 -0
  50. package/dist/src/icons/GlobeIcon.d.ts +2 -0
  51. package/dist/src/icons/HideIcon.d.ts +1 -0
  52. package/dist/src/icons/InfoIcon.d.ts +2 -0
  53. package/dist/src/icons/InsertRowIcon.d.ts +4 -0
  54. package/dist/src/icons/MobileColumnsIcon.d.ts +3 -0
  55. package/dist/src/icons/PinEmptyIcon.d.ts +1 -0
  56. package/dist/src/icons/PinFilledIcon.d.ts +1 -0
  57. package/dist/src/icons/ReloadIcon.d.ts +3 -0
  58. package/dist/src/icons/RowDetailIcon.d.ts +3 -0
  59. package/dist/src/icons/SearchIcon.d.ts +3 -0
  60. package/dist/src/icons/SortDownIcon.d.ts +1 -0
  61. package/dist/src/icons/SortResetIcon.d.ts +3 -0
  62. package/dist/src/icons/SortUpIcon.d.ts +1 -0
  63. package/dist/src/icons/TrashIcon.d.ts +3 -0
  64. package/dist/src/icons/UndoIcon.d.ts +3 -0
  65. package/dist/src/index.d.ts +14 -0
  66. package/dist/src/react/index.d.ts +20 -0
  67. package/dist/src/standalone-entry.d.ts +2 -0
  68. package/dist/src/wasm/ExcelExportClient.d.ts +14 -0
  69. package/dist/src/wasm/ExportWorker.d.ts +1 -0
  70. package/dist/src/wasm/GridEngineWasm.d.ts +70 -0
  71. package/dist/src/wasm/GridEngineWorker.d.ts +102 -0
  72. package/dist/wasm/everygrid_wasm.js +422 -0
  73. package/dist/wasm/everygrid_wasm_bg.wasm +0 -0
  74. package/package.json +61 -0
@@ -0,0 +1,8 @@
1
+ import { Everygrid } from '../core/Everygrid';
2
+ export interface ColumnSelectorProps<T extends Record<string, unknown>> {
3
+ allFields: string[];
4
+ container: HTMLElement;
5
+ grid: Everygrid<T>;
6
+ onClose: () => void;
7
+ }
8
+ export declare const ColumnSelectorComponent: <T extends Record<string, unknown>>({ allFields, container, grid, onClose, }: ColumnSelectorProps<T>) => import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { Everygrid } from '../core/Everygrid';
2
+ interface DiffPopupProps<T extends Record<string, unknown>> {
3
+ grid: Everygrid<T>;
4
+ containerId: string;
5
+ onClose: () => void;
6
+ }
7
+ /**
8
+ * The diff, shown by Everygrid itself: a second, read-only grid mounted inside the popup whose
9
+ * rows are the changes since load — an updated row's cells before → after, an inserted or
10
+ * deleted row field by field. Everything the grid does (search, sort, columns, export) works on
11
+ * the diff too. Destroyed with the popup.
12
+ */
13
+ export declare const DiffPopupComponent: <T extends Record<string, unknown>>({ grid, containerId, onClose }: DiffPopupProps<T>) => import("react").JSX.Element;
14
+ export {};
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ interface EmptyGridPlaceholderProps {
3
+ targetId: string;
4
+ dataUrl?: string;
5
+ /** While the grid is indexing, show a skeleton to fill the body instead of the "no data" message. */
6
+ indexing?: boolean;
7
+ /** Skeleton row count — the page size, so the body is the size of the table that replaces it. */
8
+ rows?: number;
9
+ /** Skeleton row height in px, matching the real table's rows. */
10
+ rowHeight?: number;
11
+ /** Skeleton header height in px, matching the real table's header. */
12
+ headerHeight?: number;
13
+ }
14
+ export declare const EmptyGridPlaceholder: React.FC<EmptyGridPlaceholderProps>;
15
+ export {};
@@ -0,0 +1,5 @@
1
+ import { IEverygrid } from '../core/types';
2
+ export declare const EverygridComponent: <T extends Record<string, unknown>>({ grid, container, }: {
3
+ grid: IEverygrid<T>;
4
+ container: HTMLElement;
5
+ }) => import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { default as React } from 'react';
2
+ export interface ExcelViewProps {
3
+ data: unknown[];
4
+ limit?: number;
5
+ isExcel?: boolean;
6
+ }
7
+ export declare const ExcelViewComponent: ({ data, limit, isExcel }: ExcelViewProps) => React.JSX.Element;
8
+ /** Rows per preview page when the grid has no pagination of its own to follow. */
9
+ export declare const EXCEL_PAGE_SIZE = 50;
10
+ export declare const ExcelViewWrapperComponent: <T extends Record<string, unknown>>({ data, toolbar, header, footer, onBodyScroll, }: {
11
+ data: T[];
12
+ toolbar: React.ReactNode;
13
+ /** The strip between toolbar and table — row count, and the preview's top pager when the grid
14
+ * paginates on top. Mirrors the normal view so toggling the preview keeps the same layout. */
15
+ header?: React.ReactNode;
16
+ /** Pagination for the preview — it pages through the whole result rather than truncating it. */
17
+ footer?: React.ReactNode;
18
+ /** Set for grids that scroll rather than page: fires as the preview body nears its end. */
19
+ onBodyScroll?: React.UIEventHandler<HTMLDivElement>;
20
+ }) => React.JSX.Element;
@@ -0,0 +1,28 @@
1
+ import { default as React } from 'react';
2
+ import { GridColumn, IEverygrid } from '../core/types';
3
+ export interface GridTableProps<T extends Record<string, unknown>> {
4
+ grid: IEverygrid<T>;
5
+ columns: GridColumn[];
6
+ /** In virtual mode a row whose block hasn't arrived yet is `undefined` — render a placeholder. */
7
+ displayItems: (T | undefined)[];
8
+ container: HTMLElement;
9
+ containerId: string;
10
+ editableFields: string[];
11
+ currentWidths: Map<string, number>;
12
+ gridTitle?: string;
13
+ startIndex?: number;
14
+ filterText?: string;
15
+ isIndexing?: boolean;
16
+ isExporting?: boolean;
17
+ /** Narrow layout: columns fit the viewport (no horizontal scroll), resizing/pinning are off. */
18
+ isMobile?: boolean;
19
+ /** Set when the target scrolls virtually: spacer heights standing in for the unrendered rows. */
20
+ virtual?: {
21
+ topPad: number;
22
+ bottomPad: number;
23
+ rowHeight: number;
24
+ };
25
+ /** Rows inserted since load: drawn first, tinted, above the data rows. Not part of `displayItems`. */
26
+ insertedItems?: T[];
27
+ }
28
+ export declare const GridTableComponent: <T extends Record<string, unknown>>(props: GridTableProps<T>) => React.ReactElement;
@@ -0,0 +1,49 @@
1
+ import { KeyTree } from '../core/types';
2
+ export interface GridToolbarProps {
3
+ isExcelViewMode: boolean;
4
+ /** While an export runs, filter/sort/reload/reset are locked (they'd corrupt the in-flight file). */
5
+ isExporting?: boolean;
6
+ /** When set (indexing / processing / exporting), loading progress shows inside the search box. */
7
+ statusText?: string;
8
+ /** Numeric progress 0–100 for the loading bar; -1 = indeterminate. */
9
+ progress?: number;
10
+ /** When set, the progress pill shows a Cancel action (abortable worker export only). */
11
+ onCancelExport?: () => void;
12
+ /** True when any column has a custom width — highlights the width-reset segment. */
13
+ hasCustomWidths?: boolean;
14
+ onToggleExcelView: () => void;
15
+ onResetWidths: () => void;
16
+ onShowColumnSelector: () => void;
17
+ onShowHiddenColumnSelector: () => void;
18
+ onDownloadExcel: (scope: 'filtered' | 'all') => void;
19
+ /** Row counts shown under each export-scope option. */
20
+ filteredCount?: number;
21
+ allCount?: number;
22
+ /** Omitted when the grid has no re-fetchable source, which hides the reload button. */
23
+ /** Set when the grid's rowActions allow inserting; the toolbar then ends with a "+ row" button. */
24
+ onInsertRow?: () => void;
25
+ /** Opens the read-only list of every change since load; enabled while there are changes. */
26
+ onShowDiff?: () => void;
27
+ /** Opens the grid's effective configuration in the popup viewer (toolbar.showConfig). */
28
+ onShowConfig?: () => void;
29
+ onReloadData?: () => void;
30
+ isReloading?: boolean;
31
+ onReset: () => void;
32
+ onResetSort: () => void;
33
+ hasChanges: boolean;
34
+ hiddenFields: Set<string>;
35
+ sortInfo: {
36
+ field: string;
37
+ direction: 'asc' | 'desc' | null;
38
+ } | undefined;
39
+ filterText?: string;
40
+ onFilter?: (text: string) => void;
41
+ /** Searchable-key tree for the search-box autocomplete (sub-keys per scope). */
42
+ searchKeys?: KeyTree;
43
+ /** Localized display name for a suggestion key — shown as `key(label)`; the inserted query keeps
44
+ * the real key. Returns the key unchanged when no label is configured. */
45
+ labelOf?: (key: string) => string;
46
+ gridTitle?: string;
47
+ isIndexing?: boolean;
48
+ }
49
+ export declare const GridToolbarComponent: ({ isExcelViewMode, isExporting, statusText, progress, onCancelExport, hasCustomWidths, onToggleExcelView, onResetWidths, onShowColumnSelector, onShowHiddenColumnSelector, onDownloadExcel, filteredCount, allCount, onReloadData, onInsertRow, onShowDiff, onShowConfig, isReloading, onReset, onResetSort, hasChanges, hiddenFields, sortInfo, filterText, onFilter, searchKeys, labelOf, gridTitle, isIndexing, }: GridToolbarProps) => import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { Everygrid } from '../core/Everygrid';
2
+ export interface HiddenColumnSelectorProps<T extends Record<string, unknown>> {
3
+ container: HTMLElement;
4
+ grid: Everygrid<T>;
5
+ onClose: () => void;
6
+ }
7
+ export declare const HiddenColumnSelectorComponent: <T extends Record<string, unknown>>({ container, grid, onClose, }: HiddenColumnSelectorProps<T>) => import("react").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { GridColumn, IEverygrid } from '../core/types';
2
+ interface InsertedRowsProps<T extends Record<string, unknown>> {
3
+ grid: IEverygrid<T>;
4
+ columns: GridColumn[];
5
+ items: T[];
6
+ container: HTMLElement;
7
+ containerId: string;
8
+ editableFields: string[];
9
+ filterText: string;
10
+ rowHeight?: number;
11
+ visibleFields?: string[];
12
+ isMobile?: boolean;
13
+ }
14
+ /**
15
+ * Rows inserted since load, drawn first in a table body — tinted, before any virtual spacer: new
16
+ * rows belong above the data and are not part of the loaded data the window is computed over.
17
+ * The checkbox column stays empty (a new row has no key to be checked by yet). Rendered by the
18
+ * main table and the pinned table alike, so the two stay row-for-row aligned.
19
+ */
20
+ export declare const InsertedRowsComponent: <T extends Record<string, unknown>>({ grid, columns, items, container, containerId, editableFields, filterText, rowHeight, visibleFields, isMobile, }: InsertedRowsProps<T>) => import("react").JSX.Element;
21
+ export {};
@@ -0,0 +1,8 @@
1
+ import { Everygrid } from '../core/Everygrid';
2
+ export interface MobileColumnSelectorProps<T extends Record<string, unknown>> {
3
+ allFields: string[];
4
+ container: HTMLElement;
5
+ grid: Everygrid<T>;
6
+ onClose: () => void;
7
+ }
8
+ export declare const MobileColumnSelectorComponent: <T extends Record<string, unknown>>({ allFields, container, grid, onClose, }: MobileColumnSelectorProps<T>) => import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ interface NestedTableProps {
3
+ data: unknown;
4
+ depth?: number;
5
+ onShowPopup?: () => void;
6
+ filterText?: string;
7
+ elementGate?: (el: unknown) => string;
8
+ }
9
+ declare const NestedTableComponent: React.FC<NestedTableProps>;
10
+ export { NestedTableComponent };
@@ -0,0 +1,21 @@
1
+ import { IEverygrid } from '../core/types';
2
+ import { RowCountProps } from './RowCountComponent';
3
+ export interface PaginationProps<T extends Record<string, unknown>> {
4
+ grid: IEverygrid<T>;
5
+ container: HTMLElement;
6
+ currentPage: number;
7
+ totalPages: number;
8
+ /** Greys the controls out without removing them — used while a reload is in flight. */
9
+ disabled?: boolean;
10
+ /**
11
+ * Set to render the row count inside the bar — the layout from before the count moved to the
12
+ * strip under the toolbar. Selected per grid with `pagination.rowCount: 'inline'`.
13
+ */
14
+ rowCount?: Omit<RowCountProps, 'className'>;
15
+ /**
16
+ * Overrides where a page click goes. The Excel preview pages through the same result on its own
17
+ * axis, so it drives its own state rather than moving the grid underneath.
18
+ */
19
+ onPageChange?: (page: number) => void;
20
+ }
21
+ export declare const PaginationComponent: <T extends Record<string, unknown>>({ grid, container, currentPage, totalPages, disabled, rowCount, onPageChange, }: PaginationProps<T>) => import("react").JSX.Element | null;
@@ -0,0 +1,26 @@
1
+ import { default as React } from 'react';
2
+ import { GridColumn, IEverygrid } from '../core/types';
3
+ interface PinnedTableComponentProps<T extends Record<string, unknown>> {
4
+ instance: IEverygrid<T>;
5
+ columns: GridColumn[];
6
+ displayItems: (T | undefined)[];
7
+ container: HTMLElement;
8
+ containerId: string;
9
+ editableFields: string[];
10
+ gridTitle?: string;
11
+ startIndex?: number;
12
+ filterText?: string;
13
+ isIndexing?: boolean;
14
+ isExporting?: boolean;
15
+ /** Must match the main table's spacers exactly — that identity is what keeps the two
16
+ * tables' rows aligned without any JS height syncing. */
17
+ virtual?: {
18
+ topPad: number;
19
+ bottomPad: number;
20
+ rowHeight: number;
21
+ };
22
+ /** Same rows as the main table's — the two must stay row-for-row aligned. */
23
+ insertedItems?: T[];
24
+ }
25
+ export declare const PinnedTableComponent: <T extends Record<string, unknown>>(props: PinnedTableComponentProps<T>) => React.ReactElement;
26
+ export {};
@@ -0,0 +1,29 @@
1
+ import { default as React } from 'react';
2
+ interface PopupProps {
3
+ onClose: () => void;
4
+ title?: string;
5
+ /** Muted line under the title, e.g. the file a config came from. */
6
+ subtitle?: string;
7
+ /** Hover text for the subtitle (e.g. the full URL when `subtitle` is just the file name). */
8
+ subtitleTitle?: string;
9
+ children: React.ReactNode;
10
+ data?: unknown;
11
+ /**
12
+ * Box size. `s` / `m` / `l` are fixed squares, so detail and text popups all open at the same
13
+ * shape whatever they hold. `auto` is a content-height rectangle for popups with an action
14
+ * footer (the editor), where a square wastes space and crowds the buttons.
15
+ */
16
+ size?: 's' | 'm' | 'l' | 'auto';
17
+ /** Expand the box to fill the viewport (the caller owns the toggle; see MaximizeToggle). */
18
+ maximized?: boolean;
19
+ /** Render the MaximizeToggle in the header, next to the close button, and own its state. */
20
+ maximizable?: boolean;
21
+ }
22
+ /** Icon button toggling a popup between its normal box and the viewport-filling one. */
23
+ export declare const MaximizeToggle: ({ maximized, onToggle, className }: {
24
+ maximized: boolean;
25
+ onToggle: () => void;
26
+ className?: string;
27
+ }) => React.JSX.Element;
28
+ declare const PopupComponent: React.FC<PopupProps>;
29
+ export { PopupComponent };
@@ -0,0 +1,18 @@
1
+ export interface RowCountProps {
2
+ /** 1-based index of the first row on screen, or 0 when there are none. */
3
+ start: number;
4
+ /** 1-based index of the last row on screen. */
5
+ end: number;
6
+ /** Rows remaining after the filter. */
7
+ total: number;
8
+ /** Rows before the filter, for the "x of y" form. */
9
+ rawTotal: number;
10
+ /** Extra class, so the pagination bar can style its own copy differently. */
11
+ className?: string;
12
+ }
13
+ /**
14
+ * The "Showing 1–5 of 10" line. It lives between the toolbar and the table rather than inside the
15
+ * pagination, because it describes the data whether or not the grid is paged — a virtual or
16
+ * single-page grid has just as much use for it, and there is no pagination there to carry it.
17
+ */
18
+ export declare const RowCountComponent: ({ start, end, total, rawTotal, className }: RowCountProps) => import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { Everygrid } from '../core/Everygrid';
2
+ export interface RowDetailProps<T extends Record<string, unknown>> {
3
+ row: T;
4
+ container: HTMLElement;
5
+ grid: Everygrid<T>;
6
+ onClose: () => void;
7
+ }
8
+ export declare const RowDetailComponent: <T extends Record<string, unknown>>({ row, container, grid, onClose, }: RowDetailProps<T>) => import("react").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { JSX } from 'react';
2
+ import { GridColumn, IEverygrid } from '../core/types';
3
+ export interface TableCellProps<T extends Record<string, unknown>> {
4
+ grid: IEverygrid<T>;
5
+ col: GridColumn;
6
+ item: T;
7
+ rowIndex: number;
8
+ containerId: string;
9
+ container: HTMLElement;
10
+ editableFields?: string[];
11
+ filterText?: string;
12
+ /** Mobile only: the data fields shown as visible columns, so the detail button can flag a match
13
+ * that lives in one of the hidden (detail-only) fields. */
14
+ visibleFields?: string[];
15
+ /** Narrow layout: cells truncate, so a match hidden past the ellipsis needs a whole-cell flag. */
16
+ isMobile?: boolean;
17
+ }
18
+ export declare const TableCellComponent: <T extends Record<string, unknown>>(props: TableCellProps<T>) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ export declare const TextEditorPopupComponent: ({ field, data, onClose, onSave }: {
2
+ field: string;
3
+ data: unknown;
4
+ onClose: () => void;
5
+ onSave: (data: unknown) => void;
6
+ }) => import("react").JSX.Element;