Skip to content

Commit

Permalink
chore: use named exports in editor
Browse files Browse the repository at this point in the history
Related to #918
  • Loading branch information
Skaiir committed Jan 11, 2024
1 parent 0636183 commit 6bc584a
Show file tree
Hide file tree
Showing 129 changed files with 301 additions and 320 deletions.
39 changes: 19 additions & 20 deletions packages/form-js-editor/src/FormEditor.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import { clone, createFormContainer, createInjector, schemaVersion } from '@bpmn-io/form-js-viewer';
import Ids from 'ids';
import { clone, createFormContainer, createInjector, schemaVersion } from '@bpmn-io/form-js-viewer';
import { isString, set } from 'min-dash';

import core from './core';

import EditorActionsModule from './features/editor-actions';
import DraggingModule from './features/dragging';
import KeyboardModule from './features/keyboard';
import ModelingModule from './features/modeling';
import SelectionModule from './features/selection';
import PaletteModule from './features/palette';
import PropertiesPanelModule from './features/properties-panel';
import RenderInjectionModule from './features/render-injection';
import RepeatRenderManagerModule from './features/repeat-render';
import ExpressionLanguageModule from './features/expression-language';
import { CoreModule } from './core';
import { EditorActionsModule } from './features/editor-actions';
import { EditorExpressionLanguageModule } from './features/expression-language';
import { FormEditorKeyboardModule } from './features/keyboard';
import { DraggingModule } from './features/dragging';
import { ModelingModule } from './features/modeling';
import { SelectionModule } from './features/selection';
import { PaletteModule } from './features/palette';
import { PropertiesPanelModule } from './features/properties-panel';
import { RenderInjectionModule } from './features/render-injection';
import { RepeatRenderModule } from './features/repeat-render';

import { MarkdownModule } from '@bpmn-io/form-js-viewer';
import { MarkdownRendererModule } from '@bpmn-io/form-js-viewer';

const ids = new Ids([ 32, 36, 1 ]);

Expand All @@ -40,7 +39,7 @@ const ids = new Ids([ 32, 36, 1 ]);
/**
* The form editor.
*/
export default class FormEditor {
export class FormEditor {

/**
* @constructor
Expand Down Expand Up @@ -265,7 +264,7 @@ export default class FormEditor {
return createInjector([
{ config: [ 'value', enrichedConfig ] },
{ formEditor: [ 'value', this ] },
core,
CoreModule,
...modules,
...additionalModules
]);
Expand Down Expand Up @@ -304,15 +303,15 @@ export default class FormEditor {
return [
ModelingModule,
EditorActionsModule,
FormEditorKeyboardModule,
DraggingModule,
KeyboardModule,
SelectionModule,
PaletteModule,
ExpressionLanguageModule,
MarkdownModule,
EditorExpressionLanguageModule,
MarkdownRendererModule,
PropertiesPanelModule,
RenderInjectionModule,
RepeatRenderManagerModule
RepeatRenderModule
];
}

Expand Down
2 changes: 1 addition & 1 deletion packages/form-js-editor/src/core/Debounce.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { debounce } from 'min-dash';
*
* @param {number|boolean} [config=true]
*/
export default function DebounceFactory(config = true) {
export function DebounceFactory(config = true) {

const timeout = typeof config === 'number' ? config : config ? 300 : 0;

Expand Down
2 changes: 1 addition & 1 deletion packages/form-js-editor/src/core/EventBus.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from 'diagram-js/lib/core/EventBus';
export { default as EventBus } from 'diagram-js/lib/core/EventBus';
2 changes: 1 addition & 1 deletion packages/form-js-editor/src/core/FormFieldRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
} from '@bpmn-io/form-js-viewer';


export default class FormFieldRegistry extends BaseFieldRegistry {
export class FormFieldRegistry extends BaseFieldRegistry {

/**
* Updates a form fields id.
Expand Down
6 changes: 3 additions & 3 deletions packages/form-js-editor/src/core/FormLayoutValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ export const MAX_COLUMNS = 16;
export const MIN_COLUMNS = 2;
export const MAX_FIELDS_PER_ROW = 4;

export default class FormLayoutValidator {
export class FormLayoutValidator {

/**
* @constructor
*
* @param { import('./FormLayouter').default } formLayouter
* @param { import('./FormFieldRegistry').default } formFieldRegistry
* @param { import('./FormLayouter').FormLayouter } formLayouter
* @param { import('./FormFieldRegistry').FormFieldRegistry } formFieldRegistry
*/
constructor(formLayouter, formFieldRegistry) {
this._formLayouter = formLayouter;
Expand Down
2 changes: 1 addition & 1 deletion packages/form-js-editor/src/core/FormLayouter.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { FormLayouter as default } from '@bpmn-io/form-js-viewer';
export { FormLayouter } from '@bpmn-io/form-js-viewer';
16 changes: 8 additions & 8 deletions packages/form-js-editor/src/core/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { FieldFactory, Importer, PathRegistry } from '@bpmn-io/form-js-viewer';

import EventBus from './EventBus';
import DebounceFactory from './Debounce';
import FormFieldRegistry from './FormFieldRegistry';
import FormLayouter from './FormLayouter';
import FormLayoutValidator from './FormLayoutValidator';
import { EventBus } from './EventBus';
import { DebounceFactory } from './Debounce';
import { FormFieldRegistry } from './FormFieldRegistry';
import { FormLayouter } from './FormLayouter';
import { FormLayoutValidator } from './FormLayoutValidator';

import renderModule from '../render';
import { RenderModule } from '../render';

export default {
export const CoreModule = {
__depends__: [
renderModule
RenderModule
],
debounce: [ 'factory', DebounceFactory ],
eventBus: [ 'type', EventBus ],
Expand Down
2 changes: 1 addition & 1 deletion packages/form-js-editor/src/features/SectionModuleBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @class SectionModuleBase
*/
export default class SectionModuleBase {
export class SectionModuleBase {

/**
* Create a SectionModuleBase instance.
Expand Down
12 changes: 6 additions & 6 deletions packages/form-js-editor/src/features/dragging/Dragging.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ export const ERROR_DROP_CLS = 'fjs-error-drop';
* @typedef { { id: String, components: Array<any> } } FormRow
*/

export default class Dragging {
export class Dragging {

/**
* @constructor
*
* @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
* @param { import('../../core/FormLayouter').default } formLayouter
* @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
* @param { import('../../core/EventBus').default } eventBus
* @param { import('../modeling/Modeling').default } modeling
* @param { import('../../core/FormFieldRegistry').FormFieldRegistry } formFieldRegistry
* @param { import('../../core/FormLayouter').FormLayouter } formLayouter
* @param { import('../../core/FormLayoutValidator').FormLayoutValidator } formLayoutValidator
* @param { import('../../core/EventBus').EventBus } eventBus
* @param { import('../modeling/Modeling').Modeling } modeling
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
*/
constructor(formFieldRegistry, formLayouter, formLayoutValidator, eventBus, modeling, pathRegistry) {
Expand Down
4 changes: 2 additions & 2 deletions packages/form-js-editor/src/features/dragging/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Dragging from './Dragging';
import { Dragging } from './Dragging';

export default {
export const DraggingModule = {
__init__: [ 'dragging' ],
dragging: [ 'type', Dragging ]
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import EditorActions from 'diagram-js/lib/features/editor-actions/EditorActions';


export default class FormEditorActions extends EditorActions {
export class FormEditorActions extends EditorActions {
constructor(eventBus, injector) {
super(eventBus, injector);

Expand Down
8 changes: 4 additions & 4 deletions packages/form-js-editor/src/features/editor-actions/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import EditorActionsModule from 'diagram-js/lib/features/editor-actions';
import BaseEditorActionsModule from 'diagram-js/lib/features/editor-actions';

import FormEditorActions from './FormEditorActions';
import { FormEditorActions } from './FormEditorActions';

export default {
export const EditorActionsModule = {
__depends__: [
EditorActionsModule
BaseEditorActionsModule
],
editorActions: [ 'type', FormEditorActions ]
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isString } from 'min-dash';

export default class EditorTemplating {
export class EditorTemplating {

// same rules as viewer templating
isTemplate(value) { return isString(value) && (value.startsWith('=') || /{{/.test(value)); }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FeelExpressionLanguage } from '@bpmn-io/form-js-viewer';
import EditorTemplating from './EditorTemplating';
import { EditorTemplating } from './EditorTemplating';

export default {
export const EditorExpressionLanguageModule = {
__init__: [ 'expressionLanguage', 'templating' ],
expressionLanguage: [ 'type', FeelExpressionLanguage ],
templating: [ 'type', EditorTemplating ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {

const LOW_PRIORITY = 500;

export default class FormEditorKeyboardBindings {
export class FormEditorKeyboardBindings {
constructor(eventBus, keyboard) {
eventBus.on('editorActions.init', LOW_PRIORITY, (event) => {
const { editorActions } = event;
Expand Down
4 changes: 2 additions & 2 deletions packages/form-js-editor/src/features/keyboard/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import KeyboardModule from 'diagram-js/lib/features/keyboard';

import FormEditorKeyboardBindings from './FormEditorKeyboardBindings';
import { FormEditorKeyboardBindings } from './FormEditorKeyboardBindings';

export default {
export const FormEditorKeyboardModule = {
__depends__: [
KeyboardModule
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
import { clone } from '@bpmn-io/form-js-viewer';


export default class FormLayoutUpdater extends CommandInterceptor {
export class FormLayoutUpdater extends CommandInterceptor {

constructor(eventBus, formLayouter, modeling, formEditor) {
super(eventBus);
Expand Down
16 changes: 8 additions & 8 deletions packages/form-js-editor/src/features/modeling/Modeling.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import AddFormFieldHandler from './cmd/AddFormFieldHandler';
import EditFormFieldHandler from './cmd/EditFormFieldHandler';
import MoveFormFieldHandler from './cmd/MoveFormFieldHandler';
import RemoveFormFieldHandler from './cmd/RemoveFormFieldHandler';
import UpdateIdClaimHandler from './cmd/UpdateIdClaimHandler';
import UpdateKeyClaimHandler from './cmd/UpdateKeyClaimHandler';
import UpdatePathClaimHandler from './cmd/UpdatePathClaimHandler';
import { AddFormFieldHandler } from './cmd/AddFormFieldHandler';
import { EditFormFieldHandler } from './cmd/EditFormFieldHandler';
import { MoveFormFieldHandler } from './cmd/MoveFormFieldHandler';
import { RemoveFormFieldHandler } from './cmd/RemoveFormFieldHandler';
import { UpdateIdClaimHandler } from './cmd/UpdateIdClaimHandler';
import { UpdateKeyClaimHandler } from './cmd/UpdateKeyClaimHandler';
import { UpdatePathClaimHandler } from './cmd/UpdatePathClaimHandler';

import { isObject } from 'min-dash';


export default class Modeling {
export class Modeling {
constructor(commandStack, eventBus, formEditor, formFieldRegistry, fieldFactory) {
this._commandStack = commandStack;
this._formEditor = formEditor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';

export default class IdBehavior extends CommandInterceptor {
export class IdBehavior extends CommandInterceptor {
constructor(eventBus, modeling) {
super(eventBus);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';

export default class KeyBehavior extends CommandInterceptor {
export class KeyBehavior extends CommandInterceptor {
constructor(eventBus, modeling, formFields) {
super(eventBus);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
OPTIONS_SOURCES_PATHS
} from '@bpmn-io/form-js-viewer';

export default class OptionsSourceBehavior extends CommandInterceptor {
export class OptionsSourceBehavior extends CommandInterceptor {
constructor(eventBus) {
super(eventBus);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';

export default class PathBehavior extends CommandInterceptor {
export class PathBehavior extends CommandInterceptor {
constructor(eventBus, modeling, formFields) {
super(eventBus);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';

export default class ValidateBehavior extends CommandInterceptor {
export class ValidateBehavior extends CommandInterceptor {
constructor(eventBus) {
super(eventBus);

Expand Down
12 changes: 6 additions & 6 deletions packages/form-js-editor/src/features/modeling/behavior/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import IdBehavior from './IdBehavior';
import KeyBehavior from './KeyBehavior';
import PathBehavior from './PathBehavior';
import ValidateBehavior from './ValidateBehavior';
import OptionsSourceBehavior from './OptionsSourceBehavior';
import { IdBehavior } from './IdBehavior';
import { KeyBehavior } from './KeyBehavior';
import { PathBehavior } from './PathBehavior';
import { ValidateBehavior } from './ValidateBehavior';
import { OptionsSourceBehavior } from './OptionsSourceBehavior';
import { ColumnsSourceBehavior } from './ColumnsSourceBehavior';
import { TableDataSourceBehavior } from './TableDataSourceBehavior';

export default {
export const BehaviorModule = {
__init__: [
'idBehavior',
'keyBehavior',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import {
updatePath
} from './Util';

export default class AddFormFieldHandler {
export class AddFormFieldHandler {

/**
* @constructor
* @param { import('../../../FormEditor').default } formEditor
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
* @param { import('../../../FormEditor').FormEditor } formEditor
* @param { import('../../../core/FormFieldRegistry').FormFieldRegistry } formFieldRegistry
*/
constructor(formEditor, formFieldRegistry) {
this._formEditor = formEditor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export default class EditFormFieldHandler {
export class EditFormFieldHandler {

/**
* @constructor
* @param { import('../../../FormEditor').default } formEditor
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
* @param { import('../../../FormEditor').FormEditor } formEditor
* @param { import('../../../core/FormFieldRegistry').FormFieldRegistry } formFieldRegistry
*/
constructor(formEditor, formFieldRegistry) {
this._formEditor = formEditor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import {
updateRow
} from './Util';

export default class MoveFormFieldHandler {
export class MoveFormFieldHandler {

/**
* @constructor
* @param { import('../../../FormEditor').default } formEditor
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
* @param { import('../../../FormEditor').FormEditor } formEditor
* @param { import('../../../core/FormFieldRegistry').FormFieldRegistry } formFieldRegistry
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
* @param { import('@bpmn-io/form-js-viewer').FormLayouter } formLayouter
*/
Expand Down
Loading

0 comments on commit 6bc584a

Please sign in to comment.