@mrcaktuz/sds-react 0.1.0 → 0.2.0
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/README.md +591 -105
- package/dist/grid.cjs +282 -15632
- package/dist/grid.d.cts +43 -28
- package/dist/grid.d.ts +43 -28
- package/dist/grid.js +297 -15618
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/package.json +7 -11
package/dist/grid.d.cts
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import { GridProps, GridElement } from '@vaadin/react-components/Grid.js';
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { Ref } from 'react';
|
|
3
|
+
import { GridProps, GridElement, GridDefaultItem } from '@vaadin/react-components/Grid.js';
|
|
4
4
|
export { GridDataProvider as SDSGridDataProvider, GridElement as SDSGridElement } from '@vaadin/react-components/Grid.js';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { GridColumnProps, GridColumnElement } from '@vaadin/react-components/GridColumn.js';
|
|
6
|
+
import { GridFilterColumnProps, GridFilterColumnElement } from '@vaadin/react-components/GridFilterColumn.js';
|
|
7
|
+
import { GridSortColumnProps, GridSortColumnElement } from '@vaadin/react-components/GridSortColumn.js';
|
|
8
|
+
export { GridFilter as SDSGridFilter } from '@vaadin/react-components/GridFilter.js';
|
|
7
9
|
export { GridSelectionColumn as SDSGridSelectionColumn } from '@vaadin/react-components/GridSelectionColumn.js';
|
|
8
|
-
export {
|
|
10
|
+
export { GridSorter as SDSGridSorter } from '@vaadin/react-components/GridSorter.js';
|
|
11
|
+
|
|
12
|
+
type SDSGridEditorType = 'text' | 'number' | 'checkbox' | 'select';
|
|
13
|
+
type SDSGridEditorOption = string | {
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
};
|
|
17
|
+
type SDSGridEditableColumnProps<TItem> = {
|
|
18
|
+
/** The cells of the column can be edited in the grid (needs `path`). A function decides row by row */
|
|
19
|
+
editable?: boolean | ((item: TItem) => boolean);
|
|
20
|
+
/** Editor shown in the cell being edited */
|
|
21
|
+
editorType?: SDSGridEditorType;
|
|
22
|
+
/** Choices of the `select` editor */
|
|
23
|
+
editorOptions?: SDSGridEditorOption[];
|
|
24
|
+
};
|
|
25
|
+
type SDSGridItemPropertyChange<TItem> = {
|
|
26
|
+
item: TItem;
|
|
27
|
+
path: string;
|
|
28
|
+
value: unknown;
|
|
29
|
+
};
|
|
9
30
|
|
|
10
31
|
type SDSGridProps<TItem> = Omit<GridProps<TItem>, 'theme'> & {
|
|
11
32
|
/** Background on every other row (Figma "Content alt") */
|
|
@@ -14,30 +35,24 @@ type SDSGridProps<TItem> = Omit<GridProps<TItem>, 'theme'> & {
|
|
|
14
35
|
columnBorders?: boolean;
|
|
15
36
|
/** No outer border nor radius */
|
|
16
37
|
noBorder?: boolean;
|
|
38
|
+
/** Editable cells start editing on a single click (default: double-click, Enter or F2) */
|
|
39
|
+
editOnClick?: boolean;
|
|
40
|
+
/** An editable cell was changed: the item already holds the new value, save it */
|
|
41
|
+
onItemPropertyChanged?: (change: SDSGridItemPropertyChange<TItem>) => void;
|
|
17
42
|
ref?: Ref<GridElement<TItem>>;
|
|
18
43
|
};
|
|
19
|
-
declare function SDSGrid<TItem>({ stripes, columnBorders, noBorder, className, ...props }: SDSGridProps<TItem>):
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
type SDSGridForkBodyRenderer<TItem = unknown> = (root: HTMLElement, column: HTMLElement, model: {
|
|
23
|
-
item: TItem;
|
|
24
|
-
index: number;
|
|
25
|
-
}) => void;
|
|
26
|
-
type LooseProps = {
|
|
27
|
-
children?: ReactNode;
|
|
28
|
-
className?: string;
|
|
29
|
-
style?: CSSProperties;
|
|
30
|
-
[property: string]: unknown;
|
|
44
|
+
declare function SDSGrid<TItem>({ stripes, columnBorders, noBorder, editOnClick, onItemPropertyChanged, className, ref, ...props }: SDSGridProps<TItem>): react.JSX.Element;
|
|
45
|
+
type SDSGridColumnProps<TItem> = GridColumnProps<TItem> & SDSGridEditableColumnProps<TItem> & {
|
|
46
|
+
ref?: Ref<GridColumnElement<TItem>>;
|
|
31
47
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
declare function SDSGridColumn<TItem = GridDefaultItem>(props: SDSGridColumnProps<TItem>): react.JSX.Element;
|
|
49
|
+
type SDSGridSortColumnProps<TItem> = GridSortColumnProps<TItem> & SDSGridEditableColumnProps<TItem> & {
|
|
50
|
+
ref?: Ref<GridSortColumnElement<TItem>>;
|
|
51
|
+
};
|
|
52
|
+
declare function SDSGridSortColumn<TItem = GridDefaultItem>(props: SDSGridSortColumnProps<TItem>): react.JSX.Element;
|
|
53
|
+
type SDSGridFilterColumnProps<TItem> = GridFilterColumnProps<TItem> & SDSGridEditableColumnProps<TItem> & {
|
|
54
|
+
ref?: Ref<GridFilterColumnElement<TItem>>;
|
|
36
55
|
};
|
|
37
|
-
declare function
|
|
38
|
-
declare const SDSGridForkColumn: React__default.FC<LooseProps>;
|
|
39
|
-
declare const SDSGridForkSortColumn: React__default.FC<LooseProps>;
|
|
40
|
-
declare const SDSGridForkFilterColumn: React__default.FC<LooseProps>;
|
|
41
|
-
declare const SDSGridForkSelectionColumn: React__default.FC<LooseProps>;
|
|
56
|
+
declare function SDSGridFilterColumn<TItem = GridDefaultItem>(props: SDSGridFilterColumnProps<TItem>): react.JSX.Element;
|
|
42
57
|
|
|
43
|
-
export { SDSGrid,
|
|
58
|
+
export { SDSGrid, SDSGridColumn, type SDSGridColumnProps, type SDSGridEditableColumnProps, type SDSGridEditorOption, type SDSGridEditorType, SDSGridFilterColumn, type SDSGridFilterColumnProps, type SDSGridItemPropertyChange, type SDSGridProps, SDSGridSortColumn, type SDSGridSortColumnProps };
|
package/dist/grid.d.ts
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import { GridProps, GridElement } from '@vaadin/react-components/Grid.js';
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { Ref } from 'react';
|
|
3
|
+
import { GridProps, GridElement, GridDefaultItem } from '@vaadin/react-components/Grid.js';
|
|
4
4
|
export { GridDataProvider as SDSGridDataProvider, GridElement as SDSGridElement } from '@vaadin/react-components/Grid.js';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { GridColumnProps, GridColumnElement } from '@vaadin/react-components/GridColumn.js';
|
|
6
|
+
import { GridFilterColumnProps, GridFilterColumnElement } from '@vaadin/react-components/GridFilterColumn.js';
|
|
7
|
+
import { GridSortColumnProps, GridSortColumnElement } from '@vaadin/react-components/GridSortColumn.js';
|
|
8
|
+
export { GridFilter as SDSGridFilter } from '@vaadin/react-components/GridFilter.js';
|
|
7
9
|
export { GridSelectionColumn as SDSGridSelectionColumn } from '@vaadin/react-components/GridSelectionColumn.js';
|
|
8
|
-
export {
|
|
10
|
+
export { GridSorter as SDSGridSorter } from '@vaadin/react-components/GridSorter.js';
|
|
11
|
+
|
|
12
|
+
type SDSGridEditorType = 'text' | 'number' | 'checkbox' | 'select';
|
|
13
|
+
type SDSGridEditorOption = string | {
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
};
|
|
17
|
+
type SDSGridEditableColumnProps<TItem> = {
|
|
18
|
+
/** The cells of the column can be edited in the grid (needs `path`). A function decides row by row */
|
|
19
|
+
editable?: boolean | ((item: TItem) => boolean);
|
|
20
|
+
/** Editor shown in the cell being edited */
|
|
21
|
+
editorType?: SDSGridEditorType;
|
|
22
|
+
/** Choices of the `select` editor */
|
|
23
|
+
editorOptions?: SDSGridEditorOption[];
|
|
24
|
+
};
|
|
25
|
+
type SDSGridItemPropertyChange<TItem> = {
|
|
26
|
+
item: TItem;
|
|
27
|
+
path: string;
|
|
28
|
+
value: unknown;
|
|
29
|
+
};
|
|
9
30
|
|
|
10
31
|
type SDSGridProps<TItem> = Omit<GridProps<TItem>, 'theme'> & {
|
|
11
32
|
/** Background on every other row (Figma "Content alt") */
|
|
@@ -14,30 +35,24 @@ type SDSGridProps<TItem> = Omit<GridProps<TItem>, 'theme'> & {
|
|
|
14
35
|
columnBorders?: boolean;
|
|
15
36
|
/** No outer border nor radius */
|
|
16
37
|
noBorder?: boolean;
|
|
38
|
+
/** Editable cells start editing on a single click (default: double-click, Enter or F2) */
|
|
39
|
+
editOnClick?: boolean;
|
|
40
|
+
/** An editable cell was changed: the item already holds the new value, save it */
|
|
41
|
+
onItemPropertyChanged?: (change: SDSGridItemPropertyChange<TItem>) => void;
|
|
17
42
|
ref?: Ref<GridElement<TItem>>;
|
|
18
43
|
};
|
|
19
|
-
declare function SDSGrid<TItem>({ stripes, columnBorders, noBorder, className, ...props }: SDSGridProps<TItem>):
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
type SDSGridForkBodyRenderer<TItem = unknown> = (root: HTMLElement, column: HTMLElement, model: {
|
|
23
|
-
item: TItem;
|
|
24
|
-
index: number;
|
|
25
|
-
}) => void;
|
|
26
|
-
type LooseProps = {
|
|
27
|
-
children?: ReactNode;
|
|
28
|
-
className?: string;
|
|
29
|
-
style?: CSSProperties;
|
|
30
|
-
[property: string]: unknown;
|
|
44
|
+
declare function SDSGrid<TItem>({ stripes, columnBorders, noBorder, editOnClick, onItemPropertyChanged, className, ref, ...props }: SDSGridProps<TItem>): react.JSX.Element;
|
|
45
|
+
type SDSGridColumnProps<TItem> = GridColumnProps<TItem> & SDSGridEditableColumnProps<TItem> & {
|
|
46
|
+
ref?: Ref<GridColumnElement<TItem>>;
|
|
31
47
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
declare function SDSGridColumn<TItem = GridDefaultItem>(props: SDSGridColumnProps<TItem>): react.JSX.Element;
|
|
49
|
+
type SDSGridSortColumnProps<TItem> = GridSortColumnProps<TItem> & SDSGridEditableColumnProps<TItem> & {
|
|
50
|
+
ref?: Ref<GridSortColumnElement<TItem>>;
|
|
51
|
+
};
|
|
52
|
+
declare function SDSGridSortColumn<TItem = GridDefaultItem>(props: SDSGridSortColumnProps<TItem>): react.JSX.Element;
|
|
53
|
+
type SDSGridFilterColumnProps<TItem> = GridFilterColumnProps<TItem> & SDSGridEditableColumnProps<TItem> & {
|
|
54
|
+
ref?: Ref<GridFilterColumnElement<TItem>>;
|
|
36
55
|
};
|
|
37
|
-
declare function
|
|
38
|
-
declare const SDSGridForkColumn: React__default.FC<LooseProps>;
|
|
39
|
-
declare const SDSGridForkSortColumn: React__default.FC<LooseProps>;
|
|
40
|
-
declare const SDSGridForkFilterColumn: React__default.FC<LooseProps>;
|
|
41
|
-
declare const SDSGridForkSelectionColumn: React__default.FC<LooseProps>;
|
|
56
|
+
declare function SDSGridFilterColumn<TItem = GridDefaultItem>(props: SDSGridFilterColumnProps<TItem>): react.JSX.Element;
|
|
42
57
|
|
|
43
|
-
export { SDSGrid,
|
|
58
|
+
export { SDSGrid, SDSGridColumn, type SDSGridColumnProps, type SDSGridEditableColumnProps, type SDSGridEditorOption, type SDSGridEditorType, SDSGridFilterColumn, type SDSGridFilterColumnProps, type SDSGridItemPropertyChange, type SDSGridProps, SDSGridSortColumn, type SDSGridSortColumnProps };
|