devexpress-reporting
Version:
DevExpress Reporting provides the capability to develop a reporting application to create and customize reports.
58 lines (57 loc) • 2.67 kB
JavaScript
/**
* DevExpress HTML/JS Reporting (rich-edit\surface.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 { DxDeferred } from '@devexpress/analytics-core/analytics-internal-native';
import * as ko from 'knockout';
import { XRControlSurface } from '../designer/controls/xrControl';
import { base64UTF16LEtobase64UTF8 } from '../designer/utils/utils';
import { XRRichController } from './utils/_controller';
export class XRRichModernSurface extends XRControlSurface {
constructor(control, context) {
super(control, context);
this._richEditVisible = ko.observable(false);
this.isValid = ko.observable(true);
this.serializedRtf = ko.observable('');
this.dragDropFileEnabled = ko.observable(true);
this.template = 'dxrd-richedit';
this.contenttemplate = 'dxrd-richedit-content';
this.selectiontemplate = 'dxrd-richedit-selection';
this._convertReady = new DxDeferred();
base64UTF16LEtobase64UTF8(control.serializableRtfString(), (val) => {
this.serializedRtf(val);
this._convertReady.resolve(true);
});
this._disposables.push(this.serializedRtf.subscribe((newValue) => {
control.serializableRtfString(newValue);
}));
this.defaultStyleunit = ko.computed(() => ({
top: this.contentSizes().top + (this.isIntersect() ? 1 : 0),
left: this.contentSizes().left + (this.isIntersect() ? 1 : 0),
lineHeight: this.contentSizes().height,
height: this.contentSizes().height,
width: this.contentSizes().width
})).extend({ deferred: true });
this._disposables.push(this.defaultStyleunit);
this.hasContentBinding = ko.pureComputed(() => {
const params = this.displayNameParameters();
return !!(params.isExpression || params.dataMember);
});
this._disposables.push(this.hasContentBinding);
this.showRichEditWidget = ko.pureComputed(() => {
return this._richEditVisible() || !this.hasContentBinding();
});
this._disposables.push(this.showRichEditWidget);
}
createController(richEdit) {
this._convertReady.done(() => {
this.controller = new XRRichController(richEdit, this);
this._disposables.push(this.controller);
this._richEditVisible(richEdit.visible());
this._disposables.push(richEdit.visible.subscribe((val) => this._richEditVisible(val)));
});
}
}