@cerberus-design/data-grid 0.25.3 → 1.0.0-rc.6
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/column-helpers.cjs +55 -21
- package/dist/column-helpers.js +55 -17
- package/dist/components/cerby-data-grid.client.cjs +12 -11
- package/dist/components/cerby-data-grid.client.js +12 -7
- package/dist/components/count-menu.client.cjs +46 -49
- package/dist/components/count-menu.client.js +46 -45
- package/dist/components/data-grid.client.cjs +89 -82
- package/dist/components/data-grid.client.js +89 -78
- package/dist/components/features.client.cjs +72 -76
- package/dist/components/features.client.js +72 -72
- package/dist/components/grid.client.cjs +280 -309
- package/dist/components/grid.client.js +281 -303
- package/dist/components/pagination.client.cjs +90 -113
- package/dist/components/pagination.client.js +90 -109
- package/dist/components/pinned-items.client.cjs +60 -59
- package/dist/components/pinned-items.client.js +60 -55
- package/dist/components/sort-items.client.cjs +44 -49
- package/dist/components/sort-items.client.js +44 -45
- package/dist/const.cjs +32 -43
- package/dist/const.js +33 -31
- package/dist/context.client.cjs +12 -12
- package/dist/context.client.js +12 -8
- package/dist/hooks.client.cjs +13 -20
- package/dist/hooks.client.js +13 -16
- package/dist/index.cjs +9 -15
- package/dist/index.js +5 -4
- package/dist/panda.buildinfo.json +23 -0
- package/dist/store.cjs +241 -284
- package/dist/store.js +241 -280
- package/dist/utils.cjs +23 -45
- package/dist/utils.js +23 -41
- package/dist/virtualizer.client.cjs +63 -53
- package/dist/virtualizer.client.js +63 -49
- package/package.json +33 -27
package/dist/column-helpers.cjs
CHANGED
|
@@ -1,24 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/column-helpers.ts
|
|
3
|
+
/**
|
|
4
|
+
* A helper to format columns which provides a heavily typed interface for
|
|
5
|
+
* creating column definitions used by the DataGrid component.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { createColumnHelper } from '@cerberus/data-grid'
|
|
10
|
+
*
|
|
11
|
+
* const columnHelper = createColumnHelper<MyDataType>()
|
|
12
|
+
*
|
|
13
|
+
* const columns = [
|
|
14
|
+
* columnHelper.accessor('id', {
|
|
15
|
+
* header: 'ID',
|
|
16
|
+
* width: 100,
|
|
17
|
+
* cell: (props) => props.row.original.id,
|
|
18
|
+
* }),
|
|
19
|
+
* columnHelper.accessorFn(
|
|
20
|
+
* (row: User) => `${row.firstName} ${row.lastName}`,
|
|
21
|
+
* {
|
|
22
|
+
* id: 'id',
|
|
23
|
+
* header: 'Full Name',
|
|
24
|
+
* cell: (props) => <span className="custom-component">{props.value}</span>
|
|
25
|
+
* }
|
|
26
|
+
* ),
|
|
27
|
+
* columnHelper.display({
|
|
28
|
+
* id: 'actions',
|
|
29
|
+
* header: 'Actions',
|
|
30
|
+
* width: 150,
|
|
31
|
+
* cell: (props) => (
|
|
32
|
+
* <button onClick={() => handleDelete(props.row.original.id)}>
|
|
33
|
+
* Delete
|
|
34
|
+
* </button>
|
|
35
|
+
* ),
|
|
36
|
+
* }),
|
|
37
|
+
* ]
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
6
40
|
function createColumnHelper() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
41
|
+
return {
|
|
42
|
+
accessor: (key, options) => ({
|
|
43
|
+
id: options.id ?? key,
|
|
44
|
+
accessor: (row) => row[key],
|
|
45
|
+
...options
|
|
46
|
+
}),
|
|
47
|
+
accessorFn: (accessorFn, options) => ({
|
|
48
|
+
accessor: accessorFn,
|
|
49
|
+
...options
|
|
50
|
+
}),
|
|
51
|
+
display: (options) => ({
|
|
52
|
+
accessor: () => void 0,
|
|
53
|
+
...options
|
|
54
|
+
})
|
|
55
|
+
};
|
|
22
56
|
}
|
|
23
|
-
|
|
57
|
+
//#endregion
|
|
24
58
|
exports.createColumnHelper = createColumnHelper;
|
package/dist/column-helpers.js
CHANGED
|
@@ -1,20 +1,58 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/column-helpers.ts
|
|
3
|
+
/**
|
|
4
|
+
* A helper to format columns which provides a heavily typed interface for
|
|
5
|
+
* creating column definitions used by the DataGrid component.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { createColumnHelper } from '@cerberus/data-grid'
|
|
10
|
+
*
|
|
11
|
+
* const columnHelper = createColumnHelper<MyDataType>()
|
|
12
|
+
*
|
|
13
|
+
* const columns = [
|
|
14
|
+
* columnHelper.accessor('id', {
|
|
15
|
+
* header: 'ID',
|
|
16
|
+
* width: 100,
|
|
17
|
+
* cell: (props) => props.row.original.id,
|
|
18
|
+
* }),
|
|
19
|
+
* columnHelper.accessorFn(
|
|
20
|
+
* (row: User) => `${row.firstName} ${row.lastName}`,
|
|
21
|
+
* {
|
|
22
|
+
* id: 'id',
|
|
23
|
+
* header: 'Full Name',
|
|
24
|
+
* cell: (props) => <span className="custom-component">{props.value}</span>
|
|
25
|
+
* }
|
|
26
|
+
* ),
|
|
27
|
+
* columnHelper.display({
|
|
28
|
+
* id: 'actions',
|
|
29
|
+
* header: 'Actions',
|
|
30
|
+
* width: 150,
|
|
31
|
+
* cell: (props) => (
|
|
32
|
+
* <button onClick={() => handleDelete(props.row.original.id)}>
|
|
33
|
+
* Delete
|
|
34
|
+
* </button>
|
|
35
|
+
* ),
|
|
36
|
+
* }),
|
|
37
|
+
* ]
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
2
40
|
function createColumnHelper() {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
41
|
+
return {
|
|
42
|
+
accessor: (key, options) => ({
|
|
43
|
+
id: options.id ?? key,
|
|
44
|
+
accessor: (row) => row[key],
|
|
45
|
+
...options
|
|
46
|
+
}),
|
|
47
|
+
accessorFn: (accessorFn, options) => ({
|
|
48
|
+
accessor: accessorFn,
|
|
49
|
+
...options
|
|
50
|
+
}),
|
|
51
|
+
display: (options) => ({
|
|
52
|
+
accessor: () => void 0,
|
|
53
|
+
...options
|
|
54
|
+
})
|
|
55
|
+
};
|
|
18
56
|
}
|
|
19
|
-
|
|
57
|
+
//#endregion
|
|
20
58
|
export { createColumnHelper };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
const require_data_grid_client = require("./data-grid.client.cjs");
|
|
4
|
+
let _cerberus_design_react = require("@cerberus-design/react");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
//#region src/components/cerby-data-grid.client.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A Data Grid wrapped in the CerberusProvider in order to provide the necessary
|
|
9
|
+
* context for the grid to function properly.
|
|
10
|
+
*/
|
|
10
11
|
function CerberusDataGrid(props) {
|
|
11
|
-
|
|
12
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.CerberusProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_data_grid_client.DataGrid, { ...props }) });
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
//#endregion
|
|
14
15
|
exports.CerberusDataGrid = CerberusDataGrid;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { DataGrid } from "./data-grid.client.js";
|
|
4
|
+
import { CerberusProvider } from "@cerberus-design/react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/cerby-data-grid.client.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A Data Grid wrapped in the CerberusProvider in order to provide the necessary
|
|
9
|
+
* context for the grid to function properly.
|
|
10
|
+
*/
|
|
6
11
|
function CerberusDataGrid(props) {
|
|
7
|
-
|
|
12
|
+
return /* @__PURE__ */ jsx(CerberusProvider, { children: /* @__PURE__ */ jsx(DataGrid, { ...props }) });
|
|
8
13
|
}
|
|
9
|
-
|
|
14
|
+
//#endregion
|
|
10
15
|
export { CerberusDataGrid };
|
|
@@ -1,52 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const jsx = require('styled-system/jsx');
|
|
10
|
-
const context_client = require('../context.client.cjs');
|
|
11
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
const require_context_client = require("../context.client.cjs");
|
|
4
|
+
let _cerberus_design_react = require("@cerberus-design/react");
|
|
5
|
+
let _cerberus_design_signals = require("@cerberus-design/signals");
|
|
6
|
+
let styled_system_jsx = require("styled-system/jsx");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
//#region src/components/count-menu.client.tsx
|
|
12
9
|
function CountMenu(props) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
10
|
+
const state = require_context_client.useDataGridContext();
|
|
11
|
+
const { icons } = (0, _cerberus_design_react.useCerberusContext)();
|
|
12
|
+
const pageSize = (0, _cerberus_design_signals.useRead)(state.pageSize);
|
|
13
|
+
const range = (0, _cerberus_design_signals.useRead)(state.pageRange);
|
|
14
|
+
const Icon = icons.caretDown;
|
|
15
|
+
const collection = (0, _cerberus_design_react.createSelectCollection)(range.map((size) => {
|
|
16
|
+
const sizeStr = String(size);
|
|
17
|
+
return {
|
|
18
|
+
value: sizeStr,
|
|
19
|
+
label: sizeStr
|
|
20
|
+
};
|
|
21
|
+
}));
|
|
22
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(styled_system_jsx.Box, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.Field, {
|
|
23
|
+
label: "Select a page size",
|
|
24
|
+
hideLabel: true,
|
|
25
|
+
flexDirection: "row",
|
|
26
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_cerberus_design_react.SelectParts.Root, {
|
|
27
|
+
...props,
|
|
28
|
+
collection,
|
|
29
|
+
defaultValue: [String(pageSize)],
|
|
30
|
+
size: "sm",
|
|
31
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.SelectParts.Control, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_cerberus_design_react.SelectParts.Trigger, {
|
|
32
|
+
border: "none",
|
|
33
|
+
minW: "initial",
|
|
34
|
+
gap: "xs",
|
|
35
|
+
ps: "0",
|
|
36
|
+
pe: "0",
|
|
37
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.SelectParts.ValueText, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(styled_system_jsx.HStack, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.SelectParts.Indicator, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {}) }) })]
|
|
38
|
+
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.SelectParts.Positioner, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.SelectParts.Content, {
|
|
39
|
+
minW: "7rem",
|
|
40
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.For, {
|
|
41
|
+
each: collection.items,
|
|
42
|
+
children: (item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.Option, { item }, item.value)
|
|
43
|
+
})
|
|
44
|
+
}) })]
|
|
45
|
+
})
|
|
46
|
+
}) });
|
|
50
47
|
}
|
|
51
|
-
|
|
48
|
+
//#endregion
|
|
52
49
|
exports.CountMenu = CountMenu;
|
|
@@ -1,48 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { useDataGridContext } from "../context.client.js";
|
|
4
|
+
import { Field, For, Option, SelectParts, createSelectCollection, useCerberusContext } from "@cerberus-design/react";
|
|
5
|
+
import { useRead } from "@cerberus-design/signals";
|
|
6
|
+
import { Box, HStack } from "styled-system/jsx";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/count-menu.client.tsx
|
|
8
9
|
function CountMenu(props) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
10
|
+
const state = useDataGridContext();
|
|
11
|
+
const { icons } = useCerberusContext();
|
|
12
|
+
const pageSize = useRead(state.pageSize);
|
|
13
|
+
const range = useRead(state.pageRange);
|
|
14
|
+
const Icon = icons.caretDown;
|
|
15
|
+
const collection = createSelectCollection(range.map((size) => {
|
|
16
|
+
const sizeStr = String(size);
|
|
17
|
+
return {
|
|
18
|
+
value: sizeStr,
|
|
19
|
+
label: sizeStr
|
|
20
|
+
};
|
|
21
|
+
}));
|
|
22
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Field, {
|
|
23
|
+
label: "Select a page size",
|
|
24
|
+
hideLabel: true,
|
|
25
|
+
flexDirection: "row",
|
|
26
|
+
children: /* @__PURE__ */ jsxs(SelectParts.Root, {
|
|
27
|
+
...props,
|
|
28
|
+
collection,
|
|
29
|
+
defaultValue: [String(pageSize)],
|
|
30
|
+
size: "sm",
|
|
31
|
+
children: [/* @__PURE__ */ jsx(SelectParts.Control, { children: /* @__PURE__ */ jsxs(SelectParts.Trigger, {
|
|
32
|
+
border: "none",
|
|
33
|
+
minW: "initial",
|
|
34
|
+
gap: "xs",
|
|
35
|
+
ps: "0",
|
|
36
|
+
pe: "0",
|
|
37
|
+
children: [/* @__PURE__ */ jsx(SelectParts.ValueText, {}), /* @__PURE__ */ jsx(HStack, { children: /* @__PURE__ */ jsx(SelectParts.Indicator, { children: /* @__PURE__ */ jsx(Icon, {}) }) })]
|
|
38
|
+
}) }), /* @__PURE__ */ jsx(SelectParts.Positioner, { children: /* @__PURE__ */ jsx(SelectParts.Content, {
|
|
39
|
+
minW: "7rem",
|
|
40
|
+
children: /* @__PURE__ */ jsx(For, {
|
|
41
|
+
each: collection.items,
|
|
42
|
+
children: (item) => /* @__PURE__ */ jsx(Option, { item }, item.value)
|
|
43
|
+
})
|
|
44
|
+
}) })]
|
|
45
|
+
})
|
|
46
|
+
}) });
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
+
//#endregion
|
|
48
49
|
export { CountMenu };
|
|
@@ -1,85 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const grid_client = require('./grid.client.cjs');
|
|
15
|
-
const pagination_client = require('./pagination.client.cjs');
|
|
16
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
const require_const = require("../const.cjs");
|
|
4
|
+
const require_context_client = require("../context.client.cjs");
|
|
5
|
+
const require_store = require("../store.cjs");
|
|
6
|
+
const require_grid_client = require("./grid.client.cjs");
|
|
7
|
+
const require_pagination_client = require("./pagination.client.cjs");
|
|
8
|
+
let _cerberus_design_react = require("@cerberus-design/react");
|
|
9
|
+
let _cerberus_design_signals = require("@cerberus-design/signals");
|
|
10
|
+
let react = require("react");
|
|
11
|
+
let styled_system_jsx = require("styled-system/jsx");
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
|
+
//#region src/components/data-grid.client.tsx
|
|
17
14
|
function DataGridEl(props) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
15
|
+
const { data } = props;
|
|
16
|
+
const store = (0, react.useMemo)(() => require_store.createGridStore({
|
|
17
|
+
data,
|
|
18
|
+
columns: props.columns,
|
|
19
|
+
initialState: props.initialState,
|
|
20
|
+
rowSize: props.rowSize,
|
|
21
|
+
onPageChange: props.onPageChange
|
|
22
|
+
}), []);
|
|
23
|
+
const [ready, setReady] = (0, _cerberus_design_signals.useSignal)(false);
|
|
24
|
+
const rootRef = (0, react.useRef)(null);
|
|
25
|
+
(0, react.useEffect)(() => {
|
|
26
|
+
store.updateData(data);
|
|
27
|
+
}, [data, store]);
|
|
28
|
+
(0, react.useEffect)(() => {
|
|
29
|
+
const el = rootRef.current;
|
|
30
|
+
if (!el) return;
|
|
31
|
+
const observer = new ResizeObserver((entries) => {
|
|
32
|
+
for (const entry of entries) store.setContainerWidth(entry.contentRect.width);
|
|
33
|
+
});
|
|
34
|
+
observer.observe(el);
|
|
35
|
+
const cleanupSignalEffect = (0, _cerberus_design_signals.createEffect)(() => {
|
|
36
|
+
Object.entries(store.rootCssVars()).forEach(([key, val]) => {
|
|
37
|
+
el.style.setProperty(key, val);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
setReady(true);
|
|
41
|
+
return () => {
|
|
42
|
+
observer.disconnect();
|
|
43
|
+
cleanupSignalEffect();
|
|
44
|
+
};
|
|
45
|
+
}, [store, setReady]);
|
|
46
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_context_client.DataGridProvider, {
|
|
47
|
+
createStore: () => store,
|
|
48
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.Show, {
|
|
49
|
+
when: props.toolbar,
|
|
50
|
+
children: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(styled_system_jsx.HStack, {
|
|
51
|
+
"data-scope": require_const.SCOPE,
|
|
52
|
+
"data-part": require_const.PARTS.TOOLBAR,
|
|
53
|
+
w: "full",
|
|
54
|
+
children: props.toolbar
|
|
55
|
+
})
|
|
56
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(styled_system_jsx.Stack, {
|
|
57
|
+
"data-scope": require_const.SCOPE,
|
|
58
|
+
"data-part": require_const.PARTS.ROOT,
|
|
59
|
+
dir: "columns",
|
|
60
|
+
maxH: "inherit",
|
|
61
|
+
minH: "inherit",
|
|
62
|
+
gap: "0",
|
|
63
|
+
h: "full",
|
|
64
|
+
bgColor: "page.surface.100/55",
|
|
65
|
+
border: "1px solid",
|
|
66
|
+
borderColor: "page.border.initial",
|
|
67
|
+
rounded: "lg",
|
|
68
|
+
overflow: "hidden",
|
|
69
|
+
w: "full",
|
|
70
|
+
ref: rootRef,
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.Show, {
|
|
73
|
+
when: ready,
|
|
74
|
+
children: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_grid_client.GridViewport, {})
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_cerberus_design_react.Show, {
|
|
77
|
+
when: props.footer,
|
|
78
|
+
children: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(styled_system_jsx.HStack, {
|
|
79
|
+
"data-scope": require_const.SCOPE,
|
|
80
|
+
"data-part": require_const.PARTS.FOOTER,
|
|
81
|
+
w: "full",
|
|
82
|
+
children: props.footer
|
|
83
|
+
})
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_pagination_client.GridPagination, {})
|
|
86
|
+
]
|
|
87
|
+
})]
|
|
88
|
+
});
|
|
82
89
|
}
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
var DataGrid = (0, react.memo)(DataGridEl);
|
|
91
|
+
//#endregion
|
|
85
92
|
exports.DataGrid = DataGrid;
|