@omnia/fx-models 8.0.60-vnext → 8.0.62-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.
@@ -1,3 +1,4 @@
1
+ import "./Equals";
1
2
  import { IEquals } from "./Equals";
2
3
  export interface GuidValue extends Partial<IEquals<{
3
4
  guid(value: GuidValue): boolean;
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Guid = void 0;
2
4
  //export interface GuidValue {
3
5
  // :string;
4
6
  //}
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Guid = void 0;
7
+ require("./Equals"); // ensure execute code in equals first
7
8
  // export interface GuidValue {
8
9
  // toString: () => string;
9
10
  // }
@@ -58,7 +59,7 @@ class Guid {
58
59
  Guid._empty = new Guid("00000000-0000-0000-0000-000000000000");
59
60
  exports.Guid = Guid;
60
61
  // only add extension methods when running in browser, not in node.js
61
- if (globalThis.omnia) {
62
+ if (globalThis.omnia && String.prototype["equals"]) {
62
63
  Object.defineProperty(String.prototype["equals"], "guid", {
63
64
  value: function () {
64
65
  return function (value) {
@@ -6,8 +6,13 @@ function getSpacingValueFromBlueprint(spacingValue, blueprint) {
6
6
  if (!spacingValue) {
7
7
  return 0;
8
8
  }
9
+ let negative = false;
9
10
  let result = spacingValue;
10
11
  if (isNaN(spacingValue) && blueprint?.definition) {
12
+ if (spacingValue.startsWith("-")) {
13
+ negative = true;
14
+ }
15
+ spacingValue = spacingValue.replace("-", "");
11
16
  if (spacingValue === SpacingSetting_1.SpacingTypes.xs) {
12
17
  result = blueprint.definition.xs;
13
18
  }
@@ -27,6 +32,6 @@ function getSpacingValueFromBlueprint(spacingValue, blueprint) {
27
32
  result = 0;
28
33
  }
29
34
  }
30
- return result;
35
+ return negative ? -result : result;
31
36
  }
32
37
  exports.getSpacingValueFromBlueprint = getSpacingValueFromBlueprint;
@@ -1,7 +1,7 @@
1
1
  import { VelcronEvent, VelcronOnUpdatedEvent, VelcronOnClosedEvent, VelcronOnCloseRequestedEvent, VelcronOnEditModeEvent, VelcronOnLoadEvent, VelcronOnPressEvent } from "./VelcronEvents";
2
2
  import { VelcroncomponentArrayType, VelcronPrimitiveType } from "./VelcronTypes";
3
3
  import { AssignOperators, VelcronHorizontalAlignments, VelcronIconTypes, VelcronActionTypes, VelcronVerticalAlignments } from "./Enums";
4
- import { useVelcronThemingStore } from "..";
4
+ import { VelcronPropertyEditor, useVelcronThemingStore } from "..";
5
5
  import { useVelcronColorSchemaStore } from "../stores/VelcronColorSchema";
6
6
  import { useVelcronBlueprintStore } from "../stores/VelcronBlueprint";
7
7
  export interface ResolvedComponentRenderer {
@@ -10,19 +10,19 @@ export interface ResolvedComponentRenderer {
10
10
  customComponent: boolean;
11
11
  }
12
12
  export interface BuiltInComponentRenderers {
13
- "View": unknown;
14
- "Card": unknown;
15
- "Text": unknown;
16
- "Image": unknown;
17
- "Button": unknown;
18
- "TextInput": unknown;
19
- "ProgressCircle": unknown;
20
- "WebView": unknown;
21
- "CustomComponent": unknown;
22
- "Dialog": unknown;
23
- "Icon": unknown;
24
- "Chip": unknown;
25
- "Markdown": unknown;
13
+ "view": unknown;
14
+ "card": unknown;
15
+ "text": unknown;
16
+ "image": unknown;
17
+ "button": unknown;
18
+ "text-input": unknown;
19
+ "progress-circle": unknown;
20
+ "web-view": unknown;
21
+ "custom-component": unknown;
22
+ "dialog": unknown;
23
+ "icon": unknown;
24
+ "chip": unknown;
25
+ "markdown": unknown;
26
26
  }
27
27
  export interface ColorSchemaReference {
28
28
  name: string;
@@ -162,7 +162,7 @@ export interface VelcronIcon {
162
162
  name: string;
163
163
  }
164
164
  export interface VelcronAppDefinition<TState extends DynamicState = DynamicState> extends VelcronDefinitionBase {
165
- type: "Velcron";
165
+ type: "velcron";
166
166
  version: string;
167
167
  name: string;
168
168
  body?: Array<VelcronDefinition>;
@@ -171,6 +171,7 @@ export interface VelcronAppDefinition<TState extends DynamicState = DynamicState
171
171
  [name: string]: [];
172
172
  };
173
173
  components?: Array<VelcronCustomComponentDefinition>;
174
+ propEditors?: Array<VelcronPropertyEditor>;
174
175
  state?: TState;
175
176
  computed?: {
176
177
  [name: string]: [];
@@ -184,91 +185,95 @@ export interface VelcronComponentDefinition extends VelcronDefinition {
184
185
  }
185
186
  /*** Built-in Components *********************************************************************/
186
187
  export interface VelcronViewDefinition extends VelcronDefinition, VelcronColorStyling {
187
- type: "View";
188
+ type: "view";
188
189
  events?: VelcronOnPressEvent;
189
190
  direction?: "row" | "column" | "row-reverse" | "column-reverse" | string;
190
191
  columnStyle?: object;
191
192
  horizontalAlignment?: VelcronHorizontalAlignments;
192
193
  verticalAlignment?: VelcronVerticalAlignments;
193
194
  grow?: number;
195
+ absolute?: VelcronSpacing;
194
196
  border?: VelcronBorder;
195
197
  borderRadius?: VelcronDimensions;
196
- width?: number;
198
+ width?: number | string;
199
+ minWidth?: number | string;
200
+ height?: number | string;
201
+ minHeight?: number | string;
197
202
  }
198
203
  export interface VelcronCardDefinition extends VelcronDefinition, VelcronColorStyling {
199
- type: "Card";
204
+ type: "card";
200
205
  style?: VelcronCardStyling;
201
206
  footer?: Array<VelcronDefinition>;
202
207
  events?: VelcronOnPressEvent;
203
208
  }
204
209
  export interface VelcronTextDefinition extends VelcronDefinitionWithEditMode, VelcronColorStyling, VelcronTextStyling {
205
- type: "Text";
210
+ type: "text";
206
211
  editLabel?: VelcronBindableProp;
207
212
  lineClamp?: number;
208
213
  noWrap?: boolean;
209
214
  events?: VelcronOnPressEvent & VelcronOnUpdatedEvent;
210
215
  }
211
216
  export declare enum VelcronImageRatios {
212
- square = 1,
213
- landscape = 2
217
+ square = "square",
218
+ landscape = "landscapre"
214
219
  }
215
220
  export interface VelcronImageDefinition extends VelcronDefinition {
216
- type: "Image";
221
+ type: "image";
217
222
  source: string;
218
- ratio: VelcronImageRatios;
223
+ ratio: VelcronImageRatios | string;
219
224
  cover?: VelcronBindableProp<boolean>;
220
225
  borderRadius?: VelcronDimensions;
221
226
  events?: VelcronOnPressEvent;
222
227
  }
223
228
  export interface VelcronButtonDefinition extends VelcronDefinition {
224
- type: "Button";
229
+ type: "button";
225
230
  text: string;
226
231
  icon?: VelcronIcon;
227
232
  disabled?: boolean;
228
233
  events?: VelcronOnPressEvent;
229
234
  }
230
235
  export interface VelcronTextInputDefinition extends VelcronDefinition {
231
- type: "TextInput";
236
+ type: "text-input";
232
237
  label?: string;
233
238
  bind: string;
234
239
  initialValue?: string;
235
240
  events: VelcronOnUpdatedEvent;
236
241
  }
237
242
  export interface VelcronProgressCircleDefinition extends VelcronDefinition {
238
- type: "ProgressCircle";
243
+ type: "progress-circle";
239
244
  events?: VelcronOnPressEvent;
240
245
  }
241
246
  export interface VelcronWebViewDefinition extends VelcronDefinition {
242
- type: "WebView";
247
+ type: "web-view";
243
248
  source: string;
244
249
  }
245
250
  export interface VelcronDialogDefinition extends VelcronDefinition {
246
- type: "Dialog";
251
+ type: "dialog";
247
252
  title: string;
248
253
  visible: string;
249
254
  events?: VelcronOnCloseRequestedEvent & VelcronOnClosedEvent;
250
255
  }
251
256
  export interface VelcronIconDefinition extends VelcronDefinition, VelcronColorStyling {
252
- type: "Icon";
257
+ type: "icon";
253
258
  icon: string;
254
259
  size?: VelcronBindableProp<number>;
255
260
  events?: VelcronOnPressEvent;
256
261
  }
257
262
  export interface VelcronMarkdownDefinition extends VelcronDefinitionWithEditMode, VelcronColorStyling, VelcronTextStyling {
258
- type: "Markdown";
263
+ type: "markdown";
259
264
  events: VelcronOnUpdatedEvent;
260
265
  }
261
266
  export interface VelcronDimensions {
262
- top: number;
263
- right: number;
264
- bottom: number;
265
- left: number;
267
+ top: number | string;
268
+ right: number | string;
269
+ bottom: number | string;
270
+ left: number | string;
266
271
  }
267
272
  export interface VelcronBorder extends VelcronDimensions {
268
273
  color: string;
269
274
  }
270
275
  export interface VelcronChipDefinition extends VelcronDefinition {
271
- type: "Chip";
276
+ type: "chip";
272
277
  text: string;
273
278
  icon?: VelcronIcon;
274
279
  disabled?: boolean;
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VelcronImageRatios = void 0;
4
4
  var VelcronImageRatios;
5
5
  (function (VelcronImageRatios) {
6
- VelcronImageRatios[VelcronImageRatios["square"] = 1] = "square";
7
- VelcronImageRatios[VelcronImageRatios["landscape"] = 2] = "landscape";
6
+ VelcronImageRatios["square"] = "square";
7
+ VelcronImageRatios["landscape"] = "landscapre";
8
8
  })(VelcronImageRatios = exports.VelcronImageRatios || (exports.VelcronImageRatios = {}));
@@ -0,0 +1,57 @@
1
+ import { VelcronDataTypes, VelcronImageRatios } from "@omnia/fx-models";
2
+ export interface VelcronPropertyEditor<TSettings = any> {
3
+ name?: string;
4
+ type: BuiltInPropertyEditorType | string;
5
+ settings?: TSettings;
6
+ mapToStateProperty: string;
7
+ dataType?: VelcronDataTypes;
8
+ component?: unknown;
9
+ }
10
+ export type BuiltInPropertyEditorType = "text" | "slider" | "switch" | "alignment" | "color" | "markdown" | "icon" | "image";
11
+ export declare enum BuiltInPropertyEditorTypes {
12
+ text = "text",
13
+ slider = "slider",
14
+ switch = "switch",
15
+ alignment = "alignment",
16
+ color = "color",
17
+ markdown = "markdown",
18
+ icon = "icon",
19
+ image = "image"
20
+ }
21
+ export interface VelcronSliderPropertyEditorSettings {
22
+ min: number;
23
+ max: number;
24
+ step: number;
25
+ }
26
+ export interface VelcronSliderPropertyEditor extends VelcronPropertyEditor<VelcronSliderPropertyEditorSettings> {
27
+ type: "slider";
28
+ }
29
+ export interface VelcronTextPropertyEditor extends VelcronPropertyEditor<any> {
30
+ type: "text";
31
+ }
32
+ export interface VelcronSwitchPropertyEditor extends VelcronPropertyEditor<any> {
33
+ type: "switch";
34
+ }
35
+ export interface VelcronAlignmentPropertyEditor extends VelcronPropertyEditor<any> {
36
+ type: "alignment";
37
+ }
38
+ export interface VelcronColorPropertyEditor extends VelcronPropertyEditor<any> {
39
+ type: "color";
40
+ }
41
+ export interface VelcronIconPropertyEditor extends VelcronPropertyEditor<any> {
42
+ type: "icon";
43
+ }
44
+ export interface VelcronMarkdownPropertyEditor extends VelcronPropertyEditor<any> {
45
+ type: "markdown";
46
+ }
47
+ export interface VelcronImagePropertyEditor extends VelcronPropertyEditor<any> {
48
+ type: "image";
49
+ }
50
+ export interface VelcronContentState {
51
+ caption: string;
52
+ main: string;
53
+ }
54
+ export interface VelcronImageState {
55
+ url: string;
56
+ ratio: VelcronImageRatios;
57
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuiltInPropertyEditorTypes = void 0;
4
+ var BuiltInPropertyEditorTypes;
5
+ (function (BuiltInPropertyEditorTypes) {
6
+ BuiltInPropertyEditorTypes["text"] = "text";
7
+ BuiltInPropertyEditorTypes["slider"] = "slider";
8
+ BuiltInPropertyEditorTypes["switch"] = "switch";
9
+ BuiltInPropertyEditorTypes["alignment"] = "alignment";
10
+ BuiltInPropertyEditorTypes["color"] = "color";
11
+ BuiltInPropertyEditorTypes["markdown"] = "markdown";
12
+ BuiltInPropertyEditorTypes["icon"] = "icon";
13
+ BuiltInPropertyEditorTypes["image"] = "image";
14
+ })(BuiltInPropertyEditorTypes = exports.BuiltInPropertyEditorTypes || (exports.BuiltInPropertyEditorTypes = {}));
@@ -4,3 +4,4 @@ export * from "./VelcronEvents";
4
4
  export * from "./VelcronTypes";
5
5
  export * from "./Enums";
6
6
  export * from "./VelcronUnitProvider";
7
+ export * from "./VelcronPropertyEditorDefinitions";
@@ -7,3 +7,4 @@ tslib_1.__exportStar(require("./VelcronEvents"), exports);
7
7
  tslib_1.__exportStar(require("./VelcronTypes"), exports);
8
8
  tslib_1.__exportStar(require("./Enums"), exports);
9
9
  tslib_1.__exportStar(require("./VelcronUnitProvider"), exports);
10
+ tslib_1.__exportStar(require("./VelcronPropertyEditorDefinitions"), exports);
@@ -107,7 +107,7 @@ export declare const TabVariantDefinitions: readonly ["default", "navigation", "
107
107
  export type TabVariants = typeof TabVariantDefinitions[number];
108
108
  export declare const TabVariantsName = "TabVariants";
109
109
  /** Text Box */
110
- export declare const TextBoxVariantTypeDefinitions: readonly ["default", "filter-menu", "search", "find-slim", "link", "media"];
110
+ export declare const TextBoxVariantTypeDefinitions: readonly ["default", "search", "find-slim", "link", "media"];
111
111
  export type TextBoxVariantTypes = typeof TextBoxVariantTypeDefinitions[number];
112
112
  export declare const TextBoxVariantTypesName = "TextBoxVariantTypes";
113
113
  export declare const TextBoxTypeDefinitions: readonly ["text", "password", "number"];
@@ -82,7 +82,7 @@ exports.TabVariantDefinitions = ["default", "navigation", "settings"];
82
82
  exports.TabVariantsName = "TabVariants";
83
83
  /** Text Box */
84
84
  //export const TextBoxVariantTypeDefinitions = ["default", "filter-menu", "search", "find-slim", "numberselector", "numberselector-prepend", "link", "media"] as const;
85
- exports.TextBoxVariantTypeDefinitions = ["default", "filter-menu", "search", "find-slim", "link", "media"];
85
+ exports.TextBoxVariantTypeDefinitions = ["default", "search", "find-slim", "link", "media"];
86
86
  exports.TextBoxVariantTypesName = "TextBoxVariantTypes";
87
87
  exports.TextBoxTypeDefinitions = ["text", "password", "number"];
88
88
  exports.TextBoxTypesName = "TextBoxTypes";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/fx-models",
3
3
  "license": "MIT",
4
- "version": "8.0.60-vnext",
4
+ "version": "8.0.62-vnext",
5
5
  "description": "Provide Omnia Fx Models Stuffs.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"