@toolbox-web/grid 2.4.1 → 2.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.
Files changed (55) hide show
  1. package/README.md +15 -3
  2. package/all.js +2 -2
  3. package/all.js.map +1 -1
  4. package/index.js +1 -1
  5. package/index.js.map +1 -1
  6. package/lib/core/types.d.ts +72 -30
  7. package/lib/plugins/clipboard/index.js.map +1 -1
  8. package/lib/plugins/column-virtualization/index.js.map +1 -1
  9. package/lib/plugins/context-menu/index.js.map +1 -1
  10. package/lib/plugins/editing/index.js +1 -1
  11. package/lib/plugins/editing/index.js.map +1 -1
  12. package/lib/plugins/editing/internal/helpers.d.ts +17 -0
  13. package/lib/plugins/export/index.js.map +1 -1
  14. package/lib/plugins/filtering/index.js.map +1 -1
  15. package/lib/plugins/grouping-columns/index.js.map +1 -1
  16. package/lib/plugins/grouping-rows/index.js.map +1 -1
  17. package/lib/plugins/master-detail/index.js.map +1 -1
  18. package/lib/plugins/multi-sort/index.js.map +1 -1
  19. package/lib/plugins/pinned-columns/index.js.map +1 -1
  20. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +28 -4
  21. package/lib/plugins/pinned-rows/index.d.ts +3 -2
  22. package/lib/plugins/pinned-rows/index.js +1 -1
  23. package/lib/plugins/pinned-rows/index.js.map +1 -1
  24. package/lib/plugins/pinned-rows/pinned-rows.d.ts +29 -1
  25. package/lib/plugins/pinned-rows/types.d.ts +96 -9
  26. package/lib/plugins/pivot/index.js.map +1 -1
  27. package/lib/plugins/print/index.js.map +1 -1
  28. package/lib/plugins/reorder-columns/index.js.map +1 -1
  29. package/lib/plugins/reorder-rows/index.js.map +1 -1
  30. package/lib/plugins/responsive/index.js +1 -1
  31. package/lib/plugins/responsive/index.js.map +1 -1
  32. package/lib/plugins/row-drag-drop/index.js.map +1 -1
  33. package/lib/plugins/row-drag-drop/types.d.ts +7 -0
  34. package/lib/plugins/selection/index.js.map +1 -1
  35. package/lib/plugins/server-side/index.js.map +1 -1
  36. package/lib/plugins/tooltip/index.js.map +1 -1
  37. package/lib/plugins/tree/index.js.map +1 -1
  38. package/lib/plugins/undo-redo/index.js.map +1 -1
  39. package/lib/plugins/visibility/VisibilityPlugin.d.ts +0 -11
  40. package/lib/plugins/visibility/index.d.ts +1 -2
  41. package/lib/plugins/visibility/index.js.map +1 -1
  42. package/lib/plugins/visibility/types.d.ts +32 -0
  43. package/package.json +1 -1
  44. package/public.d.ts +28 -67
  45. package/umd/grid.all.umd.js +1 -1
  46. package/umd/grid.all.umd.js.map +1 -1
  47. package/umd/grid.umd.js +1 -1
  48. package/umd/grid.umd.js.map +1 -1
  49. package/umd/plugins/editing.umd.js +1 -1
  50. package/umd/plugins/editing.umd.js.map +1 -1
  51. package/umd/plugins/pinned-rows.umd.js +1 -1
  52. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  53. package/umd/plugins/responsive.umd.js +1 -1
  54. package/umd/plugins/responsive.umd.js.map +1 -1
  55. package/umd/plugins/visibility.umd.js.map +1 -1
@@ -1,5 +1,5 @@
1
1
  import { ColumnConfig } from '../../core/types';
2
- import { AggregationRowConfig, PinnedRowsConfig, PinnedRowsContext } from './types';
2
+ import { AggregationRowConfig, PanelRender, PanelSlot, PinnedRowsConfig, PinnedRowsContext } from './types';
3
3
  /**
4
4
  * Creates the info bar DOM element with all configured panels.
5
5
  *
@@ -40,3 +40,31 @@ export declare function buildContext(rows: unknown[], columns: unknown[], grid:
40
40
  } | null, filterState?: {
41
41
  cachedResult: unknown[] | null;
42
42
  } | null): PinnedRowsContext;
43
+ /**
44
+ * Built-in panel renderer: total row count.
45
+ * Always renders. Output: `<span class="tbw-status-panel tbw-status-panel-row-count">Total: N rows</span>`.
46
+ */
47
+ export declare function rowCountPanel(): PanelRender;
48
+ /**
49
+ * Built-in panel renderer: selected row count.
50
+ * Returns `null` (skipped) when no rows are selected.
51
+ */
52
+ export declare function selectedCountPanel(): PanelRender;
53
+ /**
54
+ * Built-in panel renderer: filtered row count.
55
+ * Returns `null` (skipped) when the filtered count equals the total (no filter active).
56
+ */
57
+ export declare function filteredCountPanel(): PanelRender;
58
+ /**
59
+ * Renders a single {@link PanelSlot} as a `.tbw-pinned-rows` row with three zones.
60
+ * Returns `null` if no panel content was produced (all renders returned null).
61
+ */
62
+ export declare function renderPanelSlot(slot: PanelSlot, context: PinnedRowsContext): HTMLElement | null;
63
+ /**
64
+ * Renders a single {@link AggregationRowConfig} (slot variant) as one
65
+ * `.tbw-aggregation-rows` container holding one `.tbw-aggregation-row`.
66
+ *
67
+ * The container class includes `-top` or `-bottom` to preserve existing CSS
68
+ * (e.g. border-top vs border-bottom).
69
+ */
70
+ export declare function renderAggregationSlot(slot: AggregationRowConfig, position: 'top' | 'bottom', columns: ColumnConfig[], dataRows: unknown[], globalFullWidth?: boolean): HTMLElement;
@@ -102,33 +102,120 @@ export interface AggregationRowConfig {
102
102
  }
103
103
  /** Configuration options for the status bar plugin */
104
104
  export interface PinnedRowsConfig {
105
- /** Position of the info bar (default: 'bottom') */
105
+ /**
106
+ * Unified ordered list of pinned-row slots. When provided, `aggregationRows`,
107
+ * `customPanels`, `position`, `showRowCount`, `showSelectedCount` and
108
+ * `showFilteredCount` are ignored — slots are rendered in declared order
109
+ * within their `position` ('top' or 'bottom', default 'bottom').
110
+ *
111
+ * When omitted, the plugin synthesizes a slot list from the legacy fields so
112
+ * existing consumers keep their current DOM byte-identical.
113
+ *
114
+ * @example Mixed slots, top placement
115
+ * ```ts
116
+ * import { rowCountPanel, selectedCountPanel } from '@toolbox-web/grid/plugins/pinned-rows';
117
+ *
118
+ * new PinnedRowsPlugin({
119
+ * slots: [
120
+ * { position: 'top', render: rowCountPanel() },
121
+ * { position: 'top', aggregators: { price: 'sum' }, label: 'Total' },
122
+ * { position: 'bottom', render: selectedCountPanel() },
123
+ * ],
124
+ * });
125
+ * ```
126
+ */
127
+ slots?: PinnedRowSlot[];
128
+ /**
129
+ * Position of the info bar (default: 'bottom').
130
+ * @deprecated Use {@link PinnedRowsConfig.slots} with per-slot `position`.
131
+ */
106
132
  position?: PinnedRowsPosition;
107
- /** Show total row count in info bar (default: true) */
133
+ /**
134
+ * Show total row count in info bar (default: true).
135
+ * @deprecated Use {@link PinnedRowsConfig.slots} with the exported `rowCountPanel()` render function.
136
+ */
108
137
  showRowCount?: boolean;
109
- /** Show selected row count in info bar (default: true) */
138
+ /**
139
+ * Show selected row count in info bar (default: true).
140
+ * @deprecated Use {@link PinnedRowsConfig.slots} with the exported `selectedCountPanel()` render function.
141
+ */
110
142
  showSelectedCount?: boolean;
111
- /** Show filtered row count when filter is active (default: true) */
143
+ /**
144
+ * Show filtered row count when filter is active (default: true).
145
+ * @deprecated Use {@link PinnedRowsConfig.slots} with the exported `filteredCountPanel()` render function.
146
+ */
112
147
  showFilteredCount?: boolean;
113
- /** Custom panels to display in the info bar */
148
+ /**
149
+ * Custom panels to display in the info bar.
150
+ * @deprecated Use {@link PinnedRowsConfig.slots} with `PanelSlot` entries.
151
+ */
114
152
  customPanels?: PinnedRowsPanel[];
115
- /** Aggregation rows (footer/header rows with computed values) */
153
+ /**
154
+ * Aggregation rows (footer/header rows with computed values).
155
+ * @deprecated Use {@link PinnedRowsConfig.slots} with `AggregationSlot` entries (any slot
156
+ * without a `render` field is treated as an aggregation slot).
157
+ */
116
158
  aggregationRows?: AggregationRowConfig[];
117
159
  /**
118
160
  * Default fullWidth mode for all aggregation rows.
119
161
  * When true, each aggregation row renders as a single spanning cell with label and
120
162
  * aggregated values inline. When false (default), rows render per-column cells aligned
121
- * to the grid template. Individual `AggregationRowConfig.fullWidth` overrides this.
163
+ * to the grid template. Individual `AggregationRowConfig.fullWidth` (or `AggregationSlot.fullWidth`)
164
+ * overrides this.
122
165
  * @default false
123
166
  */
124
167
  fullWidth?: boolean;
125
168
  }
126
- /** Custom panel definition for the status bar */
169
+ /**
170
+ * A unified pinned-row slot. Discriminated by the presence of `render`:
171
+ * - With `render` ⇒ {@link PanelSlot} (a status-panel row)
172
+ * - Without `render` ⇒ {@link AggregationSlot} (an aggregation row)
173
+ *
174
+ * Each slot occupies one DOM row inside its `position` area, in declared order.
175
+ */
176
+ export type PinnedRowSlot = PanelSlot | AggregationSlot;
177
+ /** Horizontal zone within a panel slot row. */
178
+ export type PanelZone = 'left' | 'center' | 'right';
179
+ /**
180
+ * Render function for a panel slot.
181
+ * Return `null` to skip rendering (used by the built-in count panels for
182
+ * conditional display, e.g. only show "Selected: N" when N > 0).
183
+ */
184
+ export type PanelRender = (context: PinnedRowsContext) => HTMLElement | null;
185
+ /** Render function plus optional zone within the panel row. */
186
+ export interface ZonedPanelRender {
187
+ /** Horizontal zone within the row (default: 'left') */
188
+ zone?: PanelZone;
189
+ /** Render function */
190
+ render: PanelRender;
191
+ }
192
+ /** A status-panel slot. Each slot becomes its own `.tbw-pinned-rows` row. */
193
+ export interface PanelSlot {
194
+ /** Optional identifier for diffing/targeted updates */
195
+ id?: string;
196
+ /** Position relative to the grid body (default: 'bottom') */
197
+ position?: PinnedRowsPosition;
198
+ /**
199
+ * Render function (or array of zoned render functions).
200
+ * - Single `PanelRender` ⇒ rendered into the `'left'` zone.
201
+ * - Array of `ZonedPanelRender` ⇒ each entry rendered into its declared zone.
202
+ */
203
+ render: PanelRender | ZonedPanelRender[];
204
+ }
205
+ /**
206
+ * An aggregation slot (row of computed values). Equivalent to {@link AggregationRowConfig}
207
+ * but lives in the unified `slots[]` ordering.
208
+ */
209
+ export type AggregationSlot = AggregationRowConfig;
210
+ /**
211
+ * Custom panel definition for the legacy info bar.
212
+ * @deprecated Use {@link PinnedRowSlot} via {@link PinnedRowsConfig.slots}.
213
+ */
127
214
  export interface PinnedRowsPanel {
128
215
  /** Unique identifier for the panel */
129
216
  id: string;
130
217
  /** Position within the status bar */
131
- position: 'left' | 'center' | 'right';
218
+ position: PanelZone;
132
219
  /** Render function for the panel content */
133
220
  render: (context: PinnedRowsContext) => HTMLElement | string;
134
221
  }