devexpress-reporting
Version:
DevExpress Reporting provides the capability to develop a reporting application to create and customize reports.
45 lines (44 loc) • 2.1 kB
JavaScript
/**
* DevExpress HTML/JS Reporting (designer\controls\properties\components.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 { Disposable } from '@devexpress/analytics-core/analytics-utils';
import * as ko from 'knockout';
import { name, collectionDataSourceCriteria } from '../metadata/properties/metadata';
import { FilterStringOptions } from '@devexpress/analytics-core/analytics-widgets';
import { collectAvailableParameters } from '../../dataObjects/metadata/_parameterUtils';
export class ComponentsModel extends Disposable {
getInfo() {
return [name, collectionDataSourceCriteria];
}
constructor(model, renameComponentStrategy, parameters) {
super();
this.renameComponentStrategy = renameComponentStrategy;
this.className = () => {
return 'component';
};
this.controlType = 'XRComponent';
const _name = ko.observable(model.name);
if (model.isFilterableDataSource) {
const _criteriaString = ko.observable(model.data.criteriaString);
const dsHelper = model.data.dsHelperProvider();
const dsPath = dsHelper?.getDataSourcePath(model.data);
this.criteriaString = new FilterStringOptions(_criteriaString(), ko.observable(dsPath));
this._disposables.push(this.criteriaString.helper.parameters = ko.pureComputed(() => parameters && collectAvailableParameters(parameters()) || []));
}
this.data = model.data;
this._disposables.push(this.name = ko.pureComputed({
read: () => { return _name(); },
write: (value) => {
if (value !== _name() && renameComponentStrategy.validateName(value) && renameComponentStrategy.validateUnique(value, _name())) {
if (renameComponentStrategy.tryRename(value, this.data)) {
_name(value);
}
}
}
}));
}
}