@node-projects/web-component-designer 0.0.274 → 0.0.276

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.
@@ -1,3 +1,4 @@
1
1
  export declare const dragDropFormatNameElementDefinition = "text/json/elementdefintion";
2
2
  export declare const dragDropFormatNameBindingObject = "text/json/bindingobject";
3
+ export declare const dragDropFormatNamePropertyGrid = "text/json/propertydrop";
3
4
  export declare var assetsPath: string;
package/dist/Constants.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export const dragDropFormatNameElementDefinition = 'text/json/elementdefintion';
2
2
  export const dragDropFormatNameBindingObject = 'text/json/bindingobject';
3
+ export const dragDropFormatNamePropertyGrid = 'text/json/propertydrop';
3
4
  //export const assetsPath = './node_modules/@node-projects/web-component-designer/assets/';
4
5
  let imporUrl = new URL((import.meta.url));
5
6
  export var assetsPath = imporUrl.origin + imporUrl.pathname.split('/').slice(0, -1).join('/') + '/../assets/';
@@ -42,6 +42,7 @@ import { IDesignItemDocumentPositionService } from './designItemDocumentPosition
42
42
  import { IDragDropService } from './dragDropService/IDragDropService.js';
43
43
  import { IDesignItemService } from './designItemService/IDesignItemService.js';
44
44
  import { IEventsService } from './eventsService/IEventsService.js';
45
+ import { IPropertyGridDragDropService } from './dragDropService/IPropertyGridDragDropService.js';
45
46
  interface ServiceNameMap {
46
47
  "propertyService": IPropertiesService;
47
48
  "containerService": IPlacementService;
@@ -65,6 +66,7 @@ interface ServiceNameMap {
65
66
  "dragDropService": IDragDropService;
66
67
  "designItemService": IDesignItemService;
67
68
  "eventsService": IEventsService;
69
+ "propertyGridDragDropService": IPropertyGridDragDropService;
68
70
  "undoService": (designerCanvas: IDesignerCanvas) => IUndoService;
69
71
  "selectionService": (designerCanvas: IDesignerCanvas) => ISelectionService;
70
72
  "contentService": (designerCanvas: IDesignerCanvas) => IContentService;
@@ -91,6 +93,7 @@ export declare class ServiceContainer extends BaseServiceContainer<ServiceNameMa
91
93
  get bindingService(): IBindingService;
92
94
  get bindableObjectsServices(): IBindableObjectsService[];
93
95
  get bindableObjectDragDropService(): IBindableObjectDragDropService;
96
+ get propertyGridDragDropService(): IPropertyGridDragDropService;
94
97
  get dragDropService(): IDragDropService;
95
98
  get elementInteractionServices(): IElementInteractionService[];
96
99
  get propertiesServices(): IPropertiesService[];
@@ -34,6 +34,9 @@ export class ServiceContainer extends BaseServiceContainer {
34
34
  get bindableObjectDragDropService() {
35
35
  return this.getLastService('bindableObjectDragDropService');
36
36
  }
37
+ get propertyGridDragDropService() {
38
+ return this.getLastService('propertyGridDragDropService');
39
+ }
37
40
  get dragDropService() {
38
41
  return this.getLastService('dragDropService');
39
42
  }
@@ -0,0 +1,5 @@
1
+ import { IDesignerCanvas } from "../../widgets/designerView/IDesignerCanvas.js";
2
+ export interface IExternalDragDropService {
3
+ dragOver(event: DragEvent): 'none' | 'copy' | 'link' | 'move';
4
+ drop(designerCanvas: IDesignerCanvas, event: DragEvent): any;
5
+ }
@@ -0,0 +1,6 @@
1
+ import { IDesignItem } from "../../item/IDesignItem.js";
2
+ import { IProperty } from "../propertiesService/IProperty.js";
3
+ export interface IPropertyGridDragDropService {
4
+ dragOverOnProperty?(event: DragEvent, property: IProperty, designItems: IDesignItem[]): 'none' | 'copy' | 'link' | 'move';
5
+ dropOnProperty?(event: DragEvent, property: IProperty, dropObject: any, designItems: IDesignItem[]): void;
6
+ }
@@ -13,7 +13,7 @@ export class ColorPropertyEditor extends BasePropertyEditor {
13
13
  }
14
14
  refreshValue(valueType, value) {
15
15
  if (!value)
16
- this.element.value = null;
16
+ this.element.value = '#000000';
17
17
  else {
18
18
  let w3Col = w3color.toColorObject(value);
19
19
  this.element.value = w3Col.toHexString();
@@ -3,7 +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
+ import { dragDropFormatNameBindingObject, dragDropFormatNamePropertyGrid } from '../../../Constants.js';
7
7
  export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
8
8
  _div;
9
9
  _propertyMap = new Map();
@@ -91,7 +91,7 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
91
91
  font-size: 10px;
92
92
  text-decoration: underline;
93
93
  }
94
- .createBinding {
94
+ .dragOverProperty {
95
95
  outline: 2px dashed orange;
96
96
  outline-offset: -2px;
97
97
  }
@@ -216,7 +216,7 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
216
216
  }
217
217
  _onDragLeave(event, property, label) {
218
218
  event.preventDefault();
219
- label.classList.remove('createBinding');
219
+ label.classList.remove('dragOverProperty');
220
220
  }
221
221
  _onDragOver(event, property, label) {
222
222
  event.preventDefault();
@@ -226,18 +226,32 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
226
226
  if (ddService) {
227
227
  const effect = ddService.dragOverOnProperty(event, property, this._designItems);
228
228
  if ((effect ?? 'none') != 'none') {
229
- label.classList.add('createBinding');
229
+ label.classList.add('dragOverProperty');
230
230
  event.dataTransfer.dropEffect = effect;
231
231
  }
232
232
  else {
233
- label.classList.remove('createBinding');
233
+ label.classList.remove('dragOverProperty');
234
+ }
235
+ }
236
+ }
237
+ const hasPropertyGrid = event.dataTransfer.types.indexOf(dragDropFormatNamePropertyGrid) >= 0;
238
+ if (hasPropertyGrid) {
239
+ const ddService = this._serviceContainer.propertyGridDragDropService;
240
+ if (ddService) {
241
+ const effect = ddService.dragOverOnProperty(event, property, this._designItems);
242
+ if ((effect ?? 'none') != 'none') {
243
+ label.classList.add('dragOverProperty');
244
+ event.dataTransfer.dropEffect = effect;
245
+ }
246
+ else {
247
+ label.classList.remove('dragOverProperty');
234
248
  }
235
249
  }
236
250
  }
237
251
  }
238
252
  _onDrop(event, property, label) {
239
253
  event.preventDefault();
240
- label.classList.remove('createBinding');
254
+ label.classList.remove('dragOverProperty');
241
255
  const transferDataBindingObject = event.dataTransfer.getData(dragDropFormatNameBindingObject);
242
256
  if (transferDataBindingObject) {
243
257
  const bo = JSON.parse(transferDataBindingObject);
@@ -246,6 +260,14 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
246
260
  ddService.dropOnProperty(event, property, bo, this._designItems);
247
261
  }
248
262
  }
263
+ const transferDataPropertyGrid = event.dataTransfer.getData(dragDropFormatNamePropertyGrid);
264
+ if (transferDataPropertyGrid) {
265
+ const dropObj = JSON.parse(transferDataPropertyGrid);
266
+ const ddService = this._serviceContainer.propertyGridDragDropService;
267
+ if (ddService) {
268
+ ddService.dropOnProperty(event, property, dropObj, this._designItems);
269
+ }
270
+ }
249
271
  }
250
272
  openContextMenu(event, property) {
251
273
  PropertyGridPropertyList.openContextMenu(event, this._designItems, property);
package/dist/index.d.ts CHANGED
@@ -50,6 +50,7 @@ export * from "./elements/services/designItemService/DesignItemService.js";
50
50
  export type { IDesignItemService } from "./elements/services/designItemService/IDesignItemService.js";
51
51
  export * from "./elements/services/dragDropService/ExternalDragDropService.js";
52
52
  export type { IExternalDragDropService } from "./elements/services/dragDropService/IExternalDragDropService.js";
53
+ export type { IPropertyGridDragDropService } from "./elements/services/dragDropService/IPropertyGridDragDropService.js";
53
54
  export * from "./elements/services/dragDropService/DragDropService.js";
54
55
  export type { IDragDropService } from "./elements/services/dragDropService/IDragDropService.js";
55
56
  export type { IElementInteractionService } from "./elements/services/elementInteractionService/IElementInteractionService.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "A UI designer for Polymer apps",
3
3
  "name": "@node-projects/web-component-designer",
4
- "version": "0.0.274",
4
+ "version": "0.0.276",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "",