@node-projects/web-component-designer 0.0.253 → 0.0.254
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/propertiesService/DefaultEditorTypesService.js +5 -0
- 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 +44 -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/services/CssProperties.json +4 -1
- package/dist/elements/services/propertiesService/services/CssPropertiesService.d.ts +3 -1
- package/dist/elements/services/propertiesService/services/CssPropertiesService.js +12 -1
- package/dist/elements/services/selectionService/SelectionService.js +1 -1
- package/dist/elements/widgets/propertyGrid/PropertyGrid.js +37 -35
- package/package.json +3 -3
|
@@ -8,6 +8,7 @@ import { BooleanPropertyEditor } from './propertyEditors/BooleanPropertyEditor.j
|
|
|
8
8
|
import { ImageButtonListPropertyEditor } from './propertyEditors/ImageButtonListPropertyEditor.js';
|
|
9
9
|
import { ThicknessPropertyEditor } from "./propertyEditors/ThicknessPropertyEditor.js";
|
|
10
10
|
import { MetricsPropertyEditor } from './propertyEditors/MetricsPropertyEditor.js';
|
|
11
|
+
import { GridAssignedRowColumnPropertyEditor } from './propertyEditors/GridAssignedRowColumnPropertyEditor.js';
|
|
11
12
|
export class DefaultEditorTypesService {
|
|
12
13
|
getEditorForProperty(property) {
|
|
13
14
|
if (property.createEditor)
|
|
@@ -53,6 +54,10 @@ export class DefaultEditorTypesService {
|
|
|
53
54
|
{
|
|
54
55
|
return new MetricsPropertyEditor(property);
|
|
55
56
|
}
|
|
57
|
+
case "assigned-row-column":
|
|
58
|
+
{
|
|
59
|
+
return new GridAssignedRowColumnPropertyEditor(property);
|
|
60
|
+
}
|
|
56
61
|
case "css-length":
|
|
57
62
|
case "string":
|
|
58
63
|
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,44 @@
|
|
|
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.height = '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.onclick = () => {
|
|
32
|
+
let grp = this.designItems[0].openGroup('Change grid row/column');
|
|
33
|
+
this.designItems[0].setStyle("grid-row", p + ' / ' + (p + 1));
|
|
34
|
+
this.designItems[0].setStyle("grid-column", n + ' / ' + (n + 1));
|
|
35
|
+
grp.commit();
|
|
36
|
+
};
|
|
37
|
+
if (p >= rowStart && p < rowEnd && n >= colStart && n < colEnd)
|
|
38
|
+
b.style.backgroundColor = 'coral';
|
|
39
|
+
this._root.appendChild(b);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
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
|
+
}
|
|
@@ -8,9 +8,11 @@ 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[];
|
|
@@ -48,7 +48,14 @@ export class CssPropertiesService extends CommonPropertiesService {
|
|
|
48
48
|
"align-content",
|
|
49
49
|
"justify-content",
|
|
50
50
|
"align-items",
|
|
51
|
-
"justify-items"
|
|
51
|
+
"justify-items",
|
|
52
|
+
];
|
|
53
|
+
gridChild = [
|
|
54
|
+
"grid-row",
|
|
55
|
+
"grid-column",
|
|
56
|
+
"assigned-row-column",
|
|
57
|
+
"align-self",
|
|
58
|
+
"justify-self"
|
|
52
59
|
];
|
|
53
60
|
flex = [
|
|
54
61
|
"display",
|
|
@@ -59,6 +66,10 @@ export class CssPropertiesService extends CommonPropertiesService {
|
|
|
59
66
|
"justify-content",
|
|
60
67
|
"align-items"
|
|
61
68
|
];
|
|
69
|
+
flexChild = [
|
|
70
|
+
"align-self",
|
|
71
|
+
"justify-self"
|
|
72
|
+
];
|
|
62
73
|
svg = [
|
|
63
74
|
"fill",
|
|
64
75
|
"fill-rule",
|
|
@@ -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);
|
|
@@ -64,44 +64,46 @@ 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
|
-
for (const a of this._propertyGridPropertyLists) {
|
|
98
|
-
a.refreshForDesignItems(items);
|
|
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
|
+
a.designItemsChanged(items);
|
|
95
|
+
}
|
|
96
|
+
if (items) {
|
|
97
|
+
if (items.length == 1) {
|
|
98
|
+
for (const a of this._propertyGridPropertyLists) {
|
|
99
|
+
a.refreshForDesignItems(items);
|
|
100
|
+
}
|
|
101
|
+
this._observeItems();
|
|
99
102
|
}
|
|
100
|
-
this._observeItems();
|
|
101
103
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
else {
|
|
105
|
+
this._itemsObserver.disconnect();
|
|
106
|
+
}
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
_observeItems() {
|
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.254",
|
|
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",
|