diff --git a/src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js b/src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js index 8df133c7..c3bd645a 100644 --- a/src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js +++ b/src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js @@ -1,7 +1,7 @@ import { createElementTemplatesGroup, TemplateProps -} from '../../element-templates/components'; +} from '../../components'; import { CustomProperties, diff --git a/src/cloud-element-templates/properties-panel/components/PropertyTooltip.js b/src/cloud-element-templates/properties-panel/components/PropertyTooltip.js index 7d8cdabd..cded1a40 100644 --- a/src/cloud-element-templates/properties-panel/components/PropertyTooltip.js +++ b/src/cloud-element-templates/properties-panel/components/PropertyTooltip.js @@ -1,6 +1,6 @@ import Markup from 'preact-markup'; -import { sanitizeHTML } from '../../../element-templates/util/sanitize'; +import { sanitizeHTML } from '../../../utils/sanitize'; export function PropertyTooltip(props) { diff --git a/src/cloud-element-templates/properties-panel/properties/CustomProperties.js b/src/cloud-element-templates/properties-panel/properties/CustomProperties.js index 9672d947..557f9cef 100644 --- a/src/cloud-element-templates/properties-panel/properties/CustomProperties.js +++ b/src/cloud-element-templates/properties-panel/properties/CustomProperties.js @@ -6,7 +6,7 @@ import { import { useService } from 'bpmn-js-properties-panel'; -import { PropertyDescription } from '../../../element-templates/components/PropertyDescription'; +import { PropertyDescription } from '../../../components/PropertyDescription'; import { PropertyTooltip } from '../components/PropertyTooltip'; import { getPropertyValue, setPropertyValue, validateProperty } from '../../util/propertyUtil'; diff --git a/src/element-templates/components/ElementTemplatesGroup.js b/src/components/ElementTemplatesGroup.js similarity index 98% rename from src/element-templates/components/ElementTemplatesGroup.js rename to src/components/ElementTemplatesGroup.js index 255a1d43..f7a67045 100644 --- a/src/element-templates/components/ElementTemplatesGroup.js +++ b/src/components/ElementTemplatesGroup.js @@ -12,11 +12,11 @@ import { useService } from 'bpmn-js-properties-panel'; -import { getTemplateId as defaultGetTemplateId } from '../Helper'; +import { getTemplateId as defaultGetTemplateId } from '../element-templates/Helper'; import { getVersionOrDateFromTemplate -} from '../util/templateUtil'; +} from '../utils/templateUtil'; /** diff --git a/src/element-templates/components/PropertyDescription.js b/src/components/PropertyDescription.js similarity index 82% rename from src/element-templates/components/PropertyDescription.js rename to src/components/PropertyDescription.js index f136d2c6..3d1e142b 100644 --- a/src/element-templates/components/PropertyDescription.js +++ b/src/components/PropertyDescription.js @@ -1,6 +1,6 @@ import Markup from 'preact-markup'; -import { sanitizeHTML } from '../util/sanitize'; +import { sanitizeHTML } from '../utils/sanitize'; export function PropertyDescription(props) { diff --git a/src/element-templates/components/TemplateProps.js b/src/components/TemplateProps.js similarity index 95% rename from src/element-templates/components/TemplateProps.js rename to src/components/TemplateProps.js index aaa62036..0c9f195d 100644 --- a/src/element-templates/components/TemplateProps.js +++ b/src/components/TemplateProps.js @@ -1,6 +1,6 @@ import { useService } from 'bpmn-js-properties-panel'; -import { getVersionOrDateFromTemplate } from '../util/templateUtil'; +import { getVersionOrDateFromTemplate } from '../utils/templateUtil'; export function TemplateProps({ element, elementTemplates }) { const template = elementTemplates.get(element); diff --git a/src/element-templates/components/index.js b/src/components/index.js similarity index 100% rename from src/element-templates/components/index.js rename to src/components/index.js diff --git a/src/element-templates/ReplaceBehavior.js b/src/element-templates/behavior/ReplaceBehavior.js similarity index 100% rename from src/element-templates/ReplaceBehavior.js rename to src/element-templates/behavior/ReplaceBehavior.js diff --git a/src/element-templates/behavior/index.js b/src/element-templates/behavior/index.js new file mode 100644 index 00000000..08902b60 --- /dev/null +++ b/src/element-templates/behavior/index.js @@ -0,0 +1,8 @@ +import ReplaceBehavior from './ReplaceBehavior'; + +export default { + __init__: [ + 'elementTemplatesReplaceBehavior' + ], + elementTemplatesReplaceBehavior: [ 'type', ReplaceBehavior ] +}; diff --git a/src/element-templates/core/index.js b/src/element-templates/core/index.js new file mode 100644 index 00000000..2d02e74b --- /dev/null +++ b/src/element-templates/core/index.js @@ -0,0 +1,17 @@ +import ElementTemplates from '../ElementTemplates'; +import ElementTemplatesLoader from '../ElementTemplatesLoader'; + +import commandsModule from '../cmd'; +import behaviorModule from '../behavior'; + +export default { + __depends__: [ + commandsModule, + behaviorModule + ], + __init__: [ + 'elementTemplatesLoader' + ], + elementTemplates: [ 'type', ElementTemplates ], + elementTemplatesLoader: [ 'type', ElementTemplatesLoader ] +}; diff --git a/src/element-templates/index.js b/src/element-templates/index.js index 76655c0f..c92ff54e 100644 --- a/src/element-templates/index.js +++ b/src/element-templates/index.js @@ -1,26 +1,9 @@ -import translateModule from 'diagram-js/lib/i18n/translate'; - -import ElementTemplates from './ElementTemplates'; -import ElementTemplatesLoader from './ElementTemplatesLoader'; -import ReplaceBehavior from './ReplaceBehavior'; -import commandsModule from './cmd'; -import ElementTemplatesPropertiesProvider from './ElementTemplatesPropertiesProvider'; - -import { CamundaPlatformPropertiesProviderModule } from 'bpmn-js-properties-panel'; +import coreModule from './core'; +import propertiesProviderModule from './properties-panel'; export default { __depends__: [ - commandsModule, - translateModule, - CamundaPlatformPropertiesProviderModule - ], - __init__: [ - 'elementTemplatesLoader', - 'replaceBehavior', - 'elementTemplatesPropertiesProvider' - ], - elementTemplates: [ 'type', ElementTemplates ], - elementTemplatesLoader: [ 'type', ElementTemplatesLoader ], - replaceBehavior: [ 'type', ReplaceBehavior ], - elementTemplatesPropertiesProvider: [ 'type', ElementTemplatesPropertiesProvider ] + coreModule, + propertiesProviderModule, + ] }; diff --git a/src/element-templates/ElementTemplatesPropertiesProvider.js b/src/element-templates/properties-panel/ElementTemplatesPropertiesProvider.js similarity index 98% rename from src/element-templates/ElementTemplatesPropertiesProvider.js rename to src/element-templates/properties-panel/ElementTemplatesPropertiesProvider.js index 75910859..6f7cf0b0 100644 --- a/src/element-templates/ElementTemplatesPropertiesProvider.js +++ b/src/element-templates/properties-panel/ElementTemplatesPropertiesProvider.js @@ -3,7 +3,7 @@ import { ListGroup } from '@bpmn-io/properties-panel'; import { createElementTemplatesGroup, TemplateProps -} from './components'; +} from '../../components'; import { CustomProperties, @@ -12,7 +12,7 @@ import { OutputProperties } from './properties'; -import { getTemplateId } from './Helper'; +import { getTemplateId } from '../Helper'; const CAMUNDA_ERROR_EVENT_DEFINITION_TYPE = 'camunda:errorEventDefinition', CAMUNDA_INPUT_PARAMETER_TYPE = 'camunda:inputParameter', diff --git a/src/element-templates/properties-panel/index.js b/src/element-templates/properties-panel/index.js new file mode 100644 index 00000000..eb4c9c75 --- /dev/null +++ b/src/element-templates/properties-panel/index.js @@ -0,0 +1,16 @@ +import translateModule from 'diagram-js/lib/i18n/translate'; + +import ElementTemplatesPropertiesProvider from './ElementTemplatesPropertiesProvider'; + +import { CamundaPlatformPropertiesProviderModule } from 'bpmn-js-properties-panel'; + +export default { + __depends__: [ + translateModule, + CamundaPlatformPropertiesProviderModule + ], + __init__: [ + 'elementTemplatesPropertiesProvider' + ], + elementTemplatesPropertiesProvider: [ 'type', ElementTemplatesPropertiesProvider ] +}; diff --git a/src/element-templates/properties/CustomProperties.js b/src/element-templates/properties-panel/properties/CustomProperties.js similarity index 99% rename from src/element-templates/properties/CustomProperties.js rename to src/element-templates/properties-panel/properties/CustomProperties.js index da669c4c..cc1aa902 100644 --- a/src/element-templates/properties/CustomProperties.js +++ b/src/element-templates/properties-panel/properties/CustomProperties.js @@ -19,7 +19,7 @@ import { TextFieldEntry, isTextFieldEntryEdited } from '@bpmn-io/properties-panel'; -import { PropertyDescription } from '../components/PropertyDescription'; +import { PropertyDescription } from '../../../components/PropertyDescription'; import { findCamundaErrorEventDefinition, @@ -29,12 +29,12 @@ import { findExtensions, findInputParameter, findOutputParameter -} from '../Helper'; +} from '../../Helper'; import { createElement, getRoot -} from '../../utils/ElementUtil'; +} from '../../../utils/ElementUtil'; import { createCamundaErrorEventDefinition, @@ -46,7 +46,7 @@ import { createError, createInputParameter, createOutputParameter -} from '../CreateHelper'; +} from '../../CreateHelper'; import { CAMUNDA_ERROR_EVENT_DEFINITION_TYPE, @@ -62,7 +62,7 @@ import { EXTENSION_BINDING_TYPES, IO_BINDING_TYPES, IN_OUT_BINDING_TYPES -} from '../util/bindingTypes'; +} from '../../util/bindingTypes'; const PRIMITIVE_MODDLE_TYPES = [ 'Boolean', diff --git a/src/element-templates/properties/ErrorProperties.js b/src/element-templates/properties-panel/properties/ErrorProperties.js similarity index 99% rename from src/element-templates/properties/ErrorProperties.js rename to src/element-templates/properties-panel/properties/ErrorProperties.js index 5b80f5a4..f3db7af8 100644 --- a/src/element-templates/properties/ErrorProperties.js +++ b/src/element-templates/properties-panel/properties/ErrorProperties.js @@ -7,7 +7,7 @@ import { TextFieldEntry } from '@bpmn-io/properties-panel'; import { findCamundaErrorEventDefinition, findExtensions -} from '../Helper'; +} from '../../Helper'; import { useService } from 'bpmn-js-properties-panel'; diff --git a/src/element-templates/properties/InputProperties.js b/src/element-templates/properties-panel/properties/InputProperties.js similarity index 95% rename from src/element-templates/properties/InputProperties.js rename to src/element-templates/properties-panel/properties/InputProperties.js index a2d2cb8f..1178e846 100644 --- a/src/element-templates/properties/InputProperties.js +++ b/src/element-templates/properties-panel/properties/InputProperties.js @@ -5,17 +5,17 @@ import { ToggleSwitchEntry } from '@bpmn-io/properties-panel'; import { findExtension, findInputParameter -} from '../Helper'; +} from '../../Helper'; import { useService } from 'bpmn-js-properties-panel'; import { without } from 'min-dash'; -import { createElement } from '../../utils/ElementUtil'; +import { createElement } from '../../../utils/ElementUtil'; -import { PropertyDescription } from '../components/PropertyDescription'; +import { PropertyDescription } from '../../../components/PropertyDescription'; -import { createInputParameter } from '../CreateHelper'; +import { createInputParameter } from '../../CreateHelper'; export function InputProperties(props) { diff --git a/src/element-templates/properties/OutputProperties.js b/src/element-templates/properties-panel/properties/OutputProperties.js similarity index 95% rename from src/element-templates/properties/OutputProperties.js rename to src/element-templates/properties-panel/properties/OutputProperties.js index b60c296f..d90f9514 100644 --- a/src/element-templates/properties/OutputProperties.js +++ b/src/element-templates/properties-panel/properties/OutputProperties.js @@ -2,22 +2,22 @@ import { getBusinessObject } from 'bpmn-js/lib/util/ModelUtil'; import { TextFieldEntry, ToggleSwitchEntry } from '@bpmn-io/properties-panel'; -import { containsSpace } from '../util/validationUtil'; +import { containsSpace } from '../../util/validationUtil'; import { findExtension, findOutputParameter -} from '../Helper'; +} from '../../Helper'; import { useService } from 'bpmn-js-properties-panel'; import { without } from 'min-dash'; -import { PropertyDescription } from '../components/PropertyDescription'; +import { PropertyDescription } from '../../../components/PropertyDescription'; -import { createElement } from '../../utils/ElementUtil'; +import { createElement } from '../../../utils/ElementUtil'; -import { createOutputParameter } from '../CreateHelper'; +import { createOutputParameter } from '../../CreateHelper'; export function OutputProperties(props) { diff --git a/src/element-templates/properties/index.js b/src/element-templates/properties-panel/properties/index.js similarity index 100% rename from src/element-templates/properties/index.js rename to src/element-templates/properties-panel/properties/index.js diff --git a/src/index.js b/src/index.js index e410e217..2de41fef 100644 --- a/src/index.js +++ b/src/index.js @@ -4,3 +4,7 @@ export { default as ElementTemplatesPropertiesProviderModule } from './element-t // utils export { Validator as CloudElementTemplatesValidator } from './cloud-element-templates/Validator'; export { ElementTemplateLinterPlugin as CloudElementTemplatesLinterPlugin } from './cloud-element-templates/linting'; + +// core +export { default as CloudElementTemplatesCoreModule } from './cloud-element-templates/core'; +export { default as ElementTemplatesCoreModule } from './element-templates/core'; diff --git a/src/element-templates/util/sanitize.js b/src/utils/sanitize.js similarity index 100% rename from src/element-templates/util/sanitize.js rename to src/utils/sanitize.js diff --git a/src/element-templates/util/templateUtil.js b/src/utils/templateUtil.js similarity index 100% rename from src/element-templates/util/templateUtil.js rename to src/utils/templateUtil.js diff --git a/test/spec/cloud-element-templates/CalledElementBehavior.bpmn b/test/spec/cloud-element-templates/behavior/CalledElementBehavior.bpmn similarity index 100% rename from test/spec/cloud-element-templates/CalledElementBehavior.bpmn rename to test/spec/cloud-element-templates/behavior/CalledElementBehavior.bpmn diff --git a/test/spec/cloud-element-templates/CalledElementBehavior.json b/test/spec/cloud-element-templates/behavior/CalledElementBehavior.json similarity index 100% rename from test/spec/cloud-element-templates/CalledElementBehavior.json rename to test/spec/cloud-element-templates/behavior/CalledElementBehavior.json diff --git a/test/spec/cloud-element-templates/CalledElementBehavior.spec.js b/test/spec/cloud-element-templates/behavior/CalledElementBehavior.spec.js similarity index 100% rename from test/spec/cloud-element-templates/CalledElementBehavior.spec.js rename to test/spec/cloud-element-templates/behavior/CalledElementBehavior.spec.js diff --git a/test/spec/element-templates/ReplaceBehavior.spec.js b/test/spec/element-templates/behavior/ReplaceBehavior.spec.js similarity index 97% rename from test/spec/element-templates/ReplaceBehavior.spec.js rename to test/spec/element-templates/behavior/ReplaceBehavior.spec.js index 654e383f..8e1afa6d 100644 --- a/test/spec/element-templates/ReplaceBehavior.spec.js +++ b/test/spec/element-templates/behavior/ReplaceBehavior.spec.js @@ -1,7 +1,7 @@ import { bootstrapModeler, inject -} from '../../TestHelper'; +} from '../../../TestHelper'; import { BpmnPropertiesPanelModule as BpmnPropertiesPanel } from 'bpmn-js-properties-panel';import { BpmnPropertiesProviderModule as BpmnPropertiesProvider } from 'bpmn-js-properties-panel'; import ElementTemplatesModule from 'src/element-templates'; @@ -13,9 +13,9 @@ import camundaModdlePackage from 'camunda-bpmn-moddle/resources/camunda'; import { getBusinessObject } from 'bpmn-js/lib/util/ModelUtil'; -import diagramXML from './fixtures/replace-behavior.bpmn'; +import diagramXML from '../fixtures/replace-behavior.bpmn'; -import elementTemplates from './fixtures/replace-behavior.json'; +import elementTemplates from '../fixtures/replace-behavior.json'; describe('provider/element-templates - ReplaceBehavior', function() { diff --git a/test/spec/element-templates/ElementTemplatesPropertiesProvider.bpmn b/test/spec/element-templates/properties-panel/ElementTemplatesPropertiesProvider.bpmn similarity index 100% rename from test/spec/element-templates/ElementTemplatesPropertiesProvider.bpmn rename to test/spec/element-templates/properties-panel/ElementTemplatesPropertiesProvider.bpmn diff --git a/test/spec/element-templates/ElementTemplatesPropertiesProvider.spec.js b/test/spec/element-templates/properties-panel/ElementTemplatesPropertiesProvider.spec.js similarity index 98% rename from test/spec/element-templates/ElementTemplatesPropertiesProvider.spec.js rename to test/spec/element-templates/properties-panel/ElementTemplatesPropertiesProvider.spec.js index e2bd09f3..22cda48b 100644 --- a/test/spec/element-templates/ElementTemplatesPropertiesProvider.spec.js +++ b/test/spec/element-templates/properties-panel/ElementTemplatesPropertiesProvider.spec.js @@ -28,9 +28,9 @@ import { BpmnPropertiesPanelModule as BpmnPropertiesPanel } from 'bpmn-js-proper import { BpmnPropertiesProviderModule as BpmnPropertiesProvider } from 'bpmn-js-properties-panel'; import diagramXML from './ElementTemplatesPropertiesProvider.bpmn'; -import templates from './fixtures/simple.json'; -import entriesVisibleDiagramXML from './fixtures/entries-visible.bpmn'; -import entriesVisibleTemplates from './fixtures/entries-visible.json'; +import templates from '../fixtures/simple.json'; +import entriesVisibleDiagramXML from '../fixtures/entries-visible.bpmn'; +import entriesVisibleTemplates from '../fixtures/entries-visible.json'; describe('provider/element-templates - ElementTemplates', function() { diff --git a/test/spec/element-templates/TemplateProps.spec.js b/test/spec/element-templates/properties/TemplateProps.spec.js similarity index 98% rename from test/spec/element-templates/TemplateProps.spec.js rename to test/spec/element-templates/properties/TemplateProps.spec.js index fe4833bf..905bc2b8 100644 --- a/test/spec/element-templates/TemplateProps.spec.js +++ b/test/spec/element-templates/properties/TemplateProps.spec.js @@ -19,8 +19,8 @@ import { import { BpmnPropertiesPanelModule as BpmnPropertiesPanel } from 'bpmn-js-properties-panel';import elementTemplatesModule from 'src/element-templates'; -import diagramXML from './fixtures/template-props.bpmn'; -import templates from './fixtures/template-props.json'; +import diagramXML from '../fixtures/template-props.bpmn'; +import templates from '../fixtures/template-props.json'; describe('provider/element-templates - TemplateProps', function() { diff --git a/test/spec/element-templates/util/sanitize.spec.js b/test/spec/utils/sanitize.spec.js similarity index 98% rename from test/spec/element-templates/util/sanitize.spec.js rename to test/spec/utils/sanitize.spec.js index 119b3309..dde7ab0f 100644 --- a/test/spec/element-templates/util/sanitize.spec.js +++ b/test/spec/utils/sanitize.spec.js @@ -1,4 +1,4 @@ -import { sanitizeHTML } from 'src/element-templates/util/sanitize'; +import { sanitizeHTML } from 'src/utils/sanitize'; describe('provider/element-template - sanitize', function() { diff --git a/test/spec/element-templates/fixtures/template-util.bpmn b/test/spec/utils/template-util.bpmn similarity index 100% rename from test/spec/element-templates/fixtures/template-util.bpmn rename to test/spec/utils/template-util.bpmn diff --git a/test/spec/element-templates/util/templateUtil.spec.js b/test/spec/utils/templateUtil.spec.js similarity index 95% rename from test/spec/element-templates/util/templateUtil.spec.js rename to test/spec/utils/templateUtil.spec.js index 7dd1befa..e6889b3b 100644 --- a/test/spec/element-templates/util/templateUtil.spec.js +++ b/test/spec/utils/templateUtil.spec.js @@ -1,6 +1,6 @@ import { getVersionOrDateFromTemplate -} from 'src/element-templates/util/templateUtil'; +} from 'src/utils/templateUtil'; import TestContainer from 'mocha-test-container-support'; @@ -12,7 +12,7 @@ import modelingModule from 'bpmn-js/lib/features/modeling'; import camundaModdlePackage from 'camunda-bpmn-moddle/resources/camunda'; -import diagramXML from '../fixtures/template-util.bpmn'; +import diagramXML from './template-util.bpmn'; describe('provider/element-template - templateUtil', function() {