@node-projects/web-component-designer 0.1.142 → 0.1.144
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/DefaultServiceBootstrap.js +2 -0
- package/dist/elements/services/propertiesService/services/BasicWebcomponentPropertiesService copy.d.ts +21 -0
- package/dist/elements/services/propertiesService/services/BasicWebcomponentPropertiesService copy.js +243 -0
- package/dist/elements/services/propertiesService/services/BasicWebcomponentPropertiesService.d.ts +12 -0
- package/dist/elements/services/propertiesService/services/BasicWebcomponentPropertiesService.js +31 -0
- package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService copy.d.ts +21 -0
- package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService copy.js +243 -0
- package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService.d.ts +2 -2
- package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService.js +2 -2
- package/dist/elements/widgets/propertyGrid/PropertyGrid.d.ts +3 -0
- package/dist/elements/widgets/propertyGrid/PropertyGrid.js +4 -0
- package/dist/elements/widgets/propertyGrid/PropertyGridPropertyList.d.ts +3 -0
- package/dist/elements/widgets/propertyGrid/PropertyGridPropertyList.js +34 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -94,12 +94,14 @@ import { ToolbarExtensionsDesignViewConfigButtons } from '../widgets/designerVie
|
|
|
94
94
|
import { PaddingExtensionProvider } from '../widgets/designerView/extensions/PaddingExtensionProvider.js';
|
|
95
95
|
import { GridChildResizeExtensionProvider } from '../widgets/designerView/extensions/grid/GridChildResizeExtensionProvider.js';
|
|
96
96
|
import { AlignItemsContextMenu } from '../widgets/designerView/extensions/contextMenu/AlignItemsContextMenu.js';
|
|
97
|
+
import { BasicWebcomponentPropertiesService } from './propertiesService/services/BasicWebcomponentPropertiesService.js';
|
|
97
98
|
export function createDefaultServiceContainer() {
|
|
98
99
|
let serviceContainer = new ServiceContainer();
|
|
99
100
|
let defaultPlacementService = new DefaultPlacementService();
|
|
100
101
|
serviceContainer.register("containerService", defaultPlacementService);
|
|
101
102
|
serviceContainer.register("containerService", new GridPlacementService(defaultPlacementService));
|
|
102
103
|
serviceContainer.register("containerService", new FlexBoxPlacementService(defaultPlacementService));
|
|
104
|
+
serviceContainer.register("propertyService", new BasicWebcomponentPropertiesService());
|
|
103
105
|
serviceContainer.register("propertyService", new PolymerPropertiesService());
|
|
104
106
|
serviceContainer.register("propertyService", new LitElementPropertiesService());
|
|
105
107
|
serviceContainer.register("propertyService", new NativeElementsPropertiesService());
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IProperty } from '../IProperty.js';
|
|
2
|
+
import { IDesignItem } from '../../../item/IDesignItem.js';
|
|
3
|
+
import { CommonPropertiesService } from './CommonPropertiesService.js';
|
|
4
|
+
import { RefreshMode } from '../IPropertiesService.js';
|
|
5
|
+
import { IPropertyGroup } from '../IPropertyGroup.js';
|
|
6
|
+
export declare class NativeElementsPropertiesService extends CommonPropertiesService {
|
|
7
|
+
private inputProperties;
|
|
8
|
+
private textareaProperties;
|
|
9
|
+
private selectProperties;
|
|
10
|
+
private buttonProperties;
|
|
11
|
+
private anchorProperties;
|
|
12
|
+
private divProperties;
|
|
13
|
+
private imgProperties;
|
|
14
|
+
private iframeProperties;
|
|
15
|
+
private formElementProperties;
|
|
16
|
+
name: string;
|
|
17
|
+
getRefreshMode(designItem: IDesignItem): RefreshMode;
|
|
18
|
+
isHandledElement(designItem: IDesignItem): boolean;
|
|
19
|
+
getProperty(designItem: IDesignItem, name: string): IProperty;
|
|
20
|
+
getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
|
|
21
|
+
}
|
package/dist/elements/services/propertiesService/services/BasicWebcomponentPropertiesService copy.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { CommonPropertiesService } from './CommonPropertiesService.js';
|
|
2
|
+
import { PropertyType } from '../PropertyType.js';
|
|
3
|
+
import { RefreshMode } from '../IPropertiesService.js';
|
|
4
|
+
export class NativeElementsPropertiesService extends CommonPropertiesService {
|
|
5
|
+
inputProperties = [
|
|
6
|
+
{
|
|
7
|
+
name: "type",
|
|
8
|
+
type: "list",
|
|
9
|
+
values: ["text", "number", "button", "checkbox", "color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "password", "radio", "range", "reset", "search", "submit", "tel", "time", "url", "week"],
|
|
10
|
+
service: this,
|
|
11
|
+
defaultValue: "text",
|
|
12
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
13
|
+
}, {
|
|
14
|
+
name: "value",
|
|
15
|
+
type: "string",
|
|
16
|
+
service: this,
|
|
17
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
18
|
+
}, {
|
|
19
|
+
name: "placeholder",
|
|
20
|
+
type: "string",
|
|
21
|
+
service: this,
|
|
22
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
23
|
+
}, {
|
|
24
|
+
name: "checked",
|
|
25
|
+
type: "boolean",
|
|
26
|
+
service: this,
|
|
27
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
28
|
+
}, {
|
|
29
|
+
name: "min",
|
|
30
|
+
type: "number",
|
|
31
|
+
service: this,
|
|
32
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
33
|
+
}, {
|
|
34
|
+
name: "max",
|
|
35
|
+
type: "number",
|
|
36
|
+
service: this,
|
|
37
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
38
|
+
}, {
|
|
39
|
+
name: "readonly",
|
|
40
|
+
type: "boolean",
|
|
41
|
+
service: this,
|
|
42
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
43
|
+
}, {
|
|
44
|
+
name: "valueAsDate",
|
|
45
|
+
type: "string",
|
|
46
|
+
service: this,
|
|
47
|
+
propertyType: PropertyType.property
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "valueAsNumber",
|
|
51
|
+
type: "string",
|
|
52
|
+
service: this,
|
|
53
|
+
propertyType: PropertyType.property
|
|
54
|
+
}
|
|
55
|
+
];
|
|
56
|
+
textareaProperties = [
|
|
57
|
+
{
|
|
58
|
+
name: "value",
|
|
59
|
+
type: "string",
|
|
60
|
+
service: this,
|
|
61
|
+
propertyType: PropertyType.property
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "placeholder",
|
|
65
|
+
type: "string",
|
|
66
|
+
service: this,
|
|
67
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
68
|
+
}, {
|
|
69
|
+
name: "maxlength",
|
|
70
|
+
type: "number",
|
|
71
|
+
service: this,
|
|
72
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
73
|
+
}, {
|
|
74
|
+
name: "cols",
|
|
75
|
+
type: "number",
|
|
76
|
+
service: this,
|
|
77
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
78
|
+
}, {
|
|
79
|
+
name: "rows",
|
|
80
|
+
type: "number",
|
|
81
|
+
service: this,
|
|
82
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
83
|
+
}, {
|
|
84
|
+
name: "readonly",
|
|
85
|
+
type: "boolean",
|
|
86
|
+
service: this,
|
|
87
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
88
|
+
}, {
|
|
89
|
+
name: "resize",
|
|
90
|
+
type: "list",
|
|
91
|
+
values: ["both", "none", "horizontal", "vertical"],
|
|
92
|
+
service: this,
|
|
93
|
+
propertyType: PropertyType.cssValue
|
|
94
|
+
}
|
|
95
|
+
];
|
|
96
|
+
selectProperties = [
|
|
97
|
+
{
|
|
98
|
+
name: "value",
|
|
99
|
+
type: "string",
|
|
100
|
+
service: this,
|
|
101
|
+
propertyType: PropertyType.property
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "size",
|
|
105
|
+
type: "number",
|
|
106
|
+
service: this,
|
|
107
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
108
|
+
}, {
|
|
109
|
+
name: "multiple",
|
|
110
|
+
type: "boolean",
|
|
111
|
+
service: this,
|
|
112
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
buttonProperties = [
|
|
116
|
+
{
|
|
117
|
+
name: "type",
|
|
118
|
+
type: "list",
|
|
119
|
+
values: ["button", "submit", "reset"],
|
|
120
|
+
service: this,
|
|
121
|
+
defaultValue: "button",
|
|
122
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
123
|
+
}, {
|
|
124
|
+
name: "value",
|
|
125
|
+
type: "string",
|
|
126
|
+
service: this,
|
|
127
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
128
|
+
}
|
|
129
|
+
];
|
|
130
|
+
anchorProperties = [
|
|
131
|
+
{
|
|
132
|
+
name: "href",
|
|
133
|
+
type: "string",
|
|
134
|
+
service: this,
|
|
135
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
136
|
+
}
|
|
137
|
+
];
|
|
138
|
+
divProperties = [
|
|
139
|
+
{
|
|
140
|
+
name: "title",
|
|
141
|
+
type: "string",
|
|
142
|
+
service: this,
|
|
143
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
144
|
+
}
|
|
145
|
+
];
|
|
146
|
+
imgProperties = [
|
|
147
|
+
{
|
|
148
|
+
name: "src",
|
|
149
|
+
type: "string",
|
|
150
|
+
service: this,
|
|
151
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
152
|
+
}
|
|
153
|
+
];
|
|
154
|
+
iframeProperties = [
|
|
155
|
+
{
|
|
156
|
+
name: "src",
|
|
157
|
+
type: "string",
|
|
158
|
+
service: this,
|
|
159
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
160
|
+
}
|
|
161
|
+
];
|
|
162
|
+
formElementProperties = [
|
|
163
|
+
{
|
|
164
|
+
name: "autofocus",
|
|
165
|
+
type: "boolean",
|
|
166
|
+
service: this,
|
|
167
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: "disabled",
|
|
171
|
+
type: "boolean",
|
|
172
|
+
service: this,
|
|
173
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "required",
|
|
177
|
+
type: "boolean",
|
|
178
|
+
service: this,
|
|
179
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
180
|
+
}
|
|
181
|
+
];
|
|
182
|
+
name = "native";
|
|
183
|
+
getRefreshMode(designItem) {
|
|
184
|
+
return RefreshMode.full;
|
|
185
|
+
}
|
|
186
|
+
isHandledElement(designItem) {
|
|
187
|
+
switch (designItem.element.localName) {
|
|
188
|
+
case 'input':
|
|
189
|
+
case 'textarea':
|
|
190
|
+
case 'select':
|
|
191
|
+
case 'button':
|
|
192
|
+
case 'a':
|
|
193
|
+
case 'div':
|
|
194
|
+
case 'span':
|
|
195
|
+
case 'br':
|
|
196
|
+
case 'img':
|
|
197
|
+
case 'iframe':
|
|
198
|
+
case 'h1':
|
|
199
|
+
case 'h2':
|
|
200
|
+
case 'h3':
|
|
201
|
+
case 'h4':
|
|
202
|
+
case 'h5':
|
|
203
|
+
case 'h6':
|
|
204
|
+
case 'p':
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
getProperty(designItem, name) {
|
|
210
|
+
return this.getProperties(designItem).find(x => x.name == name);
|
|
211
|
+
}
|
|
212
|
+
getProperties(designItem) {
|
|
213
|
+
if (!this.isHandledElement(designItem))
|
|
214
|
+
return null;
|
|
215
|
+
switch (designItem.element.localName) {
|
|
216
|
+
case 'input':
|
|
217
|
+
return [...this.inputProperties, ...this.formElementProperties];
|
|
218
|
+
case 'textarea':
|
|
219
|
+
return [...this.textareaProperties, ...this.formElementProperties];
|
|
220
|
+
case 'select':
|
|
221
|
+
return [...this.selectProperties, ...this.formElementProperties];
|
|
222
|
+
case 'button':
|
|
223
|
+
return [...this.buttonProperties, ...this.formElementProperties];
|
|
224
|
+
case 'a':
|
|
225
|
+
return this.anchorProperties;
|
|
226
|
+
case 'div':
|
|
227
|
+
return this.divProperties;
|
|
228
|
+
case 'img':
|
|
229
|
+
return this.imgProperties;
|
|
230
|
+
case 'iframe':
|
|
231
|
+
return this.iframeProperties;
|
|
232
|
+
case 'h1':
|
|
233
|
+
case 'h2':
|
|
234
|
+
case 'h3':
|
|
235
|
+
case 'h4':
|
|
236
|
+
case 'h5':
|
|
237
|
+
case 'h6':
|
|
238
|
+
case 'p':
|
|
239
|
+
return [];
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
}
|
package/dist/elements/services/propertiesService/services/BasicWebcomponentPropertiesService.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IProperty } from '../IProperty.js';
|
|
2
|
+
import { IDesignItem } from '../../../item/IDesignItem.js';
|
|
3
|
+
import { RefreshMode } from '../IPropertiesService.js';
|
|
4
|
+
import { IPropertyGroup } from '../IPropertyGroup.js';
|
|
5
|
+
import { AbstractPropertiesService } from './AbstractPropertiesService.js';
|
|
6
|
+
export declare class BasicWebcomponentPropertiesService extends AbstractPropertiesService {
|
|
7
|
+
name: string;
|
|
8
|
+
getRefreshMode(designItem: IDesignItem): RefreshMode;
|
|
9
|
+
isHandledElement(designItem: IDesignItem): boolean;
|
|
10
|
+
getProperty(designItem: IDesignItem, name: string): IProperty;
|
|
11
|
+
getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
|
|
12
|
+
}
|
package/dist/elements/services/propertiesService/services/BasicWebcomponentPropertiesService.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PropertyType } from '../PropertyType.js';
|
|
2
|
+
import { RefreshMode } from '../IPropertiesService.js';
|
|
3
|
+
import { AbstractPropertiesService } from './AbstractPropertiesService.js';
|
|
4
|
+
import { PropertiesHelper } from './PropertiesHelper.js';
|
|
5
|
+
export class BasicWebcomponentPropertiesService extends AbstractPropertiesService {
|
|
6
|
+
name = "webcomponent";
|
|
7
|
+
getRefreshMode(designItem) {
|
|
8
|
+
return RefreshMode.full;
|
|
9
|
+
}
|
|
10
|
+
isHandledElement(designItem) {
|
|
11
|
+
//@ts-ignore
|
|
12
|
+
const attr = designItem.element.constructor?.observedAttributes;
|
|
13
|
+
if (attr && attr.length > 0) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
getProperty(designItem, name) {
|
|
19
|
+
return this.getProperties(designItem).find(x => x.name == name);
|
|
20
|
+
}
|
|
21
|
+
getProperties(designItem) {
|
|
22
|
+
//@ts-ignore
|
|
23
|
+
const attr = designItem.element.constructor?.observedAttributes;
|
|
24
|
+
return attr.map(x => ({
|
|
25
|
+
name: PropertiesHelper.dashToCamelCase(x),
|
|
26
|
+
type: "string",
|
|
27
|
+
service: this,
|
|
28
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
}
|
package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService copy.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IProperty } from '../IProperty.js';
|
|
2
|
+
import { IDesignItem } from '../../../item/IDesignItem.js';
|
|
3
|
+
import { CommonPropertiesService } from './CommonPropertiesService.js';
|
|
4
|
+
import { RefreshMode } from '../IPropertiesService.js';
|
|
5
|
+
import { IPropertyGroup } from '../IPropertyGroup.js';
|
|
6
|
+
export declare class NativeElementsPropertiesService extends CommonPropertiesService {
|
|
7
|
+
private inputProperties;
|
|
8
|
+
private textareaProperties;
|
|
9
|
+
private selectProperties;
|
|
10
|
+
private buttonProperties;
|
|
11
|
+
private anchorProperties;
|
|
12
|
+
private divProperties;
|
|
13
|
+
private imgProperties;
|
|
14
|
+
private iframeProperties;
|
|
15
|
+
private formElementProperties;
|
|
16
|
+
name: string;
|
|
17
|
+
getRefreshMode(designItem: IDesignItem): RefreshMode;
|
|
18
|
+
isHandledElement(designItem: IDesignItem): boolean;
|
|
19
|
+
getProperty(designItem: IDesignItem, name: string): IProperty;
|
|
20
|
+
getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
|
|
21
|
+
}
|
package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService copy.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { CommonPropertiesService } from './CommonPropertiesService.js';
|
|
2
|
+
import { PropertyType } from '../PropertyType.js';
|
|
3
|
+
import { RefreshMode } from '../IPropertiesService.js';
|
|
4
|
+
export class NativeElementsPropertiesService extends CommonPropertiesService {
|
|
5
|
+
inputProperties = [
|
|
6
|
+
{
|
|
7
|
+
name: "type",
|
|
8
|
+
type: "list",
|
|
9
|
+
values: ["text", "number", "button", "checkbox", "color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "password", "radio", "range", "reset", "search", "submit", "tel", "time", "url", "week"],
|
|
10
|
+
service: this,
|
|
11
|
+
defaultValue: "text",
|
|
12
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
13
|
+
}, {
|
|
14
|
+
name: "value",
|
|
15
|
+
type: "string",
|
|
16
|
+
service: this,
|
|
17
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
18
|
+
}, {
|
|
19
|
+
name: "placeholder",
|
|
20
|
+
type: "string",
|
|
21
|
+
service: this,
|
|
22
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
23
|
+
}, {
|
|
24
|
+
name: "checked",
|
|
25
|
+
type: "boolean",
|
|
26
|
+
service: this,
|
|
27
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
28
|
+
}, {
|
|
29
|
+
name: "min",
|
|
30
|
+
type: "number",
|
|
31
|
+
service: this,
|
|
32
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
33
|
+
}, {
|
|
34
|
+
name: "max",
|
|
35
|
+
type: "number",
|
|
36
|
+
service: this,
|
|
37
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
38
|
+
}, {
|
|
39
|
+
name: "readonly",
|
|
40
|
+
type: "boolean",
|
|
41
|
+
service: this,
|
|
42
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
43
|
+
}, {
|
|
44
|
+
name: "valueAsDate",
|
|
45
|
+
type: "string",
|
|
46
|
+
service: this,
|
|
47
|
+
propertyType: PropertyType.property
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "valueAsNumber",
|
|
51
|
+
type: "string",
|
|
52
|
+
service: this,
|
|
53
|
+
propertyType: PropertyType.property
|
|
54
|
+
}
|
|
55
|
+
];
|
|
56
|
+
textareaProperties = [
|
|
57
|
+
{
|
|
58
|
+
name: "value",
|
|
59
|
+
type: "string",
|
|
60
|
+
service: this,
|
|
61
|
+
propertyType: PropertyType.property
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "placeholder",
|
|
65
|
+
type: "string",
|
|
66
|
+
service: this,
|
|
67
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
68
|
+
}, {
|
|
69
|
+
name: "maxlength",
|
|
70
|
+
type: "number",
|
|
71
|
+
service: this,
|
|
72
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
73
|
+
}, {
|
|
74
|
+
name: "cols",
|
|
75
|
+
type: "number",
|
|
76
|
+
service: this,
|
|
77
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
78
|
+
}, {
|
|
79
|
+
name: "rows",
|
|
80
|
+
type: "number",
|
|
81
|
+
service: this,
|
|
82
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
83
|
+
}, {
|
|
84
|
+
name: "readonly",
|
|
85
|
+
type: "boolean",
|
|
86
|
+
service: this,
|
|
87
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
88
|
+
}, {
|
|
89
|
+
name: "resize",
|
|
90
|
+
type: "list",
|
|
91
|
+
values: ["both", "none", "horizontal", "vertical"],
|
|
92
|
+
service: this,
|
|
93
|
+
propertyType: PropertyType.cssValue
|
|
94
|
+
}
|
|
95
|
+
];
|
|
96
|
+
selectProperties = [
|
|
97
|
+
{
|
|
98
|
+
name: "value",
|
|
99
|
+
type: "string",
|
|
100
|
+
service: this,
|
|
101
|
+
propertyType: PropertyType.property
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "size",
|
|
105
|
+
type: "number",
|
|
106
|
+
service: this,
|
|
107
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
108
|
+
}, {
|
|
109
|
+
name: "multiple",
|
|
110
|
+
type: "boolean",
|
|
111
|
+
service: this,
|
|
112
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
buttonProperties = [
|
|
116
|
+
{
|
|
117
|
+
name: "type",
|
|
118
|
+
type: "list",
|
|
119
|
+
values: ["button", "submit", "reset"],
|
|
120
|
+
service: this,
|
|
121
|
+
defaultValue: "button",
|
|
122
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
123
|
+
}, {
|
|
124
|
+
name: "value",
|
|
125
|
+
type: "string",
|
|
126
|
+
service: this,
|
|
127
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
128
|
+
}
|
|
129
|
+
];
|
|
130
|
+
anchorProperties = [
|
|
131
|
+
{
|
|
132
|
+
name: "href",
|
|
133
|
+
type: "string",
|
|
134
|
+
service: this,
|
|
135
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
136
|
+
}
|
|
137
|
+
];
|
|
138
|
+
divProperties = [
|
|
139
|
+
{
|
|
140
|
+
name: "title",
|
|
141
|
+
type: "string",
|
|
142
|
+
service: this,
|
|
143
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
144
|
+
}
|
|
145
|
+
];
|
|
146
|
+
imgProperties = [
|
|
147
|
+
{
|
|
148
|
+
name: "src",
|
|
149
|
+
type: "string",
|
|
150
|
+
service: this,
|
|
151
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
152
|
+
}
|
|
153
|
+
];
|
|
154
|
+
iframeProperties = [
|
|
155
|
+
{
|
|
156
|
+
name: "src",
|
|
157
|
+
type: "string",
|
|
158
|
+
service: this,
|
|
159
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
160
|
+
}
|
|
161
|
+
];
|
|
162
|
+
formElementProperties = [
|
|
163
|
+
{
|
|
164
|
+
name: "autofocus",
|
|
165
|
+
type: "boolean",
|
|
166
|
+
service: this,
|
|
167
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: "disabled",
|
|
171
|
+
type: "boolean",
|
|
172
|
+
service: this,
|
|
173
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "required",
|
|
177
|
+
type: "boolean",
|
|
178
|
+
service: this,
|
|
179
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
180
|
+
}
|
|
181
|
+
];
|
|
182
|
+
name = "native";
|
|
183
|
+
getRefreshMode(designItem) {
|
|
184
|
+
return RefreshMode.full;
|
|
185
|
+
}
|
|
186
|
+
isHandledElement(designItem) {
|
|
187
|
+
switch (designItem.element.localName) {
|
|
188
|
+
case 'input':
|
|
189
|
+
case 'textarea':
|
|
190
|
+
case 'select':
|
|
191
|
+
case 'button':
|
|
192
|
+
case 'a':
|
|
193
|
+
case 'div':
|
|
194
|
+
case 'span':
|
|
195
|
+
case 'br':
|
|
196
|
+
case 'img':
|
|
197
|
+
case 'iframe':
|
|
198
|
+
case 'h1':
|
|
199
|
+
case 'h2':
|
|
200
|
+
case 'h3':
|
|
201
|
+
case 'h4':
|
|
202
|
+
case 'h5':
|
|
203
|
+
case 'h6':
|
|
204
|
+
case 'p':
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
getProperty(designItem, name) {
|
|
210
|
+
return this.getProperties(designItem).find(x => x.name == name);
|
|
211
|
+
}
|
|
212
|
+
getProperties(designItem) {
|
|
213
|
+
if (!this.isHandledElement(designItem))
|
|
214
|
+
return null;
|
|
215
|
+
switch (designItem.element.localName) {
|
|
216
|
+
case 'input':
|
|
217
|
+
return [...this.inputProperties, ...this.formElementProperties];
|
|
218
|
+
case 'textarea':
|
|
219
|
+
return [...this.textareaProperties, ...this.formElementProperties];
|
|
220
|
+
case 'select':
|
|
221
|
+
return [...this.selectProperties, ...this.formElementProperties];
|
|
222
|
+
case 'button':
|
|
223
|
+
return [...this.buttonProperties, ...this.formElementProperties];
|
|
224
|
+
case 'a':
|
|
225
|
+
return this.anchorProperties;
|
|
226
|
+
case 'div':
|
|
227
|
+
return this.divProperties;
|
|
228
|
+
case 'img':
|
|
229
|
+
return this.imgProperties;
|
|
230
|
+
case 'iframe':
|
|
231
|
+
return this.iframeProperties;
|
|
232
|
+
case 'h1':
|
|
233
|
+
case 'h2':
|
|
234
|
+
case 'h3':
|
|
235
|
+
case 'h4':
|
|
236
|
+
case 'h5':
|
|
237
|
+
case 'h6':
|
|
238
|
+
case 'p':
|
|
239
|
+
return [];
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
}
|
package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IProperty } from '../IProperty.js';
|
|
2
2
|
import { IDesignItem } from '../../../item/IDesignItem.js';
|
|
3
|
-
import { CommonPropertiesService } from './CommonPropertiesService.js';
|
|
4
3
|
import { RefreshMode } from '../IPropertiesService.js';
|
|
5
4
|
import { IPropertyGroup } from '../IPropertyGroup.js';
|
|
6
|
-
|
|
5
|
+
import { AbstractPropertiesService } from './AbstractPropertiesService.js';
|
|
6
|
+
export declare class NativeElementsPropertiesService extends AbstractPropertiesService {
|
|
7
7
|
private inputProperties;
|
|
8
8
|
private textareaProperties;
|
|
9
9
|
private selectProperties;
|
package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CommonPropertiesService } from './CommonPropertiesService.js';
|
|
2
1
|
import { PropertyType } from '../PropertyType.js';
|
|
3
2
|
import { RefreshMode } from '../IPropertiesService.js';
|
|
4
|
-
|
|
3
|
+
import { AbstractPropertiesService } from './AbstractPropertiesService.js';
|
|
4
|
+
export class NativeElementsPropertiesService extends AbstractPropertiesService {
|
|
5
5
|
inputProperties = [
|
|
6
6
|
{
|
|
7
7
|
name: "type",
|
|
@@ -2,6 +2,7 @@ import { ServiceContainer } from '../../services/ServiceContainer.js';
|
|
|
2
2
|
import { IDesignItem } from '../../item/IDesignItem.js';
|
|
3
3
|
import { BaseCustomWebComponentLazyAppend } from '@node-projects/base-custom-webcomponent';
|
|
4
4
|
import { InstanceServiceContainer } from '../../services/InstanceServiceContainer.js';
|
|
5
|
+
import { IPropertyGroup } from '../../services/propertiesService/IPropertyGroup.js';
|
|
5
6
|
export declare class PropertyGrid extends BaseCustomWebComponentLazyAppend {
|
|
6
7
|
private _serviceContainer;
|
|
7
8
|
private _designerTabControl;
|
|
@@ -12,6 +13,8 @@ export declare class PropertyGrid extends BaseCustomWebComponentLazyAppend {
|
|
|
12
13
|
private _nodeReplacedCb;
|
|
13
14
|
private _instanceServiceContainer;
|
|
14
15
|
private _selectionChangedHandler;
|
|
16
|
+
propertyGroupHover: (group: IPropertyGroup, part: 'name' | 'desc') => boolean;
|
|
17
|
+
propertyGroupClick: (group: IPropertyGroup, part: 'name' | 'desc') => void;
|
|
15
18
|
static readonly style: CSSStyleSheet;
|
|
16
19
|
static readonly properties: {
|
|
17
20
|
serviceContainer: ObjectConstructor;
|
|
@@ -12,6 +12,8 @@ export class PropertyGrid extends BaseCustomWebComponentLazyAppend {
|
|
|
12
12
|
_nodeReplacedCb;
|
|
13
13
|
_instanceServiceContainer;
|
|
14
14
|
_selectionChangedHandler;
|
|
15
|
+
propertyGroupHover;
|
|
16
|
+
propertyGroupClick;
|
|
15
17
|
static style = css `
|
|
16
18
|
:host {
|
|
17
19
|
display: block;
|
|
@@ -71,6 +73,8 @@ export class PropertyGrid extends BaseCustomWebComponentLazyAppend {
|
|
|
71
73
|
if (!lst) {
|
|
72
74
|
lst = new PropertyGridPropertyList(this.serviceContainer);
|
|
73
75
|
lst.title = p.name;
|
|
76
|
+
lst.propertyGroupHover = this.propertyGroupHover;
|
|
77
|
+
lst.propertyGroupClick = this.propertyGroupClick;
|
|
74
78
|
this._designerTabControl.appendChild(lst);
|
|
75
79
|
this._propertyGridPropertyLists.push(lst);
|
|
76
80
|
this._propertyGridPropertyListsDict[p.name] = lst;
|
|
@@ -4,12 +4,15 @@ import { BaseCustomWebComponentLazyAppend } from '@node-projects/base-custom-web
|
|
|
4
4
|
import { IPropertyEditor } from '../../services/propertiesService/IPropertyEditor.js';
|
|
5
5
|
import { IDesignItem } from '../../item/IDesignItem.js';
|
|
6
6
|
import { IPropertiesService } from '../../services/propertiesService/IPropertiesService.js';
|
|
7
|
+
import { IPropertyGroup } from '../../services/propertiesService/IPropertyGroup.js';
|
|
7
8
|
export declare class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
|
|
8
9
|
private _div;
|
|
9
10
|
private _propertyMap;
|
|
10
11
|
private _serviceContainer;
|
|
11
12
|
private _propertiesService;
|
|
12
13
|
private _designItems;
|
|
14
|
+
propertyGroupHover: (group: IPropertyGroup, part: 'name' | 'desc') => boolean;
|
|
15
|
+
propertyGroupClick: (group: IPropertyGroup, part: 'name' | 'desc') => void;
|
|
13
16
|
get propertiesService(): IPropertiesService;
|
|
14
17
|
static get style(): CSSStyleSheet;
|
|
15
18
|
constructor(serviceContainer: ServiceContainer);
|
|
@@ -10,6 +10,8 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
|
|
|
10
10
|
_serviceContainer;
|
|
11
11
|
_propertiesService;
|
|
12
12
|
_designItems;
|
|
13
|
+
propertyGroupHover;
|
|
14
|
+
propertyGroupClick;
|
|
13
15
|
get propertiesService() {
|
|
14
16
|
return this._propertiesService;
|
|
15
17
|
}
|
|
@@ -85,12 +87,22 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
|
|
|
85
87
|
font-size: 10px;
|
|
86
88
|
font-family: monospace;
|
|
87
89
|
}
|
|
90
|
+
.group-header[clickable]:hover {
|
|
91
|
+
cursor:pointer;
|
|
92
|
+
color: orange;
|
|
93
|
+
text-decoration: underline;
|
|
94
|
+
}
|
|
88
95
|
.group-desc {
|
|
89
96
|
display: inline-flex;
|
|
90
97
|
flex-direction: row-reverse;
|
|
91
98
|
font-size: 10px;
|
|
92
99
|
text-decoration: underline;
|
|
93
100
|
}
|
|
101
|
+
.group-desc[clickable]:hover {
|
|
102
|
+
cursor:pointer;
|
|
103
|
+
color: orange;
|
|
104
|
+
text-decoration: underline;
|
|
105
|
+
}
|
|
94
106
|
.dragOverProperty {
|
|
95
107
|
outline: 2px dashed orange;
|
|
96
108
|
outline-offset: -2px;
|
|
@@ -139,6 +151,28 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
|
|
|
139
151
|
let desc = document.createElement('span');
|
|
140
152
|
desc.innerHTML = g.description ?? '';
|
|
141
153
|
desc.className = 'group-desc';
|
|
154
|
+
if (this.propertyGroupHover) {
|
|
155
|
+
header.onmouseenter = () => {
|
|
156
|
+
if (this.propertyGroupHover(g, 'name'))
|
|
157
|
+
header.setAttribute('clickable', '');
|
|
158
|
+
else
|
|
159
|
+
header.removeAttribute('clickable');
|
|
160
|
+
};
|
|
161
|
+
header.onclick = () => {
|
|
162
|
+
if (this.propertyGroupClick)
|
|
163
|
+
this.propertyGroupClick(g, 'name');
|
|
164
|
+
};
|
|
165
|
+
desc.onmouseenter = () => {
|
|
166
|
+
if (this.propertyGroupHover(g, 'desc'))
|
|
167
|
+
desc.setAttribute('clickable', '');
|
|
168
|
+
else
|
|
169
|
+
desc.removeAttribute('clickable');
|
|
170
|
+
};
|
|
171
|
+
desc.onclick = () => {
|
|
172
|
+
if (this.propertyGroupClick)
|
|
173
|
+
this.propertyGroupClick(g, 'desc');
|
|
174
|
+
};
|
|
175
|
+
}
|
|
142
176
|
this._div.appendChild(desc);
|
|
143
177
|
this.createPropertyEditors(g.properties);
|
|
144
178
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -110,6 +110,7 @@ export * from "./elements/services/propertiesService/propertyEditors/special/Gri
|
|
|
110
110
|
export * from "./elements/services/propertiesService/services/PropertiesHelper.js";
|
|
111
111
|
export * from "./elements/services/propertiesService/services/AttachedPropertiesService.js";
|
|
112
112
|
export * from "./elements/services/propertiesService/services/BaseCustomWebComponentPropertiesService.js";
|
|
113
|
+
export * from "./elements/services/propertiesService/services/BasicWebcomponentPropertiesService.js";
|
|
113
114
|
export * from "./elements/services/propertiesService/services/CommonPropertiesService.js";
|
|
114
115
|
export * from "./elements/services/propertiesService/services/ContentAndIdPropertiesService.js";
|
|
115
116
|
export * from "./elements/services/propertiesService/services/CssCurrentPropertiesService.js";
|
package/dist/index.js
CHANGED
|
@@ -69,6 +69,7 @@ export * from "./elements/services/propertiesService/propertyEditors/special/Gri
|
|
|
69
69
|
export * from "./elements/services/propertiesService/services/PropertiesHelper.js";
|
|
70
70
|
export * from "./elements/services/propertiesService/services/AttachedPropertiesService.js";
|
|
71
71
|
export * from "./elements/services/propertiesService/services/BaseCustomWebComponentPropertiesService.js";
|
|
72
|
+
export * from "./elements/services/propertiesService/services/BasicWebcomponentPropertiesService.js";
|
|
72
73
|
export * from "./elements/services/propertiesService/services/CommonPropertiesService.js";
|
|
73
74
|
export * from "./elements/services/propertiesService/services/ContentAndIdPropertiesService.js";
|
|
74
75
|
export * from "./elements/services/propertiesService/services/CssCurrentPropertiesService.js";
|
package/package.json
CHANGED