@omnia/velcron 7.5.33-dev → 7.5.33-preview

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.
@@ -21,6 +21,11 @@ export interface OmniaSharedBootstrapData {
21
21
  servingMode?: boolean;
22
22
  serviceDnsMapping: OmniaServiceToDnsMapping;
23
23
  authDisabled?: boolean;
24
+ analytics: OmniaAnalytics;
25
+ }
26
+ export interface OmniaAnalytics {
27
+ paq: any[];
28
+ enabled: boolean;
24
29
  }
25
30
  export interface OmniaServiceToDnsMapping {
26
31
  [serviceId: string]: string;
@@ -6,7 +6,7 @@ import { ColorSchema, useVelcronThemingStore } from "..";
6
6
  export interface ResolvedComponentRenderer {
7
7
  component: unknown;
8
8
  definition: VelcronDefinition;
9
- customComponent: boolean;
9
+ customComponent?: boolean;
10
10
  }
11
11
  export interface BuiltInComponentRenderers {
12
12
  "View": unknown;
@@ -21,6 +21,7 @@ export interface BuiltInComponentRenderers {
21
21
  "Dialog": unknown;
22
22
  "Icon": unknown;
23
23
  "Chip": unknown;
24
+ "Slot": unknown;
24
25
  }
25
26
  export interface ColorSchemaReference {
26
27
  name: string;
@@ -251,6 +252,11 @@ export interface VelcronChipDefinition extends VelcronDefinition, VelcronCustomT
251
252
  disabled?: boolean;
252
253
  events?: VelcronOnPressEvent;
253
254
  }
255
+ export interface VelcronSlotDefinition extends VelcronDefinition, VelcronCustomThemeSettings {
256
+ type: "Slot";
257
+ bind: string;
258
+ value: VelcroncomponentArrayType;
259
+ }
254
260
  /*** Custom Components ***********************************************************************/
255
261
  export type VelcronCustomComponentDefinition = VelcronComponentDescriptor & VelcronComponentDefinition;
256
262
  export type VelcronRenderProps<TDefinition> = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/velcron",
3
3
  "license": "MIT",
4
- "version": "7.5.33-dev",
4
+ "version": "7.5.33-preview",
5
5
  "description": "Provide Omnia Velcron Stuffs.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -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];
@@ -12,6 +12,7 @@ export declare const VelcronConstants: {
12
12
  dialog: string;
13
13
  icon: string;
14
14
  chip: string;
15
+ slot: string;
15
16
  };
16
17
  events: {
17
18
  idTokenStart: string;
@@ -24,5 +25,6 @@ export declare const VelcronConstants: {
24
25
  properties: {
25
26
  tokenStart: string;
26
27
  tokenEnd: string;
28
+ propsToken: string;
27
29
  };
28
30
  };
@@ -14,7 +14,8 @@ exports.VelcronConstants = {
14
14
  webView: "WebView",
15
15
  dialog: "Dialog",
16
16
  icon: "Icon",
17
- chip: "Chip"
17
+ chip: "Chip",
18
+ slot: "Slot"
18
19
  },
19
20
  events: {
20
21
  idTokenStart: "$ev{",
@@ -25,7 +26,8 @@ exports.VelcronConstants = {
25
26
  stateRootToken: "$state"
26
27
  },
27
28
  properties: {
28
- tokenStart: "${",
29
- tokenEnd: "}"
29
+ tokenStart: "{{",
30
+ tokenEnd: "}}",
31
+ propsToken: "$props"
30
32
  }
31
33
  };
@@ -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;
@@ -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((name) => {
15
- let data = this.getOrSetObjectByPathUsingRenderContext(renderContext, name);
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
- let pathIsPropertyValue = false;
513
- if (renderContext.properties?.hasOwnProperty(path)) {
514
- pathIsPropertyValue = true;
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
- if (!result || VelcronData.isString(result)) {
523
- const tokens = VelcronData.getTokens(path);
524
- if (tokens.length > 0) {
525
- path = tokens[0];
526
- }
527
- let object = null;
528
- if (path.startsWith(`${VelcronConstants_1.VelcronConstants.state.stateRootToken}.`) || path === VelcronConstants_1.VelcronConstants.state.stateRootToken) {
529
- //Fetch from the data object
530
- object = renderContext.rootContext;
531
- path = path.substring(6);
532
- }
533
- else {
534
- //Fetch from current ctx
535
- object = renderContext.currentContext;
536
- }
537
- if (VelcronData.isObject(object)) {
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(/(\${).+?(?=\})/g, (tokenWithVar, token) => {
555
- tokens.push(tokenWithVar.substring(2));
556
- return token;
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(currentRenderCtx, definition[propName]);
108
+ result.properties[propName] = VelcronData_1.VelcronData.dataBind(result, definition[propName]);
110
109
  }
111
110
  else {
112
111
  result.properties[propName] = definition[propName];