@dxos/react-ui-table 0.7.5-main.9d26e3a → 0.7.5-main.b19bfc8
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.
- package/dist/lib/browser/{chunk-AT7O4RAD.mjs → chunk-3FR6NHPD.mjs} +6 -4
- package/dist/lib/browser/chunk-3FR6NHPD.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +476 -282
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node/{chunk-YSBXNBDJ.cjs → chunk-NB3SFHGA.cjs} +8 -6
- package/dist/lib/node/chunk-NB3SFHGA.cjs.map +7 -0
- package/dist/lib/node/index.cjs +468 -268
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types/index.cjs +3 -3
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{chunk-6OH2NHUX.mjs → chunk-RLVVOZW5.mjs} +6 -4
- package/dist/lib/node-esm/chunk-RLVVOZW5.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +476 -282
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/_deprecated/components/Cell/Cell.d.ts +2 -2
- package/dist/types/src/_deprecated/components/Cell/Cell.d.ts.map +1 -1
- package/dist/types/src/_deprecated/components/Cell/CellCombobox.d.ts +1 -2
- package/dist/types/src/_deprecated/components/Cell/CellCombobox.d.ts.map +1 -1
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnMenu.d.ts +2 -3
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnMenu.d.ts.map +1 -1
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnMenu.stories.d.ts +6 -7
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnMenu.stories.d.ts.map +1 -1
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnSettings.d.ts +1 -2
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnSettings.d.ts.map +1 -1
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnSettings.stories.d.ts +6 -7
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnSettings.stories.d.ts.map +1 -1
- package/dist/types/src/_deprecated/components/Table/Table.d.ts +5 -5
- package/dist/types/src/_deprecated/components/Table/Table.d.ts.map +1 -1
- package/dist/types/src/_deprecated/components/Table/Table.stories.d.ts +8 -9
- package/dist/types/src/_deprecated/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/types/src/_deprecated/components/Table/TableBody.d.ts +1 -2
- package/dist/types/src/_deprecated/components/Table/TableBody.d.ts.map +1 -1
- package/dist/types/src/_deprecated/components/Table/TableContext.d.ts +1 -1
- package/dist/types/src/_deprecated/components/Table/TableContext.d.ts.map +1 -1
- package/dist/types/src/_deprecated/components/Table/TableHead.d.ts +1 -2
- package/dist/types/src/_deprecated/components/Table/TableHead.d.ts.map +1 -1
- package/dist/types/src/_deprecated/schema/Schema.stories.d.ts +2 -3
- package/dist/types/src/_deprecated/schema/Schema.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/ColumnActionsMenu.d.ts +1 -2
- package/dist/types/src/components/Table/ColumnActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/ColumnSettings.d.ts +1 -2
- package/dist/types/src/components/Table/ColumnSettings.d.ts.map +1 -1
- package/dist/types/src/components/Table/CreateRefPanel.d.ts +1 -2
- package/dist/types/src/components/Table/CreateRefPanel.d.ts.map +1 -1
- package/dist/types/src/components/Table/RefPanel.d.ts +1 -2
- package/dist/types/src/components/Table/RefPanel.d.ts.map +1 -1
- package/dist/types/src/components/Table/RowActionsMenu.d.ts +1 -2
- package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.d.ts +1 -1
- package/dist/types/src/components/Table/Table.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.stories.d.ts +1 -4
- package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts +1 -2
- package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts +17 -0
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts.map +1 -0
- package/dist/types/src/components/TableToolbar/index.d.ts +2 -0
- package/dist/types/src/components/TableToolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +12 -35
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
- package/dist/types/src/model/table-model.d.ts +11 -19
- package/dist/types/src/model/table-model.d.ts.map +1 -1
- package/dist/types/src/model/table-presentation.d.ts.map +1 -1
- package/dist/types/src/model/table-sorting.d.ts +53 -0
- package/dist/types/src/model/table-sorting.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +21 -90
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/util/table-buttons.d.ts +15 -1
- package/dist/types/src/util/table-buttons.d.ts.map +1 -1
- package/dist/types/src/util/table.d.ts +2 -1
- package/dist/types/src/util/table.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +36 -34
- package/src/_deprecated/schema/Schema.stories.tsx +1 -1
- package/src/components/Table/ColumnActionsMenu.tsx +4 -4
- package/src/components/Table/Table.stories.tsx +55 -44
- package/src/components/Table/Table.tsx +4 -0
- package/src/components/TableCellEditor/TableCellEditor.stories.tsx +1 -1
- package/src/components/TableToolbar/TableToolbar.tsx +72 -0
- package/src/components/{Toolbar → TableToolbar}/index.ts +1 -1
- package/src/components/index.ts +1 -1
- package/src/hooks/useTableModel.ts +21 -0
- package/src/model/table-model.test.ts +0 -5
- package/src/model/table-model.ts +41 -99
- package/src/model/table-presentation.ts +25 -4
- package/src/model/table-sorting.ts +215 -0
- package/src/playwright/smoke.spec.ts +21 -14
- package/src/translations.ts +2 -1
- package/src/types/table.ts +3 -3
- package/src/util/table-buttons.ts +33 -3
- package/src/util/table-controls.ts +2 -2
- package/src/util/table.ts +85 -52
- package/dist/lib/browser/chunk-AT7O4RAD.mjs.map +0 -7
- package/dist/lib/node/chunk-YSBXNBDJ.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-6OH2NHUX.mjs.map +0 -7
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -21
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/common.d.ts +0 -14
- package/dist/types/src/components/Toolbar/common.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/index.d.ts +0 -2
- package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
- package/dist/types/src/playwright/playwright.config.d.ts +0 -3
- package/dist/types/src/playwright/playwright.config.d.ts.map +0 -1
- package/src/components/Toolbar/Toolbar.tsx +0 -87
- package/src/components/Toolbar/common.tsx +0 -71
- /package/src/playwright/{playwright.config.ts → playwright.config.cts} +0 -0
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React, { type PropsWithChildren } from 'react';
|
|
2
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
3
|
-
export type ToolbarAction = {
|
|
4
|
-
type: 'add-row';
|
|
5
|
-
} | {
|
|
6
|
-
type: 'comment';
|
|
7
|
-
};
|
|
8
|
-
export type ToolbarActionType = ToolbarAction['type'];
|
|
9
|
-
export type ToolbarActionHandler = (action: ToolbarAction) => void;
|
|
10
|
-
export type ToolbarProps = ThemedClassName<PropsWithChildren<{
|
|
11
|
-
onAction?: ToolbarActionHandler;
|
|
12
|
-
}>>;
|
|
13
|
-
declare const useToolbarContext: (consumerName: string) => ToolbarProps;
|
|
14
|
-
export declare const Toolbar: {
|
|
15
|
-
Root: ({ classNames, children, onAction }: ToolbarProps) => React.JSX.Element;
|
|
16
|
-
Editing: () => React.JSX.Element;
|
|
17
|
-
Actions: () => React.JSX.Element;
|
|
18
|
-
Separator: () => React.JSX.Element;
|
|
19
|
-
};
|
|
20
|
-
export { useToolbarContext };
|
|
21
|
-
//# sourceMappingURL=Toolbar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toolbar/Toolbar.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAA6B,KAAK,eAAe,EAAkB,MAAM,gBAAgB,CAAC;AAUjG,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAEtE,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AAEtD,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;AAEnE,MAAM,MAAM,YAAY,GAAG,eAAe,CACxC,iBAAiB,CAAC;IAChB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,CAAC,CACH,CAAC;AAEF,QAAA,MAA+B,iBAAiB,wCAA0C,CAAC;AAkD3F,eAAO,MAAM,OAAO;+CAhDqC,YAAY;;;;CAqDpE,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type IconProps, type ToolbarButtonProps as NaturalToolbarButtonProps, type ToolbarToggleGroupItemProps as NaturalToolbarToggleGroupItemProps } from '@dxos/react-ui';
|
|
3
|
-
export declare const buttonStyles = "min-bs-0 p-2";
|
|
4
|
-
export declare const tooltipProps: {
|
|
5
|
-
side: "top";
|
|
6
|
-
classNames: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const ToolbarSeparator: () => React.JSX.Element;
|
|
9
|
-
type ToolbarButtonProps = NaturalToolbarButtonProps & Pick<IconProps, 'icon'>;
|
|
10
|
-
export declare const ToolbarButton: ({ icon, children, ...props }: ToolbarButtonProps) => React.JSX.Element;
|
|
11
|
-
export type ToolbarToggleButtonProps = NaturalToolbarToggleGroupItemProps & Pick<IconProps, 'icon'>;
|
|
12
|
-
export declare const ToolbarToggleButton: ({ icon, children, ...props }: ToolbarToggleButtonProps) => React.JSX.Element;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toolbar/common.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAEL,KAAK,SAAS,EAGd,KAAK,kBAAkB,IAAI,yBAAyB,EACpD,KAAK,2BAA2B,IAAI,kCAAkC,EACvE,MAAM,gBAAgB,CAAC;AAIxB,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,YAAY;;;CAA+C,CAAC;AAEzE,eAAO,MAAM,gBAAgB,yBAAkD,CAAC;AAMhF,KAAK,kBAAkB,GAAG,yBAAyB,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAE9E,eAAO,MAAM,aAAa,iCAAkC,kBAAkB,sBAiB7E,CAAC;AAMF,MAAM,MAAM,wBAAwB,GAAG,kCAAkC,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAEpG,eAAO,MAAM,mBAAmB,iCAAkC,wBAAwB,sBAiBzF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toolbar/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.config.d.ts","sourceRoot":"","sources":["../../../../src/playwright/playwright.config.ts"],"names":[],"mappings":";AASA,wBAQG"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { createContext } from '@radix-ui/react-context';
|
|
6
|
-
import React, { type PropsWithChildren } from 'react';
|
|
7
|
-
|
|
8
|
-
import { Toolbar as NaturalToolbar, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
|
|
10
|
-
import { ToolbarButton, ToolbarSeparator } from './common';
|
|
11
|
-
import { translationKey } from '../../translations';
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
// Root
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
// TODO(Zan): This should become a union later.
|
|
18
|
-
export type ToolbarAction = { type: 'add-row' } | { type: 'comment' };
|
|
19
|
-
|
|
20
|
-
export type ToolbarActionType = ToolbarAction['type'];
|
|
21
|
-
|
|
22
|
-
export type ToolbarActionHandler = (action: ToolbarAction) => void;
|
|
23
|
-
|
|
24
|
-
export type ToolbarProps = ThemedClassName<
|
|
25
|
-
PropsWithChildren<{
|
|
26
|
-
onAction?: ToolbarActionHandler;
|
|
27
|
-
}>
|
|
28
|
-
>;
|
|
29
|
-
|
|
30
|
-
const [ToolbarContextProvider, useToolbarContext] = createContext<ToolbarProps>('Toolbar');
|
|
31
|
-
|
|
32
|
-
const ToolbarRoot = ({ classNames, children, onAction }: ToolbarProps) => {
|
|
33
|
-
return (
|
|
34
|
-
<ToolbarContextProvider onAction={onAction}>
|
|
35
|
-
<NaturalToolbar.Root
|
|
36
|
-
classNames={['is-full shrink-0 overflow-x-auto overflow-y-hidden p-1 attention-surface', classNames]}
|
|
37
|
-
>
|
|
38
|
-
{children}
|
|
39
|
-
</NaturalToolbar.Root>
|
|
40
|
-
</ToolbarContextProvider>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const Editing = () => {
|
|
45
|
-
const { onAction } = useToolbarContext('Editing');
|
|
46
|
-
const { t } = useTranslation(translationKey);
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<>
|
|
50
|
-
<ToolbarButton
|
|
51
|
-
value='add-row'
|
|
52
|
-
icon='ph--plus--regular'
|
|
53
|
-
data-testid='table.toolbar.add-row'
|
|
54
|
-
onClick={() => onAction?.({ type: 'add-row' })}
|
|
55
|
-
>
|
|
56
|
-
{t('add row')}
|
|
57
|
-
</ToolbarButton>
|
|
58
|
-
</>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const Actions = () => {
|
|
63
|
-
const { onAction } = useToolbarContext('Actions');
|
|
64
|
-
const { t } = useTranslation(translationKey);
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<>
|
|
68
|
-
<ToolbarButton
|
|
69
|
-
value='comment'
|
|
70
|
-
icon='ph--chat-text--regular'
|
|
71
|
-
data-testid='table.toolbar.comment'
|
|
72
|
-
onClick={() => onAction?.({ type: 'comment' })}
|
|
73
|
-
>
|
|
74
|
-
{t('create comment')}
|
|
75
|
-
</ToolbarButton>
|
|
76
|
-
</>
|
|
77
|
-
);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const Toolbar = {
|
|
81
|
-
Root: ToolbarRoot,
|
|
82
|
-
Editing,
|
|
83
|
-
Actions,
|
|
84
|
-
Separator: ToolbarSeparator,
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export { useToolbarContext };
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
Icon,
|
|
9
|
-
type IconProps,
|
|
10
|
-
Toolbar as NaturalToolbar,
|
|
11
|
-
Tooltip,
|
|
12
|
-
type ToolbarButtonProps as NaturalToolbarButtonProps,
|
|
13
|
-
type ToolbarToggleGroupItemProps as NaturalToolbarToggleGroupItemProps,
|
|
14
|
-
} from '@dxos/react-ui';
|
|
15
|
-
|
|
16
|
-
// TODO(burdon): Factor out into new package (react-ui-toolbar) in common with react-ui-editor, etc.
|
|
17
|
-
|
|
18
|
-
export const buttonStyles = 'min-bs-0 p-2';
|
|
19
|
-
export const tooltipProps = { side: 'top' as const, classNames: 'z-10' };
|
|
20
|
-
|
|
21
|
-
export const ToolbarSeparator = () => <div role='separator' className='grow' />;
|
|
22
|
-
|
|
23
|
-
//
|
|
24
|
-
// ToolbarButton
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
type ToolbarButtonProps = NaturalToolbarButtonProps & Pick<IconProps, 'icon'>;
|
|
28
|
-
|
|
29
|
-
export const ToolbarButton = ({ icon, children, ...props }: ToolbarButtonProps) => {
|
|
30
|
-
return (
|
|
31
|
-
<Tooltip.Root>
|
|
32
|
-
<Tooltip.Trigger asChild>
|
|
33
|
-
<NaturalToolbar.Button variant='ghost' {...props} classNames={buttonStyles}>
|
|
34
|
-
<Icon icon={icon} size={5} />
|
|
35
|
-
<span className='sr-only'>{children}</span>
|
|
36
|
-
</NaturalToolbar.Button>
|
|
37
|
-
</Tooltip.Trigger>
|
|
38
|
-
<Tooltip.Portal>
|
|
39
|
-
<Tooltip.Content {...tooltipProps}>
|
|
40
|
-
{children}
|
|
41
|
-
<Tooltip.Arrow />
|
|
42
|
-
</Tooltip.Content>
|
|
43
|
-
</Tooltip.Portal>
|
|
44
|
-
</Tooltip.Root>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
//
|
|
49
|
-
// ToolbarToggleButton
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
export type ToolbarToggleButtonProps = NaturalToolbarToggleGroupItemProps & Pick<IconProps, 'icon'>;
|
|
53
|
-
|
|
54
|
-
export const ToolbarToggleButton = ({ icon, children, ...props }: ToolbarToggleButtonProps) => {
|
|
55
|
-
return (
|
|
56
|
-
<Tooltip.Root>
|
|
57
|
-
<Tooltip.Trigger asChild>
|
|
58
|
-
<NaturalToolbar.ToggleGroupItem variant='ghost' {...props} classNames={buttonStyles}>
|
|
59
|
-
<Icon icon={icon} size={5} />
|
|
60
|
-
<span className='sr-only'>{children}</span>
|
|
61
|
-
</NaturalToolbar.ToggleGroupItem>
|
|
62
|
-
</Tooltip.Trigger>
|
|
63
|
-
<Tooltip.Portal>
|
|
64
|
-
<Tooltip.Content {...tooltipProps}>
|
|
65
|
-
{children}
|
|
66
|
-
<Tooltip.Arrow />
|
|
67
|
-
</Tooltip.Content>
|
|
68
|
-
</Tooltip.Portal>
|
|
69
|
-
</Tooltip.Root>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
File without changes
|