From 47186d3a35e0461e57457a3dffb3f8a325a647c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Tue, 28 Feb 2023 17:07:58 +0300 Subject: [PATCH] datatable.d.ts update --- components/datatable/DataTable.d.ts | 105 ++++++++++--------------- doc/common/apidoc/index.json | 116 ++++++++++++++-------------- 2 files changed, 97 insertions(+), 124 deletions(-) diff --git a/components/datatable/DataTable.d.ts b/components/datatable/DataTable.d.ts index 8207b20d1..3a9f9bafa 100755 --- a/components/datatable/DataTable.d.ts +++ b/components/datatable/DataTable.d.ts @@ -120,9 +120,8 @@ export interface DataTableSortEvent { rows: number; /** * Field to sort against - * @todo */ - sortField: string | ((item: any) => string) | undefined | null; + sortField: string | ((item: any) => string) | undefined; /** * Sort order as integer */ @@ -130,7 +129,7 @@ export interface DataTableSortEvent { /** * MultiSort metadata */ - multiSortMeta: DataTableSortMeta[] | undefined | null; + multiSortMeta: DataTableSortMeta[] | undefined; /** * Collection of active filters * @see DataTableFilterMeta @@ -345,7 +344,8 @@ export interface DataTableRowExpandEvent { /** * Custom row collapse event. - * @see {@link DataTableEmits.rowgroupCollapse} + * @see rowgroup-collapse + * @todo * @extends DataTableRowExpandEvent */ export interface DataTableRowCollapseEvent extends DataTableRowExpandEvent {} @@ -375,7 +375,8 @@ export interface DataTableCellEditInitEvent { /** * Custom cell edit cancel event. - * @see {@link DataTableEmits.cellEditInit} + * @see cell-edit-init + * @todo * @extends DataTableCellEditInitEvent */ export interface DataTableCellEditCancelEvent extends DataTableCellEditInitEvent {} @@ -448,14 +449,14 @@ export interface DataTableRowEditInitEvent { /** * Custom row edit init event. - * @see {@link DataTableEmits.rowEditInit} + * @see row-edit-init * @extends DataTableRowEditInitEvent */ export interface DataTableRowEditSaveEvent extends DataTableRowEditInitEvent {} /** * Custom row edit cancel event. - * @see {@link DataTableEmits.rowEditInit} + * @see row-edit-init * @extends DataTableRowEditCancelEvent */ export interface DataTableRowEditCancelEvent extends DataTableRowEditInitEvent {} @@ -484,7 +485,7 @@ export interface DataTableStateEvent { /** * MultiSort metadata */ - multiSortMeta: DataTableSortMeta[] | undefined | null; + multiSortMeta: DataTableSortMeta[] | undefined; /** * Collection of active filters * @see DataTableFilterMeta @@ -531,9 +532,8 @@ export interface DataTableProps { value?: any[] | undefined | null; /** * Name of the field that uniquely identifies the a record in the data. - * @defaultValue null */ - dataKey?: string | ((item: any) => string) | null | undefined; + dataKey?: string | ((item: any) => string) | undefined; /** * Number of rows to display per page. * @defaultValue 0 @@ -587,9 +587,9 @@ export interface DataTableProps { /** * Array of integer values to display inside rows per page dropdown. */ - rowsPerPageOptions?: number[] | undefined | null; + rowsPerPageOptions?: number[] | undefined; /** - * Template of the current page report element. It displays information about the pagination state. Default value is ({currentPage} of {totalPages}) whereas available placeholders are the following; + * Template of the current page report element. It displays information about the pagination state. Available placeholders are the following; * * - {currentPage} * - {totalPages} @@ -617,9 +617,8 @@ export interface DataTableProps { loadingIcon?: string | undefined; /** * Property name or a getter function of a row data used for sorting by default - * @defaultValue null */ - sortField?: string | ((item: any) => string) | null | undefined; + sortField?: string | ((item: any) => string) | undefined; /** * Order to sort the data by default. */ @@ -630,9 +629,9 @@ export interface DataTableProps { */ defaultSortOrder?: number | undefined; /** - * An array of SortMeta objects to sort the data by default in multiple sort mode. + * An array of SortMeta objects to sort the data. */ - multiSortMeta?: DataTableSortMeta[] | undefined | null; + multiSortMeta?: DataTableSortMeta[] | undefined; /** * Defines whether sorting works on single column or on multiple columns. * @defaultValue single @@ -647,12 +646,11 @@ export interface DataTableProps { * Filters object with key-value pairs to define the filters. * @see DataTableFilterMeta */ - filters?: DataTableFilterMeta | null; + filters?: DataTableFilterMeta; /** - * Layout of the filter elements, valid values are 'row' and 'menu'. - * @defaultValue null + * Layout of the filter elements. */ - filterDisplay?: 'menu' | 'row' | undefined | null; + filterDisplay?: 'menu' | 'row' | undefined; /** * Fields for global filter */ @@ -666,12 +664,11 @@ export interface DataTableProps { */ selection?: any[] | any | undefined; /** - * Specifies the selection mode, valid values are 'single' and 'multiple'. - * @defaultValue null + * Specifies the selection mode. */ selectionMode?: 'single' | 'multiple' | undefined; /** - * Algorithm to define if a row is selected, valid values are 'equals' that compares by reference and 'deepEquals' that compares all fields. + * Algorithm to define if a row is selected. * @defaultValue deepEquals */ compareSelectionBy?: 'equals' | 'deepEquals' | undefined; @@ -689,7 +686,7 @@ export interface DataTableProps { /** * Selected row instance with the ContextMenu. */ - contextMenuSelection?: any | any[] | undefined | null; + contextMenuSelection?: any | any[] | undefined; /** * Whether all data is selected. */ @@ -720,7 +717,7 @@ export interface DataTableProps { */ resizableColumns?: boolean | undefined; /** - * Defines whether the overall table width should change on column resize, valid values are 'fit' and 'expand'. + * Defines whether the overall table width. * @defaultValue fit */ columnResizeMode?: 'fit' | 'expand' | undefined; @@ -745,13 +742,11 @@ export interface DataTableProps { */ collapsedRowIcon?: string | undefined; /** - * Defines the row group mode, valid options are 'subheader' and 'rowspan'. - * @defaultValue null + * Defines the row group mode. */ - rowGroupMode?: 'subheader' | 'rowspan' | undefined | null; + rowGroupMode?: 'subheader' | 'rowspan' | undefined; /** * One or more field names to use in row grouping. - * @todo */ groupRowsBy?: ((field: string) => object) | string[] | string | undefined; /** @@ -765,33 +760,31 @@ export interface DataTableProps { */ expandedRowGroups?: any[] | DataTableExpandedRows; /** - * Defines where a stateful table keeps its state, valid values are 'session' for sessionStorage and 'local' for localStorage. + * Defines where a stateful table keeps its state. * @defaultValue session */ stateStorage?: 'session' | 'local' | undefined; /** * Unique identifier of a stateful table to use in state storage. */ - stateKey?: string | undefined | null; + stateKey?: string | undefined; /** * Defines the incell editing mode, valid options are 'cell' and 'row'. - * @defaultValue null */ - editMode?: 'cell' | 'row' | undefined | null; + editMode?: 'cell' | 'row' | undefined; /** * A collection of rows to represent the current editing data in row edit mode. * @see DataTableEditingRows */ - editingRows?: any[] | DataTableEditingRows | null; + editingRows?: any[] | DataTableEditingRows; /** * A function that takes the row data as a parameter and returns a string to apply a particular class for the row. - * @todo */ - rowClass?: (data: any) => object | string | undefined | null; + rowClass?: (data: any) => object | string | undefined; /** * A function that takes the row data as a parameter and returns the inline style for the corresponding row. */ - rowStyle?: any | null; + rowStyle?: any; /** * When specified, enables horizontal and/or vertical scrolling. * @defaultValue false @@ -799,15 +792,14 @@ export interface DataTableProps { scrollable?: boolean | undefined; /** * Height of the scroll viewport in fixed pixels or the 'flex' keyword for a dynamic size. - * @defaultValue null */ - scrollHeight?: 'flex' | string | undefined | null; + scrollHeight?: 'flex' | string | undefined; /** * Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it. * Note: Currently only vertical orientation mode is supported. * @see VirtualScroller.VirtualScrollerProps */ - virtualScrollerOptions?: VirtualScrollerProps | null; + virtualScrollerOptions?: VirtualScrollerProps; /** * Items of the frozen part in scrollable DataTable. */ @@ -830,19 +822,19 @@ export interface DataTableProps { /** * Inline style of the table element. */ - tableStyle?: any | null; + tableStyle?: any; /** * Style class of the table element. */ - tableClass?: any | null; + tableClass?: any; /** * Uses to pass all properties of the TableHTMLAttributes to table element inside the component. */ - tableProps?: TableHTMLAttributes | undefined | null; + tableProps?: TableHTMLAttributes | undefined; /** * Uses to pass all properties of the HTMLInputElement to the focusable filter input element inside the component. */ - filterInputProps?: InputHTMLAttributes | undefined | null; + filterInputProps?: InputHTMLAttributes | undefined; } /** * Defines valid slots in Datatable component. @@ -1067,12 +1059,12 @@ export interface DataTableEmits { * Callback to invoke when a row group is collapsed. * @param {DataTableRowCollapseEvent} event - Custom row collapse event. */ - rowgroupCollapse(event: DataTableRowCollapseEvent): void; + 'rowgroup-collapse'(event: DataTableRowCollapseEvent): void; /** * Callback to invoke when cell edit is initiated. * @param {DataTableCellEditInitEvent} event - Custom cell edit init. */ - cellEditInit(event: DataTableCellEditInitEvent): void; + 'cell-edit-init'(event: DataTableCellEditInitEvent): void; /** * Callback to invoke when cell edit is completed. * @param {DataTableCellEditCompleteEvent} event - Custom cell edit complete event. @@ -1087,7 +1079,7 @@ export interface DataTableEmits { * Callback to invoke when row edit is initiated. * @param {DataTableRowEditInitEvent} event - Custom row edit init event. */ - rowEditInit(event: DataTableRowEditInitEvent): void; + 'row-edit-init'(event: DataTableRowEditInitEvent): void; /** * Callback to invoke when row edit is saved. * @param {DataTableRowEditSaveEvent} event - Custom row edit save event. @@ -1136,23 +1128,4 @@ declare module '@vue/runtime-core' { } } -/** - * - * DataTable displays data in tabular format. - * - * Helper Components: - * - * - Column - * - ColumnGroup - * - Row - * - * Demos: - * - * - [DataTable](https://www.primefaces.org/primevue/datatable) - * - [Edit](https://www.primefaces.org/primevue/datatable/edit) - * - [Sort](https://www.primefaces.org/primevue/datatable/sort) - * - [Filter](https://www.primefaces.org/primevue/datatable/filter) - * etc. - * - */ export default DataTable; diff --git a/doc/common/apidoc/index.json b/doc/common/apidoc/index.json index d12bbca22..8556bd044 100644 --- a/doc/common/apidoc/index.json +++ b/doc/common/apidoc/index.json @@ -6833,7 +6833,7 @@ "name": "multiSortMeta", "optional": false, "readonly": false, - "type": "undefined | null | DataTableSortMeta[]", + "type": "undefined | DataTableSortMeta[]", "description": "MultiSort metadata" }, { @@ -6885,7 +6885,7 @@ "values": { "DataTableCellEditCancelEvent": { "description": "Custom cell edit cancel event.", - "relatedProp": "cellEditInit", + "relatedProp": "cell-edit-init", "props": [ { "name": "data", @@ -6968,7 +6968,7 @@ "description": "Callback to invoke when cell edit is completed." }, { - "name": "cellEditInit", + "name": "cell-edit-init", "parameters": [ { "name": "event", @@ -7096,6 +7096,19 @@ "returnType": "void", "description": "Callback to invoke when row edit is cancelled." }, + { + "name": "row-edit-init", + "parameters": [ + { + "name": "event", + "optional": false, + "type": "DataTableRowEditInitEvent", + "description": "Custom row edit init event." + } + ], + "returnType": "void", + "description": "Callback to invoke when row edit is initiated." + }, { "name": "row-edit-save", "parameters": [ @@ -7188,17 +7201,17 @@ "description": "Fired when header checkbox is unchecked." }, { - "name": "rowEditInit", + "name": "rowgroup-collapse", "parameters": [ { "name": "event", "optional": false, - "type": "DataTableRowEditInitEvent", - "description": "Custom row edit init event." + "type": "DataTableRowCollapseEvent", + "description": "Custom row collapse event." } ], "returnType": "void", - "description": "Callback to invoke when row edit is initiated." + "description": "Callback to invoke when a row group is collapsed." }, { "name": "rowgroup-expand", @@ -7213,19 +7226,6 @@ "returnType": "void", "description": "Callback to invoke when a row group is expanded." }, - { - "name": "rowgroupCollapse", - "parameters": [ - { - "name": "event", - "optional": false, - "type": "DataTableRowCollapseEvent", - "description": "Custom row collapse event." - } - ], - "returnType": "void", - "description": "Callback to invoke when a row group is collapsed." - }, { "name": "select-all-change", "parameters": [ @@ -7527,7 +7527,7 @@ "name": "multiSortMeta", "optional": false, "readonly": false, - "type": "undefined | null | DataTableSortMeta[]", + "type": "undefined | DataTableSortMeta[]", "default": "", "description": "MultiSort metadata" }, @@ -7551,7 +7551,7 @@ "name": "sortField", "optional": false, "readonly": false, - "type": "undefined | null | string | Function", + "type": "undefined | string | Function", "default": "", "description": "Field to sort against" }, @@ -7658,7 +7658,7 @@ "name": "multiSortMeta", "optional": false, "readonly": false, - "type": "undefined | null | DataTableSortMeta[]", + "type": "undefined | DataTableSortMeta[]", "default": "", "description": "MultiSort metadata" }, @@ -7698,7 +7698,7 @@ "name": "sortField", "optional": false, "readonly": false, - "type": "undefined | null | string | Function", + "type": "undefined | string | Function", "default": "", "description": "Field to sort against" }, @@ -7748,7 +7748,7 @@ "readonly": false, "type": "\"fit\" | \"expand\"", "default": "fit", - "description": "Defines whether the overall table width should change on column resize, valid values are 'fit' and 'expand'." + "description": "Defines whether the overall table width." }, { "name": "compareSelectionBy", @@ -7756,7 +7756,7 @@ "readonly": false, "type": "\"equals\" | \"deepEquals\"", "default": "deepEquals", - "description": "Algorithm to define if a row is selected, valid values are 'equals' that compares by reference and 'deepEquals' that compares all fields." + "description": "Algorithm to define if a row is selected." }, { "name": "contextMenu", @@ -7788,14 +7788,14 @@ "readonly": false, "type": "string", "default": "'({currentPage} of {totalPages})'", - "description": "Template of the current page report element. It displays information about the pagination state. Default value is ({currentPage} of {totalPages}) whereas available placeholders are the following;\n\n- {currentPage}\n- {totalPages}\n- {rows}\n- {first}\n- {last}\n- {totalRecords}" + "description": "Template of the current page report element. It displays information about the pagination state. Available placeholders are the following;\n\n- {currentPage}\n- {totalPages}\n- {rows}\n- {first}\n- {last}\n- {totalRecords}" }, { "name": "dataKey", "optional": true, "readonly": false, - "type": "null | string | Function", - "default": "null", + "type": "string | Function", + "default": "", "description": "Name of the field that uniquely identifies the a record in the data." }, { @@ -7810,15 +7810,15 @@ "name": "editMode", "optional": true, "readonly": false, - "type": "null | \"cell\" | \"row\"", - "default": "null", + "type": "\"cell\" | \"row\"", + "default": "", "description": "Defines the incell editing mode, valid options are 'cell' and 'row'." }, { "name": "editingRows", "optional": true, "readonly": false, - "type": "null | any[] | DataTableEditingRows", + "type": "any[] | DataTableEditingRows", "default": "", "description": "A collection of rows to represent the current editing data in row edit mode." }, @@ -7866,15 +7866,15 @@ "name": "filterDisplay", "optional": true, "readonly": false, - "type": "null | \"menu\" | \"row\"", - "default": "null", - "description": "Layout of the filter elements, valid values are 'row' and 'menu'." + "type": "\"menu\" | \"row\"", + "default": "", + "description": "Layout of the filter elements." }, { "name": "filterInputProps", "optional": true, "readonly": false, - "type": "null | InputHTMLAttributes", + "type": "InputHTMLAttributes", "default": "", "description": "Uses to pass all properties of the HTMLInputElement to the focusable filter input element inside the component." }, @@ -7890,7 +7890,7 @@ "name": "filters", "optional": true, "readonly": false, - "type": "null | DataTableFilterMeta", + "type": "DataTableFilterMeta", "default": "", "description": "Filters object with key-value pairs to define the filters." }, @@ -7962,9 +7962,9 @@ "name": "multiSortMeta", "optional": true, "readonly": false, - "type": "null | DataTableSortMeta[]", + "type": "DataTableSortMeta[]", "default": "", - "description": "An array of SortMeta objects to sort the data by default in multiple sort mode." + "description": "An array of SortMeta objects to sort the data." }, { "name": "pageLinkSize", @@ -8033,9 +8033,9 @@ "name": "rowGroupMode", "optional": true, "readonly": false, - "type": "null | \"rowspan\" | \"subheader\"", - "default": "null", - "description": "Defines the row group mode, valid options are 'subheader' and 'rowspan'." + "type": "\"rowspan\" | \"subheader\"", + "default": "", + "description": "Defines the row group mode." }, { "name": "rowHover", @@ -8065,7 +8065,7 @@ "name": "rowsPerPageOptions", "optional": true, "readonly": false, - "type": "null | number[]", + "type": "number[]", "default": "", "description": "Array of integer values to display inside rows per page dropdown." }, @@ -8073,8 +8073,8 @@ "name": "scrollHeight", "optional": true, "readonly": false, - "type": "null | string", - "default": "null", + "type": "string", + "default": "", "description": "Height of the scroll viewport in fixed pixels or the 'flex' keyword for a dynamic size." }, { @@ -8106,8 +8106,8 @@ "optional": true, "readonly": false, "type": "\"multiple\" | \"single\"", - "default": "null", - "description": "Specifies the selection mode, valid values are 'single' and 'multiple'." + "default": "", + "description": "Specifies the selection mode." }, { "name": "showGridlines", @@ -8121,8 +8121,8 @@ "name": "sortField", "optional": true, "readonly": false, - "type": "null | string | Function", - "default": "null", + "type": "string | Function", + "default": "", "description": "Property name or a getter function of a row data used for sorting by default" }, { @@ -8145,7 +8145,7 @@ "name": "stateKey", "optional": true, "readonly": false, - "type": "null | string", + "type": "string", "default": "", "description": "Unique identifier of a stateful table to use in state storage." }, @@ -8155,7 +8155,7 @@ "readonly": false, "type": "\"local\" | \"session\"", "default": "session", - "description": "Defines where a stateful table keeps its state, valid values are 'session' for sessionStorage and 'local' for localStorage." + "description": "Defines where a stateful table keeps its state." }, { "name": "stripedRows", @@ -8177,7 +8177,7 @@ "name": "tableProps", "optional": true, "readonly": false, - "type": "null | TableHTMLAttributes", + "type": "TableHTMLAttributes", "default": "", "description": "Uses to pass all properties of the TableHTMLAttributes to table element inside the component." }, @@ -8209,7 +8209,7 @@ "name": "virtualScrollerOptions", "optional": true, "readonly": false, - "type": "null | VirtualScrollerProps", + "type": "VirtualScrollerProps", "default": "", "description": "Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it.\nNote: Currently only vertical orientation mode is supported." } @@ -8231,7 +8231,7 @@ }, "DataTableRowCollapseEvent": { "description": "Custom row collapse event.", - "relatedProp": "rowgroupCollapse", + "relatedProp": "rowgroup-collapse", "props": [ { "name": "data", @@ -8319,7 +8319,7 @@ }, "DataTableRowEditCancelEvent": { "description": "Custom row edit cancel event.", - "relatedProp": "rowEditInit", + "relatedProp": "row-edit-init", "props": [ { "name": "data", @@ -8367,7 +8367,7 @@ }, "DataTableRowEditSaveEvent": { "description": "Custom row edit init event.", - "relatedProp": "rowEditInit", + "relatedProp": "row-edit-init", "props": [ { "name": "data", @@ -8566,7 +8566,7 @@ "name": "multiSortMeta", "optional": false, "readonly": false, - "type": "undefined | null | DataTableSortMeta[]", + "type": "undefined | DataTableSortMeta[]", "default": "", "description": "MultiSort metadata" }, @@ -8590,7 +8590,7 @@ "name": "sortField", "optional": false, "readonly": false, - "type": "undefined | null | string | Function", + "type": "undefined | string | Function", "default": "", "description": "Field to sort against" },