schummar-table 0.46.8 → 0.46.9

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.
@@ -1,6 +1,6 @@
1
1
  import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { P as PartialTableTheme } from './types-CNiUxMEp.cjs';
3
+ import { P as PartialTableTheme } from './types-CADdapzE.cjs';
4
4
  import '@emotion/react';
5
5
  import './exporter-u6SatTo6.cjs';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { P as PartialTableTheme } from './types-BM1Cjg67.js';
3
+ import { P as PartialTableTheme } from './types-DNdXIGcn.js';
4
4
  import '@emotion/react';
5
5
  import './exporter-u6SatTo6.js';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { P as PartialTableTheme } from './types-CNiUxMEp.cjs';
3
+ import { P as PartialTableTheme } from './types-CADdapzE.cjs';
4
4
  import '@emotion/react';
5
5
  import './exporter-u6SatTo6.cjs';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { P as PartialTableTheme } from './types-BM1Cjg67.js';
3
+ import { P as PartialTableTheme } from './types-DNdXIGcn.js';
4
4
  import '@emotion/react';
5
5
  import './exporter-u6SatTo6.js';
6
6
 
@@ -29,7 +29,7 @@ type MemoizedFunctions<T> = {
29
29
  type CSSInterpolation = Exclude<Interpolation<Theme>, ((...args: any[]) => any) | Array<any>>;
30
30
  type Falsy = false | 0 | '' | null | undefined;
31
31
  type DisplaySize = 'desktop' | 'mobile' | (string & {});
32
- type DisplaySizes = Record<DisplaySize, number>;
32
+ type DisplaySizes = Partial<Record<DisplaySize, number>>;
33
33
  interface TableTheme<TItem = unknown> {
34
34
  /** Define display texts. */
35
35
  text: {
@@ -174,6 +174,8 @@ type MemoizedTableTheme<TItem> = Omit<TableTheme, 'classes' | 'styles' | 'text'>
174
174
  styles: MemoizedFunctions<TableTheme<TItem>['styles']>;
175
175
  text: MemoizedFunctions<TableTheme<TItem>['text']>;
176
176
  };
177
+ type ColumnGenerator<TItem> = (col: ColumnFactory<TItem>) => (Column<TItem, any> | Falsy)[];
178
+ type ColumnFactory<TItem> = <TColumnValue>(value: (item: TItem) => TColumnValue, column: Omit<Column<TItem, TColumnValue>, 'value'>) => Column<TItem, TColumnValue>;
177
179
  interface TableProps<TItem> extends PartialTableTheme<TItem> {
178
180
  /** The data to be rendered. One item per row. */
179
181
  items?: readonly TItem[];
@@ -184,7 +186,7 @@ interface TableProps<TItem> extends PartialTableTheme<TItem> {
184
186
  /** If true for an item, it means that children will be loaded asynchronously as soon as item is expanded. */
185
187
  hasDeferredChildren?: (item: TItem) => boolean;
186
188
  /** Column definitions. */
187
- columns: (Column<TItem, any> | Falsy)[] | ((col: <TColumnValue>(value: (item: TItem) => TColumnValue, column: Omit<Column<TItem, TColumnValue>, 'value'>) => Column<TItem, TColumnValue>) => (Column<TItem, any> | Falsy)[]);
189
+ columns: (Column<TItem, any> | Falsy)[] | ColumnGenerator<TItem>;
188
190
  /** Default props for all column. Will take effect if not overriden in column definition. */
189
191
  defaultColumnProps?: Omit<Column<TItem, unknown>, 'id' | 'value'>;
190
192
  /** Set props for multiple columns at once. Will take effect if not overriden in column definition. */
@@ -29,7 +29,7 @@ type MemoizedFunctions<T> = {
29
29
  type CSSInterpolation = Exclude<Interpolation<Theme>, ((...args: any[]) => any) | Array<any>>;
30
30
  type Falsy = false | 0 | '' | null | undefined;
31
31
  type DisplaySize = 'desktop' | 'mobile' | (string & {});
32
- type DisplaySizes = Record<DisplaySize, number>;
32
+ type DisplaySizes = Partial<Record<DisplaySize, number>>;
33
33
  interface TableTheme<TItem = unknown> {
34
34
  /** Define display texts. */
35
35
  text: {
@@ -174,6 +174,8 @@ type MemoizedTableTheme<TItem> = Omit<TableTheme, 'classes' | 'styles' | 'text'>
174
174
  styles: MemoizedFunctions<TableTheme<TItem>['styles']>;
175
175
  text: MemoizedFunctions<TableTheme<TItem>['text']>;
176
176
  };
177
+ type ColumnGenerator<TItem> = (col: ColumnFactory<TItem>) => (Column<TItem, any> | Falsy)[];
178
+ type ColumnFactory<TItem> = <TColumnValue>(value: (item: TItem) => TColumnValue, column: Omit<Column<TItem, TColumnValue>, 'value'>) => Column<TItem, TColumnValue>;
177
179
  interface TableProps<TItem> extends PartialTableTheme<TItem> {
178
180
  /** The data to be rendered. One item per row. */
179
181
  items?: readonly TItem[];
@@ -184,7 +186,7 @@ interface TableProps<TItem> extends PartialTableTheme<TItem> {
184
186
  /** If true for an item, it means that children will be loaded asynchronously as soon as item is expanded. */
185
187
  hasDeferredChildren?: (item: TItem) => boolean;
186
188
  /** Column definitions. */
187
- columns: (Column<TItem, any> | Falsy)[] | ((col: <TColumnValue>(value: (item: TItem) => TColumnValue, column: Omit<Column<TItem, TColumnValue>, 'value'>) => Column<TItem, TColumnValue>) => (Column<TItem, any> | Falsy)[]);
189
+ columns: (Column<TItem, any> | Falsy)[] | ColumnGenerator<TItem>;
188
190
  /** Default props for all column. Will take effect if not overriden in column definition. */
189
191
  defaultColumnProps?: Omit<Column<TItem, unknown>, 'id' | 'value'>;
190
192
  /** Set props for multiple columns at once. Will take effect if not overriden in column definition. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "schummar-table",
3
- "version": "0.46.8",
3
+ "version": "0.46.9",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "repository": "schummar/schummar-table",