Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate @bpmn-io/draggle #588

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/form-js-editor/assets/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@use 'form-js-editor-base.css';
@use 'dragula/dist/dragula.css';
@use '@bpmn-io/draggle/dist/dragula.css';
@use '@bpmn-io/properties-panel/assets/properties-panel.css';
2 changes: 1 addition & 1 deletion packages/form-js-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
"url": "https://github.com/bpmn-io"
},
"dependencies": {
"@bpmn-io/draggle": "^4.0.0",
"@bpmn-io/form-js-viewer": "^1.1.0",
"@bpmn-io/properties-panel": "^3.2.1",
"array-move": "^3.0.1",
"big.js": "^6.2.1",
"dragula": "^3.7.3",
"ids": "^1.0.0",
"min-dash": "^4.0.0",
"min-dom": "^4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/form-js-editor/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ export default [
'preact/jsx-runtime',
'preact/hooks',
'preact/compat',
'dragula',
'@bpmn-o/draggle',
'@bpmn-io/form-js-viewer'
],
plugins: pgl([
copy({
targets: [
{ src: 'assets/form-js-editor-base.css', dest: 'dist/assets' },
{ src: '../../node_modules/dragula/dist/dragula.css', dest: 'dist/assets' },
{ src: '../../node_modules/@bpmn-io/draggle/dist/dragula.css', dest: 'dist/assets' },
{ src: '../../node_modules/@bpmn-io/properties-panel/assets/properties-panel.css', dest: 'dist/assets' }
]
})
Expand Down
17 changes: 12 additions & 5 deletions packages/form-js-editor/src/features/dragging/Dragging.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import dragula from 'dragula';
import dragula from '@bpmn-io/draggle';

import { set as setCursor } from '../../render/util/Cursor';

Expand Down Expand Up @@ -200,12 +200,17 @@ export default class Dragging {

const {
container,
direction,
mirrorContainer
} = options || {};

const dragulaInstance = dragula({
direction,
let dragulaOptions = {
direction: function(el, target) {
if (isRow(target)) {
return 'horizontal';
}

return 'vertical';
},
mirrorContainer,
isContainer(el) {
return container.some(cls => el.classList.contains(cls));
Expand Down Expand Up @@ -245,7 +250,9 @@ export default class Dragging {
},
slideFactorX: 10,
slideFactorY: 5
});
};

const dragulaInstance = dragula(dragulaOptions);

// bind life cycle events
dragulaInstance.on('drag', (element, source) => {
Expand Down
2 changes: 0 additions & 2 deletions packages/form-js-editor/src/render/components/FormEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
eventBus.on('selection.changed', scrollIntoView);

return () => eventBus.off('selection.changed', scrollIntoView);
}, [ id ]);

Check warning on line 113 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (ubuntu-20.04, 16)

React Hook useEffect has missing dependencies: 'eventBus' and 'scrollIntoView'. Either include them or remove the dependency array

Check warning on line 113 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (macos-latest, 16)

React Hook useEffect has missing dependencies: 'eventBus' and 'scrollIntoView'. Either include them or remove the dependency array

Check warning on line 113 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (windows-latest, 16)

React Hook useEffect has missing dependencies: 'eventBus' and 'scrollIntoView'. Either include them or remove the dependency array

Check warning on line 113 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (ubuntu-20.04, 16)

React Hook useEffect has missing dependencies: 'eventBus' and 'scrollIntoView'. Either include them or remove the dependency array

Check warning on line 113 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (windows-latest, 16)

React Hook useEffect has missing dependencies: 'eventBus' and 'scrollIntoView'. Either include them or remove the dependency array

Check warning on line 113 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (macos-latest, 16)

React Hook useEffect has missing dependencies: 'eventBus' and 'scrollIntoView'. Either include them or remove the dependency array

useLayoutEffect(() => {
if (selection.isSelected(field)) {
Expand Down Expand Up @@ -306,7 +306,7 @@
return () => {
eventBus.off('selection.changed', handleSelectionChanged);
};
}, [ schema, selection ]);

Check warning on line 309 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (ubuntu-20.04, 16)

React Hook useEffect has a missing dependency: 'eventBus'. Either include it or remove the dependency array

Check warning on line 309 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (macos-latest, 16)

React Hook useEffect has a missing dependency: 'eventBus'. Either include it or remove the dependency array

Check warning on line 309 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (windows-latest, 16)

React Hook useEffect has a missing dependency: 'eventBus'. Either include it or remove the dependency array

Check warning on line 309 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (ubuntu-20.04, 16)

React Hook useEffect has a missing dependency: 'eventBus'. Either include it or remove the dependency array

Check warning on line 309 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (windows-latest, 16)

React Hook useEffect has a missing dependency: 'eventBus'. Either include it or remove the dependency array

Check warning on line 309 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (macos-latest, 16)

React Hook useEffect has a missing dependency: 'eventBus'. Either include it or remove the dependency array

const [ drake, setDrake ] = useState(null);

Expand All @@ -322,7 +322,6 @@
DROP_CONTAINER_VERTICAL_CLS,
DROP_CONTAINER_HORIZONTAL_CLS
],
direction: 'vertical',
mirrorContainer: formContainerRef.current
});

Expand All @@ -345,7 +344,6 @@
DROP_CONTAINER_VERTICAL_CLS,
DROP_CONTAINER_HORIZONTAL_CLS
],
direction: 'vertical',
mirrorContainer: formContainerRef.current
});
setDrake(dragulaInstance);
Expand Down Expand Up @@ -383,7 +381,7 @@
// fire event after render to notify interested parties
useEffect(() => {
eventBus.fire('formEditor.rendered');
}, []);

Check warning on line 384 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (ubuntu-20.04, 16)

React Hook useEffect has a missing dependency: 'eventBus'. Either include it or remove the dependency array

Check warning on line 384 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (macos-latest, 16)

React Hook useEffect has a missing dependency: 'eventBus'. Either include it or remove the dependency array

Check warning on line 384 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (windows-latest, 16)

React Hook useEffect has a missing dependency: 'eventBus'. Either include it or remove the dependency array

Check warning on line 384 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (ubuntu-20.04, 16)

React Hook useEffect has a missing dependency: 'eventBus'. Either include it or remove the dependency array

Check warning on line 384 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (windows-latest, 16)

React Hook useEffect has a missing dependency: 'eventBus'. Either include it or remove the dependency array

Check warning on line 384 in packages/form-js-editor/src/render/components/FormEditor.js

View workflow job for this annotation

GitHub Actions / Build (macos-latest, 16)

React Hook useEffect has a missing dependency: 'eventBus'. Either include it or remove the dependency array

const formRenderContext = {
Children,
Expand Down
Loading