@nccirtu/tablefy 0.7.3 → 0.7.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.
@@ -7,6 +7,8 @@ export declare abstract class BaseColumn<TData, TConfig extends BaseColumnConfig
7
7
  sortable(sortable?: boolean): this;
8
8
  searchable(searchable?: boolean): this;
9
9
  hidden(hidden?: boolean): this;
10
+ visibleByDefault(visible?: boolean): this;
11
+ visibilityLabel(label: string): this;
10
12
  alignLeft(): this;
11
13
  alignCenter(): this;
12
14
  alignRight(): this;
@@ -7,6 +7,8 @@ export declare abstract class BaseColumn<TData, TConfig extends BaseColumnConfig
7
7
  sortable(sortable?: boolean): this;
8
8
  searchable(searchable?: boolean): this;
9
9
  hidden(hidden?: boolean): this;
10
+ visibleByDefault(visible?: boolean): this;
11
+ visibilityLabel(label: string): this;
10
12
  alignLeft(): this;
11
13
  alignCenter(): this;
12
14
  alignRight(): this;
@@ -6,6 +6,8 @@ export interface BaseColumnConfig<TData> {
6
6
  sortable?: boolean;
7
7
  searchable?: boolean;
8
8
  hidden?: boolean;
9
+ visibleByDefault?: boolean;
10
+ visibilityLabel?: string;
9
11
  align?: "left" | "center" | "right";
10
12
  width?: string | number;
11
13
  className?: string;
@@ -44,6 +44,14 @@ class BaseColumn {
44
44
  this.config.hidden = hidden;
45
45
  return this;
46
46
  }
47
+ visibleByDefault(visible = true) {
48
+ this.config.visibleByDefault = visible;
49
+ return this;
50
+ }
51
+ visibilityLabel(label) {
52
+ this.config.visibilityLabel = label;
53
+ return this;
54
+ }
47
55
  alignLeft() {
48
56
  this.config.align = "left";
49
57
  return this;
@@ -1229,9 +1237,13 @@ class TextColumn extends BaseColumn {
1229
1237
  return this;
1230
1238
  }
1231
1239
  build() {
1232
- const { accessor, label, sortable, prefix, suffix, placeholder, formatter, } = this.config;
1240
+ const { accessor, label, sortable, prefix, suffix, placeholder, formatter, visibleByDefault, visibilityLabel, } = this.config;
1233
1241
  return {
1234
1242
  accessorKey: accessor,
1243
+ meta: {
1244
+ visibleByDefault,
1245
+ visibilityLabel: visibilityLabel || label || String(accessor),
1246
+ },
1235
1247
  header: ({ column }) => {
1236
1248
  const displayLabel = label || String(accessor);
1237
1249
  if (!sortable) {