@ticatec/uniface-flexi-module 0.2.3 → 0.2.5

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.
@@ -38,6 +38,8 @@ export interface FlexiFieldSchema {
38
38
  required?: boolean;
39
39
  /** 事件 */
40
40
  events?: Record<string, string>;
41
+ /** 函数,部分属性可以是一个动态函数 */
42
+ methods?: Record<string, string>;
41
43
  /** 在卡片/Block中所在单元格的属性,flex布局和grid布局对应的属性也不一样*/
42
44
  cell?: any;
43
45
  /** 字段的属性 */
@@ -46,6 +46,12 @@ export default class FlexiField {
46
46
  this.#props[key] = utils.getScopeVariable(cellField.props[key]);
47
47
  }
48
48
  }
49
+ if (schema.methods) {
50
+ for (let key in schema.methods) {
51
+ let classMethod = schema.methods[key];
52
+ this.#props[key] = (...args) => card[classMethod]?.(...args);
53
+ }
54
+ }
49
55
  const result = utils.getParentAndKey(data, schema.keyField);
50
56
  this.keyField = result?.key;
51
57
  this.data = result?.parent;
package/dist/utils.js CHANGED
@@ -6,7 +6,7 @@ const propsFilter = (attrs, excludes = []) => {
6
6
  return obj;
7
7
  };
8
8
  const getScopeVariable = (key) => {
9
- if (key.startsWith("@")) {
9
+ if (typeof key == "string" && key.startsWith("@")) {
10
10
  let attrs = key.substring(1).split('.');
11
11
  if (attrs.length == 2) {
12
12
  let varName = attrs[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticatec/uniface-flexi-module",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
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",