devexpress-reporting
Version:
DevExpress Reporting provides the capability to develop a reporting application to create and customize reports.
58 lines (57 loc) • 2.78 kB
JavaScript
/**
* DevExpress HTML/JS Reporting (designer\wizard\pages\legacy\chooseReportStylePage.js)
* Version: 24.2.6
* Build date: Mar 18, 2025
* Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
* License: https://www.devexpress.com/Support/EULAs/universal.xml
*/
import { getFirstItemByPropertyValue } from '@devexpress/analytics-core/analytics-internal';
import { getLocalization } from '@devexpress/analytics-core/analytics-utils';
import { WizardPageBase } from '@devexpress/analytics-core/analytics-wizard';
import * as ko from 'knockout';
import { ReportStyle, ReportStyleItem } from '../../internal/reportStylePageUtils';
import { LegacyReportWizardPageId } from '../../pageId';
import { createDeferred } from '@devexpress/analytics-core/analytics-internal-native';
export class LegacyChooseReportStylePage extends WizardPageBase {
constructor() {
super(...arguments);
this.reportStyleItems = [
new ReportStyleItem('Bold', 'ASPxReportsStringId.ReportDesigner_Wizard_ReportStyle_Bold', ReportStyle.Bold),
new ReportStyleItem('Casual', 'ASPxReportsStringId.ReportDesigner_Wizard_ReportStyle_Casual', ReportStyle.Casual),
new ReportStyleItem('Corporate', 'ASPxReportsStringId.ReportDesigner_Wizard_ReportStyle_Corporate', ReportStyle.Corporate),
new ReportStyleItem('Compact', 'ASPxReportsStringId.ReportDesigner_Wizard_ReportStyle_Compact', ReportStyle.Compact),
new ReportStyleItem('Formal', 'ASPxReportsStringId.ReportDesigner_Wizard_ReportStyle_Formal', ReportStyle.Formal)
];
this.selectedReportStyle = ko.observable(this.reportStyleItems[0]);
}
canFinish() {
return true;
}
initialize(state) {
this.selectedReportStyle(getFirstItemByPropertyValue(this.reportStyleItems, 'reportStyle', state.style || ReportStyle.Bold));
return createDeferred().resolve().promise();
}
commit() {
return createDeferred().resolve({
style: this.selectedReportStyle().reportStyle
}).promise();
}
}
export function _registerLegacyChooseReportStylePage(factory) {
factory.registerMetadata(LegacyReportWizardPageId.ChooseReportStylePage, {
setState: (data, state) => {
state.style = data.style;
},
getState: (state) => {
return state;
},
resetState: (state, defaultState) => {
state.style = defaultState.style;
},
create: () => {
return new LegacyChooseReportStylePage();
},
template: 'dxrd-page-reportStyle',
description: getLocalization('The report style specifies the appearance of your report.', 'ASPxReportsStringId.ReportDesigner_Wizard_ReportStyle')
});
}