@dxos/react-ui-table 0.3.9-main.ee9a520 → 0.3.9-main.ef334cd

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.
@@ -70,11 +70,11 @@ export declare class ColumnBuilder<TData extends RowData> {
70
70
  /**
71
71
  * PublicKey with tooltip.
72
72
  */
73
- key({ label, tooltip, ...props }?: KeyColumnOptions<TData>): Partial<ColumnDef<TData, PublicKey>>;
73
+ key({ label, tooltip, classNames, ...props }?: KeyColumnOptions<TData>): Partial<ColumnDef<TData, PublicKey>>;
74
74
  /**
75
75
  * Row selector
76
76
  */
77
- selectRow({ label, classNames, onUpdate, id, ...props }?: SelectRowColumnOptions<TData>): Parameters<ColumnHelper<TData>['display']>[0];
77
+ selectRow({ classNames, onUpdate, id }?: SelectRowColumnOptions<TData>): Parameters<ColumnHelper<TData>['display']>[0];
78
78
  /**
79
79
  * Switch
80
80
  */
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/helpers.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAwB,KAAK,IAAI,EAAK,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,YAAY,EAElB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,gBAAgB,CAAC;AAQrE,MAAM,MAAM,YAAY,CAAC,KAAK,SAAS,OAAO,EAAE,MAAM,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAE1G,eAAO,MAAM,mBAAmB;;;CAG9B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,KAAK,EAAE,MAAM,IAAI,OAAO,CAAC,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AAE,OAAO,CAAC,CAC1B;IAWD;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,GAAE,iBAAiB,CAAC,KAAK,CAAM,GAAG,OAAO,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;CAmB5G"}
@@ -2,5 +2,6 @@ export * from './components';
2
2
  export * from './helpers';
3
3
  export * from './schema';
4
4
  export * from './theme';
5
+ export { default as translations } from './translations';
5
6
  export * from './types';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,cAAc,SAAS,CAAC"}
@@ -4,7 +4,6 @@ export type TableDef = {
4
4
  columns: ColumnProps[];
5
5
  };
6
6
  export type ColumnType = 'number' | 'boolean' | 'date' | 'string' | 'ref';
7
- export declare const columnTypes: Map<ColumnType, string>;
8
7
  export type ColumnProps = {
9
8
  id: string;
10
9
  prop: string;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,WAAW,EAAE,CAAC;CAC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E1F,eAAO,MAAM,OAAO,EAAE,iBAAiB,CAAC,eAAe,CACQ,CAAC"}
@@ -3,6 +3,17 @@ declare const _default: {
3
3
  'en-US': {
4
4
  table: {
5
5
  'no selection label': string;
6
+ 'number column type label': string;
7
+ 'boolean column type label': string;
8
+ 'date column type label': string;
9
+ 'string column type label': string;
10
+ 'ref column type label': string;
11
+ 'digits label': string;
12
+ 'save label': string;
13
+ 'delete label': string;
14
+ 'column label label': string;
15
+ 'property key label': string;
16
+ 'column type label': string;
6
17
  };
7
18
  };
8
19
  }[];
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,UAAU,CAAC;;;;;;;;AAEtC,wBAQE"}
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,UAAU,CAAC;;;;;;;;;;;;;;;;;;;AAEtC,wBAmBE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-table",
3
- "version": "0.3.9-main.ee9a520",
3
+ "version": "0.3.9-main.ef334cd",
4
4
  "description": "A table component.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -22,14 +22,14 @@
22
22
  "@tanstack/react-table": "^8.9.3",
23
23
  "date-fns": "^2.29.3",
24
24
  "lodash.defaultsdeep": "^4.6.1",
25
- "@dxos/invariant": "0.3.9-main.ee9a520",
26
- "@dxos/async": "0.3.9-main.ee9a520",
27
- "@dxos/react-ui": "0.3.9-main.ee9a520",
28
- "@dxos/keys": "0.3.9-main.ee9a520",
29
- "@dxos/react-ui-theme": "0.3.9-main.ee9a520",
30
- "@dxos/react-ui-types": "0.3.9-main.ee9a520",
31
- "@dxos/util": "0.3.9-main.ee9a520",
32
- "@dxos/react-ui-searchlist": "0.3.9-main.ee9a520"
25
+ "@dxos/async": "0.3.9-main.ef334cd",
26
+ "@dxos/keys": "0.3.9-main.ef334cd",
27
+ "@dxos/invariant": "0.3.9-main.ef334cd",
28
+ "@dxos/react-ui-searchlist": "0.3.9-main.ef334cd",
29
+ "@dxos/react-ui": "0.3.9-main.ef334cd",
30
+ "@dxos/react-ui-theme": "0.3.9-main.ef334cd",
31
+ "@dxos/react-ui-types": "0.3.9-main.ef334cd",
32
+ "@dxos/util": "0.3.9-main.ef334cd"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@faker-js/faker": "^8.0.2",
@@ -43,7 +43,7 @@
43
43
  "react-dom": "^18.2.0",
44
44
  "vite": "^4.3.9",
45
45
  "vite-plugin-turbosnap": "^1.0.2",
46
- "@dxos/react-ui-theme": "0.3.9-main.ee9a520"
46
+ "@dxos/react-ui-theme": "0.3.9-main.ef334cd"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@phosphor-icons/react": "^2.0.5",
@@ -64,7 +64,10 @@ export const CellCombobox = <TData extends RowData>({
64
64
  {value ? (
65
65
  <>
66
66
  <span
67
- className={mx('font-normal text-start flex-1 min-is-0 truncate mie-2', !value && staticPlaceholderText)}
67
+ className={mx(
68
+ 'font-normal text-start text-base flex-1 min-is-0 truncate mie-2',
69
+ !value && staticPlaceholderText,
70
+ )}
68
71
  >
69
72
  {model.getText(value)}
70
73
  </span>
@@ -6,11 +6,12 @@ import { Check, CaretDown, Trash, X } from '@phosphor-icons/react';
6
6
  import { type HeaderContext, type RowData } from '@tanstack/react-table';
7
7
  import React, { type FC, type PropsWithChildren, useRef, useState } from 'react';
8
8
 
9
- import { Button, DensityProvider, Input, Popover, Select, Separator } from '@dxos/react-ui';
9
+ import { Button, DensityProvider, Input, Popover, Select, Separator, useTranslation } from '@dxos/react-ui';
10
10
  import { getSize, mx } from '@dxos/react-ui-theme';
11
11
  import { safeParseInt } from '@dxos/util';
12
12
 
13
- import { type TableDef, type ColumnProps, columnTypes } from '../schema';
13
+ import { type TableDef, type ColumnProps, type ColumnType } from '../schema';
14
+ import { translationKey } from '../translations';
14
15
 
15
16
  export type ColumnMenuProps<TData extends RowData, TValue> = {
16
17
  context: HeaderContext<TData, TValue>;
@@ -23,13 +24,11 @@ export type ColumnMenuProps<TData extends RowData, TValue> = {
23
24
 
24
25
  export const ColumnMenu = <TData extends RowData, TValue>({ column, ...props }: ColumnMenuProps<TData, TValue>) => {
25
26
  const title = column.label?.length ? column.label : column.id;
26
-
27
27
  return (
28
- <div className='flex grow items-center overflow-hidden'>
29
- <div className='truncate' title={title}>
28
+ <div className='flex items-center gap-2'>
29
+ <div className='flex-1 min-is-0 truncate' title={title}>
30
30
  {title}
31
31
  </div>
32
- <div className='grow' />
33
32
  <div className='flex shrink-0'>
34
33
  <ColumnPanel {...props} column={column} />
35
34
  </div>
@@ -59,6 +58,7 @@ export const ColumnPanel = <TData extends RowData, TValue>({
59
58
  const [label, setLabel] = useState(column.label);
60
59
  const [digits, setDigits] = useState(String(column.digits ?? '0'));
61
60
  const propRef = useRef<HTMLInputElement>(null);
61
+ const { t } = useTranslation(translationKey);
62
62
 
63
63
  const handleCancel = () => {
64
64
  setProp(column.id);
@@ -99,7 +99,7 @@ export const ColumnPanel = <TData extends RowData, TValue>({
99
99
  return (
100
100
  <Popover.Root open={open} onOpenChange={(nextOpen) => setOpen(nextOpen)}>
101
101
  <Popover.Trigger asChild>
102
- <Button variant='ghost' classNames='p-0'>
102
+ <Button variant='ghost' classNames='p-1'>
103
103
  <CaretDown className={getSize(4)} />
104
104
  </Button>
105
105
  </Popover.Trigger>
@@ -110,7 +110,7 @@ export const ColumnPanel = <TData extends RowData, TValue>({
110
110
  <div className='flex flex-col gap-1'>
111
111
  <Section>
112
112
  <Input.Root>
113
- <Input.Label classNames='mbe-1'>Label</Input.Label>
113
+ <Input.Label classNames='mbe-1'>{t('column label label')}</Input.Label>
114
114
  <Input.TextInput
115
115
  placeholder='Column label'
116
116
  value={label ?? ''}
@@ -119,7 +119,7 @@ export const ColumnPanel = <TData extends RowData, TValue>({
119
119
  />
120
120
  </Input.Root>
121
121
  <Input.Root>
122
- <Input.Label classNames='mbe-1 mbs-3'>Property</Input.Label>
122
+ <Input.Label classNames='mbe-1 mbs-3'>{t('property key label')}</Input.Label>
123
123
  <Input.TextInput
124
124
  ref={propRef}
125
125
  placeholder='Property key'
@@ -129,15 +129,15 @@ export const ColumnPanel = <TData extends RowData, TValue>({
129
129
  />
130
130
  </Input.Root>
131
131
  <Input.Root>
132
- <Input.Label classNames='mbe-1 mbs-3'>Type</Input.Label>
132
+ <Input.Label classNames='mbe-1 mbs-3'>{t('column type label')}</Input.Label>
133
133
  <Select.Root value={type} onValueChange={setType}>
134
134
  <Select.TriggerButton placeholder='Type' classNames='is-full' />
135
135
  <Select.Portal>
136
136
  <Select.Content>
137
137
  <Select.Viewport>
138
- {Array.from(columnTypes.entries()).map(([type, label]) => (
138
+ {(['number', 'boolean', 'string', 'ref'] as ColumnType[]).map((type) => (
139
139
  <Select.Option key={type} value={type}>
140
- {label}
140
+ {t(`${type} column type label`)}
141
141
  </Select.Option>
142
142
  ))}
143
143
  </Select.Viewport>
@@ -151,7 +151,7 @@ export const ColumnPanel = <TData extends RowData, TValue>({
151
151
  <>
152
152
  <Section>
153
153
  <Input.Root>
154
- <Input.Label classNames='mbe-1 mbs-3'>Decimal places</Input.Label>
154
+ <Input.Label classNames='mbe-1 mbs-3'>{t('digits label')}</Input.Label>
155
155
  {/* TODO(burdon): Constrain input to numbers. */}
156
156
  <Input.TextInput value={digits ?? ''} onChange={(event) => setDigits(event.target.value)} />
157
157
  </Input.Root>
@@ -213,17 +213,17 @@ export const ColumnPanel = <TData extends RowData, TValue>({
213
213
  <Section className='space-b-1.5'>
214
214
  {/* TODO(burdon): Style as DropdownMenuItem. */}
215
215
  <Button variant='primary' classNames='is-full flex gap-2' onClick={handleSave}>
216
- <span>Save</span>
216
+ <span>{t('save label')}</span>
217
217
  <div className='grow' />
218
218
  <Check className={getSize(5)} />
219
219
  </Button>
220
220
  <Button classNames='is-full flex gap-2' onClick={handleCancel}>
221
- <span>Cancel</span>
221
+ <span>{t('cancel label', { ns: 'os' })}</span>
222
222
  <div className='grow' />
223
223
  <X className={getSize(5)} />
224
224
  </Button>
225
225
  <Button classNames='is-full flex gap-2' onClick={() => onDelete?.(column.id)}>
226
- <span>Delete</span>
226
+ <span>{t('delete label')}</span>
227
227
  <div className='grow' />
228
228
  <Trash className={getSize(5)} />
229
229
  </Button>
@@ -38,6 +38,7 @@ export const Table = <TData extends RowData>(props: TableProps<TData>) => {
38
38
  fullWidth,
39
39
  debug,
40
40
  onDataSelectionChange,
41
+ classNames,
41
42
  } = props;
42
43
 
43
44
  const TableProvider = UntypedTableProvider as TypedTableProvider<TData>;
@@ -138,7 +139,11 @@ export const Table = <TData extends RowData>(props: TableProps<TData>) => {
138
139
  table={table}
139
140
  isGrid={role === 'grid' || role === 'treegrid'}
140
141
  >
141
- <table role={role} className={tableRoot(props)} {...(!fullWidth && { style: { width: table.getTotalSize() } })}>
142
+ <table
143
+ role={role}
144
+ className={tableRoot(props, classNames)}
145
+ {...(!fullWidth && { style: { width: table.getTotalSize() } })}
146
+ >
142
147
  <TableHead />
143
148
 
144
149
  {grouping.length === 0 && <TableBody rows={table.getRowModel().rows} />}
@@ -4,6 +4,8 @@
4
4
 
5
5
  import { type RowData, type RowSelectionState, type Table, type VisibilityState } from '@tanstack/react-table';
6
6
 
7
+ import { type ClassNameValue } from '@dxos/react-ui-types';
8
+
7
9
  import { type KeyValue, type TableColumnDef } from '../../types';
8
10
 
9
11
  export type TableFlags = Partial<{
@@ -15,6 +17,7 @@ export type TableFlags = Partial<{
15
17
  fullWidth: boolean;
16
18
  debug: boolean;
17
19
  expand: boolean;
20
+ stickyHeader: boolean;
18
21
  rowsSelectable: boolean | 'multi';
19
22
  }>;
20
23
 
@@ -41,6 +44,8 @@ export type TableProps<TData extends RowData> = TableFlags &
41
44
  onRowSelectionChange: (rowSelection: RowSelectionState) => void;
42
45
  // Derived from row selection
43
46
  onDataSelectionChange: (dataSelection: TData[]) => void;
47
+ // `table` element props
48
+ classNames: ClassNameValue;
44
49
  }>;
45
50
 
46
51
  export type { RowSelectionState, VisibilityState, TableColumnDef, KeyValue };
package/src/helpers.tsx CHANGED
@@ -2,6 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ import { useFocusFinders } from '@fluentui/react-tabster';
5
6
  import { Check, ClipboardText, type Icon, X } from '@phosphor-icons/react';
6
7
  import {
7
8
  createColumnHelper,
@@ -13,13 +14,11 @@ import {
13
14
  } from '@tanstack/react-table';
14
15
  import format from 'date-fns/format';
15
16
  import formatDistanceToNow from 'date-fns/formatDistanceToNow';
16
- import defaultsDeep from 'lodash.defaultsdeep';
17
- import React, { useRef, useState } from 'react';
17
+ import React, { useEffect, useRef, useState } from 'react';
18
18
 
19
19
  import { type PublicKey } from '@dxos/keys';
20
20
  import { type ClassNameValue, Input, Tooltip } from '@dxos/react-ui';
21
21
  import { getSize, mx } from '@dxos/react-ui-theme';
22
- import { stripUndefinedValues } from '@dxos/util';
23
22
 
24
23
  import { CellCombobox } from './components';
25
24
  import { useTableContext } from './components/Table/TableContext';
@@ -32,6 +31,7 @@ export const createColumnBuilder = <TData extends RowData>() => ({
32
31
  builder: new ColumnBuilder<TData>(),
33
32
  });
34
33
 
34
+ // TODO(thure): This interface is redundant, e.g. `classNames` == `meta.cell.classNames`
35
35
  /**
36
36
  * NOTE: Can use `meta` for custom properties.
37
37
  */
@@ -82,22 +82,15 @@ export type IconColumnOptions<TData extends RowData> = BaseColumnOptions<TData,
82
82
  };
83
83
  };
84
84
 
85
- const defaults = <TData extends RowData, TValue>(
86
- options: Partial<ColumnDef<TData, TValue>>,
87
- ...sources: Partial<ColumnDef<TData, TValue>>[]
88
- ): Partial<ColumnDef<TData, TValue>> => {
89
- return stripUndefinedValues(defaultsDeep({}, options, ...sources));
90
- };
91
-
92
85
  const ComboboxBuilderCell = <TData extends RowData>(cellContext: CellContext<TData, TData>) => {
93
86
  const { model, onUpdate } = cellContext.column.columnDef.meta as ColumnMeta<TData, TData>;
94
- return (
87
+ return model ? (
95
88
  <CellCombobox<TData>
96
- model={model!}
89
+ model={model}
97
90
  value={cellContext.getValue()}
98
91
  onValueChange={(value) => onUpdate?.(cellContext.row.original, cellContext.column.id, value)}
99
92
  />
100
- );
93
+ ) : null;
101
94
  };
102
95
 
103
96
  const StringBuilderCell = <TData extends RowData>(cellContext: CellContext<TData, string>) => {
@@ -140,10 +133,27 @@ const StringBuilderCell = <TData extends RowData>(cellContext: CellContext<TData
140
133
  );
141
134
  };
142
135
 
136
+ const parseNumber = (text?: string) => (text?.trim().length ? Number(text) : NaN);
137
+
138
+ const displayNumber = (value?: number, digits?: number) =>
139
+ value || value === 0
140
+ ? value.toLocaleString(undefined, {
141
+ minimumFractionDigits: digits ?? 0,
142
+ maximumFractionDigits: digits ?? 2,
143
+ })
144
+ : '';
145
+
143
146
  const NumberBuilderCell = <TData extends RowData>(cellContext: CellContext<TData, number>) => {
144
- const { onUpdate, cell, digits } = cellContext.column.columnDef.meta as ColumnMeta<TData, string>;
147
+ const { onUpdate, digits } = cellContext.column.columnDef.meta as ColumnMeta<TData, string>;
145
148
  const value = cellContext.getValue();
146
- const [text, setText] = useState<string>();
149
+ const [text, setText] = useState<string>(displayNumber(value, digits));
150
+ const { findPrevFocusable } = useFocusFinders();
151
+ const ref = useRef<HTMLInputElement | null>(null);
152
+
153
+ // Update display value if `digits` changes and input is not in focus.
154
+ useEffect(() => {
155
+ (!document.activeElement || document.activeElement !== ref.current) && setText(displayNumber(value, digits));
156
+ }, [digits, value]);
147
157
 
148
158
  const handleEdit = () => {
149
159
  if (onUpdate) {
@@ -153,39 +163,34 @@ const NumberBuilderCell = <TData extends RowData>(cellContext: CellContext<TData
153
163
 
154
164
  // TODO(burdon): Property is encoded as float (e.g., 6.1 => 6.099)
155
165
  const handleSave = () => {
156
- const value = text?.trim().length ? Number(text) : NaN;
157
- onUpdate?.(cellContext.row.original, cellContext.column.id, isNaN(value) ? undefined : value);
158
- setText(undefined);
166
+ const nextValue = parseNumber(text);
167
+ onUpdate?.(cellContext.row.original, cellContext.column.id, isNaN(nextValue) ? undefined : nextValue);
168
+ setText(displayNumber(nextValue, digits));
169
+ // Shift focus only if input is focused on save (e.g. on `Enter`).
170
+ ref.current && document.activeElement === ref.current && findPrevFocusable(ref.current)?.focus();
159
171
  };
160
172
 
161
- const handleCancel = () => {
162
- setText(undefined);
173
+ const _handleCancel = () => {
174
+ setText(displayNumber(value, digits));
175
+ ref.current && findPrevFocusable(ref.current)?.focus();
163
176
  };
164
177
 
165
- if (text !== undefined) {
166
- return (
167
- <Input.Root>
168
- <Input.TextInput
169
- value={text}
170
- classNames={['is-full text-end font-mono']}
171
- onBlur={handleSave}
172
- onChange={(event) => setText(event.target.value)}
173
- onKeyDown={(event) => (event.key === 'Escape' && handleCancel()) || (event.key === 'Enter' && handleSave())}
174
- />
175
- </Input.Root>
176
- );
177
- }
178
-
179
178
  return (
180
- <div
181
- className={mx('is-full text-end font-mono empty:after:content-[" "]', textPadding, cell?.classNames)}
182
- onClick={handleEdit}
183
- >
184
- {value?.toLocaleString(undefined, {
185
- minimumFractionDigits: digits ?? 0,
186
- maximumFractionDigits: digits ?? 2,
187
- })}
188
- </div>
179
+ <Input.Root>
180
+ <Input.TextInput
181
+ ref={ref}
182
+ variant='subdued'
183
+ value={text}
184
+ classNames={['is-full text-end font-mono', textPadding]}
185
+ onBlur={handleSave}
186
+ onFocus={handleEdit}
187
+ onChange={({ target: { value } }) => setText(value)}
188
+ onKeyDown={(event) => {
189
+ // TODO(thure): `Escape` is reserved for blurring the input and moving focus to the cell
190
+ return /* (event.key === 'Escape' && handleCancel()) || */ event.key === 'Enter' && handleSave();
191
+ }}
192
+ />
193
+ </Input.Root>
189
194
  );
190
195
  };
191
196
 
@@ -245,13 +250,8 @@ export class ColumnBuilder<TData extends RowData> {
245
250
  onUpdate,
246
251
  ...props
247
252
  }: ComboboxColumnOptions<TData>): Partial<ColumnDef<TData, any>> {
248
- return defaults(props, {
253
+ return {
249
254
  minSize: 100,
250
- meta: {
251
- model,
252
- onUpdate,
253
- cell: { classNames },
254
- },
255
255
  header: (column) => {
256
256
  return label ?? column.header.id;
257
257
  },
@@ -262,7 +262,14 @@ export class ColumnBuilder<TData extends RowData> {
262
262
  const cellValue = cellContext.getValue();
263
263
  return <div className={mx('truncate', classNames)}>{cellValue ? model?.getText(cellValue) : ''}</div>;
264
264
  },
265
- });
265
+ ...props,
266
+ meta: {
267
+ ...props.meta,
268
+ model,
269
+ onUpdate,
270
+ cell: { classNames, ...props.meta?.cell },
271
+ },
272
+ };
266
273
  }
267
274
 
268
275
  /**
@@ -271,9 +278,8 @@ export class ColumnBuilder<TData extends RowData> {
271
278
  string({ label, classNames, onUpdate, ...props }: StringColumnOptions<TData> = {}): Partial<
272
279
  ColumnDef<TData, string>
273
280
  > {
274
- return defaults(props, {
281
+ return {
275
282
  minSize: 100,
276
- meta: { onUpdate, cell: { classNames } },
277
283
  // TODO(burdon): Default.
278
284
  header: (column) => {
279
285
  return label ?? column.header.id;
@@ -284,7 +290,13 @@ export class ColumnBuilder<TData extends RowData> {
284
290
  const value = cell.getValue();
285
291
  return <div className={mx('truncate', textPadding, classNames)}>{value}</div>;
286
292
  },
287
- });
293
+ ...props,
294
+ meta: {
295
+ ...props.meta,
296
+ onUpdate,
297
+ cell: { ...props.meta?.cell, classNames },
298
+ },
299
+ };
288
300
  }
289
301
 
290
302
  /**
@@ -293,13 +305,20 @@ export class ColumnBuilder<TData extends RowData> {
293
305
  number({ label, minSize, classNames, digits, onUpdate, ...props }: NumberColumnOptions<TData> = {}): Partial<
294
306
  ColumnDef<TData, number>
295
307
  > {
296
- return defaults(props, {
308
+ return {
297
309
  size: 100,
298
310
  minSize: 100,
299
- meta: { onUpdate, digits, header: { classNames: 'text-end' }, cell: { classNames } },
300
311
  header: (cell) => label ?? cell.header.id,
301
312
  cell: NumberBuilderCell,
302
- });
313
+ ...props,
314
+ meta: {
315
+ ...props.meta,
316
+ onUpdate,
317
+ digits,
318
+ header: { classNames: 'text-end', ...props.meta?.header },
319
+ cell: { ...props.meta?.cell, classNames },
320
+ },
321
+ };
303
322
  }
304
323
 
305
324
  /**
@@ -309,10 +328,9 @@ export class ColumnBuilder<TData extends RowData> {
309
328
  date({ label, format: formatSpec, relative, classNames, ...props }: DateColumnOptions<TData> = {}): Partial<
310
329
  ColumnDef<TData, Date>
311
330
  > {
312
- return defaults(props, {
331
+ return {
313
332
  size: 220, // TODO(burdon): Depends on format.
314
333
  minSize: 100,
315
- meta: { cell: { classNames } },
316
334
  header: (cell) => label ?? cell.header.id,
317
335
  cell: (cell) => {
318
336
  const value = cell.getValue();
@@ -332,17 +350,18 @@ export class ColumnBuilder<TData extends RowData> {
332
350
  return null;
333
351
  }
334
352
  },
335
- });
353
+ ...props,
354
+ meta: { ...props.meta, cell: { ...props.meta?.cell, classNames } },
355
+ };
336
356
  }
337
357
 
338
358
  /**
339
359
  * PublicKey with tooltip.
340
360
  */
341
- key({ label, tooltip, ...props }: KeyColumnOptions<TData> = {}): Partial<ColumnDef<TData, PublicKey>> {
342
- return defaults(props, {
361
+ key({ label, tooltip, classNames, ...props }: KeyColumnOptions<TData> = {}): Partial<ColumnDef<TData, PublicKey>> {
362
+ return {
343
363
  size: 94,
344
364
  minSize: 94,
345
- meta: { cell: { classNames: ['font-mono', textPadding] } },
346
365
  header: (cell) => label ?? cell.header.id,
347
366
  cell: (cell) => {
348
367
  const value = cell.getValue();
@@ -375,19 +394,17 @@ export class ColumnBuilder<TData extends RowData> {
375
394
  </Tooltip.Provider>
376
395
  );
377
396
  },
378
- });
397
+ ...props,
398
+ meta: { ...props.meta, cell: { ...props.meta?.cell, classNames: ['font-mono', textPadding, classNames] } },
399
+ };
379
400
  }
380
401
 
381
402
  /**
382
403
  * Row selector
383
404
  */
384
- selectRow({
385
- label,
386
- classNames,
387
- onUpdate,
388
- id = 'selectRow',
389
- ...props
390
- }: SelectRowColumnOptions<TData> = {}): Parameters<ColumnHelper<TData>['display']>[0] {
405
+ selectRow({ classNames, onUpdate, id = 'selectRow' }: SelectRowColumnOptions<TData> = {}): Parameters<
406
+ ColumnHelper<TData>['display']
407
+ >[0] {
391
408
  return {
392
409
  id,
393
410
  size: 32,
@@ -418,13 +435,14 @@ export class ColumnBuilder<TData extends RowData> {
418
435
  switch({ label, classNames, onUpdate, ...props }: SwitchColumnOptions<TData> = {}): Partial<
419
436
  ColumnDef<TData, boolean>
420
437
  > {
421
- return defaults(props, {
438
+ return {
422
439
  size: 50,
423
440
  minSize: 50,
424
- meta: { onUpdate, cell: { classNames: [textPadding, classNames] } },
425
441
  header: (column) => label ?? column.header.id,
426
442
  cell: SwitchBuilderCell,
427
- });
443
+ ...props,
444
+ meta: { ...props.meta, onUpdate, cell: { ...props.meta?.cell, classNames: [textPadding, classNames] } },
445
+ };
428
446
  }
429
447
 
430
448
  /**
@@ -433,7 +451,7 @@ export class ColumnBuilder<TData extends RowData> {
433
451
  icon({ label, size, on, off, ...props }: IconColumnOptions<TData> = {}): Partial<ColumnDef<TData, boolean>> {
434
452
  const IconOn = on?.Icon ?? Check;
435
453
  const IconOff = off?.Icon ?? X;
436
- return defaults(props, {
454
+ return {
437
455
  size: size ?? 32,
438
456
  header: (column) => <div className={'justify-center'}>{label ?? column.header.id}</div>,
439
457
  cell: (cell) => {
@@ -446,6 +464,7 @@ export class ColumnBuilder<TData extends RowData> {
446
464
  return null;
447
465
  }
448
466
  },
449
- });
467
+ ...props,
468
+ };
450
469
  }
451
470
  }
package/src/index.ts CHANGED
@@ -6,4 +6,5 @@ export * from './components';
6
6
  export * from './helpers';
7
7
  export * from './schema';
8
8
  export * from './theme';
9
+ export { default as translations } from './translations';
9
10
  export * from './types';