devexpress-reporting
Version:
DevExpress Reporting provides the capability to develop a reporting application to create and customize reports.
43 lines (42 loc) • 1.93 kB
JavaScript
/**
* DevExpress HTML/JS Reporting (designer\actions\pdfContentActions.js)
* Version: 25.1.3
* Build date: Jun 26, 2025
* Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
* License: https://www.devexpress.com/Support/EULAs/universal.xml
*/
import { BaseActionsProvider } from '@devexpress/analytics-core/analytics-internal';
import { getLocalization } from '@devexpress/analytics-core/analytics-utils';
import * as ko from 'knockout';
import { XRPdfContentViewModel } from '../controls/xrPdfContent';
export class PdfContentActions extends BaseActionsProvider {
get _focusedPdfContent() {
const focusedModel = this._selection.focused().getControlModel();
if (focusedModel instanceof XRPdfContentViewModel)
return focusedModel;
return null;
}
constructor(_selection, isDisabled = () => false) {
super();
this._selection = _selection;
const actionDisabled = ko.pureComputed(() => isDisabled() || this._focusedPdfContent && (this._focusedPdfContent.generateOwnPages() || !this._focusedPdfContent.canFit()
|| !this._focusedPdfContent.backgroundImage()));
super.initActions([
{
text: 'Fit Size to Content',
group: () => getLocalization('Pdf Content', 'ReportStringId.RibbonXRDesign_PageGroup_PdfContent'),
displayText: () => getLocalization('Fit Size to Content', 'ReportStringId.Verb_FitControlSize'),
imageClassName: 'dxrd-image-actions-fit_to_container',
imageTemplateName: 'dxrd-svg-actions-fit_to_container',
disabled: actionDisabled,
clickAction: (model) => {
model.fitToContent();
}
}
]);
this._disposables.push(actionDisabled);
}
condition(context) {
return context instanceof XRPdfContentViewModel;
}
}