From 467ac78118de6862d6724f9d335c19a8ebf3bf25 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: Wed, 19 Jul 2023 15:01:49 +0300 Subject: [PATCH] Fixed #4156 - DataTable & TreeTable: new size property --- api-generator/components/datatable.js | 6 ++++++ api-generator/components/treetable.js | 6 ++++++ components/lib/datatable/BaseDataTable.vue | 8 +++++++- components/lib/treetable/BaseTreeTable.vue | 8 +++++++- components/lib/treetable/TreeTable.d.ts | 4 ++++ 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/api-generator/components/datatable.js b/api-generator/components/datatable.js index d3105dbcf..793af88f7 100644 --- a/api-generator/components/datatable.js +++ b/api-generator/components/datatable.js @@ -366,6 +366,12 @@ const DataTableProps = [ default: 'false', description: 'Whether to displays rows with alternating colors.' }, + { + name: 'size', + type: 'string', + default: 'null', + description: 'Defines the size of the table.' + }, { name: 'tableStyle', type: 'object', diff --git a/api-generator/components/treetable.js b/api-generator/components/treetable.js index 189b00d37..9467d9148 100644 --- a/api-generator/components/treetable.js +++ b/api-generator/components/treetable.js @@ -222,6 +222,12 @@ const TreeTableProps = [ default: 'null', description: 'Defines the responsive mode, currently only option is scroll.' }, + { + name: 'size', + type: 'string', + default: 'null', + description: 'Defines the size of the table.' + }, { name: 'pt', type: 'any', diff --git a/components/lib/datatable/BaseDataTable.vue b/components/lib/datatable/BaseDataTable.vue index 1982300d2..d37b0ac5c 100644 --- a/components/lib/datatable/BaseDataTable.vue +++ b/components/lib/datatable/BaseDataTable.vue @@ -259,7 +259,9 @@ const classes = { 'p-datatable-striped': props.stripedRows, 'p-datatable-gridlines': props.showGridlines, 'p-datatable-grouped-header': instance.headerColumnGroup != null, - 'p-datatable-grouped-footer': instance.footerColumnGroup != null + 'p-datatable-grouped-footer': instance.footerColumnGroup != null, + 'p-datatable-sm': props.size === 'small', + 'p-datatable-lg': props.size === 'large' } ], loadingOverlay: 'p-datatable-loading-overlay p-component-overlay', @@ -709,6 +711,10 @@ export default { type: Boolean, default: false }, + size: { + type: String, + default: null + }, tableStyle: { type: null, default: null diff --git a/components/lib/treetable/BaseTreeTable.vue b/components/lib/treetable/BaseTreeTable.vue index 4758d93ff..edb34e3ad 100644 --- a/components/lib/treetable/BaseTreeTable.vue +++ b/components/lib/treetable/BaseTreeTable.vue @@ -187,7 +187,9 @@ const classes = { 'p-treetable-scrollable-horizontal': props.scrollable && props.scrollDirection === 'horizontal', 'p-treetable-scrollable-both': props.scrollable && props.scrollDirection === 'both', 'p-treetable-flex-scrollable': props.scrollable && props.scrollHeight === 'flex', - 'p-treetable-responsive-scroll': props.responsiveLayout === 'scroll' + 'p-treetable-responsive-scroll': props.responsiveLayout === 'scroll', + 'p-treetable-sm': props.size === 'small', + 'p-treetable-lg': props.size === 'large' } ], loadingWrapper: 'p-treetable-loading', @@ -416,6 +418,10 @@ export default { type: String, default: null }, + size: { + type: String, + default: null + }, tableProps: { type: Object, default: null diff --git a/components/lib/treetable/TreeTable.d.ts b/components/lib/treetable/TreeTable.d.ts index cfe9c8ed0..33d451a13 100755 --- a/components/lib/treetable/TreeTable.d.ts +++ b/components/lib/treetable/TreeTable.d.ts @@ -547,6 +547,10 @@ export interface TreeTableProps { * @defaultValue stack */ responsiveLayout?: 'stack' | 'scroll' | undefined; + /** + * Defines the size of the table. + */ + size?: 'small' | 'large' | undefined; /** * Props to pass to the table element. */