@kanunilabs/datagrid 1.9.2 → 1.9.3

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/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { GridRowData, DataGridController, GridDictionary, GridDataType, LookupItem, LookupMatchMode, RowKey, EditingEngineOptions, EditingEngine, RowChange, EditMode, RowNode, GridColumnDef, DataGridCoreConfig, FilterRenderContextBase, FilterNode, GridThemeName, GridPaletteName, GridDensity, DescribeFilterOptions, CardViewOptions, StateStoringConfig, InferColumnsOptions, RowStatusSource } from '@kanunilabs/datagrid-core';
1
+ import { GridRowData, DataGridController, GridDictionary, GridDataType, LookupItem, LookupMatchMode, RowKey, EditingEngineOptions, EditingEngine, RowChange, EditMode, RowNode, GridColumnDef, DataGridCoreConfig, FilterRenderContextBase, FilterNode, GridThemeName, GridPaletteName, GridDensity, DescribeFilterOptions, CardViewOptions, ToolbarOptions, PortalContainer, StateStoringConfig, InferColumnsOptions, RowStatusSource } from '@kanunilabs/datagrid-core';
2
2
  export { CustomFilterOperator, CustomFilterOperatorId, DENSITY_ROW_HEIGHT, DataGridController, FilterNode, GRID_COLOR_SCHEMES, GridColorScheme, GridColumnDef, GridDensity, GridPaletteName, GridRowData, GridTheme, GridThemeName, RowKey, RowNode, SortDescriptor, THEME_ROW_HEIGHT, isPackagedTheme, presetRowHeight } from '@kanunilabs/datagrid-core';
3
3
 
4
4
  /** What a header menu is opened against — the React shape, verbatim. */
@@ -780,8 +780,25 @@ interface CreateGridConfig<TRow = GridRowData> extends Omit<DataGridCoreConfig<T
780
780
  * a vanilla caller has no editor surfacing the `@deprecated` tag.
781
781
  */
782
782
  showRowCount?: boolean;
783
- /** Quick-search + CSV export bar above the grid. */
784
- toolbar?: boolean;
783
+ /**
784
+ * Quick-search + export bar above the grid. `true` shows all of it; an
785
+ * object picks the parts and sets the search box up — React's `toolbar`:
786
+ *
787
+ * toolbar: { export: false, search: { maxLength: 100, debounce: 300, validate } }
788
+ *
789
+ * Your own buttons: `toolbarItemsBefore` / `toolbarItemsAfter`, e.g. built
790
+ * with `toolbarButton()`.
791
+ */
792
+ toolbar?: boolean | ToolbarOptions;
793
+ /**
794
+ * Where the grid draws its popups (header filter, menus, date and lookup
795
+ * lists, dialogs, tooltips): an element, or a function returning one.
796
+ * Default `document.body`. Set it when the grid sits in a modal that makes
797
+ * the rest of the page ignore the pointer; pass the modal's content element
798
+ * (one without `overflow: hidden`). Popups stay in place even when the modal
799
+ * is moved with a CSS transform. Every popup carries `data-kanuni-portal`.
800
+ */
801
+ portalContainer?: PortalContainer;
785
802
  /** "Columns" button in the toolbar opening the visibility chooser. */
786
803
  toolbarColumnChooser?: boolean;
787
804
  /**
@@ -956,6 +973,26 @@ interface GridApi<TRow = GridRowData> {
956
973
  }
957
974
  declare function createGrid<TRow = GridRowData>(container: HTMLElement, config: CreateGridConfig<TRow>): GridApi<TRow>;
958
975
 
976
+ interface ToolbarButtonSpec {
977
+ /** The glyph: an element (e.g. an inline SVG) or SVG/HTML markup. */
978
+ icon: Element | string;
979
+ /** The button's name: its accessible name and the start of its tooltip. */
980
+ label: string;
981
+ /** Keyboard shortcut shown in the tooltip and as `aria-keyshortcuts`. */
982
+ shortcut?: string;
983
+ /** Set while the button cannot be used: clicks are ignored and this is the reason given. */
984
+ disabledReason?: string;
985
+ /** Show the label beside the icon. Default false (icon only). */
986
+ showLabel?: boolean;
987
+ onClick?: () => void;
988
+ /** `data-testid` on the button. */
989
+ testId?: string;
990
+ }
991
+ /** A button for the toolbar or status bar. Call `update()` to change it later. */
992
+ declare function toolbarButton(spec: ToolbarButtonSpec): HTMLButtonElement & {
993
+ update(next: Partial<ToolbarButtonSpec>): void;
994
+ };
995
+
959
996
  /**
960
997
  * Width that fits the header and every rendered cell of `columnId`.
961
998
  * Returns null when nothing could be measured (no such column on screen, or no
@@ -1010,8 +1047,13 @@ interface ConfirmDialogSpec {
1010
1047
  danger?: boolean;
1011
1048
  /** The enterprise wrapper's theme/dark classes, re-established here. */
1012
1049
  surfaceClass?: string;
1050
+ /**
1051
+ * An element inside the grid, so the dialog follows the grid's
1052
+ * `portalContainer` (core `portalContainerFor`). Default: <body>.
1053
+ */
1054
+ anchor?: Element;
1013
1055
  }
1014
1056
  /** Open the dialog; resolves the user's answer and removes itself. */
1015
1057
  declare function openConfirmDialog(spec: ConfirmDialogSpec): Promise<boolean>;
1016
1058
 
1017
- export { CHECKBOX_COLUMN_WIDTH, type CellEditingExtension, type CellEditingHelpers, type CellEditingLayer, type CellEditingOptions, type CellEditorSpec, type CellLookupEditorSpec, type CellMenuOptions, type CellRenderContext, type CellSlotContext, type ConfirmDialogSpec, type CreateGridConfig, DETAIL_COLUMN_WIDTH, type DateEditorSpec, type EditFormField, type EditFormHandle, type EditFormSpec, type ExportKind, type GridApi, type GridMenuItem, type GridNotesConfig, type HeaderMenuContext, type HeaderMenuDeps, type NoteCellContext, PRINT_MAX_ROWS, type PrintLayoutOptions, ROW_DRAG_MIME, ROW_NUMBER_COLUMN_WIDTH, type RowDragConfig, type RowDragPayload, type RowDropEvent, type RowMenuContext, type RowReorderEvent, type RowTemplateContext, type VanillaColumnDef, type VanillaEditorRenderContext, type VanillaFilterRenderApi, attachCellEditing, buildCellEditor, buildDateEditor, buildEditForm, buildHeaderMenu, createGrid, measureBestFitWidth, openConfirmDialog };
1059
+ export { CHECKBOX_COLUMN_WIDTH, type CellEditingExtension, type CellEditingHelpers, type CellEditingLayer, type CellEditingOptions, type CellEditorSpec, type CellLookupEditorSpec, type CellMenuOptions, type CellRenderContext, type CellSlotContext, type ConfirmDialogSpec, type CreateGridConfig, DETAIL_COLUMN_WIDTH, type DateEditorSpec, type EditFormField, type EditFormHandle, type EditFormSpec, type ExportKind, type GridApi, type GridMenuItem, type GridNotesConfig, type HeaderMenuContext, type HeaderMenuDeps, type NoteCellContext, PRINT_MAX_ROWS, type PrintLayoutOptions, ROW_DRAG_MIME, ROW_NUMBER_COLUMN_WIDTH, type RowDragConfig, type RowDragPayload, type RowDropEvent, type RowMenuContext, type RowReorderEvent, type RowTemplateContext, type ToolbarButtonSpec, type VanillaColumnDef, type VanillaEditorRenderContext, type VanillaFilterRenderApi, attachCellEditing, buildCellEditor, buildDateEditor, buildEditForm, buildHeaderMenu, createGrid, measureBestFitWidth, openConfirmDialog, toolbarButton };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { GridRowData, DataGridController, GridDictionary, GridDataType, LookupItem, LookupMatchMode, RowKey, EditingEngineOptions, EditingEngine, RowChange, EditMode, RowNode, GridColumnDef, DataGridCoreConfig, FilterRenderContextBase, FilterNode, GridThemeName, GridPaletteName, GridDensity, DescribeFilterOptions, CardViewOptions, StateStoringConfig, InferColumnsOptions, RowStatusSource } from '@kanunilabs/datagrid-core';
1
+ import { GridRowData, DataGridController, GridDictionary, GridDataType, LookupItem, LookupMatchMode, RowKey, EditingEngineOptions, EditingEngine, RowChange, EditMode, RowNode, GridColumnDef, DataGridCoreConfig, FilterRenderContextBase, FilterNode, GridThemeName, GridPaletteName, GridDensity, DescribeFilterOptions, CardViewOptions, ToolbarOptions, PortalContainer, StateStoringConfig, InferColumnsOptions, RowStatusSource } from '@kanunilabs/datagrid-core';
2
2
  export { CustomFilterOperator, CustomFilterOperatorId, DENSITY_ROW_HEIGHT, DataGridController, FilterNode, GRID_COLOR_SCHEMES, GridColorScheme, GridColumnDef, GridDensity, GridPaletteName, GridRowData, GridTheme, GridThemeName, RowKey, RowNode, SortDescriptor, THEME_ROW_HEIGHT, isPackagedTheme, presetRowHeight } from '@kanunilabs/datagrid-core';
3
3
 
4
4
  /** What a header menu is opened against — the React shape, verbatim. */
@@ -780,8 +780,25 @@ interface CreateGridConfig<TRow = GridRowData> extends Omit<DataGridCoreConfig<T
780
780
  * a vanilla caller has no editor surfacing the `@deprecated` tag.
781
781
  */
782
782
  showRowCount?: boolean;
783
- /** Quick-search + CSV export bar above the grid. */
784
- toolbar?: boolean;
783
+ /**
784
+ * Quick-search + export bar above the grid. `true` shows all of it; an
785
+ * object picks the parts and sets the search box up — React's `toolbar`:
786
+ *
787
+ * toolbar: { export: false, search: { maxLength: 100, debounce: 300, validate } }
788
+ *
789
+ * Your own buttons: `toolbarItemsBefore` / `toolbarItemsAfter`, e.g. built
790
+ * with `toolbarButton()`.
791
+ */
792
+ toolbar?: boolean | ToolbarOptions;
793
+ /**
794
+ * Where the grid draws its popups (header filter, menus, date and lookup
795
+ * lists, dialogs, tooltips): an element, or a function returning one.
796
+ * Default `document.body`. Set it when the grid sits in a modal that makes
797
+ * the rest of the page ignore the pointer; pass the modal's content element
798
+ * (one without `overflow: hidden`). Popups stay in place even when the modal
799
+ * is moved with a CSS transform. Every popup carries `data-kanuni-portal`.
800
+ */
801
+ portalContainer?: PortalContainer;
785
802
  /** "Columns" button in the toolbar opening the visibility chooser. */
786
803
  toolbarColumnChooser?: boolean;
787
804
  /**
@@ -956,6 +973,26 @@ interface GridApi<TRow = GridRowData> {
956
973
  }
957
974
  declare function createGrid<TRow = GridRowData>(container: HTMLElement, config: CreateGridConfig<TRow>): GridApi<TRow>;
958
975
 
976
+ interface ToolbarButtonSpec {
977
+ /** The glyph: an element (e.g. an inline SVG) or SVG/HTML markup. */
978
+ icon: Element | string;
979
+ /** The button's name: its accessible name and the start of its tooltip. */
980
+ label: string;
981
+ /** Keyboard shortcut shown in the tooltip and as `aria-keyshortcuts`. */
982
+ shortcut?: string;
983
+ /** Set while the button cannot be used: clicks are ignored and this is the reason given. */
984
+ disabledReason?: string;
985
+ /** Show the label beside the icon. Default false (icon only). */
986
+ showLabel?: boolean;
987
+ onClick?: () => void;
988
+ /** `data-testid` on the button. */
989
+ testId?: string;
990
+ }
991
+ /** A button for the toolbar or status bar. Call `update()` to change it later. */
992
+ declare function toolbarButton(spec: ToolbarButtonSpec): HTMLButtonElement & {
993
+ update(next: Partial<ToolbarButtonSpec>): void;
994
+ };
995
+
959
996
  /**
960
997
  * Width that fits the header and every rendered cell of `columnId`.
961
998
  * Returns null when nothing could be measured (no such column on screen, or no
@@ -1010,8 +1047,13 @@ interface ConfirmDialogSpec {
1010
1047
  danger?: boolean;
1011
1048
  /** The enterprise wrapper's theme/dark classes, re-established here. */
1012
1049
  surfaceClass?: string;
1050
+ /**
1051
+ * An element inside the grid, so the dialog follows the grid's
1052
+ * `portalContainer` (core `portalContainerFor`). Default: <body>.
1053
+ */
1054
+ anchor?: Element;
1013
1055
  }
1014
1056
  /** Open the dialog; resolves the user's answer and removes itself. */
1015
1057
  declare function openConfirmDialog(spec: ConfirmDialogSpec): Promise<boolean>;
1016
1058
 
1017
- export { CHECKBOX_COLUMN_WIDTH, type CellEditingExtension, type CellEditingHelpers, type CellEditingLayer, type CellEditingOptions, type CellEditorSpec, type CellLookupEditorSpec, type CellMenuOptions, type CellRenderContext, type CellSlotContext, type ConfirmDialogSpec, type CreateGridConfig, DETAIL_COLUMN_WIDTH, type DateEditorSpec, type EditFormField, type EditFormHandle, type EditFormSpec, type ExportKind, type GridApi, type GridMenuItem, type GridNotesConfig, type HeaderMenuContext, type HeaderMenuDeps, type NoteCellContext, PRINT_MAX_ROWS, type PrintLayoutOptions, ROW_DRAG_MIME, ROW_NUMBER_COLUMN_WIDTH, type RowDragConfig, type RowDragPayload, type RowDropEvent, type RowMenuContext, type RowReorderEvent, type RowTemplateContext, type VanillaColumnDef, type VanillaEditorRenderContext, type VanillaFilterRenderApi, attachCellEditing, buildCellEditor, buildDateEditor, buildEditForm, buildHeaderMenu, createGrid, measureBestFitWidth, openConfirmDialog };
1059
+ export { CHECKBOX_COLUMN_WIDTH, type CellEditingExtension, type CellEditingHelpers, type CellEditingLayer, type CellEditingOptions, type CellEditorSpec, type CellLookupEditorSpec, type CellMenuOptions, type CellRenderContext, type CellSlotContext, type ConfirmDialogSpec, type CreateGridConfig, DETAIL_COLUMN_WIDTH, type DateEditorSpec, type EditFormField, type EditFormHandle, type EditFormSpec, type ExportKind, type GridApi, type GridMenuItem, type GridNotesConfig, type HeaderMenuContext, type HeaderMenuDeps, type NoteCellContext, PRINT_MAX_ROWS, type PrintLayoutOptions, ROW_DRAG_MIME, ROW_NUMBER_COLUMN_WIDTH, type RowDragConfig, type RowDragPayload, type RowDropEvent, type RowMenuContext, type RowReorderEvent, type RowTemplateContext, type ToolbarButtonSpec, type VanillaColumnDef, type VanillaEditorRenderContext, type VanillaFilterRenderApi, attachCellEditing, buildCellEditor, buildDateEditor, buildEditForm, buildHeaderMenu, createGrid, measureBestFitWidth, openConfirmDialog, toolbarButton };