refactor 'rows' -> 'data'
This commit is contained in:
parent
7f436227d9
commit
d39f88a754
5 changed files with 15 additions and 16 deletions
|
@ -91,6 +91,8 @@ export const createDataSet = <T extends Record<string, any>>(data: T[], initialO
|
|||
value = implementation(value as DataSetRowNode<number, T>[]);
|
||||
}
|
||||
|
||||
console.log('dataset => nodes', value);
|
||||
|
||||
return value as DataSetNode<keyof T, T>[];
|
||||
});
|
||||
|
||||
|
@ -101,9 +103,6 @@ export const createDataSet = <T extends Record<string, any>>(data: T[], initialO
|
|||
return deepDiff(state.snapshot, state.value).toArray();
|
||||
});
|
||||
|
||||
const sorting = createMemo(() => state.sorting);
|
||||
const grouping = createMemo(() => state.grouping);
|
||||
|
||||
const set: DataSet<T> = {
|
||||
data,
|
||||
nodes,
|
||||
|
|
|
@ -73,12 +73,12 @@ export function Table<T extends Record<string, any>>(props: TableProps<T>) {
|
|||
<SelectionProvider selection={setSelection} multiSelect={props.selectionMode === SelectionMode.Multiple}>
|
||||
<Api api={props.api} />
|
||||
|
||||
<InnerTable class={props.class} summary={props.summary} rows={rows()} />
|
||||
<InnerTable class={props.class} summary={props.summary} data={rows()} />
|
||||
</SelectionProvider>
|
||||
</TableContext.Provider>;
|
||||
};
|
||||
|
||||
type InnerTableProps<T extends Record<string, any>> = { class?: string, summary?: string, rows: DataSet<T> };
|
||||
type InnerTableProps<T extends Record<string, any>> = { class?: string, summary?: string, data: DataSet<T> };
|
||||
|
||||
function InnerTable<T extends Record<string, any>>(props: InnerTableProps<T>) {
|
||||
const table = useTable<T>();
|
||||
|
@ -97,7 +97,7 @@ function InnerTable<T extends Record<string, any>>(props: InnerTableProps<T>) {
|
|||
<Head />
|
||||
|
||||
<tbody class={css.main}>
|
||||
<For each={props.rows.nodes() as DataSetNode<number, T>[]}>{
|
||||
<For each={props.data.nodes() as DataSetNode<number, T>[]}>{
|
||||
node => <Node node={node} depth={0} />
|
||||
}</For>
|
||||
</tbody>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue