UNPKG

devexpress-reporting

Version:

DevExpress Reporting provides the capability to develop a reporting application to create and customize reports.

55 lines (54 loc) 2.85 kB
/** * DevExpress HTML/JS Reporting (designer\wizard\pages\fullscreen\ai\aiSelectDataSourceOptionPage.js) * Version: 26.1.3 * Build date: Jun 16, 2026 * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * License: https://www.devexpress.com/Support/EULAs/universal.xml */ import { findFirstItemMatchesCondition } from '@devexpress/analytics-core/analytics-internal'; import { getLocalization } from '@devexpress/analytics-core/analytics-utils'; import { createDeferred } from '@devexpress/analytics-core/analytics-internal-native'; import { ReportType } from '../../../reportWizardState'; import { SelectReportTypePage } from '../../chooseReportTypePage'; import { FullscreenReportWizardPageId } from '../../../pageId'; const predefinedAIReportTemplates = [ { text: 'No Data Source', imageClassName: 'emptyReport', imageTemplateName: 'dxrd-svg-wizard-AIEmptyReport', id: 'Empty', localizationID: 'ASPxReportsStringId.ReportDesigner_Wizard_AI_SelectDataSourceOption_NoDataSource' }, { text: 'Add Data Source', imageClassName: 'databoundReport', imageTemplateName: 'dxrd-svg-wizard-AIStandardReport', id: 'Standard', localizationID: 'ASPxReportsStringId.ReportDesigner_Wizard_AI_SelectDataSourceOption_AddDataSource' }, ]; export class AISelectDataSourceOptionPage extends SelectReportTypePage { canNext() { return true; } commit() { return createDeferred().resolve({ reportType: this.selectedItem().type }).promise(); } initialize(state) { const type = state.reportType || ReportType.Standard; const item = findFirstItemMatchesCondition(this.typeItems, (item) => item.type === type); this.selectedItem(item || this.typeItems[0]); return createDeferred().resolve().promise(); } } export function _registerAISelectDataSourceOptionPage(factory, options) { factory.registerMetadata(FullscreenReportWizardPageId.AISelectDataSourceOptionPage, { setState: (data, state) => { state.reportType = data.reportType; }, getState: (state) => { return state; }, resetState: (state, defaultState) => { state.reportType = defaultState.reportType; }, create: () => { const canCreateDatabound = 'function' === typeof (options.canCreateDatabound) ? options.canCreateDatabound() : options.canCreateDatabound; const pageOptions = { reportTemplates: predefinedAIReportTemplates, canCreateDatabound: canCreateDatabound, }; return new AISelectDataSourceOptionPage(pageOptions); }, template: 'dxrd-page-choose-report-type', navigationPanelText: getLocalization('Select a Data Source Option', 'ASPxReportsStringId.ReportDesigner_Wizard_AI_SelectDataSourceOption') }); }