@xleddyl/443-components-vue 0.16.84 → 0.16.85
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 +1 -1
- package/dist/grid/DataGrid.vue +13 -1
- package/dist/grid/theme.d.ts +1 -0
- package/dist/grid/theme.mjs +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -986,7 +986,7 @@ Accessibility related props and defaults:
|
|
|
986
986
|
- 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.
|
|
987
987
|
- `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.
|
|
988
988
|
- `DataGrid` row ids: `getRowId: (params) => string` (wins), `rowIdKey` (a field of the row), or `gridOptions.getRowId`.
|
|
989
|
-
- `DataGrid` `v-model:selected` (`string[]`) is the selected row ids, two way, for `selectable` grids (also `'single'`, at most one id). It needs row ids (`rowIdKey`, `getRowId` or `gridOptions.getRowId`); a dev warning tells you when they are missing. Leave it unbound for an uncontrolled grid. The header checkbox selects all the filtered rows (`selectAll: 'filtered'`): not the rows hidden by the search or the column filters, and not only the current page. A row hidden by the toolbar search, a column filter or an external filter leaves the selection: the grid deselects it and drops its id from the model when the filter changes, and an id set in the model for a hidden row is dropped too, so a bulk action never acts on rows the user cannot see. `keepHiddenSelected` keeps the old behavior (a hidden row stays selected). Client pagination keeps the selection across pages. A row that disappears from `rows` is dropped from the model, except while `loading` is set or the rows are empty, so a preselected model survives the first load. With `serverPagination` the ids of rows that are not in the current `rows` stay in the model: the selection survives a page change and a re-fetch, the footer counts the whole model, and the header checkbox only selects the rows of the page. The grid cannot see the other pages, so it drops an id that the server filter excludes only when it knows the whole result: once `loading` is off and `rows` holds every row of `total` (or the result is empty), the ids that are not in `rows` leave the model. Rows of the page hidden by a client column filter leave it as in client mode. To drop the ids of other pages when your own filters change, set the model yourself (for example `selected = []` when the query changes). Ids of rows that are not loaded yet stay out of the grid and are selected when the rows arrive. With `serverPagination`, `allIds` (`() => Promise<readonly string[]> | readonly string[]`) adds a footer link "Select all N rows" (`N` is `total`) that shows when every row of the page is selected and the model holds fewer than `total` ids: it calls `allIds`, awaits it and sets the model to the returned ids (a rejected promise keeps the selection and logs an error). When the model holds `total` ids the link becomes "Clear selection". `selectionChange` still emits the selected rows of the grid.
|
|
989
|
+
- `DataGrid` `v-model:selected` (`string[]`) is the selected row ids, two way, for `selectable` grids (also `'single'`, at most one id). It needs row ids (`rowIdKey`, `getRowId` or `gridOptions.getRowId`); a dev warning tells you when they are missing. Leave it unbound for an uncontrolled grid. The header checkbox selects all the filtered rows (`selectAll: 'filtered'`): not the rows hidden by the search or the column filters, and not only the current page. A row hidden by the toolbar search, a column filter or an external filter leaves the selection: the grid deselects it and drops its id from the model when the filter changes, and an id set in the model for a hidden row is dropped too, so a bulk action never acts on rows the user cannot see. `keepHiddenSelected` keeps the old behavior (a hidden row stays selected). Client pagination keeps the selection across pages. A row that disappears from `rows` is dropped from the model, except while `loading` is set or the rows are empty, so a preselected model survives the first load. With `serverPagination` the ids of rows that are not in the current `rows` stay in the model: the selection survives a page change and a re-fetch, the footer counts the whole model, and the header checkbox only selects the rows of the page. The grid cannot see the other pages, so it drops an id that the server filter excludes only when it knows the whole result: once `loading` is off and `rows` holds every row of `total` (or the result is empty), the ids that are not in `rows` leave the model. Rows of the page hidden by a client column filter leave it as in client mode. To drop the ids of other pages when your own filters change, set the model yourself (for example `selected = []` when the query changes). Ids of rows that are not loaded yet stay out of the grid and are selected when the rows arrive. With `serverPagination`, `allIds` (`() => Promise<readonly string[]> | readonly string[]`) adds a footer link "Select all N rows" (`N` is `total`) that shows when every row of the page is selected and the model holds fewer than `total` ids: it calls `allIds`, awaits it and sets the model to the returned ids (a rejected promise keeps the selection and logs an error). When the model holds `total` ids the link becomes "Clear selection". `selectionChange` still emits the selected rows of the grid. The checkbox column has a fixed width from the density (the checkbox and the cell padding); `gridOptions.selectionColumnDef` is merged over it.
|
|
990
990
|
- `DataGrid` template ref methods have a type: `DataGridMethods<Row>` (`api`, `getSelectedRows`, `getSelectedIds`, `selectRows(ids)`, `selectAllRows()` for the filtered rows, `deselectAll`, `resetColumns` and the `GridSpreadsheetMethods`; `selectAll` stays the cell range one of the spreadsheet).
|
|
991
991
|
|
|
992
992
|
```ts
|
package/dist/grid/DataGrid.vue
CHANGED
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
:overlay-loading-template="gridOptions?.overlayLoadingTemplate ?? loadingTemplate"
|
|
66
66
|
:quick-filter-text="serverPagination ? void 0 : query"
|
|
67
67
|
:row-selection="gridRowSelection"
|
|
68
|
+
:selection-column-def="gridSelectionColumnDef"
|
|
68
69
|
:pagination="paginated && pageSize !== 'all'"
|
|
69
70
|
:pagination-page-size="pageSize === 'all' ? void 0 : pageSize"
|
|
70
71
|
:pagination-page-size-selector="false"
|
|
@@ -164,7 +165,7 @@ import {
|
|
|
164
165
|
registerGridSpreadsheetModules
|
|
165
166
|
} from "./modules";
|
|
166
167
|
import { createGridSpreadsheet } from "./spreadsheet";
|
|
167
|
-
import { getGridTheme } from "./theme";
|
|
168
|
+
import { getGridTheme, selectionColumnWidth } from "./theme";
|
|
168
169
|
registerGridModules();
|
|
169
170
|
const props = defineProps({
|
|
170
171
|
rows: { type: Array, required: false, default: () => [] },
|
|
@@ -355,6 +356,17 @@ const gridRowSelection = computed(() => {
|
|
|
355
356
|
selectAll: "filtered"
|
|
356
357
|
};
|
|
357
358
|
});
|
|
359
|
+
const gridSelectionColumnDef = computed(() => {
|
|
360
|
+
const width = selectionColumnWidth(gridDensity.value);
|
|
361
|
+
return {
|
|
362
|
+
width,
|
|
363
|
+
minWidth: width,
|
|
364
|
+
maxWidth: width,
|
|
365
|
+
resizable: false,
|
|
366
|
+
suppressSizeToFit: true,
|
|
367
|
+
...props.gridOptions?.selectionColumnDef
|
|
368
|
+
};
|
|
369
|
+
});
|
|
358
370
|
const defaultColDef = computed(() => ({
|
|
359
371
|
sortable: true,
|
|
360
372
|
resizable: true,
|
package/dist/grid/theme.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { GridDensity } from './types';
|
|
2
|
+
export declare function selectionColumnWidth(density: GridDensity): number;
|
|
2
3
|
export declare function createGridTheme(density: GridDensity, rowHeight?: number): import("ag-grid-community").Theme<import("ag-grid-community").ThemeDefaultParams>;
|
|
3
4
|
export declare function getGridTheme(density: GridDensity, rowHeight?: number): import("ag-grid-community").Theme<import("ag-grid-community").ThemeDefaultParams>;
|
package/dist/grid/theme.mjs
CHANGED
|
@@ -4,6 +4,10 @@ const spacingByDensity = {
|
|
|
4
4
|
normal: 6,
|
|
5
5
|
comfortable: 9
|
|
6
6
|
};
|
|
7
|
+
const CHECKBOX_SIZE = 16;
|
|
8
|
+
export function selectionColumnWidth(density) {
|
|
9
|
+
return CHECKBOX_SIZE + spacingByDensity[density] * 6;
|
|
10
|
+
}
|
|
7
11
|
const themes = /* @__PURE__ */ new Map();
|
|
8
12
|
export function createGridTheme(density, rowHeight) {
|
|
9
13
|
const theme = themeQuartz.withParams({
|
package/package.json
CHANGED