Refactor #3924 - For DataView & DataViewLayoutOptions

This commit is contained in:
Tuğçe Küçükoğlu 2023-05-10 01:39:10 +03:00
parent f101f1379d
commit b82bf5295a
7 changed files with 173 additions and 13 deletions

View file

@ -8,8 +8,18 @@
*
*/
import { VNode } from 'vue';
import { PaginatorPassThroughOptionType } from '../paginator';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type DataViewPassThroughOptionType = DataViewPassThroughAttributes | ((options: DataViewPassThroughMethodOptions) => DataViewPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface DataViewPassThroughMethodOptions {
props: DataViewProps;
state: DataViewState;
}
/**
* Custom page event.
* @see {@link DataViewEmits.page}
@ -33,6 +43,63 @@ export interface DataViewPageEvent {
pageCount: number;
}
/**
* Custom passthrough(pt) options.
* @see {@link DataViewProps.pt}
*/
export interface DataViewPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: DataViewPassThroughOptionType;
/**
* Uses to pass attributes to the header's DOM element.
*/
header?: DataViewPassThroughOptionType;
/**
* Uses to pass attributes to the Paginator component.
* @see {@link PaginatorPassThroughOptionType}
*/
paginator?: PaginatorPassThroughOptionType;
/**
* Uses to pass attributes to the content's DOM element.
*/
content?: DataViewPassThroughOptionType;
/**
* Uses to pass attributes to the column's DOM element.
*/
column?: DataViewPassThroughOptionType;
/**
* Uses to pass attributes to the empty message's DOM element.
*/
emptyMessage?: DataViewPassThroughOptionType;
/**
* Uses to pass attributes to the footer's DOM element.
*/
footer?: DataViewPassThroughOptionType;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface DataViewPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in DataView component.
*/
export interface DataViewState {
/**
* Current index of first record as a number.
*/
d_first: number;
/**
* Current number of rows to display in new page as a number.
*/
d_rows: number;
}
/**
* Defines valid properties in DataView component. In addition to these, all properties of HTMLDivElement can be used in this component.
*/
@ -130,6 +197,11 @@ export interface DataViewProps {
* Name of the data that uniquely identifies the a record in the data.
*/
dataKey: string | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {DataViewPassThroughOptions}
*/
pt?: DataViewPassThroughOptions;
}
/**