star-horse-lowcode 3.0.8 → 3.1.0

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.
Files changed (93) hide show
  1. package/README.md +11 -1
  2. package/dist/App.vue.d.ts +3 -0
  3. package/dist/api/WebSocketUtils.d.ts +0 -3
  4. package/dist/api/form_utils.d.ts +7 -0
  5. package/dist/api/valid_utils.d.ts +2 -1
  6. package/dist/assets/index.css +1 -1
  7. package/dist/components/comp/StarHorseDataSelector.vue.d.ts +1 -58
  8. package/dist/components/comp/StarHorseDataView.vue.d.ts +1 -1
  9. package/dist/components/comp/StarHorseFormItem.vue.d.ts +1 -5
  10. package/dist/components/comp/StarHorseFormList.vue.d.ts +1 -7
  11. package/dist/components/comp/StarHorseFormTable.vue.d.ts +1 -5
  12. package/dist/components/comp/StarHorseItem.vue.d.ts +1 -7
  13. package/dist/components/comp/StarHorseStaticTable.vue.d.ts +1 -1
  14. package/dist/components/comp/StarHorseTableColumn.vue.d.ts +14 -4
  15. package/dist/components/comp/StarHorseTableComp.vue.d.ts +1 -0
  16. package/dist/components/comp/StarHorseTree.vue.d.ts +1 -9
  17. package/dist/components/comp/app/MainSubBar.vue.d.ts +1 -3
  18. package/dist/components/comp/app/MenuShot.vue.d.ts +15 -0
  19. package/dist/components/comp/items/groupItem.vue.d.ts +23 -0
  20. package/dist/components/comp/items/{tableColumn.vue.d.ts → tableColumnItem.vue.d.ts} +12 -2
  21. package/dist/components/comp/utils/DataPicker.vue.d.ts +1 -1
  22. package/dist/components/comp/utils/DataSelectorUtils.d.ts +23 -0
  23. package/dist/components/formcomp/items/area-item.vue.d.ts +1 -5
  24. package/dist/components/formcomp/items/audio-item.vue.d.ts +1 -5
  25. package/dist/components/formcomp/items/autocomplete-item.vue.d.ts +1 -5
  26. package/dist/components/formcomp/items/barcode-item.vue.d.ts +1 -5
  27. package/dist/components/formcomp/items/button-item.vue.d.ts +1 -5
  28. package/dist/components/formcomp/items/cascade-item.vue.d.ts +1 -5
  29. package/dist/components/formcomp/items/checkbox-item.vue.d.ts +1 -5
  30. package/dist/components/formcomp/items/color-item.vue.d.ts +1 -5
  31. package/dist/components/formcomp/items/cron-item.vue.d.ts +1 -5
  32. package/dist/components/formcomp/items/datapicker-item.vue.d.ts +1 -5
  33. package/dist/components/formcomp/items/datetime-item.vue.d.ts +1 -5
  34. package/dist/components/formcomp/items/description-item.vue.d.ts +19 -0
  35. package/dist/components/formcomp/items/dialog-input-item.vue.d.ts +1 -5
  36. package/dist/components/formcomp/items/dialog-item.vue.d.ts +1 -5
  37. package/dist/components/formcomp/items/divider-item.vue.d.ts +1 -5
  38. package/dist/components/formcomp/items/drawer-item.vue.d.ts +1 -5
  39. package/dist/components/formcomp/items/html-item.vue.d.ts +1 -5
  40. package/dist/components/formcomp/items/htmleditor-item.vue.d.ts +1 -5
  41. package/dist/components/formcomp/items/icon-item.vue.d.ts +1 -5
  42. package/dist/components/formcomp/items/image-item.vue.d.ts +1 -5
  43. package/dist/components/formcomp/items/index.d.ts +6 -0
  44. package/dist/components/formcomp/items/input-item.vue.d.ts +1 -5
  45. package/dist/components/formcomp/items/input-tag-item.vue.d.ts +1 -5
  46. package/dist/components/formcomp/items/json-array-item.vue.d.ts +1 -5
  47. package/dist/components/formcomp/items/json-item.vue.d.ts +1 -5
  48. package/dist/components/formcomp/items/link-item.vue.d.ts +19 -0
  49. package/dist/components/formcomp/items/location-item.vue.d.ts +19 -0
  50. package/dist/components/formcomp/items/markdown-item.vue.d.ts +1 -5
  51. package/dist/components/formcomp/items/number-item.vue.d.ts +1 -5
  52. package/dist/components/formcomp/items/number-range-item.vue.d.ts +1 -5
  53. package/dist/components/formcomp/items/org-item.vue.d.ts +19 -0
  54. package/dist/components/formcomp/items/page-select-item.vue.d.ts +1 -5
  55. package/dist/components/formcomp/items/password-item.vue.d.ts +1 -5
  56. package/dist/components/formcomp/items/progress-item.vue.d.ts +19 -0
  57. package/dist/components/formcomp/items/qrcode-item.vue.d.ts +1 -5
  58. package/dist/components/formcomp/items/radio-item.vue.d.ts +1 -5
  59. package/dist/components/formcomp/items/rate-item.vue.d.ts +1 -5
  60. package/dist/components/formcomp/items/select-item.vue.d.ts +1 -5
  61. package/dist/components/formcomp/items/signature-item.vue.d.ts +1 -5
  62. package/dist/components/formcomp/items/slider-item.vue.d.ts +1 -5
  63. package/dist/components/formcomp/items/starhorse-form-item.vue.d.ts +3 -3
  64. package/dist/components/formcomp/items/switch-item.vue.d.ts +1 -5
  65. package/dist/components/formcomp/items/tag-item.vue.d.ts +1 -5
  66. package/dist/components/formcomp/items/text-item.vue.d.ts +1 -5
  67. package/dist/components/formcomp/items/textarea-item.vue.d.ts +1 -5
  68. package/dist/components/formcomp/items/time-item.vue.d.ts +1 -5
  69. package/dist/components/formcomp/items/time-picker-item.vue.d.ts +1 -5
  70. package/dist/components/formcomp/items/transfer-item.vue.d.ts +1 -5
  71. package/dist/components/formcomp/items/tree-select-item.vue.d.ts +19 -0
  72. package/dist/components/formcomp/items/tselect-item.vue.d.ts +1 -5
  73. package/dist/components/formcomp/items/upload-item.vue.d.ts +1 -5
  74. package/dist/components/formcomp/items/user-item.vue.d.ts +1 -5
  75. package/dist/components/formcomp/items/usercomp-item.vue.d.ts +1 -5
  76. package/dist/components/formcomp/items/view-markdown-item.vue.d.ts +1 -5
  77. package/dist/components/formcomp/utils/EditDataDialog.vue.d.ts +2 -2
  78. package/dist/components/formcomp/utils/FormulaEngine.d.ts +129 -0
  79. package/dist/components/formcomp/utils/ItemRelationEventUtils.d.ts +6 -22
  80. package/dist/components/help.vue.d.ts +2 -2
  81. package/dist/components/system/StarHorseMenu.vue.d.ts +1 -3
  82. package/dist/components/types/ItemPreps.d.ts +4 -0
  83. package/dist/components/types/PageFieldInfo.d.ts +4 -0
  84. package/dist/index.es.js +6 -8
  85. package/dist/lang/en_US.d.ts +141 -0
  86. package/dist/lang/zh_CN.d.ts +141 -0
  87. package/dist/sample/commonpage/CommonSkeleton.vue.d.ts +87 -0
  88. package/dist/sample/commonpage/NormalPage.vue.d.ts +15 -0
  89. package/dist/sample/commonpage/dynamic_form_utils.d.ts +89 -0
  90. package/dist/store/FormDataCache.d.ts +4418 -0
  91. package/dist/store/StoreManager.d.ts +8837 -0
  92. package/dist/views/NotFound.vue.d.ts +3 -0
  93. package/package.json +12 -12
@@ -5,12 +5,8 @@ type __VLS_ModelProps = {
5
5
  };
6
6
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
7
7
  declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
8
- selfFunc: (...args: any[]) => void;
9
- selectItem: (...args: any[]) => void;
10
- "update:formData": (value: any) => void;
8
+ "update:formData": (value: any) => any;
11
9
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
12
- onSelfFunc?: (...args: any[]) => any;
13
- onSelectItem?: (...args: any[]) => any;
14
10
  "onUpdate:formData"?: (value: any) => any;
15
11
  }>, {
16
12
  disabled: boolean;
@@ -5,12 +5,8 @@ type __VLS_ModelProps = {
5
5
  };
6
6
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
7
7
  declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
8
- selfFunc: (...args: any[]) => void;
9
- selectItem: (...args: any[]) => void;
10
- "update:formData": (value: any) => void;
8
+ "update:formData": (value: any) => any;
11
9
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
12
- onSelfFunc?: (...args: any[]) => any;
13
- onSelectItem?: (...args: any[]) => any;
14
10
  "onUpdate:formData"?: (value: any) => any;
15
11
  }>, {
16
12
  source: number;
@@ -5,12 +5,8 @@ type __VLS_ModelProps = {
5
5
  };
6
6
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
7
7
  declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
8
- selfFunc: (...args: any[]) => void;
9
- selectItem: (...args: any[]) => void;
10
- "update:formData": (value: any) => void;
8
+ "update:formData": (value: any) => any;
11
9
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
12
- onSelfFunc?: (...args: any[]) => any;
13
- onSelectItem?: (...args: any[]) => any;
14
10
  "onUpdate:formData"?: (value: any) => any;
15
11
  }>, {
16
12
  disabled: boolean;
@@ -2,7 +2,7 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
2
2
  modelValue: BooleanConstructor;
3
3
  title: {
4
4
  type: StringConstructor;
5
- default: string;
5
+ default: any;
6
6
  };
7
7
  boxWidth: {
8
8
  type: StringConstructor;
@@ -25,7 +25,7 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
25
25
  modelValue: BooleanConstructor;
26
26
  title: {
27
27
  type: StringConstructor;
28
- default: string;
28
+ default: any;
29
29
  };
30
30
  boxWidth: {
31
31
  type: StringConstructor;
@@ -0,0 +1,129 @@
1
+ /**
2
+ * 公式计算引擎
3
+ *
4
+ * 统一字段引用语法:${fieldName}
5
+ * 支持 8 种公式类型:
6
+ * - calc: 数学运算 expression = '${price} * ${quantity}'
7
+ * - concat: 字符串拼接 expression = '${lastName}${firstName}'
8
+ * - condition: 多分支条件判断 branches = [{ when, then }]
9
+ * - lookup: 联动回填 lookupMappings = [{ key, values }]
10
+ * - aggregate: 聚合运算 expression = 'sum' / 'avg' / 'count' / 'min' / 'max'
11
+ * - dateCalc: 日期计算 expression = '${start} ~ ${end}', dateUnit = 'day'
12
+ * - format: 格式化 expression = 'thousands' / 'padStart' / 'toFixed' / 'regex'
13
+ * - ternary: 三元表达式 expression = '${score} >= 60 ? ${score} : 0'
14
+ *
15
+ * 配置示例:
16
+ * field: {
17
+ * fieldName: 'totalPrice',
18
+ * preps: {
19
+ * formula: {
20
+ * enable: true,
21
+ * type: 'calc',
22
+ * sourceFields: ['price', 'quantity'],
23
+ * expression: '${price} * ${quantity}',
24
+ * precision: 2,
25
+ * suffix: '元',
26
+ * }
27
+ * }
28
+ * }
29
+ */
30
+ /** 公式类型 */
31
+ export type FormulaType = "calc" | "concat" | "condition" | "lookup" | "aggregate" | "dateCalc" | "format" | "ternary";
32
+ /** 条件分支配置 */
33
+ export interface ConditionBranch {
34
+ /** 匹配表达式,如 '${score} >= 90' */
35
+ when: string;
36
+ /** 匹配时返回的值,支持常量或 ${fieldName} 引用 */
37
+ then: any;
38
+ }
39
+ /** 联动回填映射配置 */
40
+ export interface LookupMapping {
41
+ /** 匹配的源字段值 */
42
+ key: string;
43
+ /** 回填目标字段名 -> 回填值的映射 */
44
+ values: Record<string, any>;
45
+ }
46
+ /** 公式配置 */
47
+ export interface FormulaConfig {
48
+ /** 是否启用 */
49
+ enable: boolean;
50
+ /** 公式类型 */
51
+ type: FormulaType;
52
+ /** 依赖字段列表 */
53
+ sourceFields: string[];
54
+ /** 公式表达式,统一使用 ${fieldName} 引用字段 */
55
+ expression?: string;
56
+ /** 条件分支(type=condition 时使用) */
57
+ branches?: ConditionBranch[];
58
+ /** 联动回填映射(type=lookup 时使用) */
59
+ lookupMappings?: LookupMapping[];
60
+ /** 精度,type=calc/format(toFixed) 时使用 */
61
+ precision?: number;
62
+ /** 前缀,type=calc 时使用,如 '¥' */
63
+ prefix?: string;
64
+ /** 后缀,type=calc 时使用,如 '%'、'元' */
65
+ suffix?: string;
66
+ /** 日期单位,type=dateCalc 时使用:'year'|'month'|'day'|'hour'|'minute'|'second' */
67
+ dateUnit?: "year" | "month" | "day" | "hour" | "minute" | "second";
68
+ /** 日期偏移量,type=dateCalc 且 mode=offset 时使用,正数向后,负数向前 */
69
+ dateOffset?: number;
70
+ /** 日期计算模式:diff(差值) | offset(偏移) | format(格式化) */
71
+ dateMode?: "diff" | "offset" | "format";
72
+ /** 日期输出格式,type=dateCalc 且 mode=format 时使用,如 'YYYY-MM-DD' */
73
+ dateFormat?: string;
74
+ /** 格式化子类型,type=format 时使用 */
75
+ formatType?: "thousands" | "padStart" | "toFixed" | "regex";
76
+ /** 格式化参数:padStart 的目标长度 / regex 的替换模式 */
77
+ formatArg?: string | number;
78
+ /** 格式化参数2:padStart 的填充字符 / regex 的替换值 */
79
+ formatArg2?: string;
80
+ /** 聚合子字段,type=aggregate 时使用,指定子表单中要聚合的字段名 */
81
+ aggregateField?: string;
82
+ /** 条件不匹配时的默认值,type=condition/ternary 时使用 */
83
+ defaultValue?: any;
84
+ }
85
+ /** 字段定义(最小集) */
86
+ export interface FormulaField {
87
+ fieldName: string;
88
+ type?: string;
89
+ formula?: FormulaConfig;
90
+ preps?: Record<string, any>;
91
+ }
92
+ /**
93
+ * 执行公式计算,返回计算结果
94
+ * @param formula 公式配置
95
+ * @param formData 表单数据
96
+ * @returns 计算结果
97
+ */
98
+ export declare const executeFormula: (formula: FormulaConfig, formData: Record<string, any>) => any;
99
+ /**
100
+ * 执行公式并回填表单数据
101
+ * - lookup: 回填多个目标字段
102
+ * - 其他类型: 结果赋值给当前字段
103
+ *
104
+ * @param field 当前字段
105
+ * @param formInfo 所有字段列表
106
+ * @param formData 表单数据(会被直接修改)
107
+ */
108
+ export declare const executeFormulaWithFill: (field: FormulaField, formInfo: FormulaField[], formData: Record<string, any>) => void;
109
+ /**
110
+ * 构建字段级别的 watch 监听器
111
+ * 当依赖字段变化时,自动触发公式计算并回填
112
+ *
113
+ * @param field 当前字段
114
+ * @param formInfo 所有字段列表
115
+ * @param formData 响应式表单数据
116
+ * @param watchFn Vue watch 函数
117
+ * @returns stop 函数数组,用于在 onBeforeUnmount 中清理
118
+ */
119
+ export declare const setupFormulaWatchers: (field: FormulaField, formInfo: FormulaField[], formData: any, watchFn: typeof import('vue').watch) => (() => void)[];
120
+ /**
121
+ * 批量初始化表单中所有带 formula 配置的字段
122
+ * 适合在表单容器组件 onMounted 时调用
123
+ *
124
+ * @param formInfo 所有字段列表
125
+ * @param formData 响应式表单数据
126
+ * @param watchFn Vue watch 函数
127
+ * @returns stop 函数数组,用于在 onBeforeUnmount 中清理
128
+ */
129
+ export declare const initFormFormulaWatchers: (formInfo: FormulaField[], formData: any, watchFn: typeof import('vue').watch) => (() => void)[];
@@ -1,27 +1,11 @@
1
1
  import { RelationDetail } from '../../types';
2
+ import { executeFormulaWithFill, initFormFormulaWatchers, setupFormulaWatchers } from './FormulaEngine';
2
3
  declare const relationEvent: (props: any, relationDetails: RelationDetail[], e: any, actionName: string) => void;
3
- /**
4
- * 所有触发的事件
5
- * @param context
6
- * @param emits
7
- * @param formData
8
- * @param actionName
9
- * @param isInit
10
- */
11
- declare const allAction: (context: any, emits: any, formData: any, actionName: string, isInit?: boolean) => void;
12
- /**
13
- * Button 组件的点击事件
14
- * @param context
15
- * @param emits
16
- * @param formData
17
- * @param code
18
- * @param evtName 时间名称
19
- */
4
+ /** 所有触发的事件 */
5
+ declare const allAction: (context: any, emits: any, formData: any, actionName: string, _isInit?: boolean) => void;
6
+ /** Button 组件的点击事件 */
20
7
  declare const buttonAction: (context: any, emits: any, formData: any, code: string, evtName?: string) => void;
21
- /**
22
- * 检查是否禁用
23
- * @param attrs
24
- */
8
+ /** 检查是否禁用 */
25
9
  declare const checkIsDisabled: (attrs: any) => boolean;
26
10
  declare const useFormField: (context: any, field: any) => {
27
11
  fieldValue: import('vue').WritableComputedRef<any, any>;
@@ -29,4 +13,4 @@ declare const useFormField: (context: any, field: any) => {
29
13
  declare const initCompCallEvent: (props: any, emits: any, formData: any) => void;
30
14
  declare const prepsFilter: (preps: any) => any;
31
15
  declare const convertData: (data: any) => any;
32
- export { allAction, buttonAction, checkIsDisabled, initCompCallEvent, prepsFilter, relationEvent, useFormField, convertData, };
16
+ export { allAction, buttonAction, checkIsDisabled, initCompCallEvent, prepsFilter, relationEvent, useFormField, convertData, executeFormulaWithFill, initFormFormulaWatchers, setupFormulaWatchers, };
@@ -6,7 +6,7 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
6
6
  message: {
7
7
  type: StringConstructor;
8
8
  required: true;
9
- default: string;
9
+ default: any;
10
10
  };
11
11
  }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
12
12
  width: {
@@ -16,7 +16,7 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
16
16
  message: {
17
17
  type: StringConstructor;
18
18
  required: true;
19
- default: string;
19
+ default: any;
20
20
  };
21
21
  }>> & Readonly<{}>, {
22
22
  message: string;
@@ -14,8 +14,7 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
14
14
  type: PropType<any>;
15
15
  };
16
16
  }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
17
- selectItem: (...args: any[]) => void;
18
- "update:dataList": (value: any) => void;
17
+ "update:dataList": (value: any) => any;
19
18
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
20
19
  preps: {
21
20
  type: PropType<any>;
@@ -31,7 +30,6 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
31
30
  type: PropType<any>;
32
31
  };
33
32
  }>> & Readonly<{
34
- onSelectItem?: (...args: any[]) => any;
35
33
  "onUpdate:dataList"?: (value: any) => any;
36
34
  }>, {
37
35
  preps: any;
@@ -100,6 +100,10 @@ export interface ContainerPreps {
100
100
  * 组件来源
101
101
  */
102
102
  source: number;
103
+ /**
104
+ * 层级深度(用于 children 递归渲染)
105
+ */
106
+ level?: number;
103
107
  /**
104
108
  * 格式化函数
105
109
  */
@@ -235,6 +235,10 @@ export declare interface FieldInfo {
235
235
  * 删除事件
236
236
  */
237
237
  removeActions?: Function | string;
238
+ /**
239
+ * 子节点,在多级表头中使用,需考虑怎么在表单中正确渲染显示
240
+ */
241
+ children?: FieldInfo[];
238
242
  }
239
243
  /**
240
244
  * 属性映射