simple-table-core 4.0.2 → 4.0.4

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.
@@ -10,7 +10,7 @@ export interface ColumnEditorRowRendererComponents {
10
10
  /** Default pin column (outline / filled); omit when building a fully custom row */
11
11
  pinIcon?: IconElement;
12
12
  }
13
- /** Pin / unpin actions for column editor rows (also use for lock/tooltip UX via HeaderObject.isEssential). */
13
+ /** Pin / unpin actions for column editor rows (also use for lock/tooltip UX via HeaderObject.essential). */
14
14
  export interface ColumnEditorPinControl {
15
15
  pinnedSide: "left" | "right" | null;
16
16
  canPinLeft: boolean;
@@ -26,8 +26,8 @@ interface ColumnEditorRowRendererProps {
26
26
  components: ColumnEditorRowRendererComponents;
27
27
  /** Which panel section this row is rendered in */
28
28
  panelSection?: PanelSection;
29
- /** Resolved from HeaderObject.isEssential / essentialAccessors */
30
- isEssential?: boolean;
29
+ /** Resolved from HeaderObject.essential / essentialAccessors */
30
+ essential?: boolean;
31
31
  /** False when visibility cannot be toggled (essential columns) */
32
32
  canToggleVisibility?: boolean;
33
33
  /** Mirrors `columnEditorConfig.allowColumnPinning` (default true) */
@@ -97,29 +97,17 @@ type HeaderObject = {
97
97
  filterOperators?: FilterOperator[];
98
98
  headerRenderer?: HeaderRenderer;
99
99
  hide?: boolean;
100
- /**
101
- * Whether cells in this column are editable.
102
- * @deprecated Prefer {@link editable}
103
- */
104
- isEditable?: boolean;
105
- /** Whether cells in this column are editable. Preferred over `isEditable`. */
100
+ /** Whether cells in this column are editable. */
106
101
  editable?: boolean;
107
102
  excludeFromRender?: boolean;
108
103
  excludeFromCsv?: boolean;
109
104
  isSelectionColumn?: boolean;
110
105
  /**
111
- * When true, column stays visible, cannot be unpinned from a pinned side, cannot reorder above non-essentials in its section.
112
- * @deprecated Prefer {@link essential}
106
+ * When true, column stays visible, cannot be unpinned from a pinned side, and
107
+ * cannot reorder above non-essentials in its section.
113
108
  */
114
- isEssential?: boolean;
115
- /** When true, column stays visible and cannot be unpinned / reordered above non-essentials. Preferred over `isEssential`. */
116
109
  essential?: boolean;
117
- /**
118
- * Whether this column is sortable.
119
- * @deprecated Prefer {@link sortable}
120
- */
121
- isSortable?: boolean;
122
- /** Whether this column is sortable. Preferred over `isSortable`. */
110
+ /** Whether this column is sortable. */
123
111
  sortable?: boolean;
124
112
  label: string;
125
113
  minWidth?: number | string;
@@ -66,6 +66,12 @@ export interface SimpleTableConfig {
66
66
  externalFilterHandling?: boolean;
67
67
  externalSortHandling?: boolean;
68
68
  footerRenderer?: (props: FooterRendererProps) => HTMLElement | string | null;
69
+ /**
70
+ * @see SimpleTableProps.footerRenderKey
71
+ * Included in the custom-footer reuse key so external footer state can bust
72
+ * the scroll-safe cache without replacing the `footerRenderer` function.
73
+ */
74
+ footerRenderKey?: string | number;
69
75
  /** Placement of the pagination footer. Default `"bottom"`. */
70
76
  footerPosition?: FooterPosition;
71
77
  headerDropdown?: VanillaHeaderDropdown;
@@ -88,6 +88,15 @@ export interface SimpleTableProps {
88
88
  externalFilterHandling?: boolean;
89
89
  externalSortHandling?: boolean;
90
90
  footerRenderer?: (props: FooterRendererProps) => HTMLElement | string | null;
91
+ /**
92
+ * Cache key for a custom `footerRenderer`. Include any external state the
93
+ * footer reads (e.g. a loading flag) so the footer re-renders when that
94
+ * state changes even if page/row-count inputs are unchanged.
95
+ *
96
+ * Scroll-driven re-renders still reuse the previous footer DOM when this key
97
+ * (and pagination inputs) are stable — that avoids scroll-snap regressions.
98
+ */
99
+ footerRenderKey?: string | number;
91
100
  footerPosition?: FooterPosition;
92
101
  headerDropdown?: HeaderDropdown;
93
102
  height?: string | number;
@@ -1,6 +1,7 @@
1
1
  import HeaderObject, { Accessor } from "../types/HeaderObject";
2
2
  import { Pinned } from "../types/Pinned";
3
3
  import { RowId } from "../types/RowId";
4
+ export { isHeaderExcludedFromLayout } from "./headerLayoutUtils";
4
5
  export declare const getCellId: ({ accessor, rowId }: {
5
6
  accessor: Accessor;
6
7
  rowId: RowId;
@@ -19,9 +19,10 @@ export declare const getAllChildHeaders: (header: HeaderObject) => HeaderObject[
19
19
  export declare const hasCollapsibleChildren: (header: HeaderObject) => boolean;
20
20
  /**
21
21
  * Number of visible leaf (bottom-level) columns a header spans, for
22
- * `aria-colspan` on grouped/nested header cells. Leaf headers that are hidden
23
- * (`hide`) or suppressed by their parent's collapsed state are excluded so the
24
- * announced span matches the columns actually rendered. Leaf headers return 1.
22
+ * `aria-colspan` on grouped/nested header cells. Leaf headers excluded from
23
+ * layout (`hide` / `excludeFromRender`) or suppressed by their parent's
24
+ * collapsed state are omitted so the announced span matches the columns
25
+ * actually rendered. Leaf headers return 1.
25
26
  */
26
27
  export declare const getHeaderColspan: (header: HeaderObject, rootHeaders: HeaderObject[], collapsedHeaders: Set<Accessor>) => number;
27
28
  /**
@@ -0,0 +1,9 @@
1
+ import type HeaderObject from "../types/HeaderObject";
2
+ /**
3
+ * True when a column must not participate in table layout: cells, widths,
4
+ * positions, colspan, pinned-section math, etc.
5
+ *
6
+ * Covers both user-hidden columns (`hide`) and export-only columns
7
+ * (`excludeFromRender`). Prefer this over checking either flag alone.
8
+ */
9
+ export declare const isHeaderExcludedFromLayout: (header: Pick<HeaderObject, "hide" | "excludeFromRender">) => boolean;
@@ -1,21 +1,12 @@
1
1
  import type HeaderObject from "../types/HeaderObject";
2
2
  import type { SimpleTableConfig } from "../types/SimpleTableConfig";
3
- /** Preferred column-def aliases accepted on column objects (normalized to `is*` fields). */
4
- export type ColumnDefAliases = {
5
- /** @deprecated Prefer `editable` */
6
- isEditable?: boolean;
7
- editable?: boolean;
8
- /** @deprecated Prefer `sortable` */
9
- isSortable?: boolean;
10
- sortable?: boolean;
11
- /** @deprecated Prefer `essential` */
12
- isEssential?: boolean;
13
- essential?: boolean;
14
- };
15
3
  /**
16
4
  * Consumer-facing config input: accepts preferred prop names alongside legacy
17
5
  * names. {@link normalizeConfig} / {@link normalizeConfigPatch} collapse aliases
18
6
  * into the canonical {@link SimpleTableConfig} shape used internally.
7
+ *
8
+ * Column flags (`sortable` / `editable` / `essential`) have no legacy aliases —
9
+ * they are stored and returned as those names only.
19
10
  */
20
11
  export type SimpleTableConfigInput = Omit<SimpleTableConfig, "defaultHeaders" | "editColumns" | "editColumnsInitOpen" | "shouldPaginate" | "onGridReady" | "useHoverRowBackground" | "useOddColumnBackground" | "useOddEvenRowBackground"> & {
21
12
  /** Preferred column definitions prop. */
@@ -47,7 +38,7 @@ export type SimpleTableConfigInput = Omit<SimpleTableConfig, "defaultHeaders" |
47
38
  /** @deprecated Prefer `oddEvenRowBackground` */
48
39
  useOddEvenRowBackground?: boolean;
49
40
  };
50
- /** Normalize a single column def: preferred bare adjectives win over `is*` aliases. */
41
+ /** Pass-through for column trees (kept for call-site stability / future transforms). */
51
42
  export declare function normalizeColumnDef(header: HeaderObject): HeaderObject;
52
43
  export declare function normalizeColumnDefs(headers: HeaderObject[]): HeaderObject[];
53
44
  /**
@@ -9,7 +9,7 @@ export declare function partitionRootHeadersByPin(headers: HeaderObject[]): {
9
9
  pinnedRight: HeaderObject[];
10
10
  };
11
11
  export declare function isHeaderEssential(header: HeaderObject, essentialAccessors: ReadonlySet<string>): boolean;
12
- /** Accessors for every header with `isEssential` in the tree (including nested). */
12
+ /** Accessors for every header with `essential` in the tree (including nested). */
13
13
  export declare function collectEssentialAccessors(headers: HeaderObject[]): Set<string>;
14
14
  /** Within one sibling list: all essential columns must form a left prefix. */
15
15
  export declare function hasEssentialPrefixOrder(siblings: HeaderObject[], essentialAccessors: ReadonlySet<string>): boolean;
@@ -14,14 +14,14 @@ export type HeaderStructureLike = {
14
14
  type?: string;
15
15
  pinned?: string | boolean | null;
16
16
  hide?: boolean;
17
- isSortable?: boolean;
17
+ sortable?: boolean;
18
18
  filterable?: boolean;
19
19
  align?: string;
20
20
  collapsible?: boolean;
21
21
  collapseDefault?: boolean;
22
22
  showWhen?: string;
23
- isEditable?: boolean;
24
- isEssential?: boolean;
23
+ editable?: boolean;
24
+ essential?: boolean;
25
25
  disableReorder?: boolean;
26
26
  expandable?: boolean;
27
27
  excludeFromRender?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-table-core",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",