Skip to content

Commit c9d8665

Browse files
committed
MC-1184: Create Dev Docs
- Update dev documentation for drag & drop implementation
1 parent 4573935 commit c9d8665

18 files changed

+157
-459
lines changed

app/code/Magento/PageBuilder/docs/events.md

Lines changed: 81 additions & 431 deletions
Large diffs are not rendered by default.

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/products/preview.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/buttons/preview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import createContentType from "../../content-type-factory";
1212
import Option from "../../content-type-menu/option";
1313
import OptionInterface from "../../content-type-menu/option.d";
1414
import ButtonItem from "../button-item/preview";
15-
import ContentTypeMountEventParamsInterface from "../content-type-mount-event-params.d";
15+
import ContentTypeDroppedCreateEventParamsInterface from "../content-type-dropped-create-event-params";
1616
import PreviewCollection from "../preview-collection";
1717

1818
export default class Preview extends PreviewCollection {
@@ -21,7 +21,7 @@ export default class Preview extends PreviewCollection {
2121
public bindEvents() {
2222
super.bindEvents();
2323

24-
events.on("buttons:contentType:dropped:create", (args: ContentTypeMountEventParamsInterface) => {
24+
events.on("buttons:contentType:dropped:create", (args: ContentTypeDroppedCreateEventParamsInterface) => {
2525
if (args.id === this.parent.id && this.parent.children().length === 0) {
2626
this.addButton();
2727
}

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/column-group/preview.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import ContentTypeInterface from "../../content-type.d";
1515
import {animationTime} from "../../drag-drop/container-animation";
1616
import {moveContentType} from "../../drag-drop/move-content-type";
1717
import {getDraggedContentTypeConfig} from "../../drag-drop/registry";
18-
import {moveArrayItem} from "../../utils/array";
1918
import {createStyleSheet} from "../../utils/create-stylesheet";
2019
import {default as ColumnGroupPreview} from "../column-group/preview";
2120
import Column from "../column/preview";
21+
import ContentTypeRemovedEventParamsInterface from "../content-type-removed-event-params";
2222
import PreviewCollection from "../preview-collection";
2323
import {calculateDropPositions, DropPosition} from "./drag-and-drop";
2424
import {createColumn} from "./factory";
@@ -29,12 +29,6 @@ import {
2929
getRoundedColumnWidth, getSmallestColumnWidth, resizeColumn, updateColumnWidth,
3030
} from "./resizing";
3131

32-
interface ContentTypeRemovedParams {
33-
parent: ColumnGroup;
34-
contentType: Column;
35-
index: number;
36-
}
37-
3832
export default class Preview extends PreviewCollection {
3933
public resizing: KnockoutObservable<boolean> = ko.observable(false);
4034
public hasEmptyChild: KnockoutComputed<boolean> = ko.computed(() => {
@@ -81,7 +75,7 @@ export default class Preview extends PreviewCollection {
8175
) {
8276
super(parent, config, stageId);
8377

84-
events.on("contentType:removed", (args: ContentTypeRemovedParams) => {
78+
events.on("contentType:removed", (args: ContentTypeRemovedEventParamsInterface) => {
8579
if (args.parent.id === this.parent.id) {
8680
this.spreadWidth(event, args);
8781
}

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/content-type-after-render-event-params.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
import ContentTypeCollectionInterface from "../content-type-collection.d";
67
import ContentTypeInterface from "../content-type.d";
78

89
export default interface ContentTypeAfterRenderEventParamsInterface {
910
id: string;
1011
element: Element;
11-
contentType: ContentTypeInterface;
12+
contentType: ContentTypeInterface & ContentTypeCollectionInterface;
1213
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
import ContentTypeCollectionInterface from "../content-type-collection.d";
7+
import ContentTypeInterface from "../content-type.d";
8+
9+
export interface ContentTypeBeforeMoveEventParams {
10+
contentType: ContentTypeInterface & ContentTypeCollectionInterface;
11+
sourceParent: ContentTypeCollectionInterface;
12+
targetParent: ContentTypeCollectionInterface;
13+
targetIndex: number;
14+
stageId: string;
15+
}

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/content-type-create-event-params.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
import ContentTypeCollectionInterface from "../content-type-collection.d";
67
import ContentTypeInterface from "../content-type.d";
78

89
export default interface ContentTypeCreateEventParamsInterface {
910
id: string;
10-
contentType: ContentTypeInterface;
11+
contentType: ContentTypeInterface & ContentTypeCollectionInterface;
1112
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
import ContentTypeCollectionInterface from "../content-type-collection.d";
7+
import ContentTypeInterface from "../content-type.d";
8+
9+
export default interface ContentTypeDroppedCreateEventParamsInterface {
10+
id: string;
11+
contentType: ContentTypeInterface & ContentTypeCollectionInterface;
12+
}

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/content-type-duplicate-event-params.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
import ContentTypeCollectionInterface from "../content-type-collection.d";
67
import ContentTypeInterface from "../content-type.d";
78

89
export default interface ContentTypeDuplicateEventParamsInterface {
9-
id: string;
10-
contentType: ContentTypeInterface;
10+
originalContentType: ContentTypeInterface & ContentTypeCollectionInterface;
11+
duplicateContentType: ContentTypeInterface & ContentTypeCollectionInterface;
12+
index: number;
1113
}

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/content-type-mount-event-params.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
import ContentTypeCollectionInterface from "../content-type-collection.d";
67
import ContentTypeInterface from "../content-type.d";
78

89
export default interface ContentTypeMountEventParamsInterface {
910
id: string;
10-
contentType: ContentTypeInterface;
11+
contentType: ContentTypeInterface & ContentTypeCollectionInterface;
1112
}

0 commit comments

Comments
 (0)