@node-projects/web-component-designer 0.0.265 → 0.0.266
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/services/bindableObjectsService/IBindableObjectDragDropService.d.ts +3 -0
- package/dist/elements/widgets/propertyGrid/PropertyGridPropertyList.d.ts +3 -0
- package/dist/elements/widgets/propertyGrid/PropertyGridPropertyList.js +40 -0
- package/dist/elements/widgets/propertyGrid/PropertyGridWithHeader.js +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { IDesignerCanvas } from "../../widgets/designerView/IDesignerCanvas.js";
|
|
2
|
+
import { IProperty } from "../propertiesService/IProperty.js";
|
|
2
3
|
import { IBindableObject } from "./IBindableObject.js";
|
|
3
4
|
export interface IBindableObjectDragDropService {
|
|
4
5
|
dragEnter(designerCanvas: IDesignerCanvas, event: DragEvent, element: Element): any;
|
|
5
6
|
dragLeave(designerCanvas: IDesignerCanvas, event: DragEvent, element: Element): any;
|
|
6
7
|
dragOver(designerCanvas: IDesignerCanvas, event: DragEvent, element: Element): 'none' | 'copy' | 'link' | 'move';
|
|
7
8
|
drop(designerCanvas: IDesignerCanvas, event: DragEvent, bindableObject: IBindableObject<any>, element: Element): any;
|
|
9
|
+
dragOverOnProperty?(event: DragEvent, property: IProperty): 'none' | 'copy' | 'link' | 'move';
|
|
10
|
+
dropOnProperty?(event: DragEvent, property: IProperty): any;
|
|
8
11
|
}
|
|
@@ -17,6 +17,9 @@ export declare class PropertyGridPropertyList extends BaseCustomWebComponentLazy
|
|
|
17
17
|
createElements(designItem: IDesignItem): void;
|
|
18
18
|
private createPropertyGroups;
|
|
19
19
|
private createPropertyEditors;
|
|
20
|
+
private _onDragLeave;
|
|
21
|
+
private _onDragOver;
|
|
22
|
+
private _onDrop;
|
|
20
23
|
openContextMenu(event: MouseEvent, property: IProperty): void;
|
|
21
24
|
static openContextMenu(event: MouseEvent, designItems: IDesignItem[], property: IProperty): void;
|
|
22
25
|
designItemsChanged(designItems: IDesignItem[]): void;
|
|
@@ -3,6 +3,7 @@ import { RefreshMode } from '../../services/propertiesService/IPropertiesService
|
|
|
3
3
|
import { ValueType } from '../../services/propertiesService/ValueType.js';
|
|
4
4
|
import { ContextMenu } from '../../helper/contextMenu/ContextMenu.js';
|
|
5
5
|
import { PropertyType } from '../../services/propertiesService/PropertyType.js';
|
|
6
|
+
import { dragDropFormatNameBindingObject } from '../../../Constants.js';
|
|
6
7
|
export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
|
|
7
8
|
_div;
|
|
8
9
|
_propertyMap = new Map();
|
|
@@ -90,6 +91,10 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
|
|
|
90
91
|
font-size: 10px;
|
|
91
92
|
text-decoration: underline;
|
|
92
93
|
}
|
|
94
|
+
.createBinding {
|
|
95
|
+
outline: 2px dashed orange;
|
|
96
|
+
outline-offset: -2px;
|
|
97
|
+
}
|
|
93
98
|
`;
|
|
94
99
|
}
|
|
95
100
|
constructor(serviceContainer) {
|
|
@@ -181,6 +186,9 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
|
|
|
181
186
|
label.htmlFor = p.name;
|
|
182
187
|
label.textContent = p.name;
|
|
183
188
|
label.title = p.name;
|
|
189
|
+
label.ondragleave = (e) => this._onDragLeave(e, p, label);
|
|
190
|
+
label.ondragover = (e) => this._onDragOver(e, p, label);
|
|
191
|
+
label.ondrop = (e) => this._onDrop(e, p, label);
|
|
184
192
|
this._div.appendChild(label);
|
|
185
193
|
}
|
|
186
194
|
else {
|
|
@@ -206,6 +214,38 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
|
|
|
206
214
|
}
|
|
207
215
|
}
|
|
208
216
|
}
|
|
217
|
+
_onDragLeave(event, property, label) {
|
|
218
|
+
event.preventDefault();
|
|
219
|
+
label.classList.remove('createBinding');
|
|
220
|
+
}
|
|
221
|
+
_onDragOver(event, property, label) {
|
|
222
|
+
event.preventDefault();
|
|
223
|
+
const hasTransferDataBindingObject = event.dataTransfer.types.indexOf(dragDropFormatNameBindingObject) >= 0;
|
|
224
|
+
if (hasTransferDataBindingObject) {
|
|
225
|
+
const ddService = this._serviceContainer.bindableObjectDragDropService;
|
|
226
|
+
if (ddService) {
|
|
227
|
+
const effect = ddService.dragOverOnProperty(event, property);
|
|
228
|
+
if ((effect ?? 'none') != 'none') {
|
|
229
|
+
label.classList.add('createBinding');
|
|
230
|
+
event.dataTransfer.dropEffect = effect;
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
label.classList.remove('createBinding');
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
_onDrop(event, property, label) {
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
label.classList.remove('createBinding');
|
|
241
|
+
const hasTransferDataBindingObject = event.dataTransfer.types.indexOf(dragDropFormatNameBindingObject) >= 0;
|
|
242
|
+
if (hasTransferDataBindingObject) {
|
|
243
|
+
const ddService = this._serviceContainer.bindableObjectDragDropService;
|
|
244
|
+
if (ddService) {
|
|
245
|
+
ddService.dropOnProperty(event, property);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
209
249
|
openContextMenu(event, property) {
|
|
210
250
|
PropertyGridPropertyList.openContextMenu(event, this._designItems, property);
|
|
211
251
|
}
|
|
@@ -15,7 +15,7 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
|
|
|
15
15
|
}
|
|
16
16
|
div.root {
|
|
17
17
|
display: grid;
|
|
18
|
-
grid-template-columns:
|
|
18
|
+
grid-template-columns: 11px 11px auto 1fr;
|
|
19
19
|
padding: 3px 6px;
|
|
20
20
|
font-family: monospace;
|
|
21
21
|
align-items: center;
|