devexpress-reporting
Version:
DevExpress Reporting provides the capability to develop a reporting application to create and customize reports.
49 lines (48 loc) • 2.13 kB
JavaScript
/**
* DevExpress HTML/JS Reporting (viewer\widgets\pictureEditor\_ko_bindings.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 { $dx, addDisposeCallback } from '@devexpress/analytics-core/analytics-internal-native';
import { getTemplate } from '@devexpress/analytics-core/analytics-utils-native';
import { Painter } from './_painter';
import * as ko from 'knockout';
import { PictureEditorModel } from './_pictureEditorModel';
ko.bindingHandlers['dxPainter'] = {
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
const options = valueAccessor();
$dx(element).empty();
const templateHtml = getTemplate('dx-painter');
const $element = $dx(element).append(templateHtml);
const child = $element[0].children[0];
const model = new Painter(child, options);
options.setPainter(model);
addDisposeCallback(element, function () {
model.dispose();
options.setPainter(null);
});
ko.applyBindings(model.getViewModel(), child);
return { controlsDescendantBindings: true };
}
};
ko.bindingHandlers['dxPictureEditor'] = {
init: function (element, valueAccessor) {
const viewModel = valueAccessor();
$dx(element).empty();
const templateHtml = getTemplate('dx-picture-editing');
const $element = $dx(element).append(templateHtml);
const child = $element[0].children[0];
const model = viewModel.getModel();
const pictureEditorModel = new PictureEditorModel(model, child);
model._setPictureEditor && model._setPictureEditor(pictureEditorModel);
ko.cleanNode(child);
ko.applyBindings(pictureEditorModel.getViewModel(), child);
addDisposeCallback(element, function () {
pictureEditorModel.dispose();
model._setPictureEditor && model._setPictureEditor(null);
});
return { controlsDescendantBindings: true };
}
};