@xleddyl/443-components-vue 0.16.12 → 0.16.13

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/CATALOG.md CHANGED
@@ -286,7 +286,7 @@ Import from `@xleddyl/443-components-vue/grid`. It wraps AG Grid Community.
286
286
  | `DataGrid` | Big table: virtual scroll, column menu, search, CSV export, selection, server sort and paging, inline editing. For small tables use `Table`. | Models: `v-model:query`, `v-model:page`, `v-model:pageSize`, `v-model:sort` (`{ column, direction }`). Props: `rows`, `columns` (AG Grid `ColDef`), `rowIdKey` or `getRowId`, `storageKey` (columns and page size in the preferences store), `density`, `selectable`, `loading`, `height`, `fill`, `autoHeight`, `toolbar`, `searchable`, `columnMenu`, `exportable`, `serverSort`, `pagination`, `serverPagination`, `total`, `filterable`, `editable`, `spreadsheet`, `gridOptions`, `messages`, `filterCount`. Slots: `actions`, `actions-end` (after the column menu and export buttons), `filters` (`{ close, count }`, hosted in a modal opened by a funnel button next to the search). Events: `filtersReset`, `rowClick`, `selectionChange`, `sortChange`, `filterChange`, `cellsChange`, `cellsInvalid`, `dirtyChange`, `rangeChange`, `copy`. | `grid/data-grid.vue` |
287
287
  | `DataGrid` with `spreadsheet` | Excel-like editing: cell range selection, copy and paste (TSV), fill down and right, clear, undo and redo, dirty cell tracking. Set `rowIdKey` or `getRowId`. | Template ref methods (`GridSpreadsheetMethods`): `getRange`, `getSelectedCells`, `selectRange`, `selectAll`, `setRangeValue`, `copyRange`, `paste`, `fillDown`, `fillRight`, `clearCells`, `undo`, `redo`, `getDirtyCells`, `clearDirty`. The `actions` slot gets the same methods plus `range`, `selectedCellCount`, `dirtyCount`, `canUndo`, `canRedo`. Use `cellsChange` to save edits, `cellsInvalid` for rejected input. | `grid/spreadsheet.vue` |
288
288
  | `GridToolbar` | Toolbar of `DataGrid` (search, column menu, export). `DataGrid` already renders it. Use it alone only for a custom grid setup. | Props: `api`, `searchable`, `columnMenu`, `exportable`, `exportFileName`, `debounce`, `filterCount`. Model: `v-model` (query). Slots: default (actions), `filters`. Events: `resetColumns`, `filtersReset`. | - |
289
- | Cell renderers | Use as `cellRenderer` in a column definition, with `cellRendererParams`. | `BadgeCell` (`tones`, `labels`, `defaultTone`, `variant`; array values render one badge each, `max` adds a `+N` badge, `wrap`), `BooleanCell` (`trueLabel`, `falseLabel`), `DateCell` (`locale`, `options`, `relative`), `EmptyCell` (placeholder for empty values), `ImageCell` (`alt`, `rounded`, `fit`, `size`), `LinkCell` (`href`, `label`, `target`), `ButtonCell` (`onClick`, `label`, `ariaLabel`, `emptyLabel`; an inline button that does not trigger the row click). | `grid/data-grid.vue` |
289
+ | Cell renderers | Use as `cellRenderer` in a column definition, with `cellRendererParams`. | `BadgeCell` (`tones`, `labels`, `defaultTone`, `variant`; array values render one badge each, `max` adds a `+N` badge, `wrap`), `BooleanCell` (`trueLabel`, `falseLabel`), `DateCell` (`locale`, `options`, `relative`), `EmptyCell` (placeholder for empty values), `ImageCell` (`alt`, `rounded`, `fit`: `cover`, `contain` or `natural` (original aspect, height `size`), `size`), `LinkCell` (`href`, `label`, `target`), `ButtonCell` (`onClick`, `label`, `ariaLabel`, `emptyLabel`; an inline button that does not trigger the row click). | `grid/data-grid.vue` |
290
290
 
291
291
  Grid helpers: `registerGridModules`, `registerGridEditorModules`, `registerGridFilterModules`, `registerGridSpreadsheetModules` (register AG Grid modules by hand), `createGridTheme`, `parseTsv`, `formatTsv`.
292
292
 
package/README.md CHANGED
@@ -848,7 +848,7 @@ Accessibility related props and defaults:
848
848
  - `ColorInput` `swatches` accept `{ value, label }` objects (a radio group named by `label` or the hex). `PasswordInput` picks `autocomplete="new-password"` with `generate` or `strength`, `current-password` otherwise.
849
849
  - `Tree` with `reorderable` shows small move buttons (up, down, indent, outdent) on the hovered or focused row, as a single pointer alternative to dragging. Set `patterns` on `LineChart` and `BarChart` to tell series apart without color (dash and point style per line, a fill pattern per bar series, mirrored in the legend); it is off by default.
850
850
  - `DataGrid` sort is a model: `v-model:sort` (`{ column, direction } | null`) sets the sorted column from outside (server side sort, a sort restored from the URL) and follows header clicks. Leave it unset for an uncontrolled grid. `sortChange` still fires with `serverSort`.
851
- - `DataGrid` takes `rowHeight` and `headerHeight` (pixels) for an exact row size on top of `density`, and `headerText: (field, column) => string | undefined` to name every column that has a `field` and no `headerName` (from your i18n).
851
+ - `DataGrid` takes `rowHeight` and `headerHeight` (pixels) for an exact row size on top of `density` (the theme gets the same row height, so the text stays centered), and `headerText: (field, column) => string | undefined` to name every column that has a `field` and no `headerName` (from your i18n).
852
852
  - `DataGrid` `filterable` registers the AG Grid text, number and date filters (`registerGridFilterModules()` does it without the prop) and turns `filter` on for every column. `filterChange(model, event)` fires with `api.getFilterModel()` whenever a column filter changes, also when the filters come from `gridOptions` or your own registered modules.
853
853
  - `DataGrid` `#actions-end` slot: same props as `#actions`, rendered at the end of the toolbar, after the column menu and export buttons (a view switch). `GridToolbar` takes it as `#end`.
854
854
  - `DataGrid` `#filters` slot: put your own filter controls (Select, Combobox, DateInput bound with `v-model`) in it and the toolbar shows a square funnel button right after the search input (at the start with `:searchable="false"`), before the `actions`. The button opens a `Modal` titled "Filters" that hosts the slot, so the filters still apply live; its footer has "Reset filters" (emits `filtersReset`, disabled while `filterCount` is 0) and "Show results" (closes it). `filterCount` shows the number of active filters as a badge on the button and in its accessible name ("Filters, 2 active", `grid.filtersActive`). Slot props: `{ close, count }`. Focus returns to the button on close, and the modal becomes a bottom sheet on small screens. `GridToolbar` takes the same slot, prop and event.
@@ -869,6 +869,7 @@ Accessibility related props and defaults:
869
869
  ```
870
870
 
871
871
  - `DateCell` takes `relative: true` (or `Intl.RelativeTimeFormatOptions`) in `cellRendererParams` for "3 days ago"; the absolute date stays in the `title`. `relativeWithin` (milliseconds, default unset: always relative) shows the absolute date instead once the value is further than that from now, in the past or the future (`relativeWithin: 7 * 86_400_000` keeps "3 days ago" and prints older dates in full).
872
+ - A column without a visible header (a photo column) keeps a name for the Columns menu with `headerValueGetter: ({ location }) => (location === 'header' ? '' : 'Photo')`: the menu reads the name for the `columnToolPanel` location.
872
873
  - `DataGrid` takes `gridOptions` for any AG Grid option it does not wrap (`rowHeight`, `onCellEditingStopped`, `onFilterChanged`, ...). A prop of `DataGrid` wins only when it is set: `getRowId`, `rowSelection` (when `selectable` is off), `autoSizeStrategy` (also `undefined` to turn it off), `tooltipShowDelay`, `overlayNoRowsTemplate` and `overlayLoadingTemplate` from `gridOptions` are used otherwise; `defaultColDef` and `localeText` are merged over the component defaults, and `context` is merged under the cell context. Handlers from both run.
873
874
  - `DataGrid` row ids: `getRowId: (params) => string` (wins), `rowIdKey` (a field of the row), or `gridOptions.getRowId`.
874
875
  - `DataGrid` `fill` makes the grid, with its toolbar and footer, fill its parent (a flex or grid item with `flex: 1; min-height: 0`, or `height: 100%` in a block with a height) instead of the fixed `height`. Ignored with `autoHeight`.
@@ -240,7 +240,9 @@ const gridLocaleText = computed(() => ({
240
240
  const gridContext = computed(() => ({ ...props.gridOptions?.context, ...cellContext.value }));
241
241
  const live = useLiveMessage();
242
242
  let announcedCount = null;
243
- const theme = computed(() => getGridTheme(props.density));
243
+ const theme = computed(
244
+ () => getGridTheme(props.density, props.rowHeight ?? props.gridOptions?.rowHeight)
245
+ );
244
246
  const mounted = ref(false);
245
247
  const api = shallowRef(null);
246
248
  const selectedCount = ref(0);
@@ -144,7 +144,7 @@ function readColumns() {
144
144
  const definition = column.getColDef();
145
145
  return {
146
146
  id: column.getColId(),
147
- label: definition.headerName ?? definition.field ?? column.getColId(),
147
+ label: api?.getDisplayNameForColumn(column, "columnToolPanel") || definition.headerName || definition.field || column.getColId(),
148
148
  visible: column.isVisible()
149
149
  };
150
150
  });
@@ -2,7 +2,11 @@
2
2
  <img
3
3
  v-if="src"
4
4
  class="k-data-grid-image"
5
- :class="{ 'is-rounded': params.rounded, 'is-contain': params.fit === 'contain' }"
5
+ :class="{
6
+ 'is-rounded': params.rounded,
7
+ 'is-contain': params.fit === 'contain',
8
+ 'is-natural': params.fit === 'natural'
9
+ }"
6
10
  :style="sizeStyle"
7
11
  :src="src"
8
12
  :alt="alt"
@@ -260,6 +260,13 @@
260
260
  object-fit: contain;
261
261
  }
262
262
 
263
+ .k-data-grid-image.is-natural {
264
+ width: auto;
265
+ max-width: 100%;
266
+ object-fit: contain;
267
+ background: none;
268
+ }
269
+
263
270
  .k-data-grid-image.is-rounded {
264
271
  border-radius: var(--k-radius-full);
265
272
  }
@@ -1,3 +1,3 @@
1
1
  import type { GridDensity } from './types';
2
- export declare function createGridTheme(density: GridDensity): import("ag-grid-community").Theme<import("ag-grid-community").ThemeDefaultParams>;
3
- export declare function getGridTheme(density: GridDensity): import("ag-grid-community").Theme<import("ag-grid-community").ThemeDefaultParams>;
2
+ export declare function createGridTheme(density: GridDensity, rowHeight?: number): import("ag-grid-community").Theme<import("ag-grid-community").ThemeDefaultParams>;
3
+ export declare function getGridTheme(density: GridDensity, rowHeight?: number): import("ag-grid-community").Theme<import("ag-grid-community").ThemeDefaultParams>;
@@ -5,8 +5,8 @@ const spacingByDensity = {
5
5
  comfortable: 9
6
6
  };
7
7
  const themes = /* @__PURE__ */ new Map();
8
- export function createGridTheme(density) {
9
- return themeQuartz.withParams({
8
+ export function createGridTheme(density, rowHeight) {
9
+ const theme = themeQuartz.withParams({
10
10
  browserColorScheme: "inherit",
11
11
  accentColor: "var(--k-accent)",
12
12
  backgroundColor: "var(--k-surface)",
@@ -47,12 +47,14 @@ export function createGridTheme(density) {
47
47
  checkboxCheckedShapeColor: "var(--k-accent-contrast)",
48
48
  focusShadow: { spread: 2, color: "var(--k-ring)" }
49
49
  });
50
+ return rowHeight ? theme.withParams({ rowHeight }) : theme;
50
51
  }
51
- export function getGridTheme(density) {
52
- let theme = themes.get(density);
52
+ export function getGridTheme(density, rowHeight) {
53
+ const key = `${density}:${rowHeight ?? ""}`;
54
+ let theme = themes.get(key);
53
55
  if (!theme) {
54
- theme = createGridTheme(density);
55
- themes.set(density, theme);
56
+ theme = createGridTheme(density, rowHeight);
57
+ themes.set(key, theme);
56
58
  }
57
59
  return theme;
58
60
  }
@@ -57,7 +57,7 @@ export interface BadgeCellParams<T = unknown> {
57
57
  max?: number;
58
58
  wrap?: boolean;
59
59
  }
60
- export type ImageCellFit = 'cover' | 'contain';
60
+ export type ImageCellFit = 'cover' | 'contain' | 'natural';
61
61
  export interface ImageCellParams<T = unknown> {
62
62
  alt?: (data: T | undefined) => string;
63
63
  rounded?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xleddyl/443-components-vue",
3
- "version": "0.16.12",
3
+ "version": "0.16.13",
4
4
  "description": "Compact, scoped dashboard components for Vue and Nuxt",
5
5
  "license": "MIT",
6
6
  "author": "Edoardo Alberti (https://github.com/xleddyl)",