@node-projects/web-component-designer 0.0.37 → 0.0.38

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.
@@ -137,7 +137,7 @@ export class DesignerTabControl extends BaseCustomWebComponentLazyAppend {
137
137
  let htmlItem = item;
138
138
  const tabHeaderDiv = this._elementMap.get(htmlItem);
139
139
  this._moreContainer.appendChild(tabHeaderDiv);
140
- if (w < this._headerDiv.clientWidth) {
140
+ if (this._headerDiv.children.length == 0 || (w + (tabHeaderDiv.clientWidth / 2)) < this._headerDiv.clientWidth) {
141
141
  this._headerDiv.appendChild(tabHeaderDiv);
142
142
  w += tabHeaderDiv.clientWidth;
143
143
  }
@@ -6,10 +6,26 @@ export declare type ThicknessEditorValueChangedEventArgs = {
6
6
  export declare class ThicknessEditor extends BaseCustomWebComponentConstructorAppend {
7
7
  static readonly style: CSSStyleSheet;
8
8
  static readonly template: HTMLTemplateElement;
9
- private _value;
10
- get value(): string;
11
- set value(value: string);
12
- valueChanged: TypedEvent<ThicknessEditorValueChangedEventArgs>;
9
+ private _leftInput;
10
+ private _topInput;
11
+ private _rightInput;
12
+ private _bottomInput;
13
+ private _valueLeft;
14
+ get valueLeft(): string;
15
+ set valueLeft(value: string);
16
+ valueLeftChanged: TypedEvent<ThicknessEditorValueChangedEventArgs>;
17
+ private _valueTop;
18
+ get valueTop(): string;
19
+ set valueTop(value: string);
20
+ valueTopChanged: TypedEvent<ThicknessEditorValueChangedEventArgs>;
21
+ private _valueRight;
22
+ get valueRight(): string;
23
+ set valueRight(value: string);
24
+ valueRightChanged: TypedEvent<ThicknessEditorValueChangedEventArgs>;
25
+ private _valueBottom;
26
+ get valueBottom(): string;
27
+ set valueBottom(value: string);
28
+ valueBottomChanged: TypedEvent<ThicknessEditorValueChangedEventArgs>;
13
29
  property: string;
14
30
  unsetValue: string;
15
31
  _updateValue(): void;
@@ -57,24 +57,89 @@ export class ThicknessEditor extends BaseCustomWebComponentConstructorAppend {
57
57
  <div id="rect"></div>
58
58
  </div>
59
59
  `;
60
- _value;
61
- get value() {
62
- return this._value;
60
+ _leftInput;
61
+ _topInput;
62
+ _rightInput;
63
+ _bottomInput;
64
+ _valueLeft;
65
+ get valueLeft() {
66
+ return this._valueLeft;
63
67
  }
64
- set value(value) {
65
- const oldValue = this._value;
66
- this._value = value;
67
- this._updateValue();
68
- this.valueChanged.emit({ newValue: this._value, oldValue: oldValue });
68
+ set valueLeft(value) {
69
+ const oldValue = this._valueLeft;
70
+ this._valueLeft = value;
71
+ if (oldValue !== value) {
72
+ this._updateValue();
73
+ this.valueLeftChanged.emit({ newValue: value, oldValue: oldValue });
74
+ }
75
+ }
76
+ valueLeftChanged = new TypedEvent();
77
+ _valueTop;
78
+ get valueTop() {
79
+ return this._valueTop;
80
+ }
81
+ set valueTop(value) {
82
+ const oldValue = this._valueTop;
83
+ this._valueTop = value;
84
+ if (oldValue !== value) {
85
+ this._updateValue();
86
+ this.valueTopChanged.emit({ newValue: value, oldValue: oldValue });
87
+ }
88
+ }
89
+ valueTopChanged = new TypedEvent();
90
+ _valueRight;
91
+ get valueRight() {
92
+ return this._valueRight;
93
+ }
94
+ set valueRight(value) {
95
+ const oldValue = this._valueRight;
96
+ this._valueRight = value;
97
+ if (oldValue !== value) {
98
+ this._updateValue();
99
+ this.valueRightChanged.emit({ newValue: value, oldValue: oldValue });
100
+ }
101
+ }
102
+ valueRightChanged = new TypedEvent();
103
+ _valueBottom;
104
+ get valueBottom() {
105
+ return this._valueBottom;
106
+ }
107
+ set valueBottom(value) {
108
+ const oldValue = this._valueBottom;
109
+ this._valueBottom = value;
110
+ if (oldValue !== value) {
111
+ this._updateValue();
112
+ this.valueBottomChanged.emit({ newValue: value, oldValue: oldValue });
113
+ }
69
114
  }
70
- valueChanged = new TypedEvent();
115
+ valueBottomChanged = new TypedEvent();
71
116
  property;
72
117
  unsetValue;
73
118
  _updateValue() {
119
+ this._leftInput.value = this.valueLeft;
120
+ this._topInput.value = this.valueTop;
121
+ this._rightInput.value = this.valueRight;
122
+ this._bottomInput.value = this._valueBottom;
74
123
  }
75
124
  ready() {
76
125
  this._parseAttributesToProperties();
77
126
  this._updateValue();
127
+ this._leftInput = this._getDomElement('left');
128
+ this._topInput = this._getDomElement('top');
129
+ this._rightInput = this._getDomElement('right');
130
+ this._bottomInput = this._getDomElement('bottom');
131
+ this._leftInput.onkeyup = (e) => { if (e.key === 'Enter')
132
+ this._valueLeft = this._leftInput.value; };
133
+ this._topInput.onkeyup = (e) => { if (e.key === 'Enter')
134
+ this._valueTop = this._topInput.value; };
135
+ this._rightInput.onkeyup = (e) => { if (e.key === 'Enter')
136
+ this._valueRight = this._rightInput.value; };
137
+ this._bottomInput.onkeyup = (e) => { if (e.key === 'Enter')
138
+ this._valueBottom = this._bottomInput.value; };
139
+ this._leftInput.onblur = (e) => this._valueLeft = this._leftInput.value;
140
+ this._topInput.onblur = (e) => this._valueTop = this._topInput.value;
141
+ this._rightInput.onblur = (e) => this._valueRight = this._rightInput.value;
142
+ this._bottomInput.onblur = (e) => this._valueBottom = this._bottomInput.value;
78
143
  }
79
144
  }
80
145
  customElements.define('node-projects-thickness-editor', ThicknessEditor);
@@ -30,7 +30,12 @@ export class BasePropertyEditor {
30
30
  else
31
31
  this.element.classList.remove('unset-value');
32
32
  this.disableChangeNotification = true;
33
- this.refreshValue(valueType, value);
33
+ try {
34
+ this.refreshValue(valueType, value);
35
+ }
36
+ catch (err) {
37
+ console.error(err);
38
+ }
34
39
  this.disableChangeNotification = false;
35
40
  }
36
41
  }
@@ -5,10 +5,10 @@ export class ThicknessPropertyEditor extends BasePropertyEditor {
5
5
  super(property);
6
6
  const selector = new ThicknessEditor();
7
7
  selector.property = property.name;
8
- selector.valueChanged.on((e) => this._valueChanged(e.newValue));
8
+ selector.valueLeftChanged.on((e) => this._valueChanged(e.newValue));
9
9
  this.element = selector;
10
10
  }
11
11
  refreshValue(valueType, value) {
12
- this.element.value = value;
12
+ this.element.valueLeft = value;
13
13
  }
14
14
  }
@@ -63,7 +63,13 @@ export class OverlayLayerView extends BaseCustomWebComponentConstructorAppend {
63
63
  }
64
64
  }
65
65
  removeOverlay(element) {
66
- element.parentElement.removeChild(element);
66
+ try {
67
+ if (element)
68
+ element.parentElement.removeChild(element);
69
+ }
70
+ catch (err) {
71
+ console.error(err);
72
+ }
67
73
  }
68
74
  removeAllNodesWithClass(className) {
69
75
  const nodes = this._svg.querySelectorAll('.' + className);
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.37",
4
+ "version": "0.0.38",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "",
@@ -11,14 +11,14 @@
11
11
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
12
12
  },
13
13
  "dependencies": {
14
- "@node-projects/base-custom-webcomponent": "^0.2.0",
14
+ "@node-projects/base-custom-webcomponent": "^0.3.0",
15
15
  "construct-style-sheets-polyfill": "^3.0.4"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@node-projects/lean-he-esm": "^3.3.0",
19
19
  "@node-projects/node-html-parser-esm": "^2.4.1",
20
20
  "@types/codemirror": "^5.60.5",
21
- "@types/jquery": "^3.5.8",
21
+ "@types/jquery": "^3.5.9",
22
22
  "@types/jquery.fancytree": "0.0.7",
23
23
  "ace-builds": "^1.4.13",
24
24
  "codemirror": "^5.64.0",