@omnia/velcron 8.0.94-vnext → 8.0.95-vnext
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/models/VelcronDefinitions.d.ts +3 -3
- package/models/VelcronPropertyEditorDefinitions.d.ts +10 -1
- package/package.json +1 -1
- package/parser/VelcronConstants.d.ts +7 -3
- package/parser/VelcronConstants.js +7 -3
- package/parser/VelcronData.js +5 -1
- package/parser/VelcronRenderers.js +2 -2
- package/templatebuilder/editor/VelcronEditorBuilder.d.ts +3 -0
- package/templatebuilder/editor/VelcronEditorBuilder.js +10 -0
- package/templatebuilder/editor/VelcronPropertyMappingEditorBuilder.d.ts +9 -0
- package/templatebuilder/editor/VelcronPropertyMappingEditorBuilder.js +30 -0
- package/templatebuilder/state/VelcronPropertyMappingStateBuilder.d.ts +11 -0
- package/templatebuilder/state/VelcronPropertyMappingStateBuilder.js +28 -0
- package/templatebuilder/state/VelcronStateBuilder.d.ts +3 -0
- package/templatebuilder/state/VelcronStateBuilder.js +8 -0
|
@@ -183,9 +183,9 @@ export interface VelcronAppDefinition<TState extends DynamicState = DynamicState
|
|
|
183
183
|
}
|
|
184
184
|
export interface VelcronComponentDefinition extends VelcronDefinition {
|
|
185
185
|
type: string;
|
|
186
|
-
events
|
|
187
|
-
properties
|
|
188
|
-
icon
|
|
186
|
+
events?: any;
|
|
187
|
+
properties?: [];
|
|
188
|
+
icon?: any;
|
|
189
189
|
}
|
|
190
190
|
/*** Built-in Components *********************************************************************/
|
|
191
191
|
export interface VelcronViewDefinition extends VelcronDefinition, VelcronColorStyling {
|
|
@@ -42,13 +42,19 @@ export interface VelcronSliderPropertyEditorSettings {
|
|
|
42
42
|
max: number;
|
|
43
43
|
step: number;
|
|
44
44
|
}
|
|
45
|
+
export interface VelcronTypographyEditorSettings {
|
|
46
|
+
type: "title" | "text";
|
|
47
|
+
}
|
|
45
48
|
export interface VelcronSliderPropertyEditor extends VelcronPropertyEditor<VelcronSliderPropertyEditorSettings> {
|
|
46
49
|
type: "slider";
|
|
47
50
|
}
|
|
48
51
|
export interface VelcronTextPropertyEditor extends VelcronPropertyEditor<any> {
|
|
49
52
|
type: "text";
|
|
50
53
|
}
|
|
51
|
-
export interface
|
|
54
|
+
export interface VelcronEnterprisePropertyEditor extends VelcronPropertyEditor<any> {
|
|
55
|
+
type: "enterprise-property";
|
|
56
|
+
}
|
|
57
|
+
export interface VelcronTypographyPropertyEditor extends VelcronPropertyEditor<VelcronTypographyEditorSettings> {
|
|
52
58
|
type: "typography";
|
|
53
59
|
}
|
|
54
60
|
export interface VelcronSwitchPropertyEditor extends VelcronPropertyEditor<any> {
|
|
@@ -78,6 +84,9 @@ export interface VelcronContentState {
|
|
|
78
84
|
main?: string;
|
|
79
85
|
};
|
|
80
86
|
}
|
|
87
|
+
export interface VelcronPropertiesState {
|
|
88
|
+
propertyItems: Array<any>;
|
|
89
|
+
}
|
|
81
90
|
export interface VelcronImageState {
|
|
82
91
|
url?: string;
|
|
83
92
|
ratio?: VelcronImageRatios;
|
package/package.json
CHANGED
|
@@ -6,9 +6,10 @@ export declare const VelcronConstants: {
|
|
|
6
6
|
text: string;
|
|
7
7
|
image: string;
|
|
8
8
|
button: string;
|
|
9
|
-
|
|
10
|
-
progress: string;
|
|
11
|
-
|
|
9
|
+
"text-input": string;
|
|
10
|
+
"progress-circle": string;
|
|
11
|
+
"web-view": string;
|
|
12
|
+
"custom-component": string;
|
|
12
13
|
dialog: string;
|
|
13
14
|
icon: string;
|
|
14
15
|
chip: string;
|
|
@@ -29,4 +30,7 @@ export declare const VelcronConstants: {
|
|
|
29
30
|
tokenEnd: string;
|
|
30
31
|
propsToken: string;
|
|
31
32
|
};
|
|
33
|
+
context: {
|
|
34
|
+
thisToken: string;
|
|
35
|
+
};
|
|
32
36
|
};
|
|
@@ -9,9 +9,10 @@ exports.VelcronConstants = {
|
|
|
9
9
|
text: "text",
|
|
10
10
|
image: "image",
|
|
11
11
|
button: "button",
|
|
12
|
-
|
|
13
|
-
progress: "progress",
|
|
14
|
-
|
|
12
|
+
"text-input": "text-input",
|
|
13
|
+
"progress-circle": "progress-circle",
|
|
14
|
+
"web-view": "web-view",
|
|
15
|
+
"custom-component": "custom-component",
|
|
15
16
|
dialog: "dialog",
|
|
16
17
|
icon: "icon",
|
|
17
18
|
chip: "chip",
|
|
@@ -31,5 +32,8 @@ exports.VelcronConstants = {
|
|
|
31
32
|
tokenStart: "{{",
|
|
32
33
|
tokenEnd: "}}",
|
|
33
34
|
propsToken: "$props"
|
|
35
|
+
},
|
|
36
|
+
context: {
|
|
37
|
+
thisToken: "$this"
|
|
34
38
|
}
|
|
35
39
|
};
|
package/parser/VelcronData.js
CHANGED
|
@@ -274,7 +274,7 @@ class VelcronData {
|
|
|
274
274
|
else if (assignOperator && VelcronData.isString(value)) {
|
|
275
275
|
//Value is assignment from renderContext
|
|
276
276
|
// "$state.title = title" or "$state.title = $state.anotherTitle"
|
|
277
|
-
if (value === "this") {
|
|
277
|
+
if (value === "$this") {
|
|
278
278
|
// $state.currentItem = this (this means currentContext)
|
|
279
279
|
value = renderContext.currentContext;
|
|
280
280
|
}
|
|
@@ -518,6 +518,10 @@ class VelcronData {
|
|
|
518
518
|
}
|
|
519
519
|
result = propObj;
|
|
520
520
|
}
|
|
521
|
+
else if (path === VelcronConstants_1.VelcronConstants.context.thisToken) {
|
|
522
|
+
//Eg foreach loop and binding to the whole object in binding use $this
|
|
523
|
+
result = renderContext.currentContext;
|
|
524
|
+
}
|
|
521
525
|
else {
|
|
522
526
|
const tokens = VelcronData.getTokens(path, true);
|
|
523
527
|
if (tokens.length > 0) {
|
|
@@ -33,7 +33,7 @@ class VelcronRenderers {
|
|
|
33
33
|
customComponentDefinition = renderContext.components?.find(p => p.type.toLowerCase() === definition.type.toLowerCase());
|
|
34
34
|
}
|
|
35
35
|
if (customComponentDefinition) {
|
|
36
|
-
if (!this.components["
|
|
36
|
+
if (!this.components[__1.VelcronConstants.components["custom-component"]]) {
|
|
37
37
|
throw "Cant find the custom component renderer";
|
|
38
38
|
}
|
|
39
39
|
//Make a new instance of the custom component
|
|
@@ -43,7 +43,7 @@ class VelcronRenderers {
|
|
|
43
43
|
//comes from the current instance and override the ones from the original to make style overide work as we want
|
|
44
44
|
customComponentInstance.style = definition.style;
|
|
45
45
|
result = {
|
|
46
|
-
component: this.components["
|
|
46
|
+
component: this.components[__1.VelcronConstants.components["custom-component"]],
|
|
47
47
|
definition: customComponentInstance,
|
|
48
48
|
customComponent: true
|
|
49
49
|
};
|
|
@@ -2,12 +2,15 @@ import { VelcronPropertyEditor } from "@omnia/fx-models";
|
|
|
2
2
|
import { VelcronContentEditorBuilder } from "./VelcronContentEditor";
|
|
3
3
|
import { VelcronColorSchemaEditorBuilder } from "./VelcronColorSchemaEditor";
|
|
4
4
|
import { VelcronImageEditorBuilder } from "./VelcronImageEditor";
|
|
5
|
+
import { VelcronPropertyMappingEditorBuilder } from "./VelcronPropertyMappingEditorBuilder";
|
|
5
6
|
export declare class VelcronEditorBuilder {
|
|
6
7
|
private contentEditorBuilder;
|
|
7
8
|
private colorSchemaEditorBuilder;
|
|
8
9
|
private imageEditorBuilder;
|
|
10
|
+
private propertyMappingBuilder;
|
|
9
11
|
content(): VelcronContentEditorBuilder;
|
|
10
12
|
colorSchemaType(): VelcronColorSchemaEditorBuilder;
|
|
11
13
|
image(): VelcronImageEditorBuilder;
|
|
14
|
+
properties(): VelcronPropertyMappingEditorBuilder;
|
|
12
15
|
build(): VelcronPropertyEditor<any>[];
|
|
13
16
|
}
|
|
@@ -4,6 +4,7 @@ exports.VelcronEditorBuilder = void 0;
|
|
|
4
4
|
const VelcronContentEditor_1 = require("./VelcronContentEditor");
|
|
5
5
|
const VelcronColorSchemaEditor_1 = require("./VelcronColorSchemaEditor");
|
|
6
6
|
const VelcronImageEditor_1 = require("./VelcronImageEditor");
|
|
7
|
+
const VelcronPropertyMappingEditorBuilder_1 = require("./VelcronPropertyMappingEditorBuilder");
|
|
7
8
|
class VelcronEditorBuilder {
|
|
8
9
|
content() {
|
|
9
10
|
if (!this.contentEditorBuilder) {
|
|
@@ -23,6 +24,12 @@ class VelcronEditorBuilder {
|
|
|
23
24
|
}
|
|
24
25
|
return this.imageEditorBuilder;
|
|
25
26
|
}
|
|
27
|
+
properties() {
|
|
28
|
+
if (!this.propertyMappingBuilder) {
|
|
29
|
+
this.propertyMappingBuilder = new VelcronPropertyMappingEditorBuilder_1.VelcronPropertyMappingEditorBuilder(this);
|
|
30
|
+
}
|
|
31
|
+
return this.propertyMappingBuilder;
|
|
32
|
+
}
|
|
26
33
|
build() {
|
|
27
34
|
const result = [];
|
|
28
35
|
if (this.colorSchemaEditorBuilder) {
|
|
@@ -34,6 +41,9 @@ class VelcronEditorBuilder {
|
|
|
34
41
|
if (this.imageEditorBuilder) {
|
|
35
42
|
result.push(...this.imageEditorBuilder.internalBuild());
|
|
36
43
|
}
|
|
44
|
+
if (this.propertyMappingBuilder) {
|
|
45
|
+
result.push(...this.propertyMappingBuilder.internalBuild());
|
|
46
|
+
}
|
|
37
47
|
return result;
|
|
38
48
|
}
|
|
39
49
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VelcronPropertyEditor } from "@omnia/fx-models";
|
|
2
|
+
import { VelcronEditorBuilder } from "./VelcronEditorBuilder";
|
|
3
|
+
import { VelcronEditorBuilderBase } from "./VelcronEditorBuilderBase";
|
|
4
|
+
export declare class VelcronPropertyMappingEditorBuilder extends VelcronEditorBuilderBase {
|
|
5
|
+
private editor;
|
|
6
|
+
constructor(builder: any);
|
|
7
|
+
add(): VelcronEditorBuilder;
|
|
8
|
+
protected internalBuild(): VelcronPropertyEditor<any>[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronPropertyMappingEditorBuilder = void 0;
|
|
4
|
+
const VelcronEditorBuilderBase_1 = require("./VelcronEditorBuilderBase");
|
|
5
|
+
class VelcronPropertyMappingEditorBuilder extends VelcronEditorBuilderBase_1.VelcronEditorBuilderBase {
|
|
6
|
+
constructor(builder) {
|
|
7
|
+
super(builder);
|
|
8
|
+
this.editor = null;
|
|
9
|
+
}
|
|
10
|
+
add() {
|
|
11
|
+
if (!this.editor) {
|
|
12
|
+
this.editor = {
|
|
13
|
+
name: "Properties",
|
|
14
|
+
type: "enterprise-property",
|
|
15
|
+
stateMapping: "propertyItems",
|
|
16
|
+
propertyMapping: true,
|
|
17
|
+
multiple: true,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return this.builder;
|
|
21
|
+
}
|
|
22
|
+
internalBuild() {
|
|
23
|
+
const result = [];
|
|
24
|
+
if (this.editor) {
|
|
25
|
+
result.push(this.editor);
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.VelcronPropertyMappingEditorBuilder = VelcronPropertyMappingEditorBuilder;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VelcronStateBuilderBase } from "./VelcronStateBuilderBase";
|
|
2
|
+
export declare class VelcronPropertyMappingStateBuilder extends VelcronStateBuilderBase {
|
|
3
|
+
private propertyItemsValue;
|
|
4
|
+
constructor(stateBuilder: any);
|
|
5
|
+
propertyItems: {
|
|
6
|
+
add: (items?: any[]) => VelcronPropertyMappingStateBuilder;
|
|
7
|
+
bind: string;
|
|
8
|
+
foreach: string;
|
|
9
|
+
};
|
|
10
|
+
protected internalBuild(): {};
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronPropertyMappingStateBuilder = void 0;
|
|
4
|
+
const VelcronStateBuilderBase_1 = require("./VelcronStateBuilderBase");
|
|
5
|
+
class VelcronPropertyMappingStateBuilder extends VelcronStateBuilderBase_1.VelcronStateBuilderBase {
|
|
6
|
+
constructor(stateBuilder) {
|
|
7
|
+
super(stateBuilder);
|
|
8
|
+
this.propertyItemsValue = [];
|
|
9
|
+
this.propertyItems = {
|
|
10
|
+
add: (items) => {
|
|
11
|
+
this.propertyItemsValue = items;
|
|
12
|
+
return this;
|
|
13
|
+
},
|
|
14
|
+
bind: "$propertyItems",
|
|
15
|
+
foreach: "propertyItems"
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
internalBuild() {
|
|
19
|
+
const resultValue = {};
|
|
20
|
+
let hasContent = false;
|
|
21
|
+
if (this.propertyItemsValue) {
|
|
22
|
+
resultValue.propertyItems = this.propertyItemsValue;
|
|
23
|
+
hasContent = true;
|
|
24
|
+
}
|
|
25
|
+
return resultValue;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.VelcronPropertyMappingStateBuilder = VelcronPropertyMappingStateBuilder;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { VelcronColorSchemaStateBuilder } from "./VelcronColorSchemaBuilder";
|
|
2
2
|
import { VelcronContentStateBuilder } from "./VelcronContentStateBuilder";
|
|
3
3
|
import { VelcronImageStateBuilder } from "./VelcronImageStateBuilder";
|
|
4
|
+
import { VelcronPropertyMappingStateBuilder } from "./VelcronPropertyMappingStateBuilder";
|
|
4
5
|
export declare class VelcronStateBuilder {
|
|
5
6
|
private contentStateBuilder;
|
|
6
7
|
private imageStateBuilder;
|
|
7
8
|
private colorSchemaStateBuilder;
|
|
9
|
+
private propertyMappingStateBuilder;
|
|
8
10
|
content(): VelcronContentStateBuilder;
|
|
9
11
|
image(): VelcronImageStateBuilder;
|
|
10
12
|
colorSchemaType(): VelcronColorSchemaStateBuilder;
|
|
13
|
+
properties(): VelcronPropertyMappingStateBuilder;
|
|
11
14
|
build(): any;
|
|
12
15
|
}
|
|
@@ -4,6 +4,7 @@ exports.VelcronStateBuilder = void 0;
|
|
|
4
4
|
const VelcronColorSchemaBuilder_1 = require("./VelcronColorSchemaBuilder");
|
|
5
5
|
const VelcronContentStateBuilder_1 = require("./VelcronContentStateBuilder");
|
|
6
6
|
const VelcronImageStateBuilder_1 = require("./VelcronImageStateBuilder");
|
|
7
|
+
const VelcronPropertyMappingStateBuilder_1 = require("./VelcronPropertyMappingStateBuilder");
|
|
7
8
|
class VelcronStateBuilder {
|
|
8
9
|
content() {
|
|
9
10
|
if (!this.contentStateBuilder) {
|
|
@@ -23,11 +24,18 @@ class VelcronStateBuilder {
|
|
|
23
24
|
}
|
|
24
25
|
return this.colorSchemaStateBuilder;
|
|
25
26
|
}
|
|
27
|
+
properties() {
|
|
28
|
+
if (!this.propertyMappingStateBuilder) {
|
|
29
|
+
this.propertyMappingStateBuilder = new VelcronPropertyMappingStateBuilder_1.VelcronPropertyMappingStateBuilder(this);
|
|
30
|
+
}
|
|
31
|
+
return this.propertyMappingStateBuilder;
|
|
32
|
+
}
|
|
26
33
|
build() {
|
|
27
34
|
return {
|
|
28
35
|
...this?.contentStateBuilder?.internalBuild(),
|
|
29
36
|
...this?.imageStateBuilder?.internalBuild(),
|
|
30
37
|
...this?.colorSchemaStateBuilder?.internalBuild(),
|
|
38
|
+
...this?.propertyMappingStateBuilder?.internalBuild(),
|
|
31
39
|
};
|
|
32
40
|
}
|
|
33
41
|
}
|