@kong-ui-public/table-data-grid 0.6.0 → 0.6.1-pr.3854.00eedd2c7.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/README.md +36 -2
- package/dist/style.css +1 -1
- package/dist/table-data-grid.es.js +515 -337
- package/dist/table-data-grid.umd.js +1 -1
- package/dist/types/components/TableDataGrid.vue.d.ts +1 -0
- package/dist/types/components/TableDataGrid.vue.d.ts.map +1 -1
- package/dist/types/components/TableDataGridCellRenderer.vue.d.ts +4 -1
- package/dist/types/components/TableDataGridCellRenderer.vue.d.ts.map +1 -1
- package/dist/types/composables/useTableDataGridColumnDefs.d.ts +13 -1
- package/dist/types/composables/useTableDataGridColumnDefs.d.ts.map +1 -1
- package/dist/types/composables/useTableDataGridConfig.d.ts +2 -0
- package/dist/types/composables/useTableDataGridConfig.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +20 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utils/tableConfig.d.ts.map +1 -1
- package/dist/types/utils/tableDataGridPresentation.d.ts +100 -0
- package/dist/types/utils/tableDataGridPresentation.d.ts.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -120,7 +120,7 @@ const handleState = (payload: TableDataGridStatePayload) => {
|
|
|
120
120
|
| `error` | `boolean` | No | `false` | Host-controlled visible error state. Internal fetch failures emit state but do not render error UI unless this prop is true. |
|
|
121
121
|
| `pageSize` | `number` | No | `25` | Infinite mode only. AG Grid cache block size and fetcher request size. `tableConfig.pageSize` wins when present. |
|
|
122
122
|
| `refreshKey` | `string \| number \| boolean` | No | - | Infinite mode only. Parent invalidation signal that rebuilds the datasource from the beginning. |
|
|
123
|
-
| `tableConfig` | `TableDataGridConfig` | No | - | Host-controlled current sort and
|
|
123
|
+
| `tableConfig` | `TableDataGridConfig` | No | - | Host-controlled current sort, page size, and optional content-height sizing. Restores a previously-chosen sort on mount, or moves it after mount, without a click. Uncontrolled (internal state) when omitted. |
|
|
124
124
|
|
|
125
125
|
## Fetcher Contract
|
|
126
126
|
|
|
@@ -175,6 +175,12 @@ changes. An empty `rows` array shows the empty state.
|
|
|
175
175
|
The row model is selected when `TableDataGrid` mounts. To switch between
|
|
176
176
|
`infinite` and `unpaginated`, key the component by mode so Vue remounts it.
|
|
177
177
|
|
|
178
|
+
For compact, content-sized tables, set `tableConfig.fitToContent` to `true` and
|
|
179
|
+
leave the host height unconstrained. The grid fits its header and all returned
|
|
180
|
+
rows, retains horizontal scrolling, and resizes when the result changes. This
|
|
181
|
+
option defaults to `false` and is ignored in infinite mode. Otherwise, give the
|
|
182
|
+
host a height and the grid scrolls within it.
|
|
183
|
+
|
|
178
184
|
```vue
|
|
179
185
|
<TableDataGrid
|
|
180
186
|
mode="unpaginated"
|
|
@@ -247,6 +253,24 @@ should opt out of the default flexible fill behavior.
|
|
|
247
253
|
| `disableRowClick` | `boolean` | No | Suppresses `row:click` for clicks landing in this column's cells, e.g. an actions column. `cell:click` still fires. |
|
|
248
254
|
| `sortable` | `boolean` | No | Enables sorting on this column via AG Grid's built-in header sort control. Only one column can be sorted at a time. |
|
|
249
255
|
| `showSortIcon` | `boolean` | No | Shows the unsorted sort icon on this column even when it isn't the active sort, instead of only on hover or once sorted. Only relevant when `sortable` is true. |
|
|
256
|
+
| `valueFormatter` | `(value, row) => string` | No | Formats a raw value for display. A custom cell slot still receives the original `rowValue`. |
|
|
257
|
+
| `showPercentage` | `boolean` | No | In unpaginated mode, shows a numeric row value's percentage of the complete returned column sum. |
|
|
258
|
+
| `percentageFormatter` | `(percentage) => string` | No | Optional formatter for the percentage points (50 means 50%) shown by `showPercentage`. The default uses the grid locale, up to two decimal places, and `< 0.01 %` for small positive values. |
|
|
259
|
+
| `bar` | `'relative' \| 'absolute'` | No | In unpaginated mode, renders a bar for numeric values. `relative` uses `value / sum`; `absolute` uses `value / maximum`, matching the TopN scales. |
|
|
260
|
+
| `thresholds` | `Array<{ value: number, type: 'warning' \| 'error' }>` | No | Compares the raw numeric value with each threshold in either grid mode. Colors the bar when rendered, or the value text otherwise. The highest crossed threshold wins, with `error` winning ties. Works without `bar`. |
|
|
261
|
+
|
|
262
|
+
Setting `showPercentage`, `bar`, or `thresholds` opts a column into numeric
|
|
263
|
+
presentation; no separate data type field is needed. Percentages and bars use
|
|
264
|
+
the complete `rows` result in unpaginated mode. Infinite mode does not calculate
|
|
265
|
+
aggregate values, so `showPercentage` or `bar` emits a console warning and omits
|
|
266
|
+
those adornments. Thresholds compare each numeric cell value in either mode.
|
|
267
|
+
Nonnumeric or non-finite values in unpaginated mode warn once per column and
|
|
268
|
+
keep their ordinary content without numeric adornments. Missing values retain
|
|
269
|
+
an empty bar track when a bar is configured.
|
|
270
|
+
Bars clamp to 0–100%; percentage labels are omitted when the column total is not positive.
|
|
271
|
+
|
|
272
|
+
Hosts render optional icons through the `cell-icon` slot. The grid places slot
|
|
273
|
+
content beside the cell value without replacing its default or custom content.
|
|
250
274
|
|
|
251
275
|
## Sorting
|
|
252
276
|
|
|
@@ -279,7 +303,13 @@ under one sort order is not valid under another.
|
|
|
279
303
|
## Custom Cell Content
|
|
280
304
|
|
|
281
305
|
Columns render custom cell content through a slot named after `header.key`.
|
|
282
|
-
Columns without a matching slot render
|
|
306
|
+
Columns without a matching slot render `valueFormatter(rowValue, row)` when
|
|
307
|
+
configured, otherwise their raw `rowValue`. The `cell-icon` slot, percentages,
|
|
308
|
+
and bars decorate both default values and slot content.
|
|
309
|
+
When a named slot renders no content, the grid falls back to the formatted
|
|
310
|
+
default value with ellipsis and an overflow tooltip; non-empty slot content
|
|
311
|
+
remains host-owned.
|
|
312
|
+
`cell-icon` is reserved for icon content and cannot name a column content slot.
|
|
283
313
|
|
|
284
314
|
```vue
|
|
285
315
|
<TableDataGrid
|
|
@@ -291,6 +321,9 @@ Columns without a matching slot render their raw `rowValue`.
|
|
|
291
321
|
{{ rowValue }}
|
|
292
322
|
</KBadge>
|
|
293
323
|
</template>
|
|
324
|
+
<template #cell-icon="{ column, rowValue }">
|
|
325
|
+
<ProviderIcon v-if="column.key === 'provider' && rowValue === 'openai'" />
|
|
326
|
+
</template>
|
|
294
327
|
</TableDataGrid>
|
|
295
328
|
```
|
|
296
329
|
|
|
@@ -320,6 +353,7 @@ Columns without a matching slot render their raw `rowValue`.
|
|
|
320
353
|
| --- | --- |
|
|
321
354
|
| `empty-state` | Replaces the default empty state after a successful empty result. |
|
|
322
355
|
| `error-state` | Replaces the default visible error state when `error` is true. |
|
|
356
|
+
| `cell-icon` | Adds optional host-rendered content before each cell's default value or column slot. Uses the same cell slot props; render nothing for cells without an icon. |
|
|
323
357
|
| `[columnKey]` | Renders custom cell content for the column matching `header.key`. See [Custom Cell Content](#custom-cell-content). |
|
|
324
358
|
|
|
325
359
|
## Exports
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.table-data-grid-cell-renderer,.table-data-grid-cell-tooltip,.table-data-grid-cell-content{display:block;min-width:0;width:100%}.table-data-grid-cell-content{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.kong-ui-public-table-data-grid[data-v-
|
|
1
|
+
.table-data-grid-cell-renderer,.table-data-grid-cell-tooltip,.table-data-grid-cell-content,.table-data-grid-cell-slot-content{display:block;min-width:0;width:100%}.table-data-grid-cell-renderer{align-items:center;display:flex;font-feature-settings:"case";font-variant-numeric:tabular-nums;gap:4px;gap:var(--kui-space-20, 4px);min-width:0;width:100%}.table-data-grid-cell-label{align-items:center;display:flex;flex:1 1 auto;gap:4px;gap:var(--kui-space-20, 4px);min-width:0}.table-data-grid-cell-label-track{display:grid;flex:1 1 auto;grid-template-columns:minmax(0,1fr);min-width:0}.table-data-grid-cell-label-track>*{grid-area:1/1}.table-data-grid-cell-label-sizer{height:0;visibility:hidden}.table-data-grid-cell-sizer-value:before,.table-data-grid-cell-sizer-relative:before{content:attr(data-text);white-space:nowrap}.table-data-grid-cell-sizer-value{font-weight:600;font-weight:var(--kui-font-weight-semibold, 600)}.table-data-grid-cell-sizer-relative{flex-shrink:0;font-size:12px;font-size:var(--kui-font-size-20, 12px);font-weight:400;font-weight:var(--kui-font-weight-regular, 400)}.table-data-grid-cell-renderer--bar{display:grid;grid-template-columns:minmax(0,max-content) minmax(80px,1fr)}.table-data-grid-cell-content,.table-data-grid-cell-slot-content,.table-data-grid-cell-relative{white-space:nowrap}.table-data-grid-cell-relative{flex-shrink:0;font-size:12px;font-size:var(--kui-font-size-20, 12px);font-weight:400;font-weight:var(--kui-font-weight-regular, 400)}.table-data-grid-cell-renderer--bar .table-data-grid-cell-content,.table-data-grid-cell-renderer--bar .table-data-grid-cell-slot-content,.table-data-grid-cell-renderer--text-warning .table-data-grid-cell-content,.table-data-grid-cell-renderer--text-warning .table-data-grid-cell-slot-content,.table-data-grid-cell-renderer--text-error .table-data-grid-cell-content,.table-data-grid-cell-renderer--text-error .table-data-grid-cell-slot-content{font-weight:600;font-weight:var(--kui-font-weight-semibold, 600)}.table-data-grid-cell-renderer--text-warning{color:#995c00;color:var(--kui-color-text-warning, #995c00)}.table-data-grid-cell-renderer--text-error{color:#d60027;color:var(--kui-color-text-danger, #d60027)}.table-data-grid-cell-renderer--bar .table-data-grid-cell-content,.table-data-grid-cell-renderer--bar .table-data-grid-cell-slot-content,.table-data-grid-cell-renderer--bar .table-data-grid-cell-tooltip,.table-data-grid-cell-renderer--percentage .table-data-grid-cell-slot-content,.table-data-grid-cell-renderer--percentage .table-data-grid-cell-tooltip,.table-data-grid-cell-renderer--percentage .table-data-grid-cell-content{flex:0 1 auto;width:auto}.table-data-grid-cell-bar{background-color:#e0e4ea;background-color:var(--kui-color-background-neutral-weaker, #e0e4ea);border-radius:100px;border-radius:var(--kui-border-radius-round, 100px);display:block;height:8px;min-width:80px;overflow:hidden;width:100%}.table-data-grid-cell-bar-fill{background-color:#6a86d2;border-radius:inherit;display:block;height:100%}.table-data-grid-cell-bar[data-threshold=warning] .table-data-grid-cell-bar-fill{background-color:#995c00;background-color:var(--kui-color-background-warning, #995c00)}.table-data-grid-cell-bar[data-threshold=error] .table-data-grid-cell-bar-fill{background-color:#d60027;background-color:var(--kui-color-background-danger, #d60027)}.table-data-grid-cell-content{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.kong-ui-public-table-data-grid[data-v-29905891]{border:none;border-radius:4px;border-radius:var(--kui-border-radius-20, 4px);box-sizing:border-box;display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden;width:100%}.kong-ui-public-table-data-grid.fit-to-content[data-v-29905891]{height:auto}.kong-ui-public-table-data-grid.fit-to-content[data-v-29905891] .ag-grid-scrolling-rows{min-height:0}.table-data-grid-grid[data-v-29905891]{--ag-background-color: var(--kui-color-background, #ffffff);--ag-border-color: var(--kui-color-border, #e0e4ea);--ag-foreground-color: var(--kui-color-text, #0d0e14);--ag-header-background-color: var(--kui-color-background, #ffffff);--ag-header-column-border: 1px solid var(--kui-color-border, #e0e4ea);--ag-header-column-border-height: 30%;--ag-header-column-resize-handle-color: transparent;--ag-header-font-weight: var(--kui-font-weight-semibold, 600);--ag-header-text-color: var(--kui-color-text-neutral, #6c7489);--ag-wrapper-border: none;--ag-wrapper-border-radius: 0;flex:1 1 auto;min-height:0;width:100%}.ag-cell{align-items:center;display:flex;min-width:0}.ag-cell-wrapper,.ag-cell-value{min-width:0;width:100%}
|