Skip to content

Commit

Permalink
optimized component export
Browse files Browse the repository at this point in the history
Issue imixs#196
rsoika committed Mar 3, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 8ba21af commit b014ba9
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -14,7 +14,12 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import {
and, computeLabel, ControlProps, isDescriptionHidden, isEnumControl, optionIs, OwnPropsOfEnum, RankedTester, rankWith
and,
computeLabel,
ControlProps,
isDescriptionHidden,
isEnumControl, JsonFormsRendererRegistryEntry, optionIs,
OwnPropsOfEnum, rankWith
} from '@jsonforms/core';
import { withJsonFormsEnumProps } from '@jsonforms/react';
import { VanillaRendererProps, withVanillaControlProps } from '@jsonforms/vanilla-renderers';
@@ -196,8 +201,10 @@ export const SelectItemGroupControl = (props: ControlProps & VanillaRendererProp
return <SelectItemGroup {...props} />;
};

export const selectItemControlTester: RankedTester = rankWith(
3,
and(isEnumControl, optionIs('format', 'selectitem'))
);
export default withVanillaControlProps(withJsonFormsEnumProps(SelectItemGroupControl));
/**
* Export the Custom Renderer and Tester for SelectItemGroupControl
*/
export const SelectItemRendererEntry: JsonFormsRendererRegistryEntry = {
tester: rankWith(3, and(isEnumControl, optionIs('format', 'selectitem'))),
renderer: withVanillaControlProps(withJsonFormsEnumProps(SelectItemGroupControl))
};
Original file line number Diff line number Diff line change
@@ -38,7 +38,8 @@ import { vanillaCells, vanillaRenderers } from '@jsonforms/vanilla-renderers';
import { isBoundaryEvent } from '@open-bpmn/open-bpmn-model';
import * as React from 'react';
import { createRoot } from 'react-dom/client';
import SelectItemGroupControl, { selectItemControlTester } from './SelectItemControl';
// import SelectItemGroupControl, { selectItemControlTester } from './SelectItemControl';
import { SelectItemRendererEntry } from './SelectItemControl';
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
@injectable()
export class BPMNPropertyPanel extends AbstractUIExtension implements SelectionListener, IActionHandler { // IActionHandler EditModeListener
@@ -301,7 +302,7 @@ export class BPMNPropertyPanel extends AbstractUIExtension implements SelectionL
const bpmnRenderers = [
...vanillaRenderers,
// optional register custom renderers...
{ tester: selectItemControlTester, renderer: SelectItemGroupControl }
SelectItemRendererEntry
];

// render JSONForm // vanillaRenderers

0 comments on commit b014ba9

Please sign in to comment.