fix(grid): show exact total row count by default

This commit is contained in:
zipg
2026-07-24 10:46:53 +08:00
committed by GitHub
parent 0ad8e4a326
commit 5186ecfa03
2 changed files with 16 additions and 2 deletions
@@ -310,8 +310,10 @@ interface DataGridProps {
}
const props = withDefaults(defineProps<DataGridProps>(), {
// Vue casts absent Boolean props to false unless the default is explicitly
// undefined; omitted row-action limits must keep normal table-data editing.
// Vue casts absent Boolean props to false unless a default is explicit.
// Regular grids have exact totals; document stores opt into lower-bound totals.
totalRowCountIsExact: true,
// Omitted row-action limits must keep normal table-data editing.
allowInsertRows: undefined,
allowDeleteRows: undefined,
});
@@ -0,0 +1,12 @@
import { describe, expect, it } from "vitest";
import DataGrid from "../DataGrid.vue";
type VuePropDefinition = { default?: unknown };
type VueComponentWithProps = { props?: Record<string, VuePropDefinition> };
describe("DataGrid total row count exactness", () => {
it("treats totals as exact unless a caller explicitly marks them as a lower bound", () => {
const component = DataGrid as unknown as VueComponentWithProps;
expect(component.props?.totalRowCountIsExact?.default).toBe(true);
});
});