@ticatec/uniface-flexi-module 0.2.0 → 0.2.1

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.
@@ -14,7 +14,7 @@ export default class FlexiCriteriaField {
14
14
  this.#set = set;
15
15
  this.visible = schema.visible != false;
16
16
  this.size = schema.size;
17
- this.label = schema.label.startsWith("@") ? utils.getVariable(schema.label) : schema.label;
17
+ this.label = schema.label.startsWith("@") ? utils.getScopeVariable(schema.label) : schema.label;
18
18
  if (schema.events) {
19
19
  for (let key in schema.events) {
20
20
  let eventHandler = schema.events[key];
@@ -33,7 +33,7 @@ export default class FlexiDataTable {
33
33
  const render = colSchema.render ? this[colSchema.render] : null;
34
34
  const compareFunction = colSchema.compareFunction ? this[colSchema.compareFunction] : null;
35
35
  const column = {
36
- text: colSchema.text.startsWith("@") ? utils.getVariable(colSchema.text) : colSchema.text,
36
+ text: colSchema.text.startsWith("@") ? utils.getScopeVariable(colSchema.text) : colSchema.text,
37
37
  field: colSchema.field,
38
38
  frozen: colSchema.frozen,
39
39
  align: colSchema.align,
@@ -24,7 +24,7 @@ export default class FlexiField {
24
24
  constructor(parent, data, mode, schema) {
25
25
  this.#parent = parent;
26
26
  this.mode = mode;
27
- this.label = schema.label.startsWith("@") ? utils.getVariable(schema.label) : schema.label;
27
+ this.label = schema.label.startsWith("@") ? utils.getScopeVariable(schema.label) : schema.label;
28
28
  this.variant = schema.variant;
29
29
  this.isReadonly = schema.readonly == true;
30
30
  this.disabled = schema.disabled == true;
package/dist/utils.d.ts CHANGED
@@ -7,6 +7,6 @@ declare const _default: {
7
7
  };
8
8
  formatText: (s: string, obj: any) => string;
9
9
  propsFilter: (attrs: any, excludes?: Array<string>) => any;
10
- getVariable: (key: string) => any;
10
+ getScopeVariable: (key: string) => any;
11
11
  };
12
12
  export default _default;
package/dist/utils.js CHANGED
@@ -5,14 +5,20 @@ const propsFilter = (attrs, excludes = []) => {
5
5
  }
6
6
  return obj;
7
7
  };
8
- const getVariable = (key) => {
9
- let attrs = key.split('.');
10
- if (attrs.length == 2) {
11
- // @ts-ignore
12
- return window[attrs[0]]?.[attrs[1]] ?? `Missing value ${key}`;
8
+ const getScopeVariable = (key) => {
9
+ if (key.startsWith("@")) {
10
+ let attrs = key.substring(1).split('.');
11
+ if (attrs.length == 2) {
12
+ let varName = attrs[0];
13
+ // @ts-ignore
14
+ return globalThis[varName]?.[attrs[1]] ?? `Missing value:${key}`;
15
+ }
16
+ else {
17
+ return `Missing key:${key}`;
18
+ }
13
19
  }
14
20
  else {
15
- return `Invalid key: ${key}`;
21
+ return key;
16
22
  }
17
23
  };
18
24
  const copyAttrs = (src, attrs) => {
@@ -62,4 +68,4 @@ const formatText = (s, obj) => {
62
68
  return obj.hasOwnProperty(key) ? String(obj[key]) : `{{${key}}}`;
63
69
  });
64
70
  };
65
- export default { copyAttrs, extractExpression, getParentAndKey, formatText, propsFilter, getVariable };
71
+ export default { copyAttrs, extractExpression, getParentAndKey, formatText, propsFilter, getScopeVariable };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticatec/uniface-flexi-module",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "A flexible form framework for Svelte applications with dynamic field types, criteria panels, and modular components",
5
5
  "keywords": [
6
6
  "svelte",