DmProTable
DmProTable documents the DmProTable export from duskmoon.
@duskmoon-dev/components/dm-pro-table Usage
When to use
- Use it in DuskMoon application screens that need a packaged, opinionated workflow component.
- Reach for the lower-level standard component when the screen needs custom composition.
Implementation notes
Features
Wraps lower-level primitives into a higher-level DuskMoon-prefixed workflow API.
Examples show the defaults and composition points expected by internal DuskMoon app screens.
DmProTable is most often configured through `rowData`, `headerTitle`, `toolBarRender`, `toolbarItems`.
Renders title bar, toolbar, and inner table rows
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
| Name |
|---|
| DuskMoon |
Basic usage
Import the component stylesheet and DmProTable from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { DmProTable } from "@duskmoon-dev/components/dm-pro-table";
export function Example() {
return (<DmProTable
columns={[{ title: "Name", dataIndex: "name", key: "name" }]}
rowData={[{ key: 1, name: "DuskMoon" }]}
/>);
} | Name |
|---|
| DuskMoon |
Renders title bar, toolbar, and inner table rows
test-backedDmProTable scenario from the component test coverage: renders title bar, toolbar, and inner table rows.
import "@duskmoon-dev/components/styles.css";
import { DmProTable } from "@duskmoon-dev/components/dm-pro-table";
export function DmProTableRendersTitleBarToolbarDemo() {
return (<DmProTable
columns={[{ title: "Name", dataIndex: "name", key: "name" }]}
rowData={[{ key: 1, name: "DuskMoon" }]}
/>);
} | Name |
|---|
| DuskMoon |
Can hide title bar
test-backedDmProTable scenario from the component test coverage: can hide title bar.
import "@duskmoon-dev/components/styles.css";
import { DmProTable } from "@duskmoon-dev/components/dm-pro-table";
export function DmProTableCanHideTitleBarDemo() {
return (<DmProTable
columns={[{ title: "Name", dataIndex: "name", key: "name" }]}
rowData={[{ key: 1, name: "DuskMoon" }]}
/>);
} | Name |
|---|
| DuskMoon |
| Name |
|---|
| DuskMoon |
Theme aware
Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.
<div data-theme="sunshine">
<DmProTable
columns={[{ title: "Name", dataIndex: "name", key: "name" }]}
rowData={[{ key: 1, name: "DuskMoon" }]}
/>
</div>
<div data-theme="moonlight">
<DmProTable
columns={[{ title: "Name", dataIndex: "name", key: "name" }]}
rowData={[{ key: 1, name: "DuskMoon" }]}
/>
</div> API
The API reference below lists every parsed exported type or interface for DmProTable. Start with `rowData`, `headerTitle`, `toolBarRender`, `toolbarItems` for common usage.
packages/components/src/components/dm-pro-table/DmProTable.types.ts
Scenarios: packages/components/src/components/dm-pro-table/DmProTable.test.tsx | Prop | Type | Required | Description |
|---|---|---|---|
rowData | T[] | No | rowData configures DmProTable. |
headerTitle | ReactNode | No | headerTitle configures DmProTable. |
toolBarRender | (() => ReactNode[] | ReactNode) | ReactNode[] | ReactNode | No | toolBarRender configures DmProTable. |
toolbarItems | DmToolbarItem[] | No | toolbarItems configures DmProTable. |
showTitleBar | boolean | No | showTitleBar configures DmProTable. |
columnSettingVisible | boolean | No | columnSettingVisible configures DmProTable. |
onSortChanged | ( | No | onSortChanged configures DmProTable. |
sortColumns | Array<{ columnKey?: string | number; order?: string | null }>, | Yes | sortColumns configures DmProTable. |