@omnia/velcron 7.0.499-dev → 7.0.500-dev
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 +2 -0
- package/index.js +2 -0
- package/models/Enums.d.ts +4 -2
- package/models/Enums.js +3 -1
- package/models/VelcronDefinitions.d.ts +4 -2
- package/package.json +1 -1
- package/parser/VelcronData.d.ts +1 -1
- package/parser/VelcronData.js +4 -4
- package/parser/VelcronStyles.d.ts +10 -0
- package/parser/VelcronStyles.js +52 -23
- package/stores/VelcronStore.d.ts +12 -0
- package/stores/VelcronStore.js +26 -0
- package/stores/index.d.ts +1 -0
- package/stores/index.js +4 -0
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -4,3 +4,5 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
tslib_1.__exportStar(require("./models"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./parser"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./actions"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./stores"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("../../../shared/models"), exports);
|
package/models/Enums.d.ts
CHANGED
|
@@ -38,8 +38,10 @@ export declare enum VelcronDescriptorTypes {
|
|
|
38
38
|
}
|
|
39
39
|
export declare enum VelcronComponentPropertyEditors {
|
|
40
40
|
text = 0,
|
|
41
|
-
|
|
42
|
-
slider = 2
|
|
41
|
+
colorSchemaPicker = 1,
|
|
42
|
+
slider = 2,
|
|
43
|
+
colorPicker = 3,
|
|
44
|
+
typographyPicker = 4
|
|
43
45
|
}
|
|
44
46
|
export declare enum VelcronDataTypes {
|
|
45
47
|
unknown = "unknown",
|
package/models/Enums.js
CHANGED
|
@@ -49,8 +49,10 @@ var VelcronDescriptorTypes;
|
|
|
49
49
|
var VelcronComponentPropertyEditors;
|
|
50
50
|
(function (VelcronComponentPropertyEditors) {
|
|
51
51
|
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["text"] = 0] = "text";
|
|
52
|
-
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["
|
|
52
|
+
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["colorSchemaPicker"] = 1] = "colorSchemaPicker";
|
|
53
53
|
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["slider"] = 2] = "slider";
|
|
54
|
+
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["colorPicker"] = 3] = "colorPicker";
|
|
55
|
+
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["typographyPicker"] = 4] = "typographyPicker";
|
|
54
56
|
})(VelcronComponentPropertyEditors = exports.VelcronComponentPropertyEditors || (exports.VelcronComponentPropertyEditors = {}));
|
|
55
57
|
var VelcronDataTypes;
|
|
56
58
|
(function (VelcronDataTypes) {
|
|
@@ -23,7 +23,7 @@ export interface BuiltInComponentRenderers {
|
|
|
23
23
|
}
|
|
24
24
|
export type DynamicViewModel = object;
|
|
25
25
|
export interface OnItemRenderedHookResult {
|
|
26
|
-
cssClass
|
|
26
|
+
cssClass: string;
|
|
27
27
|
containerRenderer?: VelcronContainerRenderer;
|
|
28
28
|
}
|
|
29
29
|
export interface VelcronRenderContext {
|
|
@@ -155,7 +155,7 @@ export interface VelcronTextDefinition extends VelcronDefinition {
|
|
|
155
155
|
type: "Text";
|
|
156
156
|
text: string;
|
|
157
157
|
color?: string;
|
|
158
|
-
|
|
158
|
+
typography?: string;
|
|
159
159
|
events?: VelcronOnPressEvent;
|
|
160
160
|
}
|
|
161
161
|
export interface VelcronImageDefinition extends VelcronDefinition {
|
|
@@ -166,6 +166,7 @@ export interface VelcronImageDefinition extends VelcronDefinition {
|
|
|
166
166
|
export interface VelcronButtonDefinition extends VelcronDefinition {
|
|
167
167
|
type: "Button";
|
|
168
168
|
text: string;
|
|
169
|
+
color: string;
|
|
169
170
|
icon?: VelcronIcon;
|
|
170
171
|
disabled?: boolean;
|
|
171
172
|
events?: VelcronOnPressEvent;
|
|
@@ -206,6 +207,7 @@ export interface VelcronFlexViewDefinition extends VelcronDefinition {
|
|
|
206
207
|
horizontalAlignment?: VelcronHorizontalAlignments;
|
|
207
208
|
verticalAlignment?: VerticalAlignments;
|
|
208
209
|
grow?: number;
|
|
210
|
+
colorSchema?: string;
|
|
209
211
|
width?: "auto" | "stretch" | number | string;
|
|
210
212
|
}
|
|
211
213
|
export interface VelcronSectionColumnWidth {
|
package/package.json
CHANGED
package/parser/VelcronData.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare class VelcronData {
|
|
|
28
28
|
static getOrSetObjectByPathUsingRenderContext<T>(renderContext: VelcronRenderContext, path: string, value?: any): T;
|
|
29
29
|
static getTokens(template: any): string[];
|
|
30
30
|
static ensureEventId(event: string): string;
|
|
31
|
-
static ensureKeys(ui: VelcronDefinition | VelcronAppDefinition): void;
|
|
31
|
+
static ensureKeys(ui: VelcronDefinition | VelcronAppDefinition, generateNewKeys?: boolean): void;
|
|
32
32
|
static removeKeys(ui: VelcronDefinition | VelcronAppDefinition): void;
|
|
33
33
|
static generateId(): string;
|
|
34
34
|
static createDeferredPromise<T>(): DeferredPromise<T>;
|
package/parser/VelcronData.js
CHANGED
|
@@ -556,8 +556,8 @@ class VelcronData {
|
|
|
556
556
|
event :
|
|
557
557
|
VelcronConstants_1.VelcronConstants.events.idTokenStart + VelcronData.generateId() + VelcronConstants_1.VelcronConstants.events.idTokenEnd + " " + event;
|
|
558
558
|
}
|
|
559
|
-
static ensureKeys(ui) {
|
|
560
|
-
if (!ui.key) {
|
|
559
|
+
static ensureKeys(ui, generateNewKeys = false) {
|
|
560
|
+
if (!ui.key || generateNewKeys) {
|
|
561
561
|
ui.key = VelcronData.generateId();
|
|
562
562
|
}
|
|
563
563
|
if (ui.events) {
|
|
@@ -572,10 +572,10 @@ class VelcronData {
|
|
|
572
572
|
Object.keys(ui).forEach((key) => {
|
|
573
573
|
if (Array.isArray(ui[key])) {
|
|
574
574
|
ui[key].forEach((item) => {
|
|
575
|
-
if (!item.key) {
|
|
575
|
+
if (!item.key || generateNewKeys) {
|
|
576
576
|
item.key = VelcronData.generateId();
|
|
577
577
|
}
|
|
578
|
-
VelcronData.ensureKeys(item);
|
|
578
|
+
VelcronData.ensureKeys(item, generateNewKeys);
|
|
579
579
|
});
|
|
580
580
|
}
|
|
581
581
|
});
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { VelcronDefinition, VelcronRenderContext } from "../models";
|
|
2
|
+
export declare enum VelcronSizeUnits {
|
|
3
|
+
Pixels = 1,
|
|
4
|
+
Numbers = 2
|
|
5
|
+
}
|
|
6
|
+
export interface VelcronStyleSettings {
|
|
7
|
+
sizeUnit: VelcronSizeUnits;
|
|
8
|
+
}
|
|
2
9
|
export declare class VelcronStyles {
|
|
10
|
+
private static styleSettings;
|
|
3
11
|
static create(definition: VelcronDefinition, renderCtx: VelcronRenderContext): any;
|
|
4
12
|
private static createStylesForText;
|
|
5
13
|
private static createStylesForImage;
|
|
6
14
|
private static createStylesForFlexbox;
|
|
7
15
|
private static createStylesForLayoutColumnComponent;
|
|
8
16
|
private static dataBindStyles;
|
|
17
|
+
private static setUnitForValue;
|
|
18
|
+
private static setup;
|
|
9
19
|
}
|
package/parser/VelcronStyles.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VelcronStyles = void 0;
|
|
3
|
+
exports.VelcronStyles = exports.VelcronSizeUnits = void 0;
|
|
4
4
|
const VelcronData_1 = require("./VelcronData");
|
|
5
5
|
const models_1 = require("../models");
|
|
6
6
|
const VelcronConstants_1 = require("./VelcronConstants");
|
|
7
|
+
var VelcronSizeUnits;
|
|
8
|
+
(function (VelcronSizeUnits) {
|
|
9
|
+
VelcronSizeUnits[VelcronSizeUnits["Pixels"] = 1] = "Pixels";
|
|
10
|
+
VelcronSizeUnits[VelcronSizeUnits["Numbers"] = 2] = "Numbers";
|
|
11
|
+
})(VelcronSizeUnits = exports.VelcronSizeUnits || (exports.VelcronSizeUnits = {}));
|
|
7
12
|
class VelcronStyles {
|
|
8
13
|
static create(definition, renderCtx) {
|
|
9
14
|
let result = { ...definition.style };
|
|
@@ -26,20 +31,25 @@ class VelcronStyles {
|
|
|
26
31
|
return result;
|
|
27
32
|
}
|
|
28
33
|
static createStylesForText(textDefinition, styles) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
// const themeStore = useInject(ThemeStore);
|
|
35
|
+
// if (textDefinition.color && textDefinition.color != "") {
|
|
36
|
+
// styles["color"] = themeStore.getters.getColor(textDefinition.color);
|
|
37
|
+
// }
|
|
38
|
+
// else {
|
|
39
|
+
// styles["color"] = themeStore.getters.activeSchema().onBase.color;
|
|
40
|
+
// }
|
|
41
|
+
// const typography = themeStore.getters.typography(textDefinition.typography);
|
|
42
|
+
// styles["fontSize"] = this.setUnitForValue(typography.large.size);
|
|
43
|
+
// styles["font-weight"] = typography.large.weight;
|
|
44
|
+
// styles["line-height"] = this.setUnitForValue(typography.large.lineHeight);
|
|
35
45
|
return styles;
|
|
36
46
|
}
|
|
37
47
|
static createStylesForImage(imageDef, styles) {
|
|
38
48
|
if (!styles.width) {
|
|
39
|
-
styles.width = 200;
|
|
49
|
+
styles.width = this.setUnitForValue(200);
|
|
40
50
|
}
|
|
41
51
|
if (!styles.height) {
|
|
42
|
-
styles.height = 400;
|
|
52
|
+
styles.height = this.setUnitForValue(400);
|
|
43
53
|
}
|
|
44
54
|
styles.flex = "0 0 auto!important";
|
|
45
55
|
return styles;
|
|
@@ -50,44 +60,51 @@ class VelcronStyles {
|
|
|
50
60
|
// styles["flex-direction"] = sectionDef.column ? "column" : "row";
|
|
51
61
|
// return styles;
|
|
52
62
|
// }
|
|
53
|
-
static createStylesForFlexbox(
|
|
54
|
-
const flexGrow =
|
|
63
|
+
static createStylesForFlexbox(flexViewDefinition, styles) {
|
|
64
|
+
const flexGrow = flexViewDefinition.grow ? flexViewDefinition.grow : 1;
|
|
55
65
|
const flextShrink = flexGrow;
|
|
56
66
|
styles.display = "flex";
|
|
57
|
-
styles.flex =
|
|
67
|
+
styles.flex = flexGrow;
|
|
58
68
|
styles["max-width"] = "100%";
|
|
59
|
-
styles["flex-direction"] =
|
|
69
|
+
styles["flex-direction"] = flexViewDefinition.column ? "column" : "row";
|
|
60
70
|
//Auto
|
|
61
|
-
if (
|
|
71
|
+
if (flexViewDefinition.width && flexViewDefinition.width === models_1.VelcronSectionColumnWidthTypes.auto) {
|
|
62
72
|
styles["flex"] = `${flexGrow} ${flextShrink} auto`;
|
|
63
73
|
}
|
|
64
74
|
//Pixels
|
|
65
|
-
else if (
|
|
75
|
+
else if (flexViewDefinition.width && VelcronData_1.VelcronData.isString(flexViewDefinition.width) && flexViewDefinition.width.endsWith("px")) {
|
|
66
76
|
//width["flex"] = `${flexGrow} ${flextShrink} ${columnDef.width}`;
|
|
67
|
-
styles["max-width"] =
|
|
77
|
+
styles["max-width"] = this.setUnitForValue(flexViewDefinition.width);
|
|
68
78
|
}
|
|
69
79
|
//Percentage
|
|
70
|
-
else if (
|
|
71
|
-
styles["flex"] = `${flexGrow} ${flextShrink} ${
|
|
80
|
+
else if (flexViewDefinition.width && (isNaN(flexViewDefinition.width) === false)) {
|
|
81
|
+
styles["flex"] = `${flexGrow} ${flextShrink} ${flexViewDefinition.width}%`;
|
|
72
82
|
}
|
|
73
83
|
// if (columnDef.horizontalAlignment && columnDef.horizontalAlignment !== VelcronHorizontalAlignments.left) {
|
|
74
84
|
// //Need to add this to make horizontalAlignment work for child div
|
|
75
85
|
// result["flex-direction"] = "column";
|
|
76
86
|
// }
|
|
77
|
-
if (
|
|
87
|
+
if (flexViewDefinition.horizontalAlignment) {
|
|
78
88
|
//Need to add this to make horizontalAlignment work for child div
|
|
79
|
-
styles["justify-content"] =
|
|
89
|
+
styles["justify-content"] = flexViewDefinition.horizontalAlignment;
|
|
80
90
|
}
|
|
81
|
-
if (
|
|
82
|
-
if (
|
|
91
|
+
if (flexViewDefinition.verticalAlignment) {
|
|
92
|
+
if (flexViewDefinition.verticalAlignment === models_1.VerticalAlignments.center) {
|
|
83
93
|
//result["flex-direction"] = "column";
|
|
84
94
|
styles["align-items"] = "center";
|
|
85
95
|
}
|
|
86
|
-
else if (
|
|
96
|
+
else if (flexViewDefinition.verticalAlignment === models_1.VerticalAlignments.bottom) {
|
|
87
97
|
//result["flex-direction"] = "column";
|
|
88
98
|
styles["align-items"] = "flex-end";
|
|
89
99
|
}
|
|
90
100
|
}
|
|
101
|
+
// if (flexViewDefinition.colorSchema && flexViewDefinition.colorSchema != "") {
|
|
102
|
+
// const themeStore = useInject(ThemeStore);
|
|
103
|
+
// styles["background-color"] = themeStore.getters.activeSchema().base.color;
|
|
104
|
+
// }
|
|
105
|
+
//Color
|
|
106
|
+
//if(flexViewDefinition.co)
|
|
107
|
+
//const { theming } = useTheme();
|
|
91
108
|
return styles;
|
|
92
109
|
}
|
|
93
110
|
static createStylesForLayoutColumnComponent(layoutDef, columnDef, styles) {
|
|
@@ -111,5 +128,17 @@ class VelcronStyles {
|
|
|
111
128
|
});
|
|
112
129
|
return styles;
|
|
113
130
|
}
|
|
131
|
+
static setUnitForValue(value) {
|
|
132
|
+
if (this.styleSettings.sizeUnit === VelcronSizeUnits.Pixels) {
|
|
133
|
+
return value + "px";
|
|
134
|
+
}
|
|
135
|
+
return value;
|
|
136
|
+
}
|
|
137
|
+
static setup(settings) {
|
|
138
|
+
this.styleSettings = settings;
|
|
139
|
+
}
|
|
114
140
|
}
|
|
115
141
|
exports.VelcronStyles = VelcronStyles;
|
|
142
|
+
VelcronStyles.styleSettings = {
|
|
143
|
+
sizeUnit: VelcronSizeUnits.Pixels
|
|
144
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class VelcronStore {
|
|
2
|
+
static makeReactive: (obj: any) => unknown;
|
|
3
|
+
static reactivityCreator(fn: (obj: any) => unknown): void;
|
|
4
|
+
state<T>(obj: T): T;
|
|
5
|
+
mutation(fn: () => void): void;
|
|
6
|
+
}
|
|
7
|
+
export declare class TestStore extends VelcronStore {
|
|
8
|
+
test: {
|
|
9
|
+
title: string;
|
|
10
|
+
};
|
|
11
|
+
increment: (text: string) => string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestStore = exports.VelcronStore = void 0;
|
|
4
|
+
class VelcronStore {
|
|
5
|
+
static reactivityCreator(fn) {
|
|
6
|
+
VelcronStore.makeReactive = fn;
|
|
7
|
+
}
|
|
8
|
+
state(obj) {
|
|
9
|
+
if (!VelcronStore.makeReactive) {
|
|
10
|
+
throw new Error("Reactivity creator not set");
|
|
11
|
+
}
|
|
12
|
+
return VelcronStore.makeReactive(obj);
|
|
13
|
+
}
|
|
14
|
+
mutation(fn) {
|
|
15
|
+
fn();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.VelcronStore = VelcronStore;
|
|
19
|
+
class TestStore extends VelcronStore {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.test = this.state({ title: "Hello" });
|
|
23
|
+
this.increment = (text) => this.test.title = text;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.TestStore = TestStore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./VelcronStore";
|
package/stores/index.js
ADDED