UNPKG

devexpress-reporting

Version:

DevExpress Reporting provides the capability to develop a reporting application to create and customize reports.

58 lines (57 loc) 2.54 kB
/** * DevExpress HTML/JS Reporting (designer\widgets\editOptionsEditor.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 { DxDeferred } from '@devexpress/analytics-core/analytics-internal-native'; import { Editor } from '@devexpress/analytics-core/analytics-widgets'; import * as ko from 'knockout'; import { EditingFieldExtensions } from '../../common/utils/editingFieldExtensions'; export class EditOptionsEditorNameEditorModel extends Editor { constructor(modelPropertyInfo, level, parentDisabled, textToSearch) { super(modelPropertyInfo, level, parentDisabled, textToSearch); this.displayValue = ko.observable(''); const extesions = EditingFieldExtensions.instance(); const editorOptions = modelPropertyInfo.editorOptions; let categoriesToFilter = []; if (editorOptions) { categoriesToFilter = editorOptions.categories || extesions.categories(editorOptions.excludeCategories); } this.itemsProvider = { getItems: (path) => { const editorSet = extesions.editors(); const filteredEditorSet = !categoriesToFilter ? editorSet : editorSet.filter(e => categoriesToFilter.indexOf(e.category) !== -1); const editorMembers = filteredEditorSet.map(item => { const mask = item.options && item.options['mask']; return { name: item.name, displayName: item.displayName, specifics: '_none_', templateName: 'dxrd-editingField-editor-treelist-item', title: item.displayName + (mask ? ' [' + mask + ']' : '') }; }); return new DxDeferred().resolve(editorMembers).promise(); } }; const editor = extesions.editor(this.value()); if (editor) { this.value(editor.name); this.displayValue(editor.displayName); } this.value.subscribe(newValue => { const editor = extesions.editor(newValue); if (editor) { this.value(editor.name); this.displayValue(editor.displayName); return; } this.displayValue(''); this.value(''); }); } }