Dan 1e75ff7b53 Standardize all Event Names, and document in README.
Fix the SpiffExtensions so they work consistently with both nested Extension Properties, and as single extensions depending on the namespace.
Add a Spiff Extension Text Area.
Everything that is within the body of tag can be referenced with ".value" -- there was a lot of pointless inconsistency in the moddle json file.
2022-11-01 20:24:28 -04:00

48 lines
1.4 KiB
JavaScript

import {useService } from 'bpmn-js-properties-panel';
import { TextFieldEntry } from '@bpmn-io/properties-panel';
import {
getExtensionValue, setExtensionValue
} from '../extensionHelpers';
/**
* A generic properties' editor for text input.
* Allows you to provide additional SpiffWorkflow extension properties. Just
* uses whatever name is provide on the property, and adds or updates it as
* needed.
*
<bpmn:extensionElements>
<spiffworkflow:properties>
<spiffworkflow:property name="formJsonSchemaFilename" value="json_schema.json" />
<spiffworkflow:property name="formUiSchemaFilename" value="ui_schema.json" />
</spiffworkflow:properties>
</bpmn:extensionElements>
*
* @returns {string|null|*}
*/
export function SpiffExtensionTextInput(props) {
const element = props.element;
const commandStack = props.commandStack, moddle = props.moddle;
const name = props.name, label = props.label, description = props.description;
const debounce = useService('debounceInput');
const getValue = () => {
return getExtensionValue(element, name)
}
const setValue = value => {
setExtensionValue(element, name, value, moddle, commandStack)
};
return <TextFieldEntry
id={'extension_' + name}
element={element}
description={description}
label={label}
getValue={getValue}
setValue={setValue}
debounce={debounce}
/>;
}