Skip to content

Commit

Permalink
load React from jsx files explicitly w/ burnettk
Browse files Browse the repository at this point in the history
  • Loading branch information
jasquat committed Apr 11, 2024
1 parent fdaeacb commit 67640ca
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 94 deletions.
61 changes: 33 additions & 28 deletions app/spiffworkflow/DataObject/propertiesPanel/DataObjectSelect.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import { useService } from 'bpmn-js-properties-panel';
import { SelectEntry } from '@bpmn-io/properties-panel';
import { findDataObjects } from '../DataObjectHelpers';
Expand All @@ -24,59 +25,63 @@ export function DataObjectSelect(props) {
const commandStack = props.commandStack;
const debounce = useService('debounceInput');


const getValue = () => {
return element.businessObject.dataObjectRef.id
}
return element.businessObject.dataObjectRef.id;
};

const setValue = value => {
const setValue = (value) => {
const businessObject = element.businessObject;
const dataObjects = findDataObjects(businessObject.$parent)
const dataObjects = findDataObjects(businessObject.$parent);
for (const dataObject of dataObjects) {
if (dataObject.$type === 'bpmn:DataObject' && dataObject.id === value) {

commandStack.execute('element.updateModdleProperties', {
element: element,
moddleElement: businessObject,
properties: {
dataObjectRef: dataObject
}
dataObjectRef: dataObject,
},
});

// Construct the new name by : the dataObject name and the current state
const stateName = businessObject.dataState && businessObject.dataState.name ? businessObject.dataState.name : '';
const newName = stateName ? `${dataObject.name} [${stateName}]` : dataObject.name;
const stateName =
businessObject.dataState && businessObject.dataState.name
? businessObject.dataState.name
: '';
const newName = stateName
? `${dataObject.name} [${stateName}]`
: dataObject.name;
// Update the name property of the DataObjectReference
commandStack.execute('element.updateProperties', {
element: element,
properties: {
name: newName
}
name: newName,
},
});
}
}
}
};

const getOptions = value => {
const getOptions = (value) => {
const businessObject = element.businessObject;
const parent = businessObject.$parent;
let dataObjects = findDataObjects(parent);
let options = [];
dataObjects.forEach(dataObj => {
options.push({ label: dataObj.id, value: dataObj.id })
dataObjects.forEach((dataObj) => {
options.push({ label: dataObj.id, value: dataObj.id });
});
return options;
}

return <SelectEntry
id={'selectDataObject'}
element={element}
description={"Select the Data Object this represents."}
label={"Which Data Object does this reference?"}
getValue={getValue}
setValue={setValue}
getOptions={getOptions}
debounce={debounce}
/>;
};

return (
<SelectEntry
id={'selectDataObject'}
element={element}
description={'Select the Data Object this represents.'}
label={'Which Data Object does this reference?'}
getValue={getValue}
setValue={setValue}
getOptions={getOptions}
debounce={debounce}
/>
);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import {
ListGroup,
CheckboxEntry,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
import {useService } from 'bpmn-js-properties-panel';
import {CheckboxEntry} from '@bpmn-io/properties-panel';
import {
getExtensionValue, setExtensionValue
} from '../extensionHelpers';
import React from 'react';

import { CheckboxEntry } from '@bpmn-io/properties-panel';
import { useService } from 'bpmn-js-properties-panel';
import { getExtensionValue, setExtensionValue } from '../extensionHelpers';

/**
* A generic properties' editor for text area.
*/
export function SpiffExtensionCheckboxEntry(props) {
const element = props.element;
const commandStack = props.commandStack, moddle = props.moddle;
const name = props.name, label = props.label, description = props.description;
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.businessObject, name)
}

const setValue = value => {
setExtensionValue(element, name, value, moddle, commandStack)
return getExtensionValue(element.businessObject, name);
};

return <CheckboxEntry
id={'extension_' + name}
element={element}
description={description}
label={label}
getValue={getValue}
setValue={setValue}
debounce={debounce}
/>;
const setValue = (value) => {
setExtensionValue(element, name, value, moddle, commandStack);
};

return (
<CheckboxEntry
id={'extension_' + name}
element={element}
description={description}
label={label}
getValue={getValue}
setValue={setValue}
debounce={debounce}
/>
);
}

Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
import {useService } from 'bpmn-js-properties-panel';
import {TextAreaEntry, TextFieldEntry} from '@bpmn-io/properties-panel';
import {
getExtensionValue, setExtensionValue
} from '../extensionHelpers';

import React from 'react';
import { useService } from 'bpmn-js-properties-panel';
import { TextAreaEntry, TextFieldEntry } from '@bpmn-io/properties-panel';
import { getExtensionValue, setExtensionValue } from '../extensionHelpers';

/**
* A generic properties' editor for text area.
*/
export function SpiffExtensionTextArea(props) {
const element = props.element;
const commandStack = props.commandStack, moddle = props.moddle;
const name = props.name, label = props.label, description = props.description;
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.businessObject, name)
}

const setValue = value => {
setExtensionValue(element, name, value, moddle, commandStack)
return getExtensionValue(element.businessObject, name);
};

return <TextAreaEntry
id={'extension_' + name}
element={element}
description={description}
label={label}
getValue={getValue}
setValue={setValue}
debounce={debounce}
/>;
const setValue = (value) => {
setExtensionValue(element, name, value, moddle, commandStack);
};

return (
<TextAreaEntry
id={'extension_' + name}
element={element}
description={description}
label={label}
getValue={getValue}
setValue={setValue}
debounce={debounce}
/>
);
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {useService } from 'bpmn-js-properties-panel';
import React from 'react';
import { useService } from 'bpmn-js-properties-panel';
import { TextFieldEntry } from '@bpmn-io/properties-panel';
import {
getExtensionValue, setExtensionValue
} from '../extensionHelpers';

import { getExtensionValue, setExtensionValue } from '../extensionHelpers';

/**
* A generic properties' editor for text input.
Expand All @@ -21,25 +19,41 @@ import {
* @returns {string|null|*}
*/
export function SpiffExtensionTextInput(props) {
const { element, commandStack, moddle, name, label, description, businessObject } = props;
const {
element,
commandStack,
moddle,
name,
label,
description,
businessObject,
} = props;
const debounce = useService('debounceInput');

const getValue = () => {
return getExtensionValue(businessObject, name)
}

const setValue = value => {
setExtensionValue(element, name, value, moddle, commandStack, businessObject)
return getExtensionValue(businessObject, name);
};

return <TextFieldEntry
id={'extension_' + name}
element={element}
description={description}
label={label}
getValue={getValue}
setValue={setValue}
debounce={debounce}
/>;
const setValue = (value) => {
setExtensionValue(
element,
name,
value,
moddle,
commandStack,
businessObject,
);
};

return (
<TextFieldEntry
id={'extension_' + name}
element={element}
description={description}
label={label}
getValue={getValue}
setValue={setValue}
debounce={debounce}
/>
);
}
5 changes: 3 additions & 2 deletions app/spiffworkflow/messages/propertiesPanel/MessagePayload.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import { useService } from 'bpmn-js-properties-panel';
import { TextAreaEntry } from '@bpmn-io/properties-panel';
import { getMessageElementForShapeElement } from '../MessageHelpers';
Expand Down Expand Up @@ -37,11 +38,11 @@ export function MessagePayload(props) {
let messagePayloadObject = getMessagePayloadObject();
if (!messagePayloadObject) {
messagePayloadObject = messageElement.$model.create(
'spiffworkflow:MessagePayload'
'spiffworkflow:MessagePayload',
);
if (!messageElement.extensionElements) {
messageElement.extensionElements = messageElement.$model.create(
'bpmn:ExtensionElements'
'bpmn:ExtensionElements',
);
}
messageElement.extensionElements.get('values').push(messagePayloadObject);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import { useService } from 'bpmn-js-properties-panel';
import { SelectEntry } from '@bpmn-io/properties-panel';
import {
Expand Down

0 comments on commit 67640ca

Please sign in to comment.