@node-projects/web-component-designer 0.0.253 → 0.0.255
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/item/DesignItem.js +2 -0
- package/dist/elements/services/propertiesService/DefaultEditorTypesService.js +0 -5
- package/dist/elements/services/propertiesService/PropertyTabsService.d.ts +8 -0
- package/dist/elements/services/propertiesService/PropertyTabsService.js +14 -2
- package/dist/elements/services/propertiesService/propertyEditors/GridAssignedRowColumnPropertyEditor.d.ts +8 -0
- package/dist/elements/services/propertiesService/propertyEditors/GridAssignedRowColumnPropertyEditor.js +45 -0
- package/dist/elements/services/propertiesService/propertyEditors/GridRowColumnPropertyEditor.d.ts +10 -0
- package/dist/elements/services/propertiesService/propertyEditors/GridRowColumnPropertyEditor.js +25 -0
- package/dist/elements/services/propertiesService/propertyEditors/JsonPropertyEditor copy.d.ts +9 -0
- package/dist/elements/services/propertiesService/propertyEditors/JsonPropertyEditor copy.js +21 -0
- package/dist/elements/services/propertiesService/propertyEditors/special/GridAssignedRowColumnPropertyEditor.d.ts +8 -0
- package/dist/elements/services/propertiesService/propertyEditors/special/GridAssignedRowColumnPropertyEditor.js +46 -0
- package/dist/elements/services/propertiesService/propertyEditors/special/MetricsPropertyEditor.d.ts +8 -0
- package/dist/elements/services/propertiesService/propertyEditors/special/MetricsPropertyEditor.js +15 -0
- package/dist/elements/services/propertiesService/services/CssPropertiesService.d.ts +4 -1
- package/dist/elements/services/propertiesService/services/CssPropertiesService.js +34 -12
- package/dist/elements/services/selectionService/SelectionService.js +1 -1
- package/dist/elements/widgets/debugView/debug-view.js +5 -3
- package/dist/elements/widgets/designerView/extensions/ExtensionManager.js +2 -2
- package/dist/elements/widgets/propertyGrid/PropertyGrid.js +39 -35
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +3 -3
|
@@ -473,6 +473,8 @@ export class DesignItem {
|
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
475
|
getPlacementService(style) {
|
|
476
|
+
if (this.nodeType != NodeType.Element)
|
|
477
|
+
return null;
|
|
476
478
|
style ??= getComputedStyle(this.element);
|
|
477
479
|
return this.serviceContainer.getLastServiceWhere('containerService', x => x.serviceForContainer(this, style));
|
|
478
480
|
}
|
|
@@ -7,7 +7,6 @@ import { TextPropertyEditor } from './propertyEditors/TextPropertyEditor.js';
|
|
|
7
7
|
import { BooleanPropertyEditor } from './propertyEditors/BooleanPropertyEditor.js';
|
|
8
8
|
import { ImageButtonListPropertyEditor } from './propertyEditors/ImageButtonListPropertyEditor.js';
|
|
9
9
|
import { ThicknessPropertyEditor } from "./propertyEditors/ThicknessPropertyEditor.js";
|
|
10
|
-
import { MetricsPropertyEditor } from './propertyEditors/MetricsPropertyEditor.js';
|
|
11
10
|
export class DefaultEditorTypesService {
|
|
12
11
|
getEditorForProperty(property) {
|
|
13
12
|
if (property.createEditor)
|
|
@@ -49,10 +48,6 @@ export class DefaultEditorTypesService {
|
|
|
49
48
|
{
|
|
50
49
|
return new ThicknessPropertyEditor(property);
|
|
51
50
|
}
|
|
52
|
-
case "metrics":
|
|
53
|
-
{
|
|
54
|
-
return new MetricsPropertyEditor(property);
|
|
55
|
-
}
|
|
56
51
|
case "css-length":
|
|
57
52
|
case "string":
|
|
58
53
|
default:
|
|
@@ -10,6 +10,14 @@ export declare class PropertyTabsService implements IPropertyTabsService {
|
|
|
10
10
|
name: string;
|
|
11
11
|
propertiesService: IPropertiesService;
|
|
12
12
|
}[];
|
|
13
|
+
protected _gridChild: {
|
|
14
|
+
name: string;
|
|
15
|
+
propertiesService: IPropertiesService;
|
|
16
|
+
}[];
|
|
17
|
+
protected _flexChild: {
|
|
18
|
+
name: string;
|
|
19
|
+
propertiesService: IPropertiesService;
|
|
20
|
+
}[];
|
|
13
21
|
getPropertygroups(designItems: IDesignItem[]): {
|
|
14
22
|
name: string;
|
|
15
23
|
propertiesService: IPropertiesService;
|
|
@@ -19,13 +19,25 @@ export class PropertyTabsService {
|
|
|
19
19
|
{ name: 'layout', propertiesService: new CssPropertiesService("layout") },
|
|
20
20
|
{ name: 'svg', propertiesService: new CssPropertiesService("svg") },
|
|
21
21
|
];
|
|
22
|
+
_gridChild = [
|
|
23
|
+
{ name: 'gridChild', propertiesService: new CssPropertiesService("gridChild") },
|
|
24
|
+
];
|
|
25
|
+
_flexChild = [
|
|
26
|
+
{ name: 'flexChild', propertiesService: new CssPropertiesService("flexChild") },
|
|
27
|
+
];
|
|
22
28
|
getPropertygroups(designItems) {
|
|
23
29
|
if (designItems == null || designItems.length == 0)
|
|
24
30
|
return [];
|
|
25
31
|
this._pgList[0].propertiesService = designItems[0].serviceContainer.getLastServiceWhere('propertyService', x => x.isHandledElement(designItems[0]));
|
|
26
32
|
this._svgPgList[0].propertiesService = designItems[0].serviceContainer.getLastServiceWhere('propertyService', x => x.isHandledElement(designItems[0]));
|
|
33
|
+
let lst = this._pgList;
|
|
27
34
|
if (designItems[0].element instanceof SVGElement)
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
lst = this._svgPgList;
|
|
36
|
+
const parentStyle = getComputedStyle(designItems[0].element.parentElement);
|
|
37
|
+
if (parentStyle.display.includes('grid'))
|
|
38
|
+
lst = [...lst, this._gridChild[0]];
|
|
39
|
+
else if (parentStyle.display.includes('flex'))
|
|
40
|
+
lst = [...lst, this._flexChild[0]];
|
|
41
|
+
return lst;
|
|
30
42
|
}
|
|
31
43
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IProperty } from '../IProperty.js';
|
|
2
|
+
import { BasePropertyEditor } from './BasePropertyEditor.js';
|
|
3
|
+
import { ValueType } from '../ValueType.js';
|
|
4
|
+
export declare class GridAssignedRowColumnPropertyEditor extends BasePropertyEditor<HTMLDivElement> {
|
|
5
|
+
_root: HTMLDivElement;
|
|
6
|
+
constructor(property: IProperty);
|
|
7
|
+
refreshValue(valueType: ValueType, value: any): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BasePropertyEditor } from './BasePropertyEditor.js';
|
|
2
|
+
export class GridAssignedRowColumnPropertyEditor extends BasePropertyEditor {
|
|
3
|
+
_root;
|
|
4
|
+
constructor(property) {
|
|
5
|
+
super(property);
|
|
6
|
+
this._root = document.createElement('div');
|
|
7
|
+
this._root.style.display = 'grid';
|
|
8
|
+
this._root.style.padding = '4px 0px';
|
|
9
|
+
this._root.style.boxSizing = 'border-box';
|
|
10
|
+
this._root.style.minHeight = '50px';
|
|
11
|
+
this.element = this._root;
|
|
12
|
+
}
|
|
13
|
+
refreshValue(valueType, value) {
|
|
14
|
+
this._root.innerHTML = "";
|
|
15
|
+
if (this.designItems != null && this.designItems.length) {
|
|
16
|
+
let styleContainer = getComputedStyle(this.designItems[0].element.parentElement);
|
|
17
|
+
let style = getComputedStyle(this.designItems[0].element);
|
|
18
|
+
let cntCol = styleContainer.gridTemplateColumns.split(' ').length;
|
|
19
|
+
let cntRow = styleContainer.gridTemplateRows.split(' ').length;
|
|
20
|
+
this._root.style.gridTemplateColumns = 'repeat(' + cntCol + ', 1fr)';
|
|
21
|
+
this._root.style.gridTemplateRows = 'repeat(' + cntRow + ', 1fr)';
|
|
22
|
+
let rowStart = parseInt(style.gridRowStart);
|
|
23
|
+
let rowEnd = style.gridRowEnd == 'auto' ? rowStart : parseInt(style.gridRowEnd);
|
|
24
|
+
rowEnd = rowEnd <= rowStart ? rowStart + 1 : rowEnd;
|
|
25
|
+
let colStart = parseInt(style.gridColumnStart);
|
|
26
|
+
let colEnd = style.gridColumnEnd == 'auto' ? colStart : parseInt(style.gridColumnEnd);
|
|
27
|
+
colEnd = colEnd <= colStart ? colStart + 1 : colEnd;
|
|
28
|
+
for (let p = 1; p <= cntRow; p++) {
|
|
29
|
+
for (let n = 1; n <= cntCol; n++) {
|
|
30
|
+
const b = document.createElement('button');
|
|
31
|
+
b.style.minHeight = '10px';
|
|
32
|
+
b.onclick = () => {
|
|
33
|
+
let grp = this.designItems[0].openGroup('Change grid row/column');
|
|
34
|
+
this.designItems[0].setStyle("grid-row", p + ' / ' + (p + 1));
|
|
35
|
+
this.designItems[0].setStyle("grid-column", n + ' / ' + (n + 1));
|
|
36
|
+
grp.commit();
|
|
37
|
+
};
|
|
38
|
+
if (p >= rowStart && p < rowEnd && n >= colStart && n < colEnd)
|
|
39
|
+
b.style.backgroundColor = 'coral';
|
|
40
|
+
this._root.appendChild(b);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
package/dist/elements/services/propertiesService/propertyEditors/GridRowColumnPropertyEditor.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IProperty } from '../IProperty.js';
|
|
2
|
+
import { BasePropertyEditor } from './BasePropertyEditor.js';
|
|
3
|
+
import { ValueType } from '../ValueType.js';
|
|
4
|
+
import { IDesignItem } from '../../../item/IDesignItem.js';
|
|
5
|
+
export declare class GridRowColumnPropertyEditor extends BasePropertyEditor<HTMLDivElement> {
|
|
6
|
+
_root: HTMLDivElement;
|
|
7
|
+
constructor(property: IProperty);
|
|
8
|
+
refreshValue(valueType: ValueType, value: any): void;
|
|
9
|
+
designItemsChanged(designItems: IDesignItem[]): void;
|
|
10
|
+
}
|
package/dist/elements/services/propertiesService/propertyEditors/GridRowColumnPropertyEditor.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BasePropertyEditor } from './BasePropertyEditor.js';
|
|
2
|
+
export class GridRowColumnPropertyEditor extends BasePropertyEditor {
|
|
3
|
+
_root;
|
|
4
|
+
constructor(property) {
|
|
5
|
+
super(property);
|
|
6
|
+
this._root = document.createElement('div');
|
|
7
|
+
this.element = this._root;
|
|
8
|
+
}
|
|
9
|
+
refreshValue(valueType, value) {
|
|
10
|
+
}
|
|
11
|
+
designItemsChanged(designItems) {
|
|
12
|
+
super.designItemsChanged(designItems);
|
|
13
|
+
this._root.innerHTML == "";
|
|
14
|
+
if (this.designItems != null && this.designItems.length) {
|
|
15
|
+
let style = getComputedStyle(this.designItems[0].element);
|
|
16
|
+
let cntCol = style.gridTemplateColumns.split(' ').length;
|
|
17
|
+
let cntRow = style.gridTemplateRows.split(' ').length;
|
|
18
|
+
this._root.style.gridTemplateColumns = 'repeat(' + cntCol + ', 1fr)';
|
|
19
|
+
this._root.style.gridTemplateRows = 'repeat(' + cntRow + ', 1fr)';
|
|
20
|
+
for (let n = 0; n < cntCol * cntRow; n++) {
|
|
21
|
+
this._root.appendChild(document.createElement('button'));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IProperty } from '../IProperty.js';
|
|
2
|
+
import { BasePropertyEditor } from './BasePropertyEditor.js';
|
|
3
|
+
import { ValueType } from '../ValueType.js';
|
|
4
|
+
export declare class JsonPropertyEditor extends BasePropertyEditor<HTMLDivElement> {
|
|
5
|
+
static template: HTMLTemplateElement;
|
|
6
|
+
_input: HTMLInputElement;
|
|
7
|
+
constructor(property: IProperty);
|
|
8
|
+
refreshValue(valueType: ValueType, value: any): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BasePropertyEditor } from './BasePropertyEditor.js';
|
|
2
|
+
import { html } from '@node-projects/base-custom-webcomponent';
|
|
3
|
+
export class JsonPropertyEditor extends BasePropertyEditor {
|
|
4
|
+
static template = html `
|
|
5
|
+
<div style="display: flex;">
|
|
6
|
+
<input id="input" type="text">
|
|
7
|
+
<button style="width: 30px;">...</button>
|
|
8
|
+
</div>
|
|
9
|
+
`;
|
|
10
|
+
_input;
|
|
11
|
+
constructor(property) {
|
|
12
|
+
super(property);
|
|
13
|
+
let el = JsonPropertyEditor.template.content.cloneNode(true);
|
|
14
|
+
this._input = el.getElementById('input');
|
|
15
|
+
this._input.onchange = (e) => this._valueChanged(this._input.value);
|
|
16
|
+
this.element = el;
|
|
17
|
+
}
|
|
18
|
+
refreshValue(valueType, value) {
|
|
19
|
+
this._input.value = value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IProperty } from '../../IProperty.js';
|
|
2
|
+
import { BasePropertyEditor } from '../BasePropertyEditor.js';
|
|
3
|
+
import { ValueType } from '../../ValueType.js';
|
|
4
|
+
export declare class GridAssignedRowColumnPropertyEditor extends BasePropertyEditor<HTMLDivElement> {
|
|
5
|
+
_root: HTMLDivElement;
|
|
6
|
+
constructor(property: IProperty);
|
|
7
|
+
refreshValue(valueType: ValueType, value: any): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { BasePropertyEditor } from '../BasePropertyEditor.js';
|
|
2
|
+
export class GridAssignedRowColumnPropertyEditor extends BasePropertyEditor {
|
|
3
|
+
//Todo: multiple cell selection, grid area support, span support
|
|
4
|
+
_root;
|
|
5
|
+
constructor(property) {
|
|
6
|
+
super(property);
|
|
7
|
+
this._root = document.createElement('div');
|
|
8
|
+
this._root.style.display = 'grid';
|
|
9
|
+
this._root.style.padding = '4px 0px';
|
|
10
|
+
this._root.style.boxSizing = 'border-box';
|
|
11
|
+
this._root.style.minHeight = '50px';
|
|
12
|
+
this.element = this._root;
|
|
13
|
+
}
|
|
14
|
+
refreshValue(valueType, value) {
|
|
15
|
+
this._root.innerHTML = "";
|
|
16
|
+
if (this.designItems != null && this.designItems.length) {
|
|
17
|
+
let styleContainer = getComputedStyle(this.designItems[0].element.parentElement);
|
|
18
|
+
let style = getComputedStyle(this.designItems[0].element);
|
|
19
|
+
let cntCol = styleContainer.gridTemplateColumns.split(' ').length;
|
|
20
|
+
let cntRow = styleContainer.gridTemplateRows.split(' ').length;
|
|
21
|
+
this._root.style.gridTemplateColumns = 'repeat(' + cntCol + ', 1fr)';
|
|
22
|
+
this._root.style.gridTemplateRows = 'repeat(' + cntRow + ', 1fr)';
|
|
23
|
+
let rowStart = parseInt(style.gridRowStart);
|
|
24
|
+
let rowEnd = style.gridRowEnd == 'auto' ? rowStart : parseInt(style.gridRowEnd);
|
|
25
|
+
rowEnd = rowEnd <= rowStart ? rowStart + 1 : rowEnd;
|
|
26
|
+
let colStart = parseInt(style.gridColumnStart);
|
|
27
|
+
let colEnd = style.gridColumnEnd == 'auto' ? colStart : parseInt(style.gridColumnEnd);
|
|
28
|
+
colEnd = colEnd <= colStart ? colStart + 1 : colEnd;
|
|
29
|
+
for (let p = 1; p <= cntRow; p++) {
|
|
30
|
+
for (let n = 1; n <= cntCol; n++) {
|
|
31
|
+
const b = document.createElement('button');
|
|
32
|
+
b.style.minHeight = '10px';
|
|
33
|
+
b.onclick = () => {
|
|
34
|
+
let grp = this.designItems[0].openGroup('Change grid row/column');
|
|
35
|
+
this.designItems[0].setStyle("grid-row", p + ' / ' + (p + 1));
|
|
36
|
+
this.designItems[0].setStyle("grid-column", n + ' / ' + (n + 1));
|
|
37
|
+
grp.commit();
|
|
38
|
+
};
|
|
39
|
+
if (p >= rowStart && p < rowEnd && n >= colStart && n < colEnd)
|
|
40
|
+
b.style.backgroundColor = 'coral';
|
|
41
|
+
this._root.appendChild(b);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
package/dist/elements/services/propertiesService/propertyEditors/special/MetricsPropertyEditor.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IProperty } from '../../IProperty.js';
|
|
2
|
+
import { BasePropertyEditor } from '../BasePropertyEditor.js';
|
|
3
|
+
import { ValueType } from '../../ValueType.js';
|
|
4
|
+
import { MetricsEditor } from '../../../../controls/MetricsEditor.js';
|
|
5
|
+
export declare class MetricsPropertyEditor extends BasePropertyEditor<MetricsEditor> {
|
|
6
|
+
constructor(property: IProperty);
|
|
7
|
+
refreshValue(valueType: ValueType, value: any): void;
|
|
8
|
+
}
|
package/dist/elements/services/propertiesService/propertyEditors/special/MetricsPropertyEditor.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BasePropertyEditor } from '../BasePropertyEditor.js';
|
|
2
|
+
import { MetricsEditor } from '../../../../controls/MetricsEditor.js';
|
|
3
|
+
export class MetricsPropertyEditor extends BasePropertyEditor {
|
|
4
|
+
//Todo: metrics editor does not work at all yet
|
|
5
|
+
constructor(property) {
|
|
6
|
+
super(property);
|
|
7
|
+
const selector = new MetricsEditor();
|
|
8
|
+
selector.property = property.name;
|
|
9
|
+
//selector.valueLeftChanged.on((e) => this._valueChanged(e.newValue));
|
|
10
|
+
this.element = selector;
|
|
11
|
+
}
|
|
12
|
+
refreshValue(valueType, value) {
|
|
13
|
+
//this.element.valueLeft = value;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -8,11 +8,14 @@ export declare class CssPropertiesService extends CommonPropertiesService {
|
|
|
8
8
|
getRefreshMode(designItem: IDesignItem): RefreshMode;
|
|
9
9
|
layout: string[];
|
|
10
10
|
grid: string[];
|
|
11
|
+
gridChild: string[];
|
|
11
12
|
flex: string[];
|
|
13
|
+
flexChild: string[];
|
|
12
14
|
svg: string[];
|
|
13
|
-
constructor(name: 'layout' | 'grid' | 'flex' | 'svg');
|
|
15
|
+
constructor(name: 'layout' | 'grid' | 'gridChild' | 'flex' | 'flexChild' | 'svg');
|
|
14
16
|
isHandledElement(designItem: IDesignItem): boolean;
|
|
15
17
|
getProperty(designItem: IDesignItem, name: string): IProperty;
|
|
16
18
|
getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
|
|
19
|
+
_getPropertyDef(name: string): IProperty;
|
|
17
20
|
getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
|
|
18
21
|
}
|
|
@@ -3,6 +3,8 @@ import { PropertyType } from '../PropertyType.js';
|
|
|
3
3
|
import { CommonPropertiesService } from './CommonPropertiesService.js';
|
|
4
4
|
import { RefreshMode } from '../IPropertiesService.js';
|
|
5
5
|
import { PropertiesHelper } from './PropertiesHelper.js';
|
|
6
|
+
import { GridAssignedRowColumnPropertyEditor } from '../propertyEditors/special/GridAssignedRowColumnPropertyEditor.js';
|
|
7
|
+
import { MetricsPropertyEditor } from '../propertyEditors/special/MetricsPropertyEditor.js';
|
|
6
8
|
//TODO: remove this code when import asserts are supported
|
|
7
9
|
let cssProperties;
|
|
8
10
|
//@ts-ignore
|
|
@@ -36,7 +38,8 @@ export class CssPropertiesService extends CommonPropertiesService {
|
|
|
36
38
|
"margin",
|
|
37
39
|
"border",
|
|
38
40
|
"padding",
|
|
39
|
-
"overflow"
|
|
41
|
+
"overflow",
|
|
42
|
+
"metrics"
|
|
40
43
|
];
|
|
41
44
|
grid = [
|
|
42
45
|
"display",
|
|
@@ -48,7 +51,14 @@ export class CssPropertiesService extends CommonPropertiesService {
|
|
|
48
51
|
"align-content",
|
|
49
52
|
"justify-content",
|
|
50
53
|
"align-items",
|
|
51
|
-
"justify-items"
|
|
54
|
+
"justify-items",
|
|
55
|
+
];
|
|
56
|
+
gridChild = [
|
|
57
|
+
"grid-row",
|
|
58
|
+
"grid-column",
|
|
59
|
+
"assigned-row-column",
|
|
60
|
+
"align-self",
|
|
61
|
+
"justify-self"
|
|
52
62
|
];
|
|
53
63
|
flex = [
|
|
54
64
|
"display",
|
|
@@ -59,6 +69,10 @@ export class CssPropertiesService extends CommonPropertiesService {
|
|
|
59
69
|
"justify-content",
|
|
60
70
|
"align-items"
|
|
61
71
|
];
|
|
72
|
+
flexChild = [
|
|
73
|
+
"align-self",
|
|
74
|
+
"justify-self"
|
|
75
|
+
];
|
|
62
76
|
svg = [
|
|
63
77
|
"fill",
|
|
64
78
|
"fill-rule",
|
|
@@ -80,18 +94,26 @@ export class CssPropertiesService extends CommonPropertiesService {
|
|
|
80
94
|
}
|
|
81
95
|
getProperties(designItem) {
|
|
82
96
|
const propNames = this[this.name];
|
|
83
|
-
const propertiesList = propNames.map(x =>
|
|
84
|
-
const camelName = PropertiesHelper.dashToCamelCase(x);
|
|
85
|
-
return {
|
|
86
|
-
name: x,
|
|
87
|
-
type: cssProperties[camelName]?.type ?? 'string',
|
|
88
|
-
values: cssProperties[camelName]?.values ? [...cssProperties[camelName]?.values, 'initial', 'inherit', 'unset'] : ['initial', 'inherit', 'unset'],
|
|
89
|
-
service: this,
|
|
90
|
-
propertyType: PropertyType.cssValue
|
|
91
|
-
};
|
|
92
|
-
});
|
|
97
|
+
const propertiesList = propNames.map(x => this._getPropertyDef(x));
|
|
93
98
|
return propertiesList;
|
|
94
99
|
}
|
|
100
|
+
_getPropertyDef(name) {
|
|
101
|
+
const camelName = PropertiesHelper.dashToCamelCase(name);
|
|
102
|
+
switch (camelName) {
|
|
103
|
+
case 'assignedRowColumn':
|
|
104
|
+
return { name, service: this, propertyType: PropertyType.complex, createEditor: (p) => new GridAssignedRowColumnPropertyEditor(p) };
|
|
105
|
+
case 'metrics':
|
|
106
|
+
return { name, service: this, propertyType: PropertyType.complex, createEditor: (p) => new MetricsPropertyEditor(p) };
|
|
107
|
+
default:
|
|
108
|
+
return {
|
|
109
|
+
name,
|
|
110
|
+
type: cssProperties[camelName]?.type ?? 'string',
|
|
111
|
+
values: cssProperties[camelName]?.values ? [...cssProperties[camelName]?.values, 'initial', 'inherit', 'unset'] : ['initial', 'inherit', 'unset'],
|
|
112
|
+
service: this,
|
|
113
|
+
propertyType: PropertyType.cssValue
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
95
117
|
getPropertyTarget(designItem, property) {
|
|
96
118
|
return BindingTarget.css;
|
|
97
119
|
}
|
|
@@ -10,7 +10,7 @@ export class SelectionService {
|
|
|
10
10
|
this._undoSelectionChanges = undoSelectionChanges;
|
|
11
11
|
}
|
|
12
12
|
setSelectedElements(designItems) {
|
|
13
|
-
if (this.selectedElements != designItems) {
|
|
13
|
+
if (this.selectedElements != designItems && !(this.selectedElements.length === 0 && (designItems == null || designItems.length === 0))) {
|
|
14
14
|
if (this._undoSelectionChanges) {
|
|
15
15
|
const action = new SelectionChangedAction(this.selectedElements, designItems, this);
|
|
16
16
|
this._designerCanvas.instanceServiceContainer.undoService.execute(action);
|
|
@@ -189,14 +189,16 @@ export class DebugView extends BaseCustomWebComponentConstructorAppend {
|
|
|
189
189
|
requestAnimationFrame(() => {
|
|
190
190
|
let element = designItem?.element;
|
|
191
191
|
if (element) {
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
if (element.nodeType == 3)
|
|
193
|
+
element = element.parentNode;
|
|
194
|
+
this.computedStyle = getComputedStyle(element);
|
|
195
|
+
this.selectedElementOffsetParent = element.offsetParent;
|
|
194
196
|
if (this.selectedElementOffsetParent == designItem.instanceServiceContainer.designerCanvas.rootDesignItem.element) {
|
|
195
197
|
this.selectedElementOffsetParentText = null;
|
|
196
198
|
this.selectedElementOffsetParent = null;
|
|
197
199
|
}
|
|
198
200
|
else
|
|
199
|
-
this.selectedElementOffsetParentText = generateSelector(
|
|
201
|
+
this.selectedElementOffsetParentText = generateSelector(element.offsetParent);
|
|
200
202
|
if (element && element.nodeType === 1) {
|
|
201
203
|
const closest = getClosestStackingContext(element);
|
|
202
204
|
this.createsStackingContext = element === closest.node;
|
|
@@ -41,11 +41,11 @@ export class ExtensionManager {
|
|
|
41
41
|
if (selectionChangedEvent.selectedElements && selectionChangedEvent.selectedElements.length) {
|
|
42
42
|
this.applyExtensions(selectionChangedEvent.selectedElements, ExtensionType.Selection);
|
|
43
43
|
this.applyExtension(selectionChangedEvent.selectedElements[0], ExtensionType.PrimarySelection);
|
|
44
|
-
if (selectionChangedEvent.selectedElements[0].getPlacementService()
|
|
44
|
+
if (selectionChangedEvent.selectedElements[0].getPlacementService()?.isEnterableContainer(selectionChangedEvent.selectedElements[0]))
|
|
45
45
|
this.applyExtension(selectionChangedEvent.selectedElements[0], ExtensionType.PrimarySelectionAndCanBeEntered);
|
|
46
46
|
const primaryContainer = DesignItem.GetOrCreateDesignItem(selectionChangedEvent.selectedElements[0].parent.element, selectionChangedEvent.selectedElements[0].parent.element, this.designerCanvas.serviceContainer, this.designerCanvas.instanceServiceContainer);
|
|
47
47
|
this.applyExtension(primaryContainer, ExtensionType.PrimarySelectionContainer);
|
|
48
|
-
if (primaryContainer.getPlacementService()
|
|
48
|
+
if (primaryContainer.getPlacementService()?.isEnterableContainer(primaryContainer))
|
|
49
49
|
this.applyExtension(primaryContainer, ExtensionType.PrimarySelectionContainerAndCanBeEntered);
|
|
50
50
|
}
|
|
51
51
|
//this.refreshExtensions(selectionChangedEvent.selectedElements);
|
|
@@ -64,44 +64,48 @@ export class PropertyGrid extends BaseCustomWebComponentLazyAppend {
|
|
|
64
64
|
return this._selectedItems;
|
|
65
65
|
}
|
|
66
66
|
set selectedItems(items) {
|
|
67
|
-
this._selectedItems
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
let
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
if (this._selectedItems != items) {
|
|
68
|
+
this._selectedItems = items;
|
|
69
|
+
const pgGroups = this._serviceContainer.propertyGroupService.getPropertygroups(items);
|
|
70
|
+
const visibleDict = new Set();
|
|
71
|
+
for (let p of pgGroups) {
|
|
72
|
+
let lst = this._propertyGridPropertyListsDict[p.name];
|
|
73
|
+
if (!lst) {
|
|
74
|
+
lst = new PropertyGridPropertyList(this.serviceContainer);
|
|
75
|
+
lst.title = p.name;
|
|
76
|
+
this._designerTabControl.appendChild(lst);
|
|
77
|
+
this._propertyGridPropertyLists.push(lst);
|
|
78
|
+
this._propertyGridPropertyListsDict[p.name] = lst;
|
|
79
|
+
}
|
|
80
|
+
lst.setPropertiesService(p.propertiesService);
|
|
81
|
+
lst.createElements(items[0]);
|
|
82
|
+
visibleDict.add(p.name);
|
|
78
83
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
this._designerTabControl.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
for (let p of this._propertyGridPropertyLists) {
|
|
85
|
+
if (visibleDict.has(p.title))
|
|
86
|
+
p.style.display = 'block';
|
|
87
|
+
else
|
|
88
|
+
p.style.display = 'none';
|
|
89
|
+
}
|
|
90
|
+
this._designerTabControl.refreshItems();
|
|
91
|
+
if (this._designerTabControl.selectedIndex < 0)
|
|
92
|
+
this._designerTabControl.selectedIndex = 0;
|
|
93
|
+
for (const a of this._propertyGridPropertyLists) {
|
|
94
|
+
if (visibleDict.has(a.title))
|
|
95
|
+
a.designItemsChanged(items);
|
|
96
|
+
}
|
|
97
|
+
if (items) {
|
|
98
|
+
if (items.length == 1) {
|
|
99
|
+
for (const a of this._propertyGridPropertyLists) {
|
|
100
|
+
if (visibleDict.has(a.title))
|
|
101
|
+
a.refreshForDesignItems(items);
|
|
102
|
+
}
|
|
103
|
+
this._observeItems();
|
|
99
104
|
}
|
|
100
|
-
this._observeItems();
|
|
101
105
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
else {
|
|
107
|
+
this._itemsObserver.disconnect();
|
|
108
|
+
}
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
_observeItems() {
|
package/dist/index.d.ts
CHANGED
|
@@ -90,11 +90,12 @@ export * from "./elements/services/propertiesService/propertyEditors/DatePropert
|
|
|
90
90
|
export * from "./elements/services/propertiesService/propertyEditors/ImageButtonListPropertyEditor.js";
|
|
91
91
|
export * from "./elements/services/propertiesService/propertyEditors/JsonPropertyEditor.js";
|
|
92
92
|
export * from "./elements/services/propertiesService/propertyEditors/JsonPropertyPopupEditor.js";
|
|
93
|
-
export * from "./elements/services/propertiesService/propertyEditors/MetricsPropertyEditor.js";
|
|
94
93
|
export * from "./elements/services/propertiesService/propertyEditors/NumberPropertyEditor.js";
|
|
95
94
|
export * from "./elements/services/propertiesService/propertyEditors/SelectPropertyEditor.js";
|
|
96
95
|
export * from "./elements/services/propertiesService/propertyEditors/TextPropertyEditor.js";
|
|
97
96
|
export * from "./elements/services/propertiesService/propertyEditors/ThicknessPropertyEditor.js";
|
|
97
|
+
export * from "./elements/services/propertiesService/propertyEditors/special/MetricsPropertyEditor.js";
|
|
98
|
+
export * from "./elements/services/propertiesService/propertyEditors/special/GridAssignedRowColumnPropertyEditor.js";
|
|
98
99
|
export * from "./elements/services/propertiesService/services/PropertiesHelper.js";
|
|
99
100
|
export * from "./elements/services/propertiesService/services/BaseCustomWebComponentPropertiesService.js";
|
|
100
101
|
export * from "./elements/services/propertiesService/services/CommonPropertiesService.js";
|
package/dist/index.js
CHANGED
|
@@ -55,11 +55,12 @@ export * from "./elements/services/propertiesService/propertyEditors/DatePropert
|
|
|
55
55
|
export * from "./elements/services/propertiesService/propertyEditors/ImageButtonListPropertyEditor.js";
|
|
56
56
|
export * from "./elements/services/propertiesService/propertyEditors/JsonPropertyEditor.js";
|
|
57
57
|
export * from "./elements/services/propertiesService/propertyEditors/JsonPropertyPopupEditor.js";
|
|
58
|
-
export * from "./elements/services/propertiesService/propertyEditors/MetricsPropertyEditor.js";
|
|
59
58
|
export * from "./elements/services/propertiesService/propertyEditors/NumberPropertyEditor.js";
|
|
60
59
|
export * from "./elements/services/propertiesService/propertyEditors/SelectPropertyEditor.js";
|
|
61
60
|
export * from "./elements/services/propertiesService/propertyEditors/TextPropertyEditor.js";
|
|
62
61
|
export * from "./elements/services/propertiesService/propertyEditors/ThicknessPropertyEditor.js";
|
|
62
|
+
export * from "./elements/services/propertiesService/propertyEditors/special/MetricsPropertyEditor.js";
|
|
63
|
+
export * from "./elements/services/propertiesService/propertyEditors/special/GridAssignedRowColumnPropertyEditor.js";
|
|
63
64
|
export * from "./elements/services/propertiesService/services/PropertiesHelper.js";
|
|
64
65
|
export * from "./elements/services/propertiesService/services/BaseCustomWebComponentPropertiesService.js";
|
|
65
66
|
export * from "./elements/services/propertiesService/services/CommonPropertiesService.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.
|
|
4
|
+
"version": "0.0.255",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"@types/css-tree": "^2.3.1",
|
|
25
25
|
"@types/jquery": "^3.5.16",
|
|
26
26
|
"@types/jquery.fancytree": "0.0.7",
|
|
27
|
-
"@types/node": "^20.4.
|
|
28
|
-
"ace-builds": "^1.
|
|
27
|
+
"@types/node": "^20.4.9",
|
|
28
|
+
"ace-builds": "^1.24.0",
|
|
29
29
|
"codemirror": "^5.0.0",
|
|
30
30
|
"css-tree": "^2.3.1",
|
|
31
31
|
"esprima-next": "^5.8.4",
|