UNPKG

devexpress-reporting-react

Version:

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

38 lines (37 loc) 1.74 kB
import React from 'react'; import CollectionEditor from '../../../../analytics/Properties/CollectionEditor'; import Template from '../../../../core/Template'; import { getLocalization } from '@devexpress/analytics-core/property-grid/localization/_localization'; import { useEditorOptions } from '../../../../analytics/Properties/Editors/editorHooks'; const properties = ({ data }) => React.createElement(Template, { data: data.getProperties({ engineType: 'native' }), template: "dx-propertieseditor" }); const MultiValueEditable = ({ data }) => { const getEditorOptions = () => { const editor = data.getModel(); const getOptionsInfoProperty = (propertyName) => !propertyName ? data.info : data.info && data.info[propertyName]; const addHandler = () => (getOptionsInfoProperty('addHandler')).call({ data }); return { data: { values: [...editor.value], addHandler: () => { return addHandler(); }, onValueChanged: (array) => { editor._set('value', [...array]); }, info: data.info, level: data.level, displayName: getLocalization(data.displayName) }, contentTemplate: properties }; }; const args = { getEditorOptions }; const options = useEditorOptions(React.useRef(), data, args); if (!data.value) return undefined; return (React.createElement("div", { className: "dxrd-editor", hidden: !data.visible }, React.createElement(CollectionEditor, { data: options.data, contentTemplate: options.contentTemplate }))); }; export default MultiValueEditable;