@cerberus-design/data-grid 0.25.3
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/LICENSE +201 -0
- package/README.md +35 -0
- package/dist/column-helpers.cjs +24 -0
- package/dist/column-helpers.d.cts +45 -0
- package/dist/column-helpers.d.ts +45 -0
- package/dist/column-helpers.js +20 -0
- package/dist/components/cerby-data-grid.client.cjs +14 -0
- package/dist/components/cerby-data-grid.client.d.cts +6 -0
- package/dist/components/cerby-data-grid.client.d.ts +6 -0
- package/dist/components/cerby-data-grid.client.js +10 -0
- package/dist/components/count-menu.client.cjs +52 -0
- package/dist/components/count-menu.client.d.cts +6 -0
- package/dist/components/count-menu.client.d.ts +6 -0
- package/dist/components/count-menu.client.js +48 -0
- package/dist/components/data-grid.client.cjs +85 -0
- package/dist/components/data-grid.client.d.cts +4 -0
- package/dist/components/data-grid.client.d.ts +4 -0
- package/dist/components/data-grid.client.js +81 -0
- package/dist/components/features.client.cjs +79 -0
- package/dist/components/features.client.d.cts +2 -0
- package/dist/components/features.client.d.ts +2 -0
- package/dist/components/features.client.js +75 -0
- package/dist/components/grid.client.cjs +319 -0
- package/dist/components/grid.client.d.cts +19 -0
- package/dist/components/grid.client.d.ts +19 -0
- package/dist/components/grid.client.js +312 -0
- package/dist/components/pagination.client.cjs +116 -0
- package/dist/components/pagination.client.d.cts +1 -0
- package/dist/components/pagination.client.d.ts +1 -0
- package/dist/components/pagination.client.js +112 -0
- package/dist/components/pinned-items.client.cjs +70 -0
- package/dist/components/pinned-items.client.d.cts +5 -0
- package/dist/components/pinned-items.client.d.ts +5 -0
- package/dist/components/pinned-items.client.js +66 -0
- package/dist/components/sort-items.client.cjs +58 -0
- package/dist/components/sort-items.client.d.cts +4 -0
- package/dist/components/sort-items.client.d.ts +4 -0
- package/dist/components/sort-items.client.js +54 -0
- package/dist/const.cjs +49 -0
- package/dist/const.d.cts +28 -0
- package/dist/const.d.ts +28 -0
- package/dist/const.js +33 -0
- package/dist/context.client.cjs +18 -0
- package/dist/context.client.d.cts +7 -0
- package/dist/context.client.d.ts +7 -0
- package/dist/context.client.js +13 -0
- package/dist/hooks.client.cjs +29 -0
- package/dist/hooks.client.d.cts +7 -0
- package/dist/hooks.client.d.ts +7 -0
- package/dist/hooks.client.js +23 -0
- package/dist/index.cjs +15 -0
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +4 -0
- package/dist/store.cjs +287 -0
- package/dist/store.d.cts +6 -0
- package/dist/store.d.ts +6 -0
- package/dist/store.js +283 -0
- package/dist/types.d.cts +198 -0
- package/dist/types.d.ts +198 -0
- package/dist/utils.cjs +59 -0
- package/dist/utils.d.cts +6 -0
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +51 -0
- package/dist/virtualizer.client.cjs +56 -0
- package/dist/virtualizer.client.d.cts +11 -0
- package/dist/virtualizer.client.d.ts +11 -0
- package/dist/virtualizer.client.js +52 -0
- package/package.json +72 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const react = require('@cerberus-design/react');
|
|
8
|
+
const jsx = require('styled-system/jsx');
|
|
9
|
+
|
|
10
|
+
function MatchSortItems(props) {
|
|
11
|
+
const { sorting } = props;
|
|
12
|
+
const MenuItems = {
|
|
13
|
+
asc: SortAsc,
|
|
14
|
+
desc: SortDesc,
|
|
15
|
+
unsort: UnsortItem
|
|
16
|
+
};
|
|
17
|
+
if (!sorting) {
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
19
|
+
/* @__PURE__ */ jsxRuntime.jsx(MenuItems.asc, {}),
|
|
20
|
+
/* @__PURE__ */ jsxRuntime.jsx(MenuItems.desc, {})
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
23
|
+
if (sorting.desc) {
|
|
24
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
25
|
+
/* @__PURE__ */ jsxRuntime.jsx(MenuItems.asc, {}),
|
|
26
|
+
/* @__PURE__ */ jsxRuntime.jsx(MenuItems.unsort, {})
|
|
27
|
+
] });
|
|
28
|
+
} else {
|
|
29
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
30
|
+
/* @__PURE__ */ jsxRuntime.jsx(MenuItems.unsort, {}),
|
|
31
|
+
/* @__PURE__ */ jsxRuntime.jsx(MenuItems.desc, {})
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function UnsortItem() {
|
|
36
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.MenuItem, { value: "unsort", children: /* @__PURE__ */ jsxRuntime.jsxs(jsx.HStack, { gap: "sm", w: "full", children: [
|
|
37
|
+
/* @__PURE__ */ jsxRuntime.jsx(jsx.Square, { size: "4" }),
|
|
38
|
+
"Unsort"
|
|
39
|
+
] }) });
|
|
40
|
+
}
|
|
41
|
+
function SortAsc() {
|
|
42
|
+
const { icons } = react.useCerberusContext();
|
|
43
|
+
const Icon = icons.sortAsc;
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.MenuItem, { value: "sort_asc", children: /* @__PURE__ */ jsxRuntime.jsxs(jsx.HStack, { gap: "sm", w: "full", children: [
|
|
45
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, {}),
|
|
46
|
+
"Sort ASC"
|
|
47
|
+
] }) });
|
|
48
|
+
}
|
|
49
|
+
function SortDesc() {
|
|
50
|
+
const { icons } = react.useCerberusContext();
|
|
51
|
+
const Icon = icons.sortDesc;
|
|
52
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.MenuItem, { value: "sort_desc", children: /* @__PURE__ */ jsxRuntime.jsxs(jsx.HStack, { gap: "sm", w: "full", children: [
|
|
53
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, {}),
|
|
54
|
+
"Sort DESC"
|
|
55
|
+
] }) });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
exports.MatchSortItems = MatchSortItems;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useCerberusContext, MenuItem } from '@cerberus-design/react';
|
|
4
|
+
import { HStack, Square } from 'styled-system/jsx';
|
|
5
|
+
|
|
6
|
+
function MatchSortItems(props) {
|
|
7
|
+
const { sorting } = props;
|
|
8
|
+
const MenuItems = {
|
|
9
|
+
asc: SortAsc,
|
|
10
|
+
desc: SortDesc,
|
|
11
|
+
unsort: UnsortItem
|
|
12
|
+
};
|
|
13
|
+
if (!sorting) {
|
|
14
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15
|
+
/* @__PURE__ */ jsx(MenuItems.asc, {}),
|
|
16
|
+
/* @__PURE__ */ jsx(MenuItems.desc, {})
|
|
17
|
+
] });
|
|
18
|
+
}
|
|
19
|
+
if (sorting.desc) {
|
|
20
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21
|
+
/* @__PURE__ */ jsx(MenuItems.asc, {}),
|
|
22
|
+
/* @__PURE__ */ jsx(MenuItems.unsort, {})
|
|
23
|
+
] });
|
|
24
|
+
} else {
|
|
25
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
|
+
/* @__PURE__ */ jsx(MenuItems.unsort, {}),
|
|
27
|
+
/* @__PURE__ */ jsx(MenuItems.desc, {})
|
|
28
|
+
] });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function UnsortItem() {
|
|
32
|
+
return /* @__PURE__ */ jsx(MenuItem, { value: "unsort", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", w: "full", children: [
|
|
33
|
+
/* @__PURE__ */ jsx(Square, { size: "4" }),
|
|
34
|
+
"Unsort"
|
|
35
|
+
] }) });
|
|
36
|
+
}
|
|
37
|
+
function SortAsc() {
|
|
38
|
+
const { icons } = useCerberusContext();
|
|
39
|
+
const Icon = icons.sortAsc;
|
|
40
|
+
return /* @__PURE__ */ jsx(MenuItem, { value: "sort_asc", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", w: "full", children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Icon, {}),
|
|
42
|
+
"Sort ASC"
|
|
43
|
+
] }) });
|
|
44
|
+
}
|
|
45
|
+
function SortDesc() {
|
|
46
|
+
const { icons } = useCerberusContext();
|
|
47
|
+
const Icon = icons.sortDesc;
|
|
48
|
+
return /* @__PURE__ */ jsx(MenuItem, { value: "sort_desc", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", w: "full", children: [
|
|
49
|
+
/* @__PURE__ */ jsx(Icon, {}),
|
|
50
|
+
"Sort DESC"
|
|
51
|
+
] }) });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { MatchSortItems };
|
package/dist/const.cjs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const SCOPE = "data-grid";
|
|
7
|
+
const PARTS = {
|
|
8
|
+
TOOLBAR: "toolbar",
|
|
9
|
+
ROOT: "root",
|
|
10
|
+
VIEWPORT: "viewport",
|
|
11
|
+
HEAD_CELL: "head-cell",
|
|
12
|
+
ROW: "row",
|
|
13
|
+
CELL: "row-cell",
|
|
14
|
+
FOOTER: "footer"
|
|
15
|
+
};
|
|
16
|
+
const DEFAULT_PAGE_IDX = 1;
|
|
17
|
+
const SM_PAGE_SIZE = 25;
|
|
18
|
+
const MD_PAGE_SIZE = 50;
|
|
19
|
+
const LG_PAGE_SIZE = 100;
|
|
20
|
+
const DEFAULT_PAGE_SIZES = [SM_PAGE_SIZE, MD_PAGE_SIZE, LG_PAGE_SIZE];
|
|
21
|
+
const XS = "xs";
|
|
22
|
+
const SM = "sm";
|
|
23
|
+
const MD = "md";
|
|
24
|
+
const LG = "lg";
|
|
25
|
+
const XL = "xl";
|
|
26
|
+
const ROW_SIZES = {
|
|
27
|
+
items: [XS, SM, MD, LG, XL],
|
|
28
|
+
results: {
|
|
29
|
+
[XS]: 32,
|
|
30
|
+
[SM]: 40,
|
|
31
|
+
[MD]: 48,
|
|
32
|
+
[LG]: 56,
|
|
33
|
+
[XL]: 64
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.DEFAULT_PAGE_IDX = DEFAULT_PAGE_IDX;
|
|
38
|
+
exports.DEFAULT_PAGE_SIZES = DEFAULT_PAGE_SIZES;
|
|
39
|
+
exports.LG = LG;
|
|
40
|
+
exports.LG_PAGE_SIZE = LG_PAGE_SIZE;
|
|
41
|
+
exports.MD = MD;
|
|
42
|
+
exports.MD_PAGE_SIZE = MD_PAGE_SIZE;
|
|
43
|
+
exports.PARTS = PARTS;
|
|
44
|
+
exports.ROW_SIZES = ROW_SIZES;
|
|
45
|
+
exports.SCOPE = SCOPE;
|
|
46
|
+
exports.SM = SM;
|
|
47
|
+
exports.SM_PAGE_SIZE = SM_PAGE_SIZE;
|
|
48
|
+
exports.XL = XL;
|
|
49
|
+
exports.XS = XS;
|
package/dist/const.d.cts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const SCOPE = "data-grid";
|
|
2
|
+
export declare const DEFAULT_COL_H = 40;
|
|
3
|
+
export declare const PARTS: {
|
|
4
|
+
TOOLBAR: string;
|
|
5
|
+
ROOT: string;
|
|
6
|
+
VIEWPORT: string;
|
|
7
|
+
HEAD_CELL: string;
|
|
8
|
+
ROW: string;
|
|
9
|
+
CELL: string;
|
|
10
|
+
FOOTER: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const DEFAULT_PAGE_IDX = 1;
|
|
13
|
+
export declare const SM_PAGE_SIZE = 25;
|
|
14
|
+
export declare const MD_PAGE_SIZE = 50;
|
|
15
|
+
export declare const LG_PAGE_SIZE = 100;
|
|
16
|
+
export declare const DEFAULT_PAGE_SIZES: number[];
|
|
17
|
+
export declare const XS = "xs";
|
|
18
|
+
export declare const SM = "sm";
|
|
19
|
+
export declare const MD = "md";
|
|
20
|
+
export declare const LG = "lg";
|
|
21
|
+
export declare const XL = "xl";
|
|
22
|
+
export type RowSize = typeof XS | typeof SM | typeof MD | typeof LG | typeof XL;
|
|
23
|
+
type RowSizeData = {
|
|
24
|
+
items: RowSize[];
|
|
25
|
+
results: Record<RowSize, number>;
|
|
26
|
+
};
|
|
27
|
+
export declare const ROW_SIZES: RowSizeData;
|
|
28
|
+
export {};
|
package/dist/const.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const SCOPE = "data-grid";
|
|
2
|
+
export declare const DEFAULT_COL_H = 40;
|
|
3
|
+
export declare const PARTS: {
|
|
4
|
+
TOOLBAR: string;
|
|
5
|
+
ROOT: string;
|
|
6
|
+
VIEWPORT: string;
|
|
7
|
+
HEAD_CELL: string;
|
|
8
|
+
ROW: string;
|
|
9
|
+
CELL: string;
|
|
10
|
+
FOOTER: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const DEFAULT_PAGE_IDX = 1;
|
|
13
|
+
export declare const SM_PAGE_SIZE = 25;
|
|
14
|
+
export declare const MD_PAGE_SIZE = 50;
|
|
15
|
+
export declare const LG_PAGE_SIZE = 100;
|
|
16
|
+
export declare const DEFAULT_PAGE_SIZES: number[];
|
|
17
|
+
export declare const XS = "xs";
|
|
18
|
+
export declare const SM = "sm";
|
|
19
|
+
export declare const MD = "md";
|
|
20
|
+
export declare const LG = "lg";
|
|
21
|
+
export declare const XL = "xl";
|
|
22
|
+
export type RowSize = typeof XS | typeof SM | typeof MD | typeof LG | typeof XL;
|
|
23
|
+
type RowSizeData = {
|
|
24
|
+
items: RowSize[];
|
|
25
|
+
results: Record<RowSize, number>;
|
|
26
|
+
};
|
|
27
|
+
export declare const ROW_SIZES: RowSizeData;
|
|
28
|
+
export {};
|
package/dist/const.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
const SCOPE = "data-grid";
|
|
3
|
+
const PARTS = {
|
|
4
|
+
TOOLBAR: "toolbar",
|
|
5
|
+
ROOT: "root",
|
|
6
|
+
VIEWPORT: "viewport",
|
|
7
|
+
HEAD_CELL: "head-cell",
|
|
8
|
+
ROW: "row",
|
|
9
|
+
CELL: "row-cell",
|
|
10
|
+
FOOTER: "footer"
|
|
11
|
+
};
|
|
12
|
+
const DEFAULT_PAGE_IDX = 1;
|
|
13
|
+
const SM_PAGE_SIZE = 25;
|
|
14
|
+
const MD_PAGE_SIZE = 50;
|
|
15
|
+
const LG_PAGE_SIZE = 100;
|
|
16
|
+
const DEFAULT_PAGE_SIZES = [SM_PAGE_SIZE, MD_PAGE_SIZE, LG_PAGE_SIZE];
|
|
17
|
+
const XS = "xs";
|
|
18
|
+
const SM = "sm";
|
|
19
|
+
const MD = "md";
|
|
20
|
+
const LG = "lg";
|
|
21
|
+
const XL = "xl";
|
|
22
|
+
const ROW_SIZES = {
|
|
23
|
+
items: [XS, SM, MD, LG, XL],
|
|
24
|
+
results: {
|
|
25
|
+
[XS]: 32,
|
|
26
|
+
[SM]: 40,
|
|
27
|
+
[MD]: 48,
|
|
28
|
+
[LG]: 56,
|
|
29
|
+
[XL]: 64
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { DEFAULT_PAGE_IDX, DEFAULT_PAGE_SIZES, LG, LG_PAGE_SIZE, MD, MD_PAGE_SIZE, PARTS, ROW_SIZES, SCOPE, SM, SM_PAGE_SIZE, XL, XS };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const signals = require('@cerberus-design/signals');
|
|
8
|
+
|
|
9
|
+
const { StoreProvider: BaseProvider, useStore: useBaseStore } = signals.createStoreContext();
|
|
10
|
+
function DataGridProvider(props) {
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BaseProvider, { createStore: props.createStore, children: props.children });
|
|
12
|
+
}
|
|
13
|
+
function useDataGridContext() {
|
|
14
|
+
return useBaseStore();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
exports.DataGridProvider = DataGridProvider;
|
|
18
|
+
exports.useDataGridContext = useDataGridContext;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { GridStore } from './types';
|
|
3
|
+
export declare function DataGridProvider<TData>(props: {
|
|
4
|
+
createStore: () => GridStore<TData>;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function useDataGridContext<TData>(): GridStore<TData>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { GridStore } from './types';
|
|
3
|
+
export declare function DataGridProvider<TData>(props: {
|
|
4
|
+
createStore: () => GridStore<TData>;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function useDataGridContext<TData>(): GridStore<TData>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { createStoreContext } from '@cerberus-design/signals';
|
|
4
|
+
|
|
5
|
+
const { StoreProvider: BaseProvider, useStore: useBaseStore } = createStoreContext();
|
|
6
|
+
function DataGridProvider(props) {
|
|
7
|
+
return /* @__PURE__ */ jsx(BaseProvider, { createStore: props.createStore, children: props.children });
|
|
8
|
+
}
|
|
9
|
+
function useDataGridContext() {
|
|
10
|
+
return useBaseStore();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { DataGridProvider, useDataGridContext };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const react = require('react');
|
|
7
|
+
|
|
8
|
+
function usePinnedState(pinned) {
|
|
9
|
+
return pinned ? "pinned" : "unpinned";
|
|
10
|
+
}
|
|
11
|
+
function usePinnedAttribute(pinned) {
|
|
12
|
+
return pinned ? { "data-pinned": pinned } : void 0;
|
|
13
|
+
}
|
|
14
|
+
function useColumnStyles(column, pinnedVal) {
|
|
15
|
+
const styles = react.useMemo(
|
|
16
|
+
() => ({
|
|
17
|
+
order: `var(--col-${column.id}-order)`,
|
|
18
|
+
left: pinnedVal === "left" ? `var(--col-${column.id}-left)` : void 0,
|
|
19
|
+
right: pinnedVal === "right" ? `var(--col-${column.id}-right)` : void 0,
|
|
20
|
+
width: `var(--col-${column.id}-width)`
|
|
21
|
+
}),
|
|
22
|
+
[column.id, pinnedVal]
|
|
23
|
+
);
|
|
24
|
+
return styles;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.useColumnStyles = useColumnStyles;
|
|
28
|
+
exports.usePinnedAttribute = usePinnedAttribute;
|
|
29
|
+
exports.usePinnedState = usePinnedState;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { InternalColumn, PinnedState } from './types';
|
|
3
|
+
export declare function usePinnedState(pinned: PinnedState): 'pinned' | 'unpinned';
|
|
4
|
+
export declare function usePinnedAttribute(pinned: PinnedState): {
|
|
5
|
+
'data-pinned': PinnedState;
|
|
6
|
+
} | undefined;
|
|
7
|
+
export declare function useColumnStyles<TData>(column: InternalColumn<TData>, pinnedVal: PinnedState): CSSProperties;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { InternalColumn, PinnedState } from './types';
|
|
3
|
+
export declare function usePinnedState(pinned: PinnedState): 'pinned' | 'unpinned';
|
|
4
|
+
export declare function usePinnedAttribute(pinned: PinnedState): {
|
|
5
|
+
'data-pinned': PinnedState;
|
|
6
|
+
} | undefined;
|
|
7
|
+
export declare function useColumnStyles<TData>(column: InternalColumn<TData>, pinnedVal: PinnedState): CSSProperties;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
function usePinnedState(pinned) {
|
|
5
|
+
return pinned ? "pinned" : "unpinned";
|
|
6
|
+
}
|
|
7
|
+
function usePinnedAttribute(pinned) {
|
|
8
|
+
return pinned ? { "data-pinned": pinned } : void 0;
|
|
9
|
+
}
|
|
10
|
+
function useColumnStyles(column, pinnedVal) {
|
|
11
|
+
const styles = useMemo(
|
|
12
|
+
() => ({
|
|
13
|
+
order: `var(--col-${column.id}-order)`,
|
|
14
|
+
left: pinnedVal === "left" ? `var(--col-${column.id}-left)` : void 0,
|
|
15
|
+
right: pinnedVal === "right" ? `var(--col-${column.id}-right)` : void 0,
|
|
16
|
+
width: `var(--col-${column.id}-width)`
|
|
17
|
+
}),
|
|
18
|
+
[column.id, pinnedVal]
|
|
19
|
+
);
|
|
20
|
+
return styles;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { useColumnStyles, usePinnedAttribute, usePinnedState };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const dataGrid_client = require('./components/data-grid.client.cjs');
|
|
6
|
+
const cerbyDataGrid_client = require('./components/cerby-data-grid.client.cjs');
|
|
7
|
+
const context_client = require('./context.client.cjs');
|
|
8
|
+
const columnHelpers = require('./column-helpers.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.DataGrid = dataGrid_client.DataGrid;
|
|
13
|
+
exports.CerberusDataGrid = cerbyDataGrid_client.CerberusDataGrid;
|
|
14
|
+
exports.useDataGridContext = context_client.useDataGridContext;
|
|
15
|
+
exports.createColumnHelper = columnHelpers.createColumnHelper;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module is the entry point for the Cerberus Data Grid package.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
export * from './components/data-grid.client';
|
|
6
|
+
export * from './components/cerby-data-grid.client';
|
|
7
|
+
export { useDataGridContext } from './context.client';
|
|
8
|
+
export * from './column-helpers';
|
|
9
|
+
export * from './types';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module is the entry point for the Cerberus Data Grid package.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
export * from './components/data-grid.client';
|
|
6
|
+
export * from './components/cerby-data-grid.client';
|
|
7
|
+
export { useDataGridContext } from './context.client';
|
|
8
|
+
export * from './column-helpers';
|
|
9
|
+
export * from './types';
|
package/dist/index.js
ADDED