@omnia/velcron 8.0.88-vnext → 8.0.91-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/index.d.ts +1 -0
- package/index.js +1 -0
- package/models/VelcronDefinitions.d.ts +8 -2
- package/models/VelcronDefinitions.js +1 -1
- package/models/VelcronPropertyEditorDefinitions.d.ts +22 -15
- package/models/VelcronPropertyEditorDefinitions.js +1 -0
- package/package.json +1 -1
- package/parser/VelcronActions.js +1 -1
- package/parser/VelcronConstants.d.ts +2 -0
- package/parser/VelcronConstants.js +4 -2
- package/parser/VelcronData.d.ts +1 -1
- package/parser/VelcronData.js +38 -42
- package/parser/VelcronRenderers.js +1 -2
- package/templatebuilder/editor/VelcronColorSchemaEditor.d.ts +9 -0
- package/templatebuilder/editor/VelcronColorSchemaEditor.js +28 -0
- package/templatebuilder/editor/VelcronContentEditor.d.ts +14 -0
- package/templatebuilder/editor/VelcronContentEditor.js +46 -0
- package/templatebuilder/editor/VelcronEditorBuilder.d.ts +13 -0
- package/templatebuilder/editor/VelcronEditorBuilder.js +40 -0
- package/templatebuilder/editor/VelcronEditorBuilderBase.d.ts +9 -0
- package/templatebuilder/editor/VelcronEditorBuilderBase.js +16 -0
- package/templatebuilder/editor/VelcronImageEditor.d.ts +11 -0
- package/templatebuilder/editor/VelcronImageEditor.js +30 -0
- package/templatebuilder/index.d.ts +1 -0
- package/templatebuilder/index.js +4 -0
- package/templatebuilder/state/VelcronColorSchemaBuilder.d.ts +11 -0
- package/templatebuilder/state/VelcronColorSchemaBuilder.js +20 -0
- package/templatebuilder/state/VelcronContentStateBuilder.d.ts +17 -0
- package/templatebuilder/state/VelcronContentStateBuilder.js +39 -0
- package/templatebuilder/state/VelcronImageStateBuilder.d.ts +20 -0
- package/templatebuilder/state/VelcronImageStateBuilder.js +43 -0
- package/templatebuilder/state/VelcronStateBuilder.d.ts +12 -0
- package/templatebuilder/state/VelcronStateBuilder.js +34 -0
- package/templatebuilder/state/VelcronStateBuilderBase.d.ts +8 -0
- package/templatebuilder/state/VelcronStateBuilderBase.js +15 -0
- package/templatebuilder/useVelcronTemplateBuilder.d.ts +6 -0
- package/templatebuilder/useVelcronTemplateBuilder.js +13 -0
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -7,3 +7,4 @@ tslib_1.__exportStar(require("./actions"), exports);
|
|
|
7
7
|
tslib_1.__exportStar(require("./stores"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("@omnia/velcron/internal-do-not-import-from-here/shared/models"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./rules"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./templatebuilder"), exports);
|
|
@@ -7,7 +7,7 @@ import { useVelcronBlueprintStore } from "../stores/VelcronBlueprint";
|
|
|
7
7
|
export interface ResolvedComponentRenderer {
|
|
8
8
|
component: unknown;
|
|
9
9
|
definition: VelcronDefinition;
|
|
10
|
-
customComponent
|
|
10
|
+
customComponent?: boolean;
|
|
11
11
|
}
|
|
12
12
|
export interface BuiltInComponentRenderers {
|
|
13
13
|
"view": unknown;
|
|
@@ -23,6 +23,7 @@ export interface BuiltInComponentRenderers {
|
|
|
23
23
|
"icon": unknown;
|
|
24
24
|
"chip": unknown;
|
|
25
25
|
"markdown": unknown;
|
|
26
|
+
"slot": unknown;
|
|
26
27
|
}
|
|
27
28
|
export interface ColorSchemaReference {
|
|
28
29
|
name: string;
|
|
@@ -215,7 +216,7 @@ export interface VelcronTextDefinition extends VelcronDefinitionWithEditMode, Ve
|
|
|
215
216
|
}
|
|
216
217
|
export declare enum VelcronImageRatios {
|
|
217
218
|
square = "square",
|
|
218
|
-
landscape = "
|
|
219
|
+
landscape = "landscape"
|
|
219
220
|
}
|
|
220
221
|
export interface VelcronImageDefinition extends VelcronDefinition {
|
|
221
222
|
type: "image";
|
|
@@ -279,6 +280,11 @@ export interface VelcronChipDefinition extends VelcronDefinition {
|
|
|
279
280
|
disabled?: boolean;
|
|
280
281
|
events?: VelcronOnPressEvent;
|
|
281
282
|
}
|
|
283
|
+
export interface VelcronSlotDefinition extends VelcronDefinition {
|
|
284
|
+
type: "slot";
|
|
285
|
+
bind: string;
|
|
286
|
+
value: VelcroncomponentArrayType;
|
|
287
|
+
}
|
|
282
288
|
export type VelcronCustomComponentDefinition = VelcronComponentDefinition;
|
|
283
289
|
export type VelcronRenderProps<TDefinition> = {
|
|
284
290
|
definition: TDefinition;
|
|
@@ -4,5 +4,5 @@ exports.VelcronImageRatios = void 0;
|
|
|
4
4
|
var VelcronImageRatios;
|
|
5
5
|
(function (VelcronImageRatios) {
|
|
6
6
|
VelcronImageRatios["square"] = "square";
|
|
7
|
-
VelcronImageRatios["landscape"] = "
|
|
7
|
+
VelcronImageRatios["landscape"] = "landscape";
|
|
8
8
|
})(VelcronImageRatios = exports.VelcronImageRatios || (exports.VelcronImageRatios = {}));
|
|
@@ -2,6 +2,15 @@ import { VelcronImageRatios } from "@omnia/fx-models";
|
|
|
2
2
|
export interface ResolvedPropertyEditor {
|
|
3
3
|
editor: VelcronPropertyEditor;
|
|
4
4
|
}
|
|
5
|
+
export interface VelcronPropertyEditor<TSettings = any> {
|
|
6
|
+
name?: string;
|
|
7
|
+
category?: string;
|
|
8
|
+
type: BuiltInPropertyEditorType | string;
|
|
9
|
+
settings?: TSettings;
|
|
10
|
+
stateMapping?: string;
|
|
11
|
+
propertyMapping?: boolean;
|
|
12
|
+
component?: unknown;
|
|
13
|
+
}
|
|
5
14
|
export interface BuiltInPropertyEditors {
|
|
6
15
|
text: unknown;
|
|
7
16
|
slider: unknown;
|
|
@@ -12,17 +21,9 @@ export interface BuiltInPropertyEditors {
|
|
|
12
21
|
icon: unknown;
|
|
13
22
|
image: unknown;
|
|
14
23
|
typography: unknown;
|
|
24
|
+
"color-schema-type": unknown;
|
|
15
25
|
}
|
|
16
|
-
export
|
|
17
|
-
name?: string;
|
|
18
|
-
category?: string;
|
|
19
|
-
type: BuiltInPropertyEditorType | string;
|
|
20
|
-
settings?: TSettings;
|
|
21
|
-
stateMapping?: string;
|
|
22
|
-
propertyMapping?: string;
|
|
23
|
-
component?: unknown;
|
|
24
|
-
}
|
|
25
|
-
export type BuiltInPropertyEditorType = "text" | "slider" | "switch" | "alignment" | "color" | "markdown" | "icon" | "image" | "typography";
|
|
26
|
+
export type BuiltInPropertyEditorType = "text" | "slider" | "switch" | "alignment" | "color" | "markdown" | "icon" | "image" | "typography" | "color-schema-type";
|
|
26
27
|
export declare enum BuiltInPropertyEditorTypes {
|
|
27
28
|
text = "text",
|
|
28
29
|
slider = "slider",
|
|
@@ -32,7 +33,8 @@ export declare enum BuiltInPropertyEditorTypes {
|
|
|
32
33
|
markdown = "markdown",
|
|
33
34
|
icon = "icon",
|
|
34
35
|
image = "image",
|
|
35
|
-
typography = "typography"
|
|
36
|
+
typography = "typography",
|
|
37
|
+
"color-schema-type" = "color-schema-type"
|
|
36
38
|
}
|
|
37
39
|
export interface VelcronSliderPropertyEditorSettings {
|
|
38
40
|
min: number;
|
|
@@ -57,6 +59,9 @@ export interface VelcronAlignmentPropertyEditor extends VelcronPropertyEditor<an
|
|
|
57
59
|
export interface VelcronColorPropertyEditor extends VelcronPropertyEditor<any> {
|
|
58
60
|
type: "color";
|
|
59
61
|
}
|
|
62
|
+
export interface VelcronColorSchemaPropertyEditor extends VelcronPropertyEditor<any> {
|
|
63
|
+
type: "color-schema-type";
|
|
64
|
+
}
|
|
60
65
|
export interface VelcronIconPropertyEditor extends VelcronPropertyEditor<any> {
|
|
61
66
|
type: "icon";
|
|
62
67
|
}
|
|
@@ -67,10 +72,12 @@ export interface VelcronImagePropertyEditor extends VelcronPropertyEditor<any> {
|
|
|
67
72
|
type: "image";
|
|
68
73
|
}
|
|
69
74
|
export interface VelcronContentState {
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
content: {
|
|
76
|
+
caption?: string;
|
|
77
|
+
main?: string;
|
|
78
|
+
};
|
|
72
79
|
}
|
|
73
80
|
export interface VelcronImageState {
|
|
74
|
-
url
|
|
75
|
-
ratio
|
|
81
|
+
url?: string;
|
|
82
|
+
ratio?: VelcronImageRatios;
|
|
76
83
|
}
|
|
@@ -12,4 +12,5 @@ var BuiltInPropertyEditorTypes;
|
|
|
12
12
|
BuiltInPropertyEditorTypes["icon"] = "icon";
|
|
13
13
|
BuiltInPropertyEditorTypes["image"] = "image";
|
|
14
14
|
BuiltInPropertyEditorTypes["typography"] = "typography";
|
|
15
|
+
BuiltInPropertyEditorTypes["color-schema-type"] = "color-schema-type";
|
|
15
16
|
})(BuiltInPropertyEditorTypes = exports.BuiltInPropertyEditorTypes || (exports.BuiltInPropertyEditorTypes = {}));
|
package/package.json
CHANGED
package/parser/VelcronActions.js
CHANGED
|
@@ -331,7 +331,7 @@ class VelcronActions {
|
|
|
331
331
|
return text;
|
|
332
332
|
}
|
|
333
333
|
static parseAndExecuteComputed(renderContext, template) {
|
|
334
|
-
VelcronData_1.VelcronData.getTokens(template).forEach(token => {
|
|
334
|
+
VelcronData_1.VelcronData.getTokens(template, false).forEach(token => {
|
|
335
335
|
const paramValues = [];
|
|
336
336
|
VelcronActions.parseFunction(renderContext.computed, token, renderContext, paramValues, (acName, params) => {
|
|
337
337
|
const funcContent = renderContext.computed[acName];
|
|
@@ -13,6 +13,7 @@ export declare const VelcronConstants: {
|
|
|
13
13
|
icon: string;
|
|
14
14
|
chip: string;
|
|
15
15
|
markdown: string;
|
|
16
|
+
slot: string;
|
|
16
17
|
};
|
|
17
18
|
events: {
|
|
18
19
|
idTokenStart: string;
|
|
@@ -25,5 +26,6 @@ export declare const VelcronConstants: {
|
|
|
25
26
|
properties: {
|
|
26
27
|
tokenStart: string;
|
|
27
28
|
tokenEnd: string;
|
|
29
|
+
propsToken: string;
|
|
28
30
|
};
|
|
29
31
|
};
|
|
@@ -16,6 +16,7 @@ exports.VelcronConstants = {
|
|
|
16
16
|
icon: "icon",
|
|
17
17
|
chip: "chip",
|
|
18
18
|
markdown: "markdown",
|
|
19
|
+
slot: "slot",
|
|
19
20
|
},
|
|
20
21
|
events: {
|
|
21
22
|
idTokenStart: "$ev{",
|
|
@@ -26,7 +27,8 @@ exports.VelcronConstants = {
|
|
|
26
27
|
stateRootToken: "$state"
|
|
27
28
|
},
|
|
28
29
|
properties: {
|
|
29
|
-
tokenStart: "
|
|
30
|
-
tokenEnd: "}"
|
|
30
|
+
tokenStart: "{{",
|
|
31
|
+
tokenEnd: "}}",
|
|
32
|
+
propsToken: "$props"
|
|
31
33
|
}
|
|
32
34
|
};
|
package/parser/VelcronData.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare class VelcronData {
|
|
|
26
26
|
static extendObject(obj: any): any;
|
|
27
27
|
static getOrSetObjectByPath<T>(object: Object, path: string, value?: any): T | null;
|
|
28
28
|
static getOrSetObjectByPathUsingRenderContext<T>(renderContext: VelcronRenderContext, path: string, value?: any): T;
|
|
29
|
-
static getTokens(template: any): string[];
|
|
29
|
+
static getTokens(template: any, removeBrackets: boolean): string[];
|
|
30
30
|
static ensureEventId(event: string): string;
|
|
31
31
|
static ensureKeys(ui: VelcronDefinition | VelcronAppDefinition, generateNewKeys?: boolean): void;
|
|
32
32
|
static removeKeys(ui: VelcronDefinition | VelcronAppDefinition): void;
|
package/parser/VelcronData.js
CHANGED
|
@@ -10,10 +10,9 @@ class VelcronData {
|
|
|
10
10
|
if (!VelcronData.isString(text)) {
|
|
11
11
|
return text;
|
|
12
12
|
}
|
|
13
|
-
const tokens = this.getTokens(text);
|
|
14
|
-
tokens.forEach((
|
|
15
|
-
let data = this.getOrSetObjectByPathUsingRenderContext(renderContext,
|
|
16
|
-
const token = VelcronConstants_1.VelcronConstants.properties.tokenStart + name + VelcronConstants_1.VelcronConstants.properties.tokenEnd;
|
|
13
|
+
const tokens = this.getTokens(text, false);
|
|
14
|
+
tokens.forEach((token) => {
|
|
15
|
+
let data = this.getOrSetObjectByPathUsingRenderContext(renderContext, token.replace(/\s*{{\s*|\s*}}\s*/g, ""));
|
|
17
16
|
if (data instanceof TextValue_1.TextValue) {
|
|
18
17
|
data = data.value;
|
|
19
18
|
}
|
|
@@ -508,52 +507,49 @@ class VelcronData {
|
|
|
508
507
|
variables[renderContext.id].hasOwnProperty(path)) {
|
|
509
508
|
result = variables[renderContext.id][path];
|
|
510
509
|
}
|
|
510
|
+
else if (path.startsWith(VelcronConstants_1.VelcronConstants.properties.propsToken + ".")) {
|
|
511
|
+
//props in a custom component $props.
|
|
512
|
+
path = path.substring(VelcronConstants_1.VelcronConstants.properties.propsToken.length + 1);
|
|
513
|
+
const propObj = VelcronData.getOrSetObjectByPath(renderContext.properties, path);
|
|
514
|
+
if (VelcronData.isString(propObj)) {
|
|
515
|
+
const propString = propObj;
|
|
516
|
+
path = VelcronData.dataBind(renderContext, propString);
|
|
517
|
+
result = path;
|
|
518
|
+
}
|
|
519
|
+
result = propObj;
|
|
520
|
+
}
|
|
511
521
|
else {
|
|
512
|
-
|
|
513
|
-
if (
|
|
514
|
-
|
|
515
|
-
const propObj = renderContext.properties[path];
|
|
516
|
-
if (VelcronData.isString(propObj)) {
|
|
517
|
-
const propString = propObj;
|
|
518
|
-
path = VelcronData.dataBind(renderContext, propString);
|
|
519
|
-
}
|
|
520
|
-
result = propObj;
|
|
522
|
+
const tokens = VelcronData.getTokens(path, true);
|
|
523
|
+
if (tokens.length > 0) {
|
|
524
|
+
path = tokens[0];
|
|
521
525
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
result = VelcronData.getOrSetObjectByPath(object, path, value);
|
|
539
|
-
}
|
|
540
|
-
else {
|
|
541
|
-
//For example if you bind to Array of ["string"] the currentContext is only a string so we just return the object without mapping path
|
|
542
|
-
result = object;
|
|
543
|
-
}
|
|
544
|
-
if (typeof result === "undefined" && pathIsPropertyValue) {
|
|
545
|
-
result = path;
|
|
546
|
-
}
|
|
526
|
+
let object = null;
|
|
527
|
+
if (path.startsWith(`${VelcronConstants_1.VelcronConstants.state.stateRootToken}.`) || path === VelcronConstants_1.VelcronConstants.state.stateRootToken) {
|
|
528
|
+
//Fetch from the data object
|
|
529
|
+
object = renderContext.rootContext;
|
|
530
|
+
path = path.substring(6);
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
//Fetch from current ctx
|
|
534
|
+
object = renderContext.currentContext;
|
|
535
|
+
}
|
|
536
|
+
if (VelcronData.isObject(object)) {
|
|
537
|
+
result = VelcronData.getOrSetObjectByPath(object, path, value);
|
|
538
|
+
}
|
|
539
|
+
else {
|
|
540
|
+
//For example if you bind to Array of ["string"] the currentContext is only a string so we just return the object without mapping path
|
|
541
|
+
result = object;
|
|
547
542
|
}
|
|
548
543
|
}
|
|
549
544
|
return result;
|
|
550
545
|
}
|
|
551
|
-
static getTokens(template) {
|
|
546
|
+
static getTokens(template, removeBrackets) {
|
|
552
547
|
const tokens = [];
|
|
553
548
|
if (template) {
|
|
554
|
-
template.replace(/(
|
|
555
|
-
|
|
556
|
-
|
|
549
|
+
template.replace(removeBrackets ? /{{\s*(.+?)\s*}}/g : /(\{{.+?\}})/g, (foundToken, token) => {
|
|
550
|
+
const tokenWithVar = removeBrackets ? token : foundToken;
|
|
551
|
+
tokens.push(tokenWithVar);
|
|
552
|
+
return tokenWithVar;
|
|
557
553
|
});
|
|
558
554
|
}
|
|
559
555
|
return tokens;
|
|
@@ -95,7 +95,6 @@ class VelcronRenderers {
|
|
|
95
95
|
//Fetch the custom component definition
|
|
96
96
|
const customDef = rendererInfo.definition;
|
|
97
97
|
if (customDef.properties) {
|
|
98
|
-
// customDef.properties.forEach((prop) => {
|
|
99
98
|
Object.keys(customDef.properties).forEach((propName) => {
|
|
100
99
|
const prop = customDef.properties ? customDef.properties[propName] : null;
|
|
101
100
|
if (!prop || (prop.required && !definition.hasOwnProperty(propName))) {
|
|
@@ -106,7 +105,7 @@ class VelcronRenderers {
|
|
|
106
105
|
if (VelcronData_1.VelcronData.isString(definition[propName])) {
|
|
107
106
|
//Properties can be databound so if its a string we try do databind
|
|
108
107
|
//this is true for other values such as number / string also
|
|
109
|
-
result.properties[propName] = VelcronData_1.VelcronData.dataBind(
|
|
108
|
+
result.properties[propName] = VelcronData_1.VelcronData.dataBind(result, definition[propName]);
|
|
110
109
|
}
|
|
111
110
|
else {
|
|
112
111
|
result.properties[propName] = definition[propName];
|
|
@@ -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 VelcronColorSchemaEditorBuilder extends VelcronEditorBuilderBase {
|
|
5
|
+
private editor;
|
|
6
|
+
constructor(builder: any);
|
|
7
|
+
add(): VelcronEditorBuilder;
|
|
8
|
+
protected internalBuild(): VelcronPropertyEditor<any>[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronColorSchemaEditorBuilder = void 0;
|
|
4
|
+
const VelcronEditorBuilderBase_1 = require("./VelcronEditorBuilderBase");
|
|
5
|
+
class VelcronColorSchemaEditorBuilder 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: "Color Schema",
|
|
14
|
+
type: "color-schema-type",
|
|
15
|
+
stateMapping: "colorSchemaType"
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return this.builder;
|
|
19
|
+
}
|
|
20
|
+
internalBuild() {
|
|
21
|
+
const result = [];
|
|
22
|
+
if (this.editor) {
|
|
23
|
+
result.push(this.editor);
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.VelcronColorSchemaEditorBuilder = VelcronColorSchemaEditorBuilder;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VelcronPropertyEditor } from "@omnia/fx-models";
|
|
2
|
+
import { VelcronEditorBuilderBase } from "./VelcronEditorBuilderBase";
|
|
3
|
+
export declare class VelcronContentEditorBuilder extends VelcronEditorBuilderBase {
|
|
4
|
+
private mainEditor;
|
|
5
|
+
private captionEditor;
|
|
6
|
+
constructor(builder: any);
|
|
7
|
+
main: {
|
|
8
|
+
add: () => VelcronContentEditorBuilder;
|
|
9
|
+
};
|
|
10
|
+
caption: {
|
|
11
|
+
add: () => VelcronContentEditorBuilder;
|
|
12
|
+
};
|
|
13
|
+
protected internalBuild(): VelcronPropertyEditor<any>[];
|
|
14
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronContentEditorBuilder = void 0;
|
|
4
|
+
const VelcronEditorBuilderBase_1 = require("./VelcronEditorBuilderBase");
|
|
5
|
+
class VelcronContentEditorBuilder extends VelcronEditorBuilderBase_1.VelcronEditorBuilderBase {
|
|
6
|
+
constructor(builder) {
|
|
7
|
+
super(builder);
|
|
8
|
+
this.mainEditor = null;
|
|
9
|
+
this.captionEditor = null;
|
|
10
|
+
this.main = {
|
|
11
|
+
add: () => {
|
|
12
|
+
if (!this.mainEditor) {
|
|
13
|
+
this.mainEditor = {
|
|
14
|
+
name: "Body",
|
|
15
|
+
type: "markdown",
|
|
16
|
+
stateMapping: "content.main"
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
this.caption = {
|
|
23
|
+
add: () => {
|
|
24
|
+
if (!this.captionEditor) {
|
|
25
|
+
this.captionEditor = {
|
|
26
|
+
name: "Caption",
|
|
27
|
+
type: "text",
|
|
28
|
+
stateMapping: "content.caption"
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
internalBuild() {
|
|
36
|
+
const result = [];
|
|
37
|
+
if (this.mainEditor) {
|
|
38
|
+
result.push(this.mainEditor);
|
|
39
|
+
}
|
|
40
|
+
if (this.captionEditor) {
|
|
41
|
+
result.push(this.captionEditor);
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.VelcronContentEditorBuilder = VelcronContentEditorBuilder;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { VelcronPropertyEditor } from "@omnia/fx-models";
|
|
2
|
+
import { VelcronContentEditorBuilder } from "./VelcronContentEditor";
|
|
3
|
+
import { VelcronColorSchemaEditorBuilder } from "./VelcronColorSchemaEditor";
|
|
4
|
+
import { VelcronImageEditorBuilder } from "./VelcronImageEditor";
|
|
5
|
+
export declare class VelcronEditorBuilder {
|
|
6
|
+
private contentEditorBuilder;
|
|
7
|
+
private colorSchemaEditorBuilder;
|
|
8
|
+
private imageEditorBuilder;
|
|
9
|
+
content(): VelcronContentEditorBuilder;
|
|
10
|
+
colorSchemaType(): VelcronColorSchemaEditorBuilder;
|
|
11
|
+
image(): VelcronImageEditorBuilder;
|
|
12
|
+
build(): VelcronPropertyEditor<any>[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronEditorBuilder = void 0;
|
|
4
|
+
const VelcronContentEditor_1 = require("./VelcronContentEditor");
|
|
5
|
+
const VelcronColorSchemaEditor_1 = require("./VelcronColorSchemaEditor");
|
|
6
|
+
const VelcronImageEditor_1 = require("./VelcronImageEditor");
|
|
7
|
+
class VelcronEditorBuilder {
|
|
8
|
+
content() {
|
|
9
|
+
if (!this.contentEditorBuilder) {
|
|
10
|
+
this.contentEditorBuilder = new VelcronContentEditor_1.VelcronContentEditorBuilder(this);
|
|
11
|
+
}
|
|
12
|
+
return this.contentEditorBuilder;
|
|
13
|
+
}
|
|
14
|
+
colorSchemaType() {
|
|
15
|
+
if (!this.colorSchemaEditorBuilder) {
|
|
16
|
+
this.colorSchemaEditorBuilder = new VelcronColorSchemaEditor_1.VelcronColorSchemaEditorBuilder(this);
|
|
17
|
+
}
|
|
18
|
+
return this.colorSchemaEditorBuilder;
|
|
19
|
+
}
|
|
20
|
+
image() {
|
|
21
|
+
if (!this.imageEditorBuilder) {
|
|
22
|
+
this.imageEditorBuilder = new VelcronImageEditor_1.VelcronImageEditorBuilder(this);
|
|
23
|
+
}
|
|
24
|
+
return this.imageEditorBuilder;
|
|
25
|
+
}
|
|
26
|
+
build() {
|
|
27
|
+
const result = [];
|
|
28
|
+
if (this.colorSchemaEditorBuilder) {
|
|
29
|
+
result.push(...this.colorSchemaEditorBuilder.internalBuild());
|
|
30
|
+
}
|
|
31
|
+
if (this.contentEditorBuilder) {
|
|
32
|
+
result.push(...this.contentEditorBuilder.internalBuild());
|
|
33
|
+
}
|
|
34
|
+
if (this.imageEditorBuilder) {
|
|
35
|
+
result.push(...this.imageEditorBuilder.internalBuild());
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.VelcronEditorBuilder = VelcronEditorBuilder;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VelcronPropertyEditor } from "../../models";
|
|
2
|
+
import { VelcronEditorBuilder } from "./VelcronEditorBuilder";
|
|
3
|
+
export declare abstract class VelcronEditorBuilderBase {
|
|
4
|
+
protected builder: VelcronEditorBuilder;
|
|
5
|
+
constructor(builder: VelcronEditorBuilder);
|
|
6
|
+
done(): VelcronEditorBuilder;
|
|
7
|
+
build(): VelcronPropertyEditor<any>[];
|
|
8
|
+
protected abstract internalBuild(): Array<VelcronPropertyEditor>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronEditorBuilderBase = void 0;
|
|
4
|
+
class VelcronEditorBuilderBase {
|
|
5
|
+
constructor(builder) {
|
|
6
|
+
this.builder = null;
|
|
7
|
+
this.builder = builder;
|
|
8
|
+
}
|
|
9
|
+
done() {
|
|
10
|
+
return this.builder;
|
|
11
|
+
}
|
|
12
|
+
build() {
|
|
13
|
+
return this.builder.build();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.VelcronEditorBuilderBase = VelcronEditorBuilderBase;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VelcronPropertyEditor } from "@omnia/fx-models";
|
|
2
|
+
import { VelcronEditorBuilder } from "./VelcronEditorBuilder";
|
|
3
|
+
import { VelcronEditorBuilderBase } from "./VelcronEditorBuilderBase";
|
|
4
|
+
export declare class VelcronImageEditorBuilder extends VelcronEditorBuilderBase {
|
|
5
|
+
private mainEditor;
|
|
6
|
+
constructor(builder: any);
|
|
7
|
+
main: {
|
|
8
|
+
add: () => VelcronEditorBuilder;
|
|
9
|
+
};
|
|
10
|
+
protected internalBuild(): VelcronPropertyEditor<any>[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronImageEditorBuilder = void 0;
|
|
4
|
+
const VelcronEditorBuilderBase_1 = require("./VelcronEditorBuilderBase");
|
|
5
|
+
class VelcronImageEditorBuilder extends VelcronEditorBuilderBase_1.VelcronEditorBuilderBase {
|
|
6
|
+
constructor(builder) {
|
|
7
|
+
super(builder);
|
|
8
|
+
this.mainEditor = null;
|
|
9
|
+
this.main = {
|
|
10
|
+
add: () => {
|
|
11
|
+
if (!this.mainEditor) {
|
|
12
|
+
this.mainEditor = {
|
|
13
|
+
name: "Select Main Image",
|
|
14
|
+
type: "image",
|
|
15
|
+
stateMapping: "main-image"
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return this.builder;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
internalBuild() {
|
|
23
|
+
const result = [];
|
|
24
|
+
if (this.mainEditor) {
|
|
25
|
+
result.push(this.mainEditor);
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.VelcronImageEditorBuilder = VelcronImageEditorBuilder;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useVelcronTemplateBuilder";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ColorSchemaType } from "@omnia/fx-models";
|
|
2
|
+
import { VelcronStateBuilderBase } from "./VelcronStateBuilderBase";
|
|
3
|
+
export declare class VelcronColorSchemaStateBuilder extends VelcronStateBuilderBase {
|
|
4
|
+
private colorSchema;
|
|
5
|
+
constructor(stateBuilder: any);
|
|
6
|
+
add(colorSchema?: ColorSchemaType): VelcronColorSchemaStateBuilder;
|
|
7
|
+
bind: string;
|
|
8
|
+
protected internalBuild(): {
|
|
9
|
+
colorSchemaType: ColorSchemaType;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronColorSchemaStateBuilder = void 0;
|
|
4
|
+
const VelcronStateBuilderBase_1 = require("./VelcronStateBuilderBase");
|
|
5
|
+
class VelcronColorSchemaStateBuilder extends VelcronStateBuilderBase_1.VelcronStateBuilderBase {
|
|
6
|
+
constructor(stateBuilder) {
|
|
7
|
+
super(stateBuilder);
|
|
8
|
+
this.bind = "{{colorSchemaType}}";
|
|
9
|
+
}
|
|
10
|
+
add(colorSchema) {
|
|
11
|
+
this.colorSchema = colorSchema;
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
internalBuild() {
|
|
15
|
+
return {
|
|
16
|
+
colorSchemaType: this.colorSchema
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.VelcronColorSchemaStateBuilder = VelcronColorSchemaStateBuilder;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { VelcronStateBuilderBase } from "./VelcronStateBuilderBase";
|
|
2
|
+
export declare class VelcronContentStateBuilder extends VelcronStateBuilderBase {
|
|
3
|
+
private mainContent;
|
|
4
|
+
private captionContent;
|
|
5
|
+
constructor(stateBuilder: any);
|
|
6
|
+
main: {
|
|
7
|
+
add: (value?: string) => VelcronContentStateBuilder;
|
|
8
|
+
bind: string;
|
|
9
|
+
};
|
|
10
|
+
caption: {
|
|
11
|
+
add: (value?: string) => VelcronContentStateBuilder;
|
|
12
|
+
bind: string;
|
|
13
|
+
};
|
|
14
|
+
protected internalBuild(): {
|
|
15
|
+
content: {};
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronContentStateBuilder = void 0;
|
|
4
|
+
const VelcronStateBuilderBase_1 = require("./VelcronStateBuilderBase");
|
|
5
|
+
class VelcronContentStateBuilder extends VelcronStateBuilderBase_1.VelcronStateBuilderBase {
|
|
6
|
+
constructor(stateBuilder) {
|
|
7
|
+
super(stateBuilder);
|
|
8
|
+
this.main = {
|
|
9
|
+
add: (value) => {
|
|
10
|
+
this.mainContent = value;
|
|
11
|
+
return this;
|
|
12
|
+
},
|
|
13
|
+
bind: "$state.content.main"
|
|
14
|
+
};
|
|
15
|
+
this.caption = {
|
|
16
|
+
add: (value) => {
|
|
17
|
+
this.captionContent = value;
|
|
18
|
+
return this;
|
|
19
|
+
},
|
|
20
|
+
bind: "{{content.caption}}"
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
internalBuild() {
|
|
24
|
+
const resultValue = {};
|
|
25
|
+
let hasContent = false;
|
|
26
|
+
if (this.mainContent) {
|
|
27
|
+
resultValue["main"] = this.mainContent;
|
|
28
|
+
hasContent = true;
|
|
29
|
+
}
|
|
30
|
+
if (this.captionContent) {
|
|
31
|
+
resultValue["caption"] = this.captionContent;
|
|
32
|
+
hasContent = true;
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
content: resultValue
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.VelcronContentStateBuilder = VelcronContentStateBuilder;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { VelcronImageRatios } from "../../models";
|
|
2
|
+
import { VelcronStateBuilderBase } from "./VelcronStateBuilderBase";
|
|
3
|
+
export declare class VelcronImageStateBuilder extends VelcronStateBuilderBase {
|
|
4
|
+
private mainImageUrl;
|
|
5
|
+
private mainImageRatio;
|
|
6
|
+
constructor(stateBuilder: any);
|
|
7
|
+
main: {
|
|
8
|
+
url: {
|
|
9
|
+
add: (url: string) => VelcronImageStateBuilder;
|
|
10
|
+
bind: string;
|
|
11
|
+
};
|
|
12
|
+
ratio: {
|
|
13
|
+
add: (ratio: VelcronImageRatios) => VelcronImageStateBuilder;
|
|
14
|
+
bind: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
protected internalBuild(): {
|
|
18
|
+
"main-image": {};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronImageStateBuilder = void 0;
|
|
4
|
+
const VelcronStateBuilderBase_1 = require("./VelcronStateBuilderBase");
|
|
5
|
+
class VelcronImageStateBuilder extends VelcronStateBuilderBase_1.VelcronStateBuilderBase {
|
|
6
|
+
constructor(stateBuilder) {
|
|
7
|
+
super(stateBuilder);
|
|
8
|
+
this.main = {
|
|
9
|
+
url: {
|
|
10
|
+
add: (url) => {
|
|
11
|
+
this.mainImageUrl = url;
|
|
12
|
+
return this;
|
|
13
|
+
},
|
|
14
|
+
bind: "{{main-image.url}}"
|
|
15
|
+
},
|
|
16
|
+
ratio: {
|
|
17
|
+
add: (ratio) => {
|
|
18
|
+
this.mainImageRatio = ratio;
|
|
19
|
+
return this;
|
|
20
|
+
},
|
|
21
|
+
bind: "{{main-image.ratio}}"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
internalBuild() {
|
|
26
|
+
if (!this.mainImageUrl) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const resultValue = {};
|
|
30
|
+
if (this.mainImageRatio) {
|
|
31
|
+
resultValue["ratio"] = this.mainImageRatio;
|
|
32
|
+
}
|
|
33
|
+
if (this.mainImageUrl) {
|
|
34
|
+
resultValue["url"] = this.mainImageUrl;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
"main-image": {
|
|
38
|
+
...resultValue
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.VelcronImageStateBuilder = VelcronImageStateBuilder;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VelcronColorSchemaStateBuilder } from "./VelcronColorSchemaBuilder";
|
|
2
|
+
import { VelcronContentStateBuilder } from "./VelcronContentStateBuilder";
|
|
3
|
+
import { VelcronImageStateBuilder } from "./VelcronImageStateBuilder";
|
|
4
|
+
export declare class VelcronStateBuilder {
|
|
5
|
+
private contentStateBuilder;
|
|
6
|
+
private imageStateBuilder;
|
|
7
|
+
private colorSchemaStateBuilder;
|
|
8
|
+
content(): VelcronContentStateBuilder;
|
|
9
|
+
image(): VelcronImageStateBuilder;
|
|
10
|
+
colorSchemaType(): VelcronColorSchemaStateBuilder;
|
|
11
|
+
build(): any;
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronStateBuilder = void 0;
|
|
4
|
+
const VelcronColorSchemaBuilder_1 = require("./VelcronColorSchemaBuilder");
|
|
5
|
+
const VelcronContentStateBuilder_1 = require("./VelcronContentStateBuilder");
|
|
6
|
+
const VelcronImageStateBuilder_1 = require("./VelcronImageStateBuilder");
|
|
7
|
+
class VelcronStateBuilder {
|
|
8
|
+
content() {
|
|
9
|
+
if (!this.contentStateBuilder) {
|
|
10
|
+
this.contentStateBuilder = new VelcronContentStateBuilder_1.VelcronContentStateBuilder(this);
|
|
11
|
+
}
|
|
12
|
+
return this.contentStateBuilder;
|
|
13
|
+
}
|
|
14
|
+
image() {
|
|
15
|
+
if (!this.imageStateBuilder) {
|
|
16
|
+
this.imageStateBuilder = new VelcronImageStateBuilder_1.VelcronImageStateBuilder(this);
|
|
17
|
+
}
|
|
18
|
+
return this.imageStateBuilder;
|
|
19
|
+
}
|
|
20
|
+
colorSchemaType() {
|
|
21
|
+
if (!this.colorSchemaStateBuilder) {
|
|
22
|
+
this.colorSchemaStateBuilder = new VelcronColorSchemaBuilder_1.VelcronColorSchemaStateBuilder(this);
|
|
23
|
+
}
|
|
24
|
+
return this.colorSchemaStateBuilder;
|
|
25
|
+
}
|
|
26
|
+
build() {
|
|
27
|
+
return {
|
|
28
|
+
...this?.contentStateBuilder?.internalBuild(),
|
|
29
|
+
...this?.imageStateBuilder?.internalBuild(),
|
|
30
|
+
...this?.colorSchemaStateBuilder?.internalBuild(),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.VelcronStateBuilder = VelcronStateBuilder;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { VelcronStateBuilder } from "./VelcronStateBuilder";
|
|
2
|
+
export declare abstract class VelcronStateBuilderBase {
|
|
3
|
+
protected stateBuilder: VelcronStateBuilder;
|
|
4
|
+
constructor(stateBulder: VelcronStateBuilder);
|
|
5
|
+
done(): VelcronStateBuilder;
|
|
6
|
+
build(): any;
|
|
7
|
+
protected abstract internalBuild(): any;
|
|
8
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronStateBuilderBase = void 0;
|
|
4
|
+
class VelcronStateBuilderBase {
|
|
5
|
+
constructor(stateBulder) {
|
|
6
|
+
this.stateBuilder = stateBulder;
|
|
7
|
+
}
|
|
8
|
+
done() {
|
|
9
|
+
return this.stateBuilder;
|
|
10
|
+
}
|
|
11
|
+
build() {
|
|
12
|
+
return this.stateBuilder.build();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.VelcronStateBuilderBase = VelcronStateBuilderBase;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { VelcronContentState, VelcronImagePropertyEditor, VelcronImageRatios, VelcronImageState, VelcronMarkdownPropertyEditor, VelcronTextPropertyEditor} from "@omnia/fx-models";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useVelcronTemplateBuilder = void 0;
|
|
5
|
+
const VelcronEditorBuilder_1 = require("./editor/VelcronEditorBuilder");
|
|
6
|
+
const VelcronStateBuilder_1 = require("./state/VelcronStateBuilder");
|
|
7
|
+
function useVelcronTemplateBuilder() {
|
|
8
|
+
return {
|
|
9
|
+
state: new VelcronStateBuilder_1.VelcronStateBuilder(),
|
|
10
|
+
editor: new VelcronEditorBuilder_1.VelcronEditorBuilder()
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.useVelcronTemplateBuilder = useVelcronTemplateBuilder;
|