@omnia/velcron 7.0.506-dev → 7.0.508-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.
@@ -1,2 +1,3 @@
1
1
  export * from "./ThemeDefinitionV2";
2
2
  export * from "./TypographyDefinition";
3
+ export * from "./OmniaThemes";
@@ -3,3 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./ThemeDefinitionV2"), exports);
5
5
  tslib_1.__exportStar(require("./TypographyDefinition"), exports);
6
+ tslib_1.__exportStar(require("./OmniaThemes"), exports);
package/models/Enums.d.ts CHANGED
@@ -16,10 +16,6 @@ export declare enum VelcronActionTypes {
16
16
  export declare enum VelcronIconTypes {
17
17
  fontAwesome = "fa"
18
18
  }
19
- export declare enum VelcronSectionColumnWidthTypes {
20
- stretch = "stretch",
21
- auto = "auto"
22
- }
23
19
  export declare enum VelcronHorizontalAlignments {
24
20
  left = "left",
25
21
  center = "center",
package/models/Enums.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VelcronDataTypes = exports.VelcronComponentPropertyEditors = exports.VelcronDescriptorTypes = exports.VerticalAlignments = exports.VelcronHorizontalAlignments = exports.VelcronSectionColumnWidthTypes = exports.VelcronIconTypes = exports.VelcronActionTypes = exports.AssignOperators = void 0;
3
+ exports.VelcronDataTypes = exports.VelcronComponentPropertyEditors = exports.VelcronDescriptorTypes = exports.VerticalAlignments = exports.VelcronHorizontalAlignments = exports.VelcronIconTypes = exports.VelcronActionTypes = exports.AssignOperators = void 0;
4
4
  var AssignOperators;
5
5
  (function (AssignOperators) {
6
6
  AssignOperators["equals"] = "=";
@@ -22,11 +22,6 @@ var VelcronIconTypes;
22
22
  (function (VelcronIconTypes) {
23
23
  VelcronIconTypes["fontAwesome"] = "fa";
24
24
  })(VelcronIconTypes = exports.VelcronIconTypes || (exports.VelcronIconTypes = {}));
25
- var VelcronSectionColumnWidthTypes;
26
- (function (VelcronSectionColumnWidthTypes) {
27
- VelcronSectionColumnWidthTypes["stretch"] = "stretch";
28
- VelcronSectionColumnWidthTypes["auto"] = "auto";
29
- })(VelcronSectionColumnWidthTypes = exports.VelcronSectionColumnWidthTypes || (exports.VelcronSectionColumnWidthTypes = {}));
30
25
  var VelcronHorizontalAlignments;
31
26
  (function (VelcronHorizontalAlignments) {
32
27
  VelcronHorizontalAlignments["left"] = "left";
@@ -1,7 +1,7 @@
1
1
  import { VelcronComponentDescriptor } from "./VelcronDescriptors";
2
2
  import { VelcronEvent, VelcronOnChangedEvent, VelcronOnClosedEvent, VelcronOnCloseRequestedEvent, VelcronOnLoadEvent, VelcronOnPressEvent } from "./VelcronEvents";
3
3
  import { VelcroncomponentArrayType, VelcronPrimitiveType } from "./VelcronTypes";
4
- import { AssignOperators, VelcronHorizontalAlignments, VelcronIconTypes, VelcronActionTypes, VelcronSectionColumnWidthTypes, VerticalAlignments } from "./Enums";
4
+ import { AssignOperators, VelcronHorizontalAlignments, VelcronIconTypes, VelcronActionTypes, VerticalAlignments } from "./Enums";
5
5
  import { VelcronTheming } from "..";
6
6
  export interface ResolvedComponentRenderer {
7
7
  component: unknown;
@@ -210,11 +210,19 @@ export interface VelcronFlexViewDefinition extends VelcronDefinition {
210
210
  horizontalAlignment?: VelcronHorizontalAlignments;
211
211
  verticalAlignment?: VerticalAlignments;
212
212
  grow?: number;
213
+ border?: VelcronBorder;
214
+ borderRadius?: VelcronDimensions;
213
215
  colorSchema?: string;
214
- width?: "auto" | "stretch" | number | string;
216
+ width: string;
215
217
  }
216
- export interface VelcronSectionColumnWidth {
217
- type: VelcronSectionColumnWidthTypes;
218
+ export interface VelcronDimensions {
219
+ top: number;
220
+ right: number;
221
+ bottom: number;
222
+ left: number;
223
+ }
224
+ export interface VelcronBorder extends VelcronDimensions {
225
+ color: string;
218
226
  }
219
227
  export interface VelcronChipDefinition extends VelcronDefinition {
220
228
  type: "Chip";
@@ -0,0 +1,5 @@
1
+ export interface VelcronUnitProvider {
2
+ formatFontSize: (value: string | number) => string | number;
3
+ formatDimension: (value: string | number) => string | number;
4
+ safeGetNumber: (value: string | number) => number;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/models/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export * from "./VelcronDescriptors";
4
4
  export * from "./VelcronEvents";
5
5
  export * from "./VelcronTypes";
6
6
  export * from "./Enums";
7
+ export * from "./VelcronUnitProvider";
package/models/index.js CHANGED
@@ -7,3 +7,4 @@ tslib_1.__exportStar(require("./VelcronDescriptors"), exports);
7
7
  tslib_1.__exportStar(require("./VelcronEvents"), exports);
8
8
  tslib_1.__exportStar(require("./VelcronTypes"), exports);
9
9
  tslib_1.__exportStar(require("./Enums"), exports);
10
+ tslib_1.__exportStar(require("./VelcronUnitProvider"), exports);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/velcron",
3
3
  "license": "MIT",
4
- "version": "7.0.506-dev",
4
+ "version": "7.0.508-dev",
5
5
  "description": "Provide Omnia Velcron Stuffs.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,7 +1,9 @@
1
1
  import { VelcronDefinition, VelcronRenderContext } from "../models";
2
+ import { VelcronUnitProvider } from "../models/VelcronUnitProvider";
2
3
  export declare class VelcronStyles {
3
- static styleProvider: (definition: VelcronDefinition, renderCtx: VelcronRenderContext) => object;
4
- static registerStyleProvider(fn: (definition: VelcronDefinition, renderCtx: VelcronRenderContext) => object): void;
5
- static create(definition: VelcronDefinition, renderCtx: VelcronRenderContext): object;
6
- private static dataBindStyles;
4
+ static styleProvider: (baseStyles: object, definition: VelcronDefinition, renderCtx: VelcronRenderContext) => object | string;
5
+ static unitProvider: VelcronUnitProvider;
6
+ static registerStyleProvider(fn: (styleBase: object, definition: VelcronDefinition, renderCtx: VelcronRenderContext) => object | string, unitProvider: VelcronUnitProvider): void;
7
+ static create(definition: VelcronDefinition, renderCtx: VelcronRenderContext): object | string;
8
+ static dataBindStyles(styles: object, renderCtx: VelcronRenderContext): object;
7
9
  }
@@ -2,16 +2,61 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VelcronStyles = void 0;
4
4
  const VelcronData_1 = require("./VelcronData");
5
+ const models_1 = require("../models");
6
+ const VelcronConstants_1 = require("./VelcronConstants");
5
7
  class VelcronStyles {
6
- static registerStyleProvider(fn) {
8
+ static registerStyleProvider(fn, unitProvider) {
7
9
  VelcronStyles.styleProvider = fn;
10
+ VelcronStyles.unitProvider = unitProvider;
8
11
  }
9
12
  static create(definition, renderCtx) {
10
- let result = VelcronStyles.styleProvider(definition, renderCtx);
11
- if (renderCtx) {
12
- result = VelcronStyles.dataBindStyles(result, renderCtx);
13
+ const styleBase = { ...definition.style };
14
+ if (definition.type === VelcronConstants_1.VelcronConstants.components.image) {
15
+ if (!styleBase.width) {
16
+ styleBase.width = this.unitProvider.formatDimension(200);
17
+ }
18
+ if (!styleBase.height) {
19
+ styleBase.height = this.unitProvider.formatDimension(400);
20
+ }
21
+ }
22
+ else if (definition.type === VelcronConstants_1.VelcronConstants.components.text) {
23
+ const textDefinition = definition;
24
+ if (textDefinition.color) {
25
+ styleBase["color"] = renderCtx.theming.getColorFromActiveSchema(textDefinition.color);
26
+ }
27
+ else {
28
+ styleBase["color"] = renderCtx.theming.activeColorSchema().onBase.color;
29
+ }
30
+ }
31
+ else if (definition.type === VelcronConstants_1.VelcronConstants.components.flexView) {
32
+ const flexViewDefinition = definition;
33
+ const flexGrow = flexViewDefinition.grow ? flexViewDefinition.grow : 1;
34
+ styleBase["flex"] = flexGrow;
35
+ styleBase["flexDirection"] = flexViewDefinition.column ? "column" : "row";
36
+ if (flexViewDefinition.width) {
37
+ styleBase["maxWidth"] = flexViewDefinition.width;
38
+ }
39
+ if (flexViewDefinition.horizontalAlignment) {
40
+ if (flexViewDefinition.horizontalAlignment === models_1.VelcronHorizontalAlignments.right) {
41
+ styleBase["justifyContent"] = "flex-end";
42
+ }
43
+ else if (flexViewDefinition.horizontalAlignment === models_1.VelcronHorizontalAlignments.center) {
44
+ styleBase["justifyContent"] = "center";
45
+ }
46
+ }
47
+ if (flexViewDefinition.verticalAlignment) {
48
+ if (flexViewDefinition.verticalAlignment === models_1.VerticalAlignments.center) {
49
+ styleBase["alignItems"] = "center";
50
+ }
51
+ else if (flexViewDefinition.verticalAlignment === models_1.VerticalAlignments.bottom) {
52
+ styleBase["alignItems"] = "flex-end";
53
+ }
54
+ }
55
+ if (flexViewDefinition.colorSchema && flexViewDefinition.colorSchema != "") {
56
+ styleBase["backgroundColor"] = renderCtx.theming.activeColorSchema().base.color;
57
+ }
13
58
  }
14
- return result;
59
+ return VelcronStyles.styleProvider(styleBase, definition, renderCtx);
15
60
  }
16
61
  static dataBindStyles(styles, renderCtx) {
17
62
  Object.keys(styles).forEach((key) => {