From 2cec6f84d84c7586066bcee8e0dbb8da7628e97e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marker=20dao=20=C2=AE?= Date: Fri, 8 Sep 2023 13:35:02 +0400 Subject: [PATCH] TabPanel: Add stylingMode option --- .../src/ui/nested/base/tab-panel-options.ts | 7 +++++++ .../src/ui/nested/tab-panel-options.ts | 1 + .../src/ui/tab-panel/index.ts | 21 +++++++++++++++++++ packages/devextreme-react/src/form.ts | 1 + packages/devextreme-react/src/tab-panel.ts | 6 ++++++ packages/devextreme-vue/src/form.ts | 2 ++ packages/devextreme-vue/src/tab-panel.ts | 3 +++ packages/devextreme/js/ui/tab_panel.d.ts | 8 +++++++ packages/devextreme/js/ui/tab_panel.js | 15 +++++++++++++ .../devextreme/js/ui/tab_panel_types.d.ts | 1 + .../DevExpress.ui.widgets/tabPanel.tests.js | 8 +++++++ packages/devextreme/ts/dx.all.d.ts | 4 ++++ 12 files changed, 77 insertions(+) diff --git a/packages/devextreme-angular/src/ui/nested/base/tab-panel-options.ts b/packages/devextreme-angular/src/ui/nested/base/tab-panel-options.ts index f1a49b12a36a..6af6e795b1d4 100644 --- a/packages/devextreme-angular/src/ui/nested/base/tab-panel-options.ts +++ b/packages/devextreme-angular/src/ui/nested/base/tab-panel-options.ts @@ -273,6 +273,13 @@ export abstract class DxoTabPanelOptions extends NestedOption { this._setOption('showNavButtons', value); } + get stylingMode(): string { + return this._getOption('stylingMode'); + } + set stylingMode(value: string) { + this._setOption('stylingMode', value); + } + get swipeEnabled(): boolean { return this._getOption('swipeEnabled'); } diff --git a/packages/devextreme-angular/src/ui/nested/tab-panel-options.ts b/packages/devextreme-angular/src/ui/nested/tab-panel-options.ts index b169b73230d9..ad901b19326e 100644 --- a/packages/devextreme-angular/src/ui/nested/tab-panel-options.ts +++ b/packages/devextreme-angular/src/ui/nested/tab-panel-options.ts @@ -70,6 +70,7 @@ import { DxiItemComponent } from './item-dxi'; 'selectedIndex', 'selectedItem', 'showNavButtons', + 'stylingMode', 'swipeEnabled', 'tabIndex', 'tabsPosition', diff --git a/packages/devextreme-angular/src/ui/tab-panel/index.ts b/packages/devextreme-angular/src/ui/tab-panel/index.ts index 959ae8217502..49293b932fe0 100644 --- a/packages/devextreme-angular/src/ui/tab-panel/index.ts +++ b/packages/devextreme-angular/src/ui/tab-panel/index.ts @@ -390,6 +390,19 @@ export class DxTabPanelComponent extends DxComponent implements OnDestroy, OnCha } + /** + * [descr:dxTabPanelOptions.stylingMode] + + */ + @Input() + get stylingMode(): string { + return this._getOption('stylingMode'); + } + set stylingMode(value: string) { + this._setOption('stylingMode', value); + } + + /** * [descr:dxTabPanelOptions.swipeEnabled] @@ -725,6 +738,13 @@ export class DxTabPanelComponent extends DxComponent implements OnDestroy, OnCha */ @Output() showNavButtonsChange: EventEmitter; + /** + + * This member supports the internal infrastructure and is not intended to be used directly from your code. + + */ + @Output() stylingModeChange: EventEmitter; + /** * This member supports the internal infrastructure and is not intended to be used directly from your code. @@ -821,6 +841,7 @@ export class DxTabPanelComponent extends DxComponent implements OnDestroy, OnCha { emit: 'selectedIndexChange' }, { emit: 'selectedItemChange' }, { emit: 'showNavButtonsChange' }, + { emit: 'stylingModeChange' }, { emit: 'swipeEnabledChange' }, { emit: 'tabIndexChange' }, { emit: 'tabsPositionChange' }, diff --git a/packages/devextreme-react/src/form.ts b/packages/devextreme-react/src/form.ts index 931818f4a9ef..f05bc1241255 100644 --- a/packages/devextreme-react/src/form.ts +++ b/packages/devextreme-react/src/form.ts @@ -707,6 +707,7 @@ type ITabPanelOptionsProps = React.PropsWithChildren<{ selectedIndex?: number; selectedItem?: any; showNavButtons?: boolean; + stylingMode?: "primary" | "secondary"; swipeEnabled?: boolean; tabIndex?: number; tabsPosition?: "bottom" | "left" | "right" | "top"; diff --git a/packages/devextreme-react/src/tab-panel.ts b/packages/devextreme-react/src/tab-panel.ts index 8a3e4e99e946..284496a1b325 100644 --- a/packages/devextreme-react/src/tab-panel.ts +++ b/packages/devextreme-react/src/tab-panel.ts @@ -123,6 +123,12 @@ class TabPanel extends BaseComponent of nested tabs widget successfully changed'); }); + QUnit.test('stylingMode option should be passed to tabs correctly', function(assert) { + assert.strictEqual(this.tabWidgetInstance.option('stylingMode'), 'primary', 'option successfully passed to nested tabs widget'); + + this.tabPanelInstance.option('stylingMode', 'secondary'); + + assert.strictEqual(this.tabWidgetInstance.option('stylingMode'), 'secondary', 'option of nested tabs widget successfully changed'); + }); + QUnit.test('dataSource option test', function(assert) { assert.expect(2); diff --git a/packages/devextreme/ts/dx.all.d.ts b/packages/devextreme/ts/dx.all.d.ts index 760ffe97af5a..85b908a87ad2 100644 --- a/packages/devextreme/ts/dx.all.d.ts +++ b/packages/devextreme/ts/dx.all.d.ts @@ -25574,6 +25574,10 @@ declare module DevExpress.ui { * [descr:dxTabPanelOptions.showNavButtons] */ showNavButtons?: boolean; + /** + * [descr:dxTabPanelOptions.stylingMode] + */ + stylingMode?: DevExpress.common.TabsStyle; /** * [descr:dxTabPanelOptions.swipeEnabled] */