@node-projects/web-component-designer 0.0.273 → 0.0.275
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/Constants.d.ts +1 -0
- package/dist/Constants.js +1 -0
- package/dist/elements/controls/MetricsEditor.d.ts +4 -0
- package/dist/elements/controls/MetricsEditor.js +30 -5
- package/dist/elements/helper/GridHelper.d.ts +2 -2
- package/dist/elements/helper/GridHelper.js +8 -4
- package/dist/elements/helper/contextMenu/ContextMenu.d.ts +2 -2
- package/dist/elements/helper/contextMenu/ContextMenu.js +2 -2
- package/dist/elements/helper/contextMenu/IContextMenuItem.d.ts +4 -1
- package/dist/elements/helper/contextMenu/IContextMenuItem.js +1 -0
- package/dist/elements/services/ServiceContainer.d.ts +3 -0
- package/dist/elements/services/ServiceContainer.js +3 -0
- package/dist/elements/services/dragDropService/IExternalDragDropService copy.d.ts +5 -0
- package/dist/elements/services/dragDropService/IExternalDragDropService copy.js +1 -0
- package/dist/elements/services/dragDropService/IPropertyGridDragDropService.d.ts +6 -0
- package/dist/elements/services/dragDropService/IPropertyGridDragDropService.js +1 -0
- package/dist/elements/services/placementService/GridPlacementService.js +9 -5
- package/dist/elements/services/propertiesService/propertyEditors/ColorPropertyEditor.js +1 -1
- package/dist/elements/services/propertiesService/propertyEditors/SelectPropertyEditor.d.ts +3 -1
- package/dist/elements/services/propertiesService/propertyEditors/SelectPropertyEditor.js +22 -5
- package/dist/elements/services/propertiesService/propertyEditors/special/GridAssignedRowColumnPropertyEditor.js +7 -6
- package/dist/elements/services/propertiesService/propertyEditors/special/MetricsPropertyEditor.js +1 -1
- package/dist/elements/services/propertiesService/services/AbstractPolymerLikePropertiesService.js +4 -0
- package/dist/elements/services/propertiesService/services/CommonPropertiesService.js +5 -0
- package/dist/elements/widgets/designerView/extensions/grid/DisplayGridExtension.js +3 -3
- package/dist/elements/widgets/designerView/extensions/grid/EditGridColumnRowSizesExtension.d.ts +2 -2
- package/dist/elements/widgets/designerView/extensions/grid/EditGridColumnRowSizesExtension.js +2 -2
- package/dist/elements/widgets/propertyGrid/PropertyGridPropertyList.js +45 -10
- package/dist/index.d.ts +2 -1
- package/package.json +1 -1
package/dist/Constants.d.ts
CHANGED
|
@@ -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/';
|
|
@@ -8,7 +8,11 @@ export declare class MetricsEditor extends BaseCustomWebComponentConstructorAppe
|
|
|
8
8
|
static readonly template: HTMLTemplateElement;
|
|
9
9
|
property: string;
|
|
10
10
|
unsetValue: string;
|
|
11
|
+
private _borderDiv;
|
|
12
|
+
private _elementDiv;
|
|
13
|
+
constructor();
|
|
11
14
|
ready(): void;
|
|
12
15
|
onDoubleClick(event: PointerEvent): void;
|
|
13
16
|
onKeyDown(event: KeyboardEvent): void;
|
|
17
|
+
refresh(element: Element): void;
|
|
14
18
|
}
|
|
@@ -50,6 +50,10 @@ div.ct {
|
|
|
50
50
|
vertical-align: middle;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
div.ct.box {
|
|
54
|
+
border: dotted 2px black;
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
div.ct > div.ct {
|
|
54
58
|
left: 0;
|
|
55
59
|
top: 0;
|
|
@@ -83,17 +87,25 @@ span {
|
|
|
83
87
|
text-overflow: ellipsis;
|
|
84
88
|
}`;
|
|
85
89
|
static template = html `
|
|
86
|
-
<div class="ct"><span title="position">position</span>
|
|
87
|
-
<div data-style="position" @keydown="onKeyDown" @dblclick="onDoubleClick" class="top">-</div><br><div data-style="position" @keydown="onKeyDown" @dblclick="onDoubleClick" class="left">-</div><div class="ct"><span title="margin">margin</span>
|
|
88
|
-
<div data-style="margin" @keydown="onKeyDown" @dblclick="onDoubleClick" class="top">-</div><br><div @keydown="onKeyDown" @dblclick="onDoubleClick" class="left">-</div><div class="ct"><span title="border">border</span>
|
|
89
|
-
<div data-style="border" @keydown="onKeyDown" @dblclick="onDoubleClick" class="top">-</div><br><div @keydown="onKeyDown" @dblclick="onDoubleClick" class="left">-</div><div class="ct"><span title="padding">padding</span>
|
|
90
|
-
<div data-style="padding" @keydown="onKeyDown" @dblclick="onDoubleClick" class="top">-</div><br><div @keydown="onKeyDown" @dblclick="onDoubleClick" class="left">-</div><div class="ct" style="font-size:6px"><div data-style="element" @keydown="onKeyDown" @dblclick="onDoubleClick" class="left">-</div>
|
|
90
|
+
<div id="position" class="ct"><span title="position">position</span>
|
|
91
|
+
<div data-style="position" @keydown="onKeyDown" @dblclick="onDoubleClick" class="top">-</div><br><div data-style="position" @keydown="onKeyDown" @dblclick="onDoubleClick" class="left">-</div><div id="margin" class="ct"><span title="margin">margin</span>
|
|
92
|
+
<div data-style="margin" @keydown="onKeyDown" @dblclick="onDoubleClick" class="top">-</div><br><div @keydown="onKeyDown" @dblclick="onDoubleClick" class="left">-</div><div id="border" class="ct"><span title="border">border</span>
|
|
93
|
+
<div data-style="border" @keydown="onKeyDown" @dblclick="onDoubleClick" class="top">-</div><br><div @keydown="onKeyDown" @dblclick="onDoubleClick" class="left">-</div><div id="padding" class="ct"><span title="padding">padding</span>
|
|
94
|
+
<div data-style="padding" @keydown="onKeyDown" @dblclick="onDoubleClick" class="top">-</div><br><div @keydown="onKeyDown" @dblclick="onDoubleClick" class="left">-</div><div id="element" class="ct" style="font-size:6px"><div data-style="element" @keydown="onKeyDown" @dblclick="onDoubleClick" class="left">-</div>
|
|
91
95
|
x
|
|
92
96
|
<div data-style="element" @keydown="onKeyDown" @dblclick="onDoubleClick" class="right">-</div>
|
|
93
97
|
</div><div data-style="padding" @keydown="onKeyDown" @dblclick="onDoubleClick" class="right">-</div><br><div data-style="padding" @keydown="onKeyDown" @dblclick="onDoubleClick" class="bottom">-</div></div><div data-style="border" @keydown="onKeyDown" @dblclick="onDoubleClick" class="right">-</div><br><div data-style="border" @keydown="onKeyDown" @dblclick="onDoubleClick" class="bottom">-</div></div><div data-style="margin" @keydown="onKeyDown" @dblclick="onDoubleClick" class="right">-</div><br><div data-style="margin" @keydown="onKeyDown" @dblclick="onDoubleClick" class="bottom">-</div></div><div data-style="position" @keydown="onKeyDown" @dblclick="onDoubleClick" class="right">-</div><br><div data-style="position" @keydown="onKeyDown" @dblclick="onDoubleClick" class="bottom">-</div></div>
|
|
94
98
|
`;
|
|
95
99
|
property;
|
|
96
100
|
unsetValue;
|
|
101
|
+
_borderDiv;
|
|
102
|
+
_elementDiv;
|
|
103
|
+
constructor() {
|
|
104
|
+
super();
|
|
105
|
+
this._restoreCachedInititalValues();
|
|
106
|
+
this._borderDiv = this._getDomElement('border');
|
|
107
|
+
this._elementDiv = this._getDomElement('element');
|
|
108
|
+
}
|
|
97
109
|
ready() {
|
|
98
110
|
this._parseAttributesToProperties();
|
|
99
111
|
this._assignEvents();
|
|
@@ -122,5 +134,18 @@ span {
|
|
|
122
134
|
this.dispatchEvent(valueChangedEvent);
|
|
123
135
|
}
|
|
124
136
|
}
|
|
137
|
+
refresh(element) {
|
|
138
|
+
this._elementDiv.classList.remove('box');
|
|
139
|
+
this._borderDiv.classList.remove('box');
|
|
140
|
+
if (element) {
|
|
141
|
+
let cp = getComputedStyle(element);
|
|
142
|
+
if (cp.boxSizing == 'content-box') {
|
|
143
|
+
this._elementDiv.classList.add('box');
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
this._borderDiv.classList.add('box');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
125
150
|
}
|
|
126
151
|
customElements.define('node-projects-metrics-editor', MetricsEditor);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IDesignItem } from "../item/IDesignItem.js";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function getElementGridInformation(element: HTMLElement): {
|
|
3
3
|
colSpan: number;
|
|
4
4
|
rowSpan: number;
|
|
5
5
|
};
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function calculateGridInformation(designItem: IDesignItem): {
|
|
7
7
|
cells?: {
|
|
8
8
|
x: number;
|
|
9
9
|
y: number;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { getDesignerCanvasNormalizedTransformedCornerDOMPoints } from "./TransformHelper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function getElementGridInformation(element) {
|
|
3
3
|
let cs = getComputedStyle(element);
|
|
4
4
|
let rowSpan = 1;
|
|
5
5
|
let colSpan = 1;
|
|
6
|
-
if (cs.gridRowEnd
|
|
6
|
+
if (cs.gridRowEnd == 'auto')
|
|
7
|
+
rowSpan = 1;
|
|
8
|
+
else if (cs.gridRowEnd.startsWith('span'))
|
|
7
9
|
rowSpan = parseInt(cs.gridRowEnd.substring(4));
|
|
8
10
|
else
|
|
9
11
|
rowSpan = parseInt(cs.gridRowEnd) - parseInt(cs.gridRowStart);
|
|
10
|
-
if (cs.gridColumnEnd
|
|
12
|
+
if (cs.gridColumnEnd == 'auto')
|
|
13
|
+
colSpan = 1;
|
|
14
|
+
else if (cs.gridColumnEnd.startsWith('span'))
|
|
11
15
|
colSpan = parseInt(cs.gridColumnEnd.substring(4));
|
|
12
16
|
else
|
|
13
17
|
colSpan = parseInt(cs.gridColumnEnd) - parseInt(cs.gridColumnStart);
|
|
14
18
|
return { colSpan, rowSpan };
|
|
15
19
|
}
|
|
16
|
-
export function
|
|
20
|
+
export function calculateGridInformation(designItem) {
|
|
17
21
|
//todo:
|
|
18
22
|
//same name should combine columns/rows
|
|
19
23
|
let itemRect = designItem.instanceServiceContainer.designerCanvas.getNormalizedElementCoordinates(designItem.element);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IContextMenuItem } from './IContextMenuItem.js';
|
|
1
|
+
import { IContextMenu, IContextMenuItem } from './IContextMenuItem.js';
|
|
2
2
|
export interface IContextMenuOptions {
|
|
3
3
|
defaultIcon?: string;
|
|
4
4
|
subIcon?: string;
|
|
@@ -6,7 +6,7 @@ export interface IContextMenuOptions {
|
|
|
6
6
|
shadowRoot?: ShadowRoot | Document;
|
|
7
7
|
mode?: 'normal' | 'undo';
|
|
8
8
|
}
|
|
9
|
-
export declare class ContextMenu {
|
|
9
|
+
export declare class ContextMenu implements IContextMenu {
|
|
10
10
|
private static _contextMenuCss;
|
|
11
11
|
static count: number;
|
|
12
12
|
menu: IContextMenuItem[];
|
|
@@ -183,12 +183,12 @@ export class ContextMenu {
|
|
|
183
183
|
else {
|
|
184
184
|
if (item.action)
|
|
185
185
|
li.addEventListener('click', (e) => {
|
|
186
|
-
item.action(e, item, this.context);
|
|
186
|
+
item.action(e, item, this.context, this);
|
|
187
187
|
this.close();
|
|
188
188
|
});
|
|
189
189
|
if (this.options?.mode == 'undo') {
|
|
190
190
|
li.addEventListener('mouseup', (e) => {
|
|
191
|
-
item.action(e, item, this.context);
|
|
191
|
+
item.action(e, item, this.context, this);
|
|
192
192
|
this.close();
|
|
193
193
|
});
|
|
194
194
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export interface IContextMenu {
|
|
2
|
+
close: () => void;
|
|
3
|
+
}
|
|
1
4
|
export interface IContextMenuItem {
|
|
2
5
|
readonly id?: string;
|
|
3
6
|
readonly title?: string;
|
|
@@ -5,5 +8,5 @@ export interface IContextMenuItem {
|
|
|
5
8
|
readonly children?: IContextMenuItem[];
|
|
6
9
|
readonly disabled?: boolean;
|
|
7
10
|
readonly shortCut?: string;
|
|
8
|
-
action?: (event: MouseEvent, item: IContextMenuItem, context?: any) => void;
|
|
11
|
+
action?: (event: MouseEvent, item: IContextMenuItem, context?: any, menu?: IContextMenu) => void;
|
|
9
12
|
}
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { calculateGridInformation, getElementGridInformation } from '../../helper/GridHelper.js';
|
|
2
2
|
import { pointInRect } from '../../helper/Helper.js';
|
|
3
3
|
import { DefaultPlacementService } from './DefaultPlacementService.js';
|
|
4
4
|
export class GridPlacementService {
|
|
@@ -49,15 +49,17 @@ export class GridPlacementService {
|
|
|
49
49
|
startPlace(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
50
50
|
}
|
|
51
51
|
place(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
52
|
-
const gridInformation =
|
|
52
|
+
const gridInformation = calculateGridInformation(container);
|
|
53
53
|
const pos = placementView.getNormalizedEventCoordinates(event);
|
|
54
|
+
//pos.x -= offsetInControl.x;
|
|
55
|
+
//pos.y -= offsetInControl.y;
|
|
54
56
|
let row = 0;
|
|
55
57
|
let column = 0;
|
|
56
58
|
for (let cellRow of gridInformation.cells) {
|
|
57
59
|
column = 0;
|
|
58
60
|
for (let cell of cellRow) {
|
|
59
61
|
if (pointInRect(pos, cell)) {
|
|
60
|
-
let info =
|
|
62
|
+
let info = getElementGridInformation(items[0].element);
|
|
61
63
|
if (cell.name) {
|
|
62
64
|
items[0].element.style.gridColumn = '';
|
|
63
65
|
items[0].element.style.gridRow = '';
|
|
@@ -76,8 +78,10 @@ export class GridPlacementService {
|
|
|
76
78
|
placementView.extensionManager.refreshAllExtensions([container]);
|
|
77
79
|
}
|
|
78
80
|
finishPlace(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
79
|
-
const gridInformation =
|
|
81
|
+
const gridInformation = calculateGridInformation(container);
|
|
80
82
|
const pos = placementView.getNormalizedEventCoordinates(event);
|
|
83
|
+
//pos.x -= offsetInControl.x;
|
|
84
|
+
//pos.y -= offsetInControl.y;
|
|
81
85
|
let row = 0;
|
|
82
86
|
let column = 0;
|
|
83
87
|
row = 0;
|
|
@@ -85,7 +89,7 @@ export class GridPlacementService {
|
|
|
85
89
|
column = 0;
|
|
86
90
|
for (let cell of cellRow) {
|
|
87
91
|
if (pointInRect(pos, cell)) {
|
|
88
|
-
let info =
|
|
92
|
+
let info = getElementGridInformation(items[0].element);
|
|
89
93
|
//Grid Area is shorthand for grid row/column, to make undo work correctly we need to set befor and after clear
|
|
90
94
|
if (cell.name) {
|
|
91
95
|
items[0].setStyle('grid-area', cell.name);
|
|
@@ -13,7 +13,7 @@ export class ColorPropertyEditor extends BasePropertyEditor {
|
|
|
13
13
|
}
|
|
14
14
|
refreshValue(valueType, value) {
|
|
15
15
|
if (!value)
|
|
16
|
-
this.element.value =
|
|
16
|
+
this.element.value = '#000000';
|
|
17
17
|
else {
|
|
18
18
|
let w3Col = w3color.toColorObject(value);
|
|
19
19
|
this.element.value = w3Col.toHexString();
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { IProperty } from '../IProperty.js';
|
|
2
2
|
import { BasePropertyEditor } from './BasePropertyEditor.js';
|
|
3
3
|
import { ValueType } from '../ValueType.js';
|
|
4
|
-
export declare class SelectPropertyEditor extends BasePropertyEditor<
|
|
4
|
+
export declare class SelectPropertyEditor extends BasePropertyEditor<HTMLDivElement> {
|
|
5
|
+
elementSelect: HTMLSelectElement;
|
|
6
|
+
elementInput: HTMLInputElement;
|
|
5
7
|
constructor(property: IProperty);
|
|
6
8
|
refreshValue(valueType: ValueType, value: any): void;
|
|
7
9
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { BasePropertyEditor } from './BasePropertyEditor.js';
|
|
2
2
|
export class SelectPropertyEditor extends BasePropertyEditor {
|
|
3
|
+
elementSelect;
|
|
4
|
+
elementInput;
|
|
3
5
|
constructor(property) {
|
|
4
6
|
super(property);
|
|
5
|
-
let element = document.createElement("
|
|
7
|
+
let element = document.createElement("div");
|
|
8
|
+
let elementSel = document.createElement("select");
|
|
6
9
|
if (property.type == 'enum') {
|
|
7
10
|
for (let v of property.enumValues) {
|
|
8
11
|
let option = document.createElement("option");
|
|
9
12
|
option.value = v[1];
|
|
10
13
|
option.text = v[0];
|
|
11
|
-
|
|
14
|
+
elementSel.appendChild(option);
|
|
12
15
|
}
|
|
13
16
|
}
|
|
14
17
|
else {
|
|
@@ -16,13 +19,27 @@ export class SelectPropertyEditor extends BasePropertyEditor {
|
|
|
16
19
|
let option = document.createElement("option");
|
|
17
20
|
option.value = v;
|
|
18
21
|
option.text = v;
|
|
19
|
-
|
|
22
|
+
elementSel.appendChild(option);
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
|
-
|
|
25
|
+
elementSel.onchange = (e) => this._valueChanged(elementSel.value);
|
|
26
|
+
let elementInput = document.createElement("input");
|
|
27
|
+
elementInput.style.display = 'none';
|
|
28
|
+
elementInput.onchange = (e) => this._valueChanged(elementInput.value);
|
|
29
|
+
this.elementSelect = elementSel;
|
|
30
|
+
this.elementInput = elementInput;
|
|
31
|
+
element.appendChild(this.elementSelect);
|
|
32
|
+
element.appendChild(this.elementInput);
|
|
23
33
|
this.element = element;
|
|
24
34
|
}
|
|
25
35
|
refreshValue(valueType, value) {
|
|
26
|
-
this.
|
|
36
|
+
this.elementSelect.style.display = 'block';
|
|
37
|
+
this.elementInput.style.display = 'none';
|
|
38
|
+
this.elementSelect.value = value;
|
|
39
|
+
if (this.elementSelect.value != value && value) {
|
|
40
|
+
this.elementInput.value = value;
|
|
41
|
+
this.elementSelect.style.display = 'none';
|
|
42
|
+
this.elementInput.style.display = 'block';
|
|
43
|
+
}
|
|
27
44
|
}
|
|
28
45
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BasePropertyEditor } from '../BasePropertyEditor.js';
|
|
2
|
+
import { getElementGridInformation } from '../../../../helper/GridHelper.js';
|
|
2
3
|
export class GridAssignedRowColumnPropertyEditor extends BasePropertyEditor {
|
|
3
4
|
//Todo: multiple cell selection, grid area support, span support
|
|
4
5
|
_root;
|
|
@@ -17,25 +18,25 @@ export class GridAssignedRowColumnPropertyEditor extends BasePropertyEditor {
|
|
|
17
18
|
let container = this.designItems[0].element.parentElement;
|
|
18
19
|
if (container) {
|
|
19
20
|
let styleContainer = getComputedStyle(container);
|
|
21
|
+
let info = getElementGridInformation(this.designItems[0].element);
|
|
20
22
|
let style = getComputedStyle(this.designItems[0].element);
|
|
21
23
|
let cntCol = styleContainer.gridTemplateColumns.split(' ').length;
|
|
22
24
|
let cntRow = styleContainer.gridTemplateRows.split(' ').length;
|
|
23
25
|
this._root.style.gridTemplateColumns = 'repeat(' + cntCol + ', 1fr)';
|
|
24
26
|
this._root.style.gridTemplateRows = 'repeat(' + cntRow + ', 1fr)';
|
|
25
27
|
let rowStart = parseInt(style.gridRowStart);
|
|
26
|
-
let rowEnd =
|
|
27
|
-
rowEnd = rowEnd <= rowStart ? rowStart + 1 : rowEnd;
|
|
28
|
+
let rowEnd = rowStart + info.rowSpan;
|
|
28
29
|
let colStart = parseInt(style.gridColumnStart);
|
|
29
|
-
let colEnd =
|
|
30
|
-
colEnd = colEnd <= colStart ? colStart + 1 : colEnd;
|
|
30
|
+
let colEnd = colStart + info.colSpan;
|
|
31
31
|
for (let p = 1; p <= cntRow; p++) {
|
|
32
32
|
for (let n = 1; n <= cntCol; n++) {
|
|
33
33
|
const b = document.createElement('button');
|
|
34
34
|
b.style.minHeight = '10px';
|
|
35
35
|
b.onclick = () => {
|
|
36
|
+
let info = getElementGridInformation(this.designItems[0].element);
|
|
36
37
|
let grp = this.designItems[0].openGroup('Change grid row/column');
|
|
37
|
-
this.designItems[0].setStyle("grid-row", p + ' / ' + (p +
|
|
38
|
-
this.designItems[0].setStyle("grid-column", n + ' / ' + (n +
|
|
38
|
+
this.designItems[0].setStyle("grid-row", p + ' / ' + (p + info.rowSpan));
|
|
39
|
+
this.designItems[0].setStyle("grid-column", n + ' / ' + (n + info.colSpan));
|
|
39
40
|
grp.commit();
|
|
40
41
|
};
|
|
41
42
|
if (p >= rowStart && p < rowEnd && n >= colStart && n < colEnd)
|
package/dist/elements/services/propertiesService/services/AbstractPolymerLikePropertiesService.js
CHANGED
|
@@ -42,6 +42,10 @@ export class AbstractPolymerLikePropertiesService extends AbstractPropertiesServ
|
|
|
42
42
|
let property = { name: name, type: "enum", enumValues: PropertiesHelper.getTypescriptEnumEntries(type), service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
43
43
|
properties.push(property);
|
|
44
44
|
}
|
|
45
|
+
else {
|
|
46
|
+
let property = { name: name, type: "string", service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
47
|
+
properties.push(property);
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
50
|
return properties;
|
|
47
51
|
}
|
|
@@ -24,6 +24,11 @@ export class CommonPropertiesService extends AbstractPropertiesService {
|
|
|
24
24
|
type: "string",
|
|
25
25
|
service: this,
|
|
26
26
|
propertyType: PropertyType.propertyAndAttribute
|
|
27
|
+
}, {
|
|
28
|
+
name: "part",
|
|
29
|
+
type: "string",
|
|
30
|
+
service: this,
|
|
31
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
27
32
|
}, {
|
|
28
33
|
name: "tabindex",
|
|
29
34
|
type: "number",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { calculateGridInformation } from "../../../../helper/GridHelper.js";
|
|
2
2
|
import { getElementCombinedTransform } from "../../../../helper/TransformHelper.js";
|
|
3
3
|
import { AbstractExtension } from '../AbstractExtension.js';
|
|
4
4
|
import { OverlayLayer } from "../OverlayLayer.js";
|
|
@@ -16,7 +16,7 @@ export class DisplayGridExtension extends AbstractExtension {
|
|
|
16
16
|
this.refresh(event);
|
|
17
17
|
}
|
|
18
18
|
refresh(event) {
|
|
19
|
-
this.gridInformation =
|
|
19
|
+
this.gridInformation = calculateGridInformation(this.extendedItem);
|
|
20
20
|
let cells = this.gridInformation.cells;
|
|
21
21
|
if (!this._group) {
|
|
22
22
|
this._group = this._drawGroup(null, this._group, OverlayLayer.Background);
|
|
@@ -56,7 +56,7 @@ export class DisplayGridExtension extends AbstractExtension {
|
|
|
56
56
|
}
|
|
57
57
|
_initSVGArrays() {
|
|
58
58
|
this._removeAllOverlays();
|
|
59
|
-
this.gridInformation =
|
|
59
|
+
this.gridInformation = calculateGridInformation(this.extendedItem);
|
|
60
60
|
this._cells = new Array(this.gridInformation.cells.length);
|
|
61
61
|
this.gridInformation.cells.forEach((row, i) => this._cells[i] = new Array(row.length));
|
|
62
62
|
this._texts = new Array(this.gridInformation.cells.length);
|
package/dist/elements/widgets/designerView/extensions/grid/EditGridColumnRowSizesExtension.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { calculateGridInformation } from "../../../../helper/GridHelper.js";
|
|
2
2
|
import { IDesignItem } from '../../../../item/IDesignItem.js';
|
|
3
3
|
import { IDesignerCanvas } from '../../IDesignerCanvas.js';
|
|
4
4
|
import { AbstractExtension } from '../AbstractExtension.js';
|
|
5
5
|
import { IExtensionManager } from '../IExtensionManger.js';
|
|
6
6
|
export declare class EditGridColumnRowSizesExtension extends AbstractExtension {
|
|
7
|
-
gridInformation: ReturnType<typeof
|
|
7
|
+
gridInformation: ReturnType<typeof calculateGridInformation>;
|
|
8
8
|
private _resizers;
|
|
9
9
|
private _initalPos;
|
|
10
10
|
private _initialSizes;
|
package/dist/elements/widgets/designerView/extensions/grid/EditGridColumnRowSizesExtension.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventNames } from "../../../../../enums/EventNames.js";
|
|
2
2
|
import { convertCssUnit, convertCssUnitToPixel, getCssUnit } from "../../../../helper/CssUnitConverter.js";
|
|
3
|
-
import {
|
|
3
|
+
import { calculateGridInformation } from "../../../../helper/GridHelper.js";
|
|
4
4
|
import { getElementCombinedTransform } from "../../../../helper/TransformHelper.js";
|
|
5
5
|
import { AbstractExtension } from '../AbstractExtension.js';
|
|
6
6
|
import { OverlayLayer } from "../OverlayLayer.js";
|
|
@@ -17,7 +17,7 @@ export class EditGridColumnRowSizesExtension extends AbstractExtension {
|
|
|
17
17
|
this.refresh(event);
|
|
18
18
|
}
|
|
19
19
|
refresh(event) {
|
|
20
|
-
this.gridInformation =
|
|
20
|
+
this.gridInformation = calculateGridInformation(this.extendedItem);
|
|
21
21
|
this._group = this._drawGroup(null, this._group, OverlayLayer.Background);
|
|
22
22
|
this._group.style.transform = getElementCombinedTransform(this.extendedItem.element).toString();
|
|
23
23
|
this._group.style.transformOrigin = '0 0';
|
|
@@ -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
|
-
.
|
|
94
|
+
.dragOverProperty {
|
|
95
95
|
outline: 2px dashed orange;
|
|
96
96
|
outline-offset: -2px;
|
|
97
97
|
}
|
|
@@ -185,7 +185,7 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
|
|
|
185
185
|
let label = document.createElement("label");
|
|
186
186
|
label.htmlFor = p.name;
|
|
187
187
|
label.textContent = p.name;
|
|
188
|
-
label.title = p.name;
|
|
188
|
+
label.title = p.name + ' (type: ' + p.type + (p.defaultValue ? ', default: ' + p.defaultValue : '') + ', propertytype: ' + p.propertyType + ')';
|
|
189
189
|
label.ondragleave = (e) => this._onDragLeave(e, p, label);
|
|
190
190
|
label.ondragover = (e) => this._onDragOver(e, p, label);
|
|
191
191
|
label.ondrop = (e) => this._onDrop(e, p, label);
|
|
@@ -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('
|
|
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('
|
|
229
|
+
label.classList.add('dragOverProperty');
|
|
230
230
|
event.dataTransfer.dropEffect = effect;
|
|
231
231
|
}
|
|
232
232
|
else {
|
|
233
|
-
label.classList.remove('
|
|
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('
|
|
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,21 +260,42 @@ 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);
|
|
252
274
|
}
|
|
253
275
|
static openContextMenu(event, designItems, property) {
|
|
254
|
-
const
|
|
276
|
+
const ctxMenuItems = [
|
|
255
277
|
{
|
|
256
278
|
title: 'clear', action: (e) => {
|
|
257
279
|
property.service.clearValue(designItems, property, 'value');
|
|
258
280
|
designItems[0].instanceServiceContainer.designerCanvas.extensionManager.refreshAllExtensions(designItems);
|
|
259
281
|
}
|
|
260
282
|
},
|
|
283
|
+
{
|
|
284
|
+
title: 'edit as text', action: (e, _1, _2, menu) => {
|
|
285
|
+
menu.close();
|
|
286
|
+
setTimeout(() => {
|
|
287
|
+
const oldValue = property.service.getValue(designItems, property);
|
|
288
|
+
let value = prompt(`edit value of '${property.name}' as string:`, oldValue);
|
|
289
|
+
if (value && value != oldValue) {
|
|
290
|
+
property.service.setValue(designItems, property, value);
|
|
291
|
+
}
|
|
292
|
+
designItems[0].instanceServiceContainer.designerCanvas.extensionManager.refreshAllExtensions(designItems);
|
|
293
|
+
}, 10);
|
|
294
|
+
}
|
|
295
|
+
},
|
|
261
296
|
];
|
|
262
297
|
if (designItems[0].serviceContainer.config.openBindingsEditor) {
|
|
263
|
-
|
|
298
|
+
ctxMenuItems.push(...[
|
|
264
299
|
{ title: '-' },
|
|
265
300
|
{
|
|
266
301
|
title: 'edit binding', action: () => {
|
|
@@ -278,7 +313,7 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
|
|
|
278
313
|
]);
|
|
279
314
|
}
|
|
280
315
|
;
|
|
281
|
-
ContextMenu.show(
|
|
316
|
+
ContextMenu.show(ctxMenuItems, event);
|
|
282
317
|
}
|
|
283
318
|
designItemsChanged(designItems) {
|
|
284
319
|
this._designItems = designItems;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export * from "./elements/helper/contextMenu/ContextMenu.js";
|
|
|
15
15
|
export * from "./elements/helper/Helper.js";
|
|
16
16
|
export * from "./elements/helper/SwitchContainerHelper.js";
|
|
17
17
|
export * from "./elements/helper/NpmPackageLoader.js";
|
|
18
|
-
export type { IContextMenuItem } from "./elements/helper/contextMenu/IContextMenuItem.js";
|
|
18
|
+
export type { IContextMenuItem, IContextMenu } from "./elements/helper/contextMenu/IContextMenuItem.js";
|
|
19
19
|
export * from "./elements/item/DesignItem.js";
|
|
20
20
|
export type { IDesignItem } from "./elements/item/IDesignItem.js";
|
|
21
21
|
export type { IBinding } from "./elements/item/IBinding.js";
|
|
@@ -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";
|