devexpress-reporting
Version:
DevExpress Reporting provides the capability to develop a reporting application to create and customize reports.
43 lines (42 loc) • 1.72 kB
JavaScript
/**
* DevExpress HTML/JS Reporting (designer\controls\xrBarcode.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 * as ko from 'knockout';
import { barCodesMap, defaultCodeSerializationInfo } from './metadata/xrBarcode';
import { BarCodeSymbology } from './properties/symbology';
import { XRControlViewModel } from './xrControl';
import { XRReportElementViewModel } from './xrReportelement';
export class XRBarCodeViewModel extends XRControlViewModel {
createBarcode(model, serializer = null) {
const name = model['@Name'] || 'Code1';
model['@Name'] = name;
const barcodeInfo = barCodesMap[name] || [defaultCodeSerializationInfo];
return new BarCodeSymbology(model, serializer, barcodeInfo, this);
}
constructor(model, parent, serializer) {
super(model, parent, serializer);
this.symbology(this.createBarcode(this.symbology() || {}, serializer));
this.barcodeFake = {
type: ko.pureComputed({
read: () => {
return this.symbology()['name']();
},
write: (val) => {
this.symbology()?.dispose();
this.symbology(this.createBarcode({ '@Name': val }, serializer));
}
}),
content: this.symbology
};
this._disposables.push(this.barcodeFake.type);
}
dispose() {
super.dispose();
this.symbology()?.dispose();
}
}
XRBarCodeViewModel.unitProperties = [].concat(['module'], XRReportElementViewModel.unitProperties);