@node-projects/web-component-designer 0.0.112 → 0.0.115
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/README.md +19 -25
- package/dist/elements/controls/DesignerTabControl.js +5 -0
- package/dist/elements/item/DesignItem.d.ts +1 -1
- package/dist/elements/item/DesignItem.js +12 -13
- package/dist/elements/item/IDesignItem.d.ts +1 -1
- package/dist/elements/services/propertiesService/services/BaseCustomWebComponentPropertiesService.js +4 -2
- package/dist/elements/services/propertiesService/services/CssPropertiesService.js +1 -1
- package/dist/elements/services/propertiesService/services/UnkownElementPropertiesService.js +1 -1
- package/dist/elements/services/undoService/ChangeGroup.d.ts +2 -2
- package/dist/elements/services/undoService/ChangeGroup.js +11 -3
- package/dist/elements/services/undoService/IUndoService.d.ts +1 -2
- package/dist/elements/services/undoService/UndoService.d.ts +1 -2
- package/dist/elements/services/undoService/UndoService.js +2 -2
- package/dist/elements/services/undoService/transactionItems/DeleteAction.js +1 -1
- package/dist/elements/services/undoService/transactionItems/InsertAction.js +2 -2
- package/dist/elements/services/undoService/transactionItems/InsertChildAction.js +10 -4
- package/dist/elements/widgets/bindableObjectsBrowser/bindable-objects-browser.js +6 -1
- package/dist/elements/widgets/codeView/code-view-code-mirror.js +6 -1
- package/dist/elements/widgets/codeView/code-view-monaco.js +7 -1
- package/dist/elements/widgets/designerView/extensions/ResizeExtension.js +1 -1
- package/dist/elements/widgets/designerView/extensions/RotateExtension.js +1 -1
- package/dist/elements/widgets/designerView/tools/PointerTool.js +1 -1
- package/dist/elements/widgets/paletteView/paletteTreeView.js +6 -1
- package/dist/elements/widgets/propertyGrid/PropertyGridWithHeader.d.ts +1 -0
- package/dist/elements/widgets/propertyGrid/PropertyGridWithHeader.js +20 -0
- package/dist/elements/widgets/treeView/treeViewExtended.js +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
# web-component-designer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
```This is a preview version. It's already useable but big refactorings could still happen.```
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Based on PolymerLabs Wizzywid (but it does not use Polymer any more.)
|
|
9
|
-
|
|
10
|
-
This is a Designer Framework wich could easily be included in your own Software..
|
|
5
|
+
A HTML web component for designing web components and HTML pages based on PolymerLabs wizzywid which can easily be integrated in your own software.
|
|
6
|
+
Meanwhile polymer is not used anymore.
|
|
11
7
|
|
|
12
8
|

|
|
13
9
|
|
|
14
10
|
## NPM Package
|
|
15
11
|
|
|
16
|
-
At the moment there is no
|
|
17
|
-
But there will be one when project is in Release Candidate state.
|
|
12
|
+
At the moment there is no npm package available, but there will be one as soon as the software has reached RC status.
|
|
18
13
|
|
|
19
14
|
## Demo
|
|
20
15
|
|
|
@@ -35,9 +30,7 @@ repository: https://github.com/node-projects/web-component-designer-simple-demo
|
|
|
35
30
|
|
|
36
31
|
## Features we are workin on
|
|
37
32
|
|
|
38
|
-
|
|
39
|
-
- look at the issues
|
|
40
|
-
- Much, much more ...
|
|
33
|
+
https://github.com/node-projects/web-component-designer/issues
|
|
41
34
|
|
|
42
35
|
## Developing
|
|
43
36
|
|
|
@@ -46,38 +39,39 @@ repository: https://github.com/node-projects/web-component-designer-simple-demo
|
|
|
46
39
|
$ npm install
|
|
47
40
|
```
|
|
48
41
|
|
|
49
|
-
* Compile
|
|
42
|
+
* Compile typescript after doing changes
|
|
50
43
|
```
|
|
51
|
-
$ npm run build
|
|
44
|
+
$ npm run build (if you use Visual Studio Code, you can also run the build task via Ctrl + Shift + B > tsc:build - tsconfig.json)
|
|
52
45
|
```
|
|
53
46
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
* *Link node module*<br/>
|
|
48
|
+
```
|
|
49
|
+
$ npm link
|
|
50
|
+
```
|
|
57
51
|
|
|
58
|
-
##
|
|
52
|
+
## Using
|
|
59
53
|
|
|
60
|
-
|
|
54
|
+
At first you have to setup a service container providing services for history, properties, elements, ...
|
|
61
55
|
|
|
62
56
|
## Code Editor
|
|
63
57
|
|
|
64
|
-
You can select to use
|
|
65
|
-
If you use one of the
|
|
58
|
+
You can select to use one of 3 code editors available (ACE, CodeMirrow, Monaco).
|
|
59
|
+
If you use one of the widgets, you need to include the JS lib in your index.html and then use the specific widget.
|
|
66
60
|
|
|
67
61
|
## TreeView
|
|
68
62
|
|
|
69
|
-
We have 2
|
|
63
|
+
We have 2 tree components. One independent and one feature rich which uses FancyTree (and cause of this it needs JQuery and JqueryUI).
|
|
70
64
|
|
|
71
65
|
## DragDrop
|
|
72
66
|
|
|
73
|
-
If you'd like to use the
|
|
74
|
-
Your
|
|
67
|
+
If you'd like to use the designer on mobile, you need the mobile-drag-drop npm library and include our polyfill.
|
|
68
|
+
Your index.html should be extended as follows:
|
|
75
69
|
|
|
76
70
|
<link rel="stylesheet" href="/node_modules/mobile-drag-drop/default.css">
|
|
77
71
|
<script src="/node_modules/mobile-drag-drop/index.js"></script>
|
|
78
72
|
<script src="/node_modules/@node-projects/web-component-designer/dist/polyfill/mobileDragDrop.js"></script>
|
|
79
73
|
|
|
80
|
-
## Copyright notice
|
|
74
|
+
## Copyright notice
|
|
81
75
|
|
|
82
76
|
The Library uses Images from the Chrome Dev Tools, see
|
|
83
77
|
https://github.com/ChromeDevTools/devtools-frontend/tree/main/front_end/Images/src
|
|
@@ -136,8 +136,13 @@ export class DesignerTabControl extends BaseCustomWebComponentLazyAppend {
|
|
|
136
136
|
let w = 0;
|
|
137
137
|
DomHelper.removeAllChildnodes(this._moreContainer);
|
|
138
138
|
DomHelper.removeAllChildnodes(this._headerDiv);
|
|
139
|
+
let reloadOnce = true;
|
|
139
140
|
for (let item of this.children) {
|
|
140
141
|
let htmlItem = item;
|
|
142
|
+
if (!this._elementMap.has(htmlItem) && reloadOnce) {
|
|
143
|
+
this.refreshItems();
|
|
144
|
+
reloadOnce = false;
|
|
145
|
+
}
|
|
141
146
|
const tabHeaderDiv = this._elementMap.get(htmlItem);
|
|
142
147
|
this._moreContainer.appendChild(tabHeaderDiv);
|
|
143
148
|
if (this._headerDiv.children.length == 0 || (w + (tabHeaderDiv.clientWidth / 2)) < this._headerDiv.clientWidth) {
|
|
@@ -53,7 +53,7 @@ export declare class DesignItem implements IDesignItem {
|
|
|
53
53
|
static createDesignItemFromInstance(node: Node, serviceContainer: ServiceContainer, instanceServiceContainer: InstanceServiceContainer): DesignItem;
|
|
54
54
|
updateChildrenFromNodesChildren(): void;
|
|
55
55
|
constructor(node: Node, serviceContainer: ServiceContainer, instanceServiceContainer: InstanceServiceContainer);
|
|
56
|
-
openGroup(title: string
|
|
56
|
+
openGroup(title: string): ChangeGroup;
|
|
57
57
|
getOrCreateDesignItem(node: Node): IDesignItem;
|
|
58
58
|
static GetOrCreateDesignItem(node: Node, serviceContainer: ServiceContainer, instanceServiceContainer: InstanceServiceContainer): IDesignItem;
|
|
59
59
|
static GetDesignItem(node: Node): IDesignItem;
|
|
@@ -74,18 +74,20 @@ export class DesignItem {
|
|
|
74
74
|
return this._childArray.indexOf(designItem);
|
|
75
75
|
}
|
|
76
76
|
insertAdjacentElement(designItem, where) {
|
|
77
|
+
let action;
|
|
77
78
|
if (where == 'afterbegin') {
|
|
78
|
-
|
|
79
|
+
action = new InsertChildAction(designItem, this, 0);
|
|
79
80
|
}
|
|
80
81
|
else if (where == 'beforeend') {
|
|
81
|
-
this.
|
|
82
|
+
action = new InsertChildAction(designItem, this, this._childArray.length);
|
|
82
83
|
}
|
|
83
84
|
else if (where == 'beforebegin') {
|
|
84
|
-
this.parent
|
|
85
|
+
action = new InsertChildAction(designItem, this.parent, this.parent.indexOf(this));
|
|
85
86
|
}
|
|
86
87
|
else if (where == 'afterend') {
|
|
87
|
-
this.parent
|
|
88
|
+
action = new InsertChildAction(designItem, this.parent, this.parent.indexOf(this));
|
|
88
89
|
}
|
|
90
|
+
this.instanceServiceContainer.undoService.execute(action);
|
|
89
91
|
}
|
|
90
92
|
insertChild(designItem, index) {
|
|
91
93
|
const action = new InsertChildAction(designItem, this, index);
|
|
@@ -96,7 +98,8 @@ export class DesignItem {
|
|
|
96
98
|
this.instanceServiceContainer.undoService.execute(action);
|
|
97
99
|
}
|
|
98
100
|
remove() {
|
|
99
|
-
|
|
101
|
+
const action = new DeleteAction([this]);
|
|
102
|
+
this.instanceServiceContainer.undoService.execute(action);
|
|
100
103
|
}
|
|
101
104
|
clearChildren() {
|
|
102
105
|
for (let i = this._childArray.length - 1; i >= 0; i--) {
|
|
@@ -210,12 +213,8 @@ export class DesignItem {
|
|
|
210
213
|
updateChildrenFromNodesChildren() {
|
|
211
214
|
this._childArray = [];
|
|
212
215
|
if (this.nodeType == NodeType.Element) {
|
|
213
|
-
|
|
214
|
-
this.
|
|
215
|
-
else {
|
|
216
|
-
for (const c of this.element.childNodes)
|
|
217
|
-
this._childArray.push(DesignItem.createDesignItemFromInstance(c, this.serviceContainer, this.instanceServiceContainer));
|
|
218
|
-
}
|
|
216
|
+
for (const c of this.element.childNodes)
|
|
217
|
+
this._childArray.push(DesignItem.createDesignItemFromInstance(c, this.serviceContainer, this.instanceServiceContainer));
|
|
219
218
|
}
|
|
220
219
|
}
|
|
221
220
|
constructor(node, serviceContainer, instanceServiceContainer) {
|
|
@@ -226,8 +225,8 @@ export class DesignItem {
|
|
|
226
225
|
this.styles = new Map();
|
|
227
226
|
DesignItem._designItemMap.set(node, this);
|
|
228
227
|
}
|
|
229
|
-
openGroup(title
|
|
230
|
-
return this.instanceServiceContainer.undoService.openGroup(title
|
|
228
|
+
openGroup(title) {
|
|
229
|
+
return this.instanceServiceContainer.undoService.openGroup(title);
|
|
231
230
|
}
|
|
232
231
|
getOrCreateDesignItem(node) {
|
|
233
232
|
return DesignItem.GetOrCreateDesignItem(node, this.serviceContainer, this.instanceServiceContainer);
|
|
@@ -39,7 +39,7 @@ export interface IDesignItem {
|
|
|
39
39
|
instanceServiceContainer: InstanceServiceContainer;
|
|
40
40
|
appliedDesignerExtensions: Map<ExtensionType, IDesignerExtension[]>;
|
|
41
41
|
getOrCreateDesignItem(node: Node): any;
|
|
42
|
-
openGroup(title: string
|
|
42
|
+
openGroup(title: string): ChangeGroup;
|
|
43
43
|
setStyle(name: string, value?: string | null): any;
|
|
44
44
|
removeStyle(name: string): any;
|
|
45
45
|
setAttribute(name: string, value?: string | null): any;
|
package/dist/elements/services/propertiesService/services/BaseCustomWebComponentPropertiesService.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { BaseCustomWebComponentLazyAppend, BaseCustomWebComponentConstructorAppend } from '@node-projects/base-custom-webcomponent';
|
|
1
|
+
import { BaseCustomWebComponentLazyAppend, BaseCustomWebComponentConstructorAppend, BaseCustomWebComponentConstructorAppendLazyReady } from '@node-projects/base-custom-webcomponent';
|
|
2
2
|
import { AbstractBasePropertiesService } from './AbstractBasePropertiesService';
|
|
3
3
|
export class BaseCustomWebComponentPropertiesService extends AbstractBasePropertiesService {
|
|
4
4
|
name = "baseCustomWebComponent";
|
|
5
5
|
isHandledElement(designItem) {
|
|
6
|
-
return designItem.element instanceof BaseCustomWebComponentLazyAppend ||
|
|
6
|
+
return designItem.element instanceof BaseCustomWebComponentLazyAppend ||
|
|
7
|
+
designItem.element instanceof BaseCustomWebComponentConstructorAppendLazyReady ||
|
|
8
|
+
designItem.element instanceof BaseCustomWebComponentConstructorAppend;
|
|
7
9
|
}
|
|
8
10
|
_notifyChangedProperty(designItem, property, value) {
|
|
9
11
|
//@ts-ignore
|
|
@@ -259,7 +259,7 @@ export class CssPropertiesService {
|
|
|
259
259
|
return this[this.name];
|
|
260
260
|
}
|
|
261
261
|
setValue(designItems, property, value) {
|
|
262
|
-
const cg = designItems[0].openGroup("properties changed"
|
|
262
|
+
const cg = designItems[0].openGroup("properties changed");
|
|
263
263
|
for (let d of designItems) {
|
|
264
264
|
d.styles.set(property.name, value);
|
|
265
265
|
d.element.style[property.name] = value;
|
|
@@ -16,7 +16,7 @@ export class UnkownElementPropertiesService {
|
|
|
16
16
|
}
|
|
17
17
|
setValue(designItems, property, value) {
|
|
18
18
|
const attributeName = PropertiesHelper.camelToDashCase(property.name);
|
|
19
|
-
const cg = designItems[0].openGroup("properties changed"
|
|
19
|
+
const cg = designItems[0].openGroup("properties changed");
|
|
20
20
|
try {
|
|
21
21
|
for (let d of designItems) {
|
|
22
22
|
if (property.type === 'object') {
|
|
@@ -2,10 +2,10 @@ import { ITransactionItem } from './ITransactionItem';
|
|
|
2
2
|
import { IDesignItem } from '../../item/IDesignItem';
|
|
3
3
|
export declare class ChangeGroup implements ITransactionItem {
|
|
4
4
|
title: string;
|
|
5
|
-
affectedItems: IDesignItem[];
|
|
5
|
+
get affectedItems(): IDesignItem[];
|
|
6
6
|
private commitHandler;
|
|
7
7
|
private abortHandler;
|
|
8
|
-
constructor(title: string,
|
|
8
|
+
constructor(title: string, commitHandler: (transactionItem: ITransactionItem) => void, abortHandler: (transactionItem: ITransactionItem) => void);
|
|
9
9
|
do(): void;
|
|
10
10
|
undo(): void;
|
|
11
11
|
commit(): void;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
export class ChangeGroup {
|
|
2
2
|
title;
|
|
3
|
-
affectedItems
|
|
3
|
+
get affectedItems() {
|
|
4
|
+
let s = new Set();
|
|
5
|
+
for (let u of this.undoStack)
|
|
6
|
+
for (let i of u.affectedItems)
|
|
7
|
+
s.add(i);
|
|
8
|
+
for (let u of this.redoStack)
|
|
9
|
+
for (let i of u.affectedItems)
|
|
10
|
+
s.add(i);
|
|
11
|
+
return [...s.values()];
|
|
12
|
+
}
|
|
4
13
|
commitHandler;
|
|
5
14
|
abortHandler;
|
|
6
|
-
constructor(title,
|
|
15
|
+
constructor(title, commitHandler, abortHandler) {
|
|
7
16
|
this.title = title;
|
|
8
|
-
this.affectedItems = affectedItems;
|
|
9
17
|
this.commitHandler = commitHandler;
|
|
10
18
|
this.abortHandler = abortHandler;
|
|
11
19
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { IService } from '../IService';
|
|
2
2
|
import { ChangeGroup } from './ChangeGroup';
|
|
3
3
|
import { ITransactionItem } from './ITransactionItem';
|
|
4
|
-
import { IDesignItem } from '../../item/IDesignItem';
|
|
5
4
|
export interface IUndoService extends IService {
|
|
6
|
-
openGroup(title: string
|
|
5
|
+
openGroup(title: string): ChangeGroup;
|
|
7
6
|
execute(item: ITransactionItem): void;
|
|
8
7
|
canUndo(): boolean;
|
|
9
8
|
canRedo(): boolean;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ITransactionItem } from './ITransactionItem.js';
|
|
2
2
|
import { ChangeGroup } from "./ChangeGroup.js";
|
|
3
3
|
import { IUndoService } from './IUndoService.js';
|
|
4
|
-
import { IDesignItem } from '../../item/IDesignItem';
|
|
5
4
|
import { IDesignerCanvas } from '../../widgets/designerView/IDesignerCanvas.js';
|
|
6
5
|
export declare class UndoService implements IUndoService {
|
|
7
6
|
private _undoStack;
|
|
@@ -9,7 +8,7 @@ export declare class UndoService implements IUndoService {
|
|
|
9
8
|
private _transactionStack;
|
|
10
9
|
private _designerCanvas;
|
|
11
10
|
constructor(designerCanvas?: IDesignerCanvas);
|
|
12
|
-
openGroup(title: string
|
|
11
|
+
openGroup(title: string): ChangeGroup;
|
|
13
12
|
private commitTransactionItem;
|
|
14
13
|
private abortTransactionItem;
|
|
15
14
|
execute(item: ITransactionItem): void;
|
|
@@ -10,8 +10,8 @@ export class UndoService {
|
|
|
10
10
|
constructor(designerCanvas) {
|
|
11
11
|
this._designerCanvas = designerCanvas;
|
|
12
12
|
}
|
|
13
|
-
openGroup(title
|
|
14
|
-
let t = new ChangeGroup(title,
|
|
13
|
+
openGroup(title) {
|
|
14
|
+
let t = new ChangeGroup(title, (t) => this.commitTransactionItem(t), (t) => this.abortTransactionItem(t));
|
|
15
15
|
this._transactionStack.push(t);
|
|
16
16
|
return t;
|
|
17
17
|
}
|
|
@@ -22,7 +22,7 @@ export class DeleteAction {
|
|
|
22
22
|
this._parentIndexes.push(DomHelper.nodeIndex(this.deletedItems[n].element));
|
|
23
23
|
}
|
|
24
24
|
for (let n = 0; n < this.deletedItems.length; n++) {
|
|
25
|
-
this.deletedItems[n].
|
|
25
|
+
this.deletedItems[n].parent._removeChildInternal(this.deletedItems[n]);
|
|
26
26
|
}
|
|
27
27
|
this.affectedItems[0].instanceServiceContainer.contentService.onContentChanged.emit({ changeType: 'removed', designItems: this.deletedItems });
|
|
28
28
|
}
|
|
@@ -7,10 +7,10 @@ export class InsertAction {
|
|
|
7
7
|
}
|
|
8
8
|
title;
|
|
9
9
|
get affectedItems() {
|
|
10
|
-
return [this.designItem];
|
|
10
|
+
return [this.designItem, this.newItem];
|
|
11
11
|
}
|
|
12
12
|
undo() {
|
|
13
|
-
this.newItem.
|
|
13
|
+
this.newItem.parent._removeChildInternal(this.newItem);
|
|
14
14
|
this.affectedItems[0].instanceServiceContainer.contentService.onContentChanged.emit({ changeType: 'removed', designItems: [this.newItem] });
|
|
15
15
|
}
|
|
16
16
|
do() {
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
export class InsertChildAction {
|
|
2
2
|
constructor(designItem, newParent, newIndex) {
|
|
3
|
-
this.title = "Move Item";
|
|
3
|
+
this.title = "Move or Insert Item";
|
|
4
4
|
this.designItem = designItem;
|
|
5
5
|
this.newParent = newParent;
|
|
6
6
|
this.newIndex = newIndex;
|
|
7
7
|
}
|
|
8
8
|
title;
|
|
9
9
|
get affectedItems() {
|
|
10
|
-
|
|
10
|
+
if (this.oldParent)
|
|
11
|
+
return [this.designItem, this.newParent, this.oldParent];
|
|
12
|
+
return [this.designItem, this.newParent];
|
|
11
13
|
}
|
|
12
14
|
undo() {
|
|
13
|
-
this.oldParent
|
|
15
|
+
if (this.oldParent)
|
|
16
|
+
this.oldParent._insertChildInternal(this.designItem, this.oldIndex);
|
|
17
|
+
else
|
|
18
|
+
this.designItem.parent._removeChildInternal(this.designItem);
|
|
14
19
|
this.affectedItems[0].instanceServiceContainer.contentService.onContentChanged.emit({ changeType: 'moved', designItems: [this.designItem] });
|
|
15
20
|
}
|
|
16
21
|
do() {
|
|
17
22
|
this.oldParent = this.designItem.parent;
|
|
18
|
-
|
|
23
|
+
if (this.oldParent)
|
|
24
|
+
this.oldIndex = this.designItem.parent.indexOf(this.designItem);
|
|
19
25
|
this.newParent._insertChildInternal(this.designItem, this.newIndex);
|
|
20
26
|
this.affectedItems[0].instanceServiceContainer.contentService.onContentChanged.emit({ changeType: 'moved', designItems: [this.designItem] });
|
|
21
27
|
}
|
|
@@ -31,7 +31,12 @@ export class BindableObjectsBrowser extends BaseCustomWebComponentLazyAppend {
|
|
|
31
31
|
super();
|
|
32
32
|
this._restoreCachedInititalValues();
|
|
33
33
|
//@ts-ignore
|
|
34
|
-
|
|
34
|
+
if (importShim)
|
|
35
|
+
//@ts-ignore
|
|
36
|
+
importShim("jquery.fancytree/dist/skin-win8/ui.fancytree.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
37
|
+
else
|
|
38
|
+
//@ts-ignore
|
|
39
|
+
import("jquery.fancytree/dist/skin-win8/ui.fancytree.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
35
40
|
this._treeDiv = document.createElement('div');
|
|
36
41
|
this._treeDiv.style.height = '100%';
|
|
37
42
|
this._treeDiv.style.overflow = 'auto';
|
|
@@ -20,7 +20,12 @@ export class CodeViewCodeMirror extends BaseCustomWebComponentLazyAppend {
|
|
|
20
20
|
constructor() {
|
|
21
21
|
super();
|
|
22
22
|
//@ts-ignore
|
|
23
|
-
|
|
23
|
+
if (importShim)
|
|
24
|
+
//@ts-ignore
|
|
25
|
+
importShim("./codemirror/lib/codemirror.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
26
|
+
else
|
|
27
|
+
//@ts-ignore
|
|
28
|
+
import("./codemirror/lib/codemirror.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
24
29
|
this.style.display = 'block';
|
|
25
30
|
this._editor = this._getDomElement('textarea');
|
|
26
31
|
}
|
|
@@ -53,8 +53,14 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
53
53
|
return false;
|
|
54
54
|
}
|
|
55
55
|
async ready() {
|
|
56
|
+
let style;
|
|
56
57
|
//@ts-ignore
|
|
57
|
-
|
|
58
|
+
if (importShim)
|
|
59
|
+
//@ts-ignore
|
|
60
|
+
style = await importShim("monaco-editor/min/vs/editor/editor.main.css", { assert: { type: 'css' } });
|
|
61
|
+
else
|
|
62
|
+
//@ts-ignore
|
|
63
|
+
style = await import("monaco-editor/min/vs/editor/editor.main.css", { assert: { type: 'css' } });
|
|
58
64
|
this.shadowRoot.adoptedStyleSheets = [style.default, this.constructor.style];
|
|
59
65
|
this._editor = this._getDomElement('container');
|
|
60
66
|
//@ts-ignore
|
|
@@ -138,7 +138,7 @@ export class ResizeExtension extends AbstractExtension {
|
|
|
138
138
|
break;
|
|
139
139
|
case EventNames.PointerUp:
|
|
140
140
|
event.target.releasePointerCapture(event.pointerId);
|
|
141
|
-
let cg = this.extendedItem.openGroup("Resize Elements"
|
|
141
|
+
let cg = this.extendedItem.openGroup("Resize Elements");
|
|
142
142
|
this.extendedItem.setStyle('width', this.extendedItem.element.style.width);
|
|
143
143
|
this.extendedItem.setStyle('height', this.extendedItem.element.style.height);
|
|
144
144
|
if (this.resizeAllSelected) {
|
|
@@ -51,7 +51,7 @@ export class RotateExtension extends AbstractExtension {
|
|
|
51
51
|
this.extensionManager.refreshExtensions(this.designerCanvas.instanceServiceContainer.selectionService.selectedElements);
|
|
52
52
|
break;
|
|
53
53
|
case EventNames.PointerUp:
|
|
54
|
-
let cg = this.extendedItem.openGroup("Rotate Elements"
|
|
54
|
+
let cg = this.extendedItem.openGroup("Rotate Elements");
|
|
55
55
|
/*for (const designItem of this.instanceServiceContainer.selectionService.selectedElements) {
|
|
56
56
|
designItem.setStyle('width', (<HTMLElement>designItem.element).style.width);
|
|
57
57
|
designItem.setStyle('height', (<HTMLElement>designItem.element).style.height);
|
|
@@ -243,7 +243,7 @@ export class PointerTool {
|
|
|
243
243
|
let containerService = designerCanvas.serviceContainer.getLastServiceWhere('containerService', x => x.serviceForContainer(this._actionStartedDesignItem.parent, containerStyle));
|
|
244
244
|
const cp = { x: currentPoint.x - this._moveItemsOffset.x, y: currentPoint.y - this._moveItemsOffset.y };
|
|
245
245
|
if (containerService) {
|
|
246
|
-
let cg = designerCanvas.rootDesignItem.openGroup("Move Elements"
|
|
246
|
+
let cg = designerCanvas.rootDesignItem.openGroup("Move Elements");
|
|
247
247
|
containerService.finishPlace(event, designerCanvas, this._actionStartedDesignItem.parent, this._initialPoint, this._initialOffset, cp, designerCanvas.instanceServiceContainer.selectionService.selectedElements);
|
|
248
248
|
cg.commit();
|
|
249
249
|
}
|
|
@@ -57,7 +57,12 @@ export class PaletteTreeView extends BaseCustomWebComponentConstructorAppend {
|
|
|
57
57
|
super();
|
|
58
58
|
this._restoreCachedInititalValues();
|
|
59
59
|
//@ts-ignore
|
|
60
|
-
|
|
60
|
+
if (importShim)
|
|
61
|
+
//@ts-ignore
|
|
62
|
+
importShim("jquery.fancytree/dist/skin-win8/ui.fancytree.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
63
|
+
else
|
|
64
|
+
//@ts-ignore
|
|
65
|
+
import("jquery.fancytree/dist/skin-win8/ui.fancytree.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
61
66
|
this._filter = this._getDomElement('input');
|
|
62
67
|
this._filter.onkeyup = () => {
|
|
63
68
|
let match = this._filter.value;
|
|
@@ -6,6 +6,7 @@ export declare class PropertyGridWithHeader extends BaseCustomWebComponentLazyAp
|
|
|
6
6
|
static readonly template: HTMLTemplateElement;
|
|
7
7
|
private _type;
|
|
8
8
|
private _id;
|
|
9
|
+
private _content;
|
|
9
10
|
private _pg;
|
|
10
11
|
private _selectionChangedHandler;
|
|
11
12
|
private _instanceServiceContainer;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseCustomWebComponentLazyAppend, css, html } from '@node-projects/base-custom-webcomponent';
|
|
2
2
|
import { sleep } from '../../helper/Helper.js';
|
|
3
|
+
import { DesignItem } from '../../item/DesignItem';
|
|
3
4
|
export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
|
|
4
5
|
static style = css `
|
|
5
6
|
:host {
|
|
@@ -43,11 +44,13 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
|
|
|
43
44
|
<div>
|
|
44
45
|
<span class="desc">Type:</span><span id="type"></span>
|
|
45
46
|
<span class="desc">Id:</span><input type="text" id="id">
|
|
47
|
+
<span class="desc">Content:</span><input type="text" id="content">
|
|
46
48
|
</div>
|
|
47
49
|
<node-projects-property-grid id="pg"></node-projects-property-grid>
|
|
48
50
|
`;
|
|
49
51
|
_type;
|
|
50
52
|
_id;
|
|
53
|
+
_content;
|
|
51
54
|
_pg;
|
|
52
55
|
_selectionChangedHandler;
|
|
53
56
|
_instanceServiceContainer;
|
|
@@ -56,6 +59,7 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
|
|
|
56
59
|
this._restoreCachedInititalValues();
|
|
57
60
|
this._type = this._getDomElement('type');
|
|
58
61
|
this._id = this._getDomElement('id');
|
|
62
|
+
this._content = this._getDomElement('content');
|
|
59
63
|
this._pg = this._getDomElement('pg');
|
|
60
64
|
this._id.onkeydown = e => {
|
|
61
65
|
if (e.key == 'Enter')
|
|
@@ -66,6 +70,21 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
|
|
|
66
70
|
e.stopPropagation();
|
|
67
71
|
}
|
|
68
72
|
};
|
|
73
|
+
this._content.onkeydown = e => {
|
|
74
|
+
if (e.key == 'Enter') {
|
|
75
|
+
const grp = this._instanceServiceContainer.selectionService.primarySelection.openGroup('set content');
|
|
76
|
+
this._instanceServiceContainer.selectionService.primarySelection.clearChildren();
|
|
77
|
+
let t = document.createTextNode(this._content.value);
|
|
78
|
+
let di = DesignItem.GetOrCreateDesignItem(t, this._instanceServiceContainer.selectionService.primarySelection.serviceContainer, this._instanceServiceContainer);
|
|
79
|
+
this._instanceServiceContainer.selectionService.primarySelection.insertAdjacentElement(di, 'afterbegin');
|
|
80
|
+
grp.commit();
|
|
81
|
+
}
|
|
82
|
+
else if (e.key == 'Escape') {
|
|
83
|
+
this._content.value = this._instanceServiceContainer.selectionService.primarySelection?.element?.textContent ?? '';
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
e.stopPropagation();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
69
88
|
let pSel;
|
|
70
89
|
this._id.onfocus = e => {
|
|
71
90
|
pSel = this._instanceServiceContainer.selectionService.primarySelection;
|
|
@@ -85,6 +104,7 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
|
|
|
85
104
|
await sleep(20); // delay assignment a little bit, so onblur above could still set the value.
|
|
86
105
|
this._type.innerText = this._instanceServiceContainer.selectionService.primarySelection?.name ?? '';
|
|
87
106
|
this._id.value = this._instanceServiceContainer.selectionService.primarySelection?.id ?? '';
|
|
107
|
+
this._content.value = this._instanceServiceContainer.selectionService.primarySelection?.element?.textContent ?? '';
|
|
88
108
|
});
|
|
89
109
|
}
|
|
90
110
|
}
|
|
@@ -96,7 +96,12 @@ export class TreeViewExtended extends BaseCustomWebComponentConstructorAppend {
|
|
|
96
96
|
super();
|
|
97
97
|
this._restoreCachedInititalValues();
|
|
98
98
|
//@ts-ignore
|
|
99
|
-
|
|
99
|
+
if (importShim)
|
|
100
|
+
//@ts-ignore
|
|
101
|
+
importShim("jquery.fancytree/dist/skin-win8/ui.fancytree.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
102
|
+
else
|
|
103
|
+
//@ts-ignore
|
|
104
|
+
import("jquery.fancytree/dist/skin-win8/ui.fancytree.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
100
105
|
this._filter = this._getDomElement('input');
|
|
101
106
|
this._filter.onkeyup = () => {
|
|
102
107
|
this._filterNodes();
|