aviator-expression-builder 0.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.
- package/AviatorExpressionBuilderLegacyModal.vue_vue_type_script_setup_true_lang-CRZlHClr.cjs +9 -0
- package/AviatorExpressionBuilderLegacyModal.vue_vue_type_script_setup_true_lang-CjWgNhEl.js +7608 -0
- package/LICENSE +202 -0
- package/PUBLIC_API.md +50 -0
- package/README.md +368 -0
- package/headless.cjs +2 -0
- package/headless.d.ts +167 -0
- package/headless.js +2317 -0
- package/index.cjs +2 -0
- package/index.d.ts +44 -0
- package/index.js +26 -0
- package/legacy.cjs +2 -0
- package/legacy.d.ts +7 -0
- package/legacy.js +5 -0
- package/package.json +69 -0
- package/plugin-DErT8PJK.cjs +2 -0
- package/plugin-DJOcRfv1.js +38 -0
- package/style.css +182 -0
- package/vue.cjs +2 -0
- package/vue.d.ts +39 -0
- package/vue.js +11 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/PUBLIC_API.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Public API
|
|
2
|
+
|
|
3
|
+
## Root (`aviator-expression-builder`)
|
|
4
|
+
|
|
5
|
+
From [`index.d.ts`](./index.d.ts):
|
|
6
|
+
|
|
7
|
+
- Vue exports:
|
|
8
|
+
- `AviatorExpressionBuilder`
|
|
9
|
+
- `AviatorExpressionBuilderModal`
|
|
10
|
+
- `AviatorExpressionBuilderPlugin`
|
|
11
|
+
- `installAviatorExpressionBuilder`
|
|
12
|
+
- `defaultTreeExpressionBuilderNotifier`
|
|
13
|
+
- `noopTreeExpressionBuilderNotifier`
|
|
14
|
+
- `TreeExpressionBuilderNotifier` (type)
|
|
15
|
+
- `AviatorExpressionBuilderPluginOptions` (type)
|
|
16
|
+
- `AviatorExpressionBuilderPluginComponentNames` (type)
|
|
17
|
+
- Legacy export:
|
|
18
|
+
- `AviatorExpressionBuilderLegacyModal`
|
|
19
|
+
- Headless exports:
|
|
20
|
+
- `createAviatorExpressionService`
|
|
21
|
+
- `parseExpression`
|
|
22
|
+
- `parseExpressionNodes`
|
|
23
|
+
- `generateExpression`
|
|
24
|
+
- `validateExpression`
|
|
25
|
+
- `createConditionNode`
|
|
26
|
+
- `createGroupNode`
|
|
27
|
+
- `generateNodeId`
|
|
28
|
+
- `extractFieldPaths`
|
|
29
|
+
- `extractFieldsFromJson`
|
|
30
|
+
- `shouldBeLambdaParameter`
|
|
31
|
+
- `AVIATOR_FUNCTIONS`
|
|
32
|
+
- `COMPARISON_OPERATORS`
|
|
33
|
+
- All related headless types (tree nodes, runtime options, service contracts)
|
|
34
|
+
|
|
35
|
+
## Subpath Exports
|
|
36
|
+
|
|
37
|
+
- `aviator-expression-builder/vue`
|
|
38
|
+
- Vue components + plugin + notifier contracts
|
|
39
|
+
- `aviator-expression-builder/headless`
|
|
40
|
+
- Parser/generator/validator/service utilities and types
|
|
41
|
+
- `aviator-expression-builder/legacy`
|
|
42
|
+
- Legacy modal component only
|
|
43
|
+
- `aviator-expression-builder/style.css`
|
|
44
|
+
- Component styles
|
|
45
|
+
|
|
46
|
+
## Stability Notes
|
|
47
|
+
|
|
48
|
+
- This package keeps `index/vue/headless/legacy/style.css` export shape stable.
|
|
49
|
+
- Internal file layout is not considered public API.
|
|
50
|
+
- Prefer type references from package entrypoints, not deep imports.
|
package/README.md
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
# Aviator Expression Builder
|
|
2
|
+
|
|
3
|
+
A Vue 3 visual builder for Aviator expressions with parsing, editing, validation, and generation support.
|
|
4
|
+
|
|
5
|
+
一个面向 Vue 3 的 Aviator 表达式可视化构建器,支持表达式解析、可视化编辑、语义校验与字符串生成。
|
|
6
|
+
|
|
7
|
+
## What It Solves / 解决什么问题
|
|
8
|
+
|
|
9
|
+
### EN
|
|
10
|
+
`aviator-expression-builder` helps teams replace hand-written expression strings with a visual workflow:
|
|
11
|
+
- Parse existing expressions into editable trees.
|
|
12
|
+
- Build or modify conditions with type-aware operators.
|
|
13
|
+
- Validate node-level issues before saving.
|
|
14
|
+
- Generate Aviator expressions back from structured nodes.
|
|
15
|
+
|
|
16
|
+
### 中文
|
|
17
|
+
`aviator-expression-builder` 用于把“手写表达式字符串”升级为“可视化编辑流程”:
|
|
18
|
+
- 把已有表达式解析成可编辑的树结构。
|
|
19
|
+
- 按字段类型推荐可用操作符并可视化修改条件。
|
|
20
|
+
- 保存前做节点级语义校验并提示问题。
|
|
21
|
+
- 把结构化节点重新生成 Aviator 表达式字符串。
|
|
22
|
+
|
|
23
|
+
## Quick Start / 快速开始
|
|
24
|
+
|
|
25
|
+
### 1) Install / 安装
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm add aviator-expression-builder
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Peer dependencies:
|
|
32
|
+
- `vue@^3.5.0`
|
|
33
|
+
- `@arco-design/web-vue@^2.57.0`
|
|
34
|
+
|
|
35
|
+
### 2) Import style / 引入样式
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import "aviator-expression-builder/style.css";
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 3) Minimal modal usage / 最小可运行 Modal 示例
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<template>
|
|
45
|
+
<AviatorExpressionBuilderModal
|
|
46
|
+
v-model:visible="visible"
|
|
47
|
+
v-model="expression"
|
|
48
|
+
:fields="fields"
|
|
49
|
+
title="Expression Builder"
|
|
50
|
+
@save="onSave"
|
|
51
|
+
/>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script setup lang="ts">
|
|
55
|
+
import { ref } from "vue";
|
|
56
|
+
import {
|
|
57
|
+
AviatorExpressionBuilderModal,
|
|
58
|
+
type AviatorFieldOption,
|
|
59
|
+
} from "aviator-expression-builder";
|
|
60
|
+
import "aviator-expression-builder/style.css";
|
|
61
|
+
|
|
62
|
+
const visible = ref(true);
|
|
63
|
+
const expression = ref("employee_id == 1");
|
|
64
|
+
|
|
65
|
+
const fields = ref<AviatorFieldOption[]>([
|
|
66
|
+
{ label: "employee_id", value: "employee_id", type: "number" },
|
|
67
|
+
{ label: "name", value: "name", type: "string" },
|
|
68
|
+
{ label: "client_ip", value: "client_ip", type: "ip" },
|
|
69
|
+
]);
|
|
70
|
+
|
|
71
|
+
function onSave(nextExpression: string) {
|
|
72
|
+
expression.value = nextExpression;
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Integration Flow / 接入流程(7 步)
|
|
78
|
+
|
|
79
|
+
1. **Define field options / 定义字段列表**
|
|
80
|
+
Provide `AviatorFieldOption[]` with `label/value/type` as editor input.
|
|
81
|
+
2. **Mount modal or builder / 挂载 Modal 或 Builder 组件**
|
|
82
|
+
Use `AviatorExpressionBuilderModal` for dialog workflow, or `AviatorExpressionBuilder` for embedded pages.
|
|
83
|
+
3. **Bind expression string / 双向绑定表达式字符串**
|
|
84
|
+
Bind `v-model` to keep your source expression synchronized with UI edits.
|
|
85
|
+
4. **Control open/close state / 管理弹窗开关状态**
|
|
86
|
+
Use `v-model:visible` on modal and wire save/cancel behavior from your page.
|
|
87
|
+
5. **Handle save callback / 处理保存事件**
|
|
88
|
+
On `@save`, persist the expression and close modal (or continue editing).
|
|
89
|
+
6. **Use `dataPreview` when needed / 按需使用 `dataPreview`**
|
|
90
|
+
Pass JSON string to let the builder extract candidate fields for faster setup.
|
|
91
|
+
7. **Reopen for secondary edits / 支持二次编辑**
|
|
92
|
+
Reopen modal with existing expression string; it will be parsed and restored for edits.
|
|
93
|
+
|
|
94
|
+
### Modal props/events you will usually use / 常用 Modal 参数与事件
|
|
95
|
+
|
|
96
|
+
- Props:
|
|
97
|
+
- `visible: boolean`
|
|
98
|
+
- `modelValue: string` (`v-model`)
|
|
99
|
+
- `fields: AviatorFieldOption[]`
|
|
100
|
+
- `dataPreview?: string`
|
|
101
|
+
- `title?: string`
|
|
102
|
+
- `width?: number`
|
|
103
|
+
- `notifier?: TreeExpressionBuilderNotifier`
|
|
104
|
+
- Emits:
|
|
105
|
+
- `update:visible`
|
|
106
|
+
- `update:modelValue`
|
|
107
|
+
- `save`
|
|
108
|
+
- `cancel`
|
|
109
|
+
|
|
110
|
+
### Example with `dataPreview` and field extraction / 使用 `dataPreview` 与字段提取
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
import {
|
|
114
|
+
extractFieldsFromJson,
|
|
115
|
+
type AviatorFieldOption,
|
|
116
|
+
} from "aviator-expression-builder/headless";
|
|
117
|
+
|
|
118
|
+
const rawPreview = `{
|
|
119
|
+
"request": { "uri": "/api/v1/users", "method": "GET" },
|
|
120
|
+
"response": { "status": 200 },
|
|
121
|
+
"client_ip": "10.1.2.3"
|
|
122
|
+
}`;
|
|
123
|
+
|
|
124
|
+
const inferredFields: AviatorFieldOption[] = extractFieldsFromJson(rawPreview);
|
|
125
|
+
// pass inferredFields to :fields and rawPreview to :data-preview
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Expression Capabilities / 表达式能力说明
|
|
129
|
+
|
|
130
|
+
### Operator matrix by field type / 按字段类型的操作符矩阵
|
|
131
|
+
|
|
132
|
+
Source of truth: `COMPARISON_OPERATORS`.
|
|
133
|
+
|
|
134
|
+
| Field type | Supported operators |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| `boolean` | `==`, `!=` |
|
|
137
|
+
| `string` | `==`, `!=`, `== nil`, `!= nil`, `== ''`, `!= ''`, `contains`, `match(regex)`, `startsWith`, `endsWith` |
|
|
138
|
+
| `number` | `==`, `!=`, `>`, `>=`, `<`, `<=`, `== nil`, `!= nil` |
|
|
139
|
+
| `ip` | `==`, `!=`, `== nil`, `!= nil`, `== ''`, `!= ''`, `contains`, `match(regex)`, `startsWith`, `endsWith`, `isIpInNetmaskList` |
|
|
140
|
+
| `url` | `==`, `!=`, `== nil`, `!= nil` |
|
|
141
|
+
| `email` | `==`, `!=`, `== nil`, `!= nil` |
|
|
142
|
+
| `uuid` | `==`, `!=`, `== nil`, `!= nil` |
|
|
143
|
+
| `datetime` | `==`, `!=`, `>`, `>=`, `<`, `<=` |
|
|
144
|
+
| `array` | `==`, `!=`, `belong` |
|
|
145
|
+
| `object` | `==`, `!=` |
|
|
146
|
+
|
|
147
|
+
### Special comparison semantics / 特殊比较语义
|
|
148
|
+
|
|
149
|
+
- `== nil` / `!= nil`: compares against `nil`/`null` keyword.
|
|
150
|
+
- `== ''` / `!= ''`: explicit empty-string checks for string-like fields.
|
|
151
|
+
- `match`: regex-like matching mode (derived from `string.match(...)` patterns in parser logic).
|
|
152
|
+
- `belong`: list membership mode (mapped from `seq.some(... include(seq.list(...)))` patterns).
|
|
153
|
+
- `isIpInNetmaskList`: IP-in-CIDR-list capability.
|
|
154
|
+
|
|
155
|
+
### Logic and syntax support / 逻辑与语法支持
|
|
156
|
+
|
|
157
|
+
- Logical operators: `&&`, `||`
|
|
158
|
+
- Unary negation: `!`
|
|
159
|
+
- Binary comparisons: `==`, `!=`, `>`, `>=`, `<`, `<=`
|
|
160
|
+
- Lambda syntax: `lambda(...) -> ... end`
|
|
161
|
+
- Member access / field path: e.g. `request.uri`, `logTagValues[0]`
|
|
162
|
+
|
|
163
|
+
### Node model (headless) / 节点模型(headless)
|
|
164
|
+
|
|
165
|
+
The engine works on tree nodes (`group` and `condition`) and supports both:
|
|
166
|
+
- Field mode: `field + comparison + value`
|
|
167
|
+
- Function mode: `functionName + parameters (+ comparison/value for non-boolean return)`
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
import type { AviatorTreeNode } from "aviator-expression-builder/headless";
|
|
171
|
+
|
|
172
|
+
const nodes: AviatorTreeNode[] = [
|
|
173
|
+
{
|
|
174
|
+
id: "root",
|
|
175
|
+
type: "group",
|
|
176
|
+
operator: "and",
|
|
177
|
+
children: [
|
|
178
|
+
{
|
|
179
|
+
id: "c1",
|
|
180
|
+
type: "condition",
|
|
181
|
+
field: "employee_id",
|
|
182
|
+
comparison: "==",
|
|
183
|
+
value: 1,
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
},
|
|
187
|
+
];
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Headless API Workflow / 纯 API 流程(parse -> edit -> validate -> generate)
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import {
|
|
194
|
+
createAviatorExpressionService,
|
|
195
|
+
parseExpression,
|
|
196
|
+
validateExpression,
|
|
197
|
+
generateExpression,
|
|
198
|
+
type AviatorFieldOption,
|
|
199
|
+
} from "aviator-expression-builder/headless";
|
|
200
|
+
|
|
201
|
+
const availableFields: AviatorFieldOption[] = [
|
|
202
|
+
{ label: "employee_id", value: "employee_id", type: "number" },
|
|
203
|
+
{ label: "name", value: "name", type: "string" },
|
|
204
|
+
];
|
|
205
|
+
|
|
206
|
+
// Option A: one-shot helpers
|
|
207
|
+
const parsed = parseExpression("employee_id == 1", { availableFields });
|
|
208
|
+
const errors = validateExpression(parsed.nodes);
|
|
209
|
+
const regenerated = generateExpression(parsed.nodes, { availableFields });
|
|
210
|
+
|
|
211
|
+
// Option B: service object
|
|
212
|
+
const service = createAviatorExpressionService({ availableFields });
|
|
213
|
+
const tree = service.parse("name contains \"a\"");
|
|
214
|
+
const issues = service.validate(tree);
|
|
215
|
+
if (issues.length === 0) {
|
|
216
|
+
const output = service.generate(tree);
|
|
217
|
+
console.log(output);
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Full Function Reference / 全量函数参考
|
|
222
|
+
|
|
223
|
+
### EN
|
|
224
|
+
This section is generated from the runtime function catalog (`AVIATOR_FUNCTIONS`), grouped by category:
|
|
225
|
+
`system`, `string`, `math`, `sequence`, `datetime`, `custom`.
|
|
226
|
+
|
|
227
|
+
### 中文
|
|
228
|
+
本节依据运行时函数目录 `AVIATOR_FUNCTIONS` 组织,按 `system`、`string`、`math`、`sequence`、`datetime`、`custom` 分类展示。
|
|
229
|
+
每个函数都包含固定字段:`name`、`description`、`parameters(required/type)`、`returnType`、`example`。
|
|
230
|
+
|
|
231
|
+
### system (17)
|
|
232
|
+
|
|
233
|
+
| name | description | parameters (required/type) | returnType | example |
|
|
234
|
+
| --- | --- | --- | --- | --- |
|
|
235
|
+
| sysdate | 返回当前日期对象 | none | date | sysdate() |
|
|
236
|
+
| now | 返回当前毫秒时间戳 | none | number | now() |
|
|
237
|
+
| assert | 当predicate结果为false时抛出异常 | predicate[required:yes,type:value,valueType:boolean]; msg[required:no,type:value,valueType:string] | boolean | assert(user.age > 18, "用户未成年") |
|
|
238
|
+
| rand | 返回[0,1)或[0,n)的随机数 | n[required:no,type:value,valueType:number] | number | rand() 或 rand(100) |
|
|
239
|
+
| cmp | 比较x和y大小,返回0(相等)、1(x>y)或-1(x<y) | x[required:yes,type:value,valueType:any]; y[required:yes,type:value,valueType:any] | number | cmp(request.size, response.size) |
|
|
240
|
+
| print | 打印对象到输出流 | obj[required:yes,type:value,valueType:any] | any | print(user.name) |
|
|
241
|
+
| println | 打印对象并换行 | obj[required:yes,type:value,valueType:any] | any | println(user.name) |
|
|
242
|
+
| long | 将值转为long类型 | v[required:yes,type:value,valueType:any] | number | long(user.age) |
|
|
243
|
+
| double | 将值转为double类型 | v[required:yes,type:value,valueType:any] | number | double(user.salary) |
|
|
244
|
+
| boolean | 将值转为boolean类型 | v[required:yes,type:value,valueType:any] | boolean | boolean(user.active) |
|
|
245
|
+
| str | 将值转为string类型 | v[required:yes,type:value,valueType:any] | string | str(user.id) |
|
|
246
|
+
| type | 返回参数的类型 | x[required:yes,type:value,valueType:any] | string | type(user.age) |
|
|
247
|
+
| is_def | 返回变量是否已定义 | x[required:yes,type:value,valueType:any] | boolean | is_def(user.email) |
|
|
248
|
+
| max | 取所有参数中的最大值 | x1[required:yes,type:value,valueType:number]; x2[required:yes,type:value,valueType:number] | number | max(request.size, response.size) |
|
|
249
|
+
| min | 取所有参数中的最小值 | x1[required:yes,type:value,valueType:number]; x2[required:yes,type:value,valueType:number] | number | min(request.size, response.size) |
|
|
250
|
+
| load | 加载指定路径的模块,每次重新编译 | path[required:yes,type:value,valueType:string] | any | load("myModule.av") |
|
|
251
|
+
| require | 加载指定路径的模块,有缓存机制 | path[required:yes,type:value,valueType:string] | any | require("myModule.av") |
|
|
252
|
+
|
|
253
|
+
### string (14)
|
|
254
|
+
|
|
255
|
+
| name | description | parameters (required/type) | returnType | example |
|
|
256
|
+
| --- | --- | --- | --- | --- |
|
|
257
|
+
| date_to_string | 将Date对象转化为特定格式的字符串 | date[required:yes,type:value,valueType:any]; format[required:yes,type:value,valueType:string] | string | date_to_string(event.time, "yyyy-MM-dd HH:mm:ss") |
|
|
258
|
+
| string_to_date | 将特定格式的字符串转化为Date对象 | source[required:yes,type:value,valueType:string]; format[required:yes,type:value,valueType:string] | date | string_to_date(event.created, "yyyy-MM-dd HH:mm:ss") |
|
|
259
|
+
| string.contains | 判断s1是否包含s2 | s1[required:yes,type:value,valueType:string]; s2[required:yes,type:value,valueType:string] | boolean | string.contains(request.uri, "/login") |
|
|
260
|
+
| string.startsWith | s1是否以s2开始 | s1[required:yes,type:value,valueType:string]; s2[required:yes,type:value,valueType:string] | boolean | string.startsWith(request.uri, "/sso/public") |
|
|
261
|
+
| string.endsWith | s1是否以s2结尾 | s1[required:yes,type:value,valueType:string]; s2[required:yes,type:value,valueType:string] | boolean | string.endsWith(request.uri, ".gif") |
|
|
262
|
+
| string.length | 求字符串长度 | s[required:yes,type:value,valueType:string] | number | string.length(request.uri) |
|
|
263
|
+
| string.indexOf | 求s2在s1中的起始索引位置 | s1[required:yes,type:value,valueType:string]; s2[required:yes,type:value,valueType:string] | number | string.indexOf(request.uri, "/api") |
|
|
264
|
+
| string.lastIndexOf | 查找字符串最后出现的位置 | str[required:yes,type:value,valueType:string]; searchStr[required:yes,type:value,valueType:string] | number | string.lastIndexOf(request.uri, "/") |
|
|
265
|
+
| string.substring | 截取字符串s,从begin到end | s[required:yes,type:value,valueType:string]; begin[required:yes,type:value,valueType:number]; end[required:no,type:value,valueType:number] | string | string.substring(request.uri, 0, 10) |
|
|
266
|
+
| string.split | Java里的String.split方法 | target[required:yes,type:value,valueType:string]; regex[required:yes,type:value,valueType:string]; limit[required:no,type:value,valueType:number] | array | string.split(request.uri, "/") |
|
|
267
|
+
| string.join | 将集合里的元素以分隔符连接起来形成字符串 | seq[required:yes,type:value,valueType:any]; separator[required:yes,type:value,valueType:string] | string | string.join(headers, ",") |
|
|
268
|
+
| string.replace_first | Java里的String.replaceFirst方法 | s[required:yes,type:value,valueType:string]; regex[required:yes,type:value,valueType:string]; replacement[required:yes,type:value,valueType:string] | string | string.replace_first(request.uri, "/api/", "/new/") |
|
|
269
|
+
| string.replace_all | Java里的String.replaceAll方法 | s[required:yes,type:value,valueType:string]; regex[required:yes,type:value,valueType:string]; replacement[required:yes,type:value,valueType:string] | string | string.replace_all(request.uri, "/api/", "/new/") |
|
|
270
|
+
| string.match | 字符串正则匹配函数,返回匹配到的字符串内容,匹配失败时返回nil | regex[required:yes,type:value,valueType:string]; str[required:yes,type:value,valueType:string]; flags[required:no,type:value,valueType:string] | string | string.match("^/api/.*", request.uri, 0) |
|
|
271
|
+
|
|
272
|
+
### math (14)
|
|
273
|
+
|
|
274
|
+
| name | description | parameters (required/type) | returnType | example |
|
|
275
|
+
| --- | --- | --- | --- | --- |
|
|
276
|
+
| math.abs | 求d的绝对值 | d[required:yes,type:value,valueType:number] | number | math.abs(response.latency) |
|
|
277
|
+
| math.round | 四舍五入 | d[required:yes,type:value,valueType:number] | number | math.round(response.latency) |
|
|
278
|
+
| math.floor | 向下取整 | d[required:yes,type:value,valueType:number] | number | math.floor(response.latency) |
|
|
279
|
+
| math.ceil | 向上取整 | d[required:yes,type:value,valueType:number] | number | math.ceil(response.latency) |
|
|
280
|
+
| math.sqrt | 求d的平方根 | d[required:yes,type:value,valueType:number] | number | math.sqrt(request.size) |
|
|
281
|
+
| math.pow | 求d1的d2次方 | d1[required:yes,type:value,valueType:number]; d2[required:yes,type:value,valueType:number] | number | math.pow(request.size, 2) |
|
|
282
|
+
| math.log | 求d的自然对数 | d[required:yes,type:value,valueType:number] | number | math.log(request.size) |
|
|
283
|
+
| math.log10 | 求d以10为底的对数 | d[required:yes,type:value,valueType:number] | number | math.log10(request.size) |
|
|
284
|
+
| math.sin | 正弦函数 | d[required:yes,type:value,valueType:number] | number | math.sin(angle) |
|
|
285
|
+
| math.cos | 余弦函数 | d[required:yes,type:value,valueType:number] | number | math.cos(angle) |
|
|
286
|
+
| math.tan | 正切函数 | d[required:yes,type:value,valueType:number] | number | math.tan(angle) |
|
|
287
|
+
| math.atan | 反正切函数 | d[required:yes,type:value,valueType:number] | number | math.atan(value) |
|
|
288
|
+
| math.acos | 反余弦函数 | d[required:yes,type:value,valueType:number] | number | math.acos(value) |
|
|
289
|
+
| math.asin | 反正弦函数 | d[required:yes,type:value,valueType:number] | number | math.asin(value) |
|
|
290
|
+
|
|
291
|
+
### sequence (23)
|
|
292
|
+
|
|
293
|
+
| name | description | parameters (required/type) | returnType | example |
|
|
294
|
+
| --- | --- | --- | --- | --- |
|
|
295
|
+
| seq.list | 创建一个ArrayList实例 | items[required:yes,type:value,valueType:array] | list | seq.list("GET", "POST", "PUT") |
|
|
296
|
+
| seq.contains_key | 当map中存在key时返回true | map[required:yes,type:value,valueType:any]; key[required:yes,type:value,valueType:string] | boolean | seq.contains_key(request.headers, "authorization") |
|
|
297
|
+
| seq.get | 从list、数组或hash-map获取对应的元素值 | coll[required:yes,type:value,valueType:any]; element[required:yes,type:value,valueType:string] | any | seq.get(request.headers, "user-agent") |
|
|
298
|
+
| include | 判断element是否在集合seq中 | seq[required:yes,type:value,valueType:list]; element[required:yes,type:value,valueType:string] | boolean | include(seq.list("admin", "user"), user.role) |
|
|
299
|
+
| count | 返回集合大小 | seq[required:yes,type:value,valueType:any] | number | count(request.headers) |
|
|
300
|
+
| seq.array | 创建指定类型的数组 | clazz[required:yes,type:value,valueType:string]; elements[required:no,type:value,valueType:array] | array | seq.array("String", "a", "b", "c") |
|
|
301
|
+
| seq.set | 创建HashSet实例 | elements[required:no,type:value,valueType:array] | set | seq.set("admin", "user", "guest") |
|
|
302
|
+
| seq.map | 创建HashMap实例 | pairs[required:no,type:value,valueType:array] | map | seq.map("key1", "value1", "key2", "value2") |
|
|
303
|
+
| seq.keys | 返回map的key集合 | m[required:yes,type:value,valueType:any] | set | seq.keys(request.headers) |
|
|
304
|
+
| seq.vals | 返回map的value集合 | m[required:yes,type:value,valueType:any] | list | seq.vals(request.headers) |
|
|
305
|
+
| seq.add | 往集合添加元素 | coll[required:yes,type:value,valueType:any]; element[required:yes,type:value,valueType:string] | any | seq.add(userList, "newUser") |
|
|
306
|
+
| seq.remove | 从集合删除元素 | coll[required:yes,type:value,valueType:any]; element[required:yes,type:value,valueType:string] | any | seq.remove(userList, "oldUser") |
|
|
307
|
+
| map | 将函数作用到集合每个元素 | seq[required:yes,type:value,valueType:any]; fun[required:yes,type:value,valueType:string] | list | map(numbers, lambda(x) -> x * 2) end |
|
|
308
|
+
| filter | 过滤集合中满足条件的元素 | seq[required:yes,type:value,valueType:any]; predicate[required:yes,type:value,valueType:string] | list | filter(numbers, lambda(x) -> x > 10) end |
|
|
309
|
+
| sort | 排序集合,仅对数组和List有效 | seq[required:yes,type:value,valueType:any]; comparator[required:no,type:value,valueType:string] | list | sort(numbers) 或 sort(users, comparator(lambda(a, b) -> a.age - b.age end)) |
|
|
310
|
+
| reverse | 将集合元素逆序 | seq[required:yes,type:value,valueType:any] | list | reverse(numbers) |
|
|
311
|
+
| distinct | 返回去重后的结果集合 | seq[required:yes,type:value,valueType:any] | list | distinct(numbers) |
|
|
312
|
+
| concat | 连接两个集合 | seq1[required:yes,type:value,valueType:any]; seq2[required:yes,type:value,valueType:any] | list | concat(list1, list2) |
|
|
313
|
+
| repeat | 返回将元素x重复n次的List | n[required:yes,type:value,valueType:number]; x[required:yes,type:value,valueType:string] | list | repeat(3, "hello") |
|
|
314
|
+
| repeatedly | 返回将函数f重复调用n次结果的List | n[required:yes,type:value,valueType:number]; f[required:yes,type:value,valueType:string] | list | repeatedly(3, lambda() -> rand() end) |
|
|
315
|
+
| reduce | 将函数作用在结果值和集合每个元素上 | seq[required:yes,type:value,valueType:any]; fun[required:yes,type:value,valueType:string]; init[required:yes,type:value,valueType:number] | any | reduce(numbers, lambda(acc, x) -> acc + x end, 0) |
|
|
316
|
+
| is_empty | 当集合为空或nil时返回true | seq[required:yes,type:value,valueType:list] | boolean | is_empty(userList) |
|
|
317
|
+
| is_distinct | 当seq没有重复元素时返回true | seq[required:yes,type:value,valueType:any] | boolean | is_distinct(userIds) |
|
|
318
|
+
|
|
319
|
+
### datetime (6)
|
|
320
|
+
|
|
321
|
+
| name | description | parameters (required/type) | returnType | example |
|
|
322
|
+
| --- | --- | --- | --- | --- |
|
|
323
|
+
| datetime.dateStrToMilliSecond | 将日期字符串转换为毫秒时间戳 | dateStr[required:yes,type:value,valueType:string]; format[required:no,type:value,valueType:string]; timezone[required:no,type:value,valueType:string] | number | datetime.dateStrToMilliSecond(event.created, "yyyy-MM-dd HH:mm:ss") |
|
|
324
|
+
| datetime.milliSecondToDate | 将毫秒时间戳转换为LocalDate | milliSecond[required:yes,type:value,valueType:number] | date | datetime.milliSecondToDate(event.timestamp) |
|
|
325
|
+
| datetime.isSameDay | 判断两个时间戳是否是同一天 | second1[required:yes,type:value,valueType:number]; second2[required:yes,type:value,valueType:number] | boolean | datetime.isSameDay(event.created, event.updated) |
|
|
326
|
+
| datetime.isAfterDay | 判断第一个日期是否晚于第二个日期 | date1[required:yes,type:value,valueType:any]; date2[required:yes,type:value,valueType:any] | boolean | datetime.isAfterDay(event.created, event.baseline) |
|
|
327
|
+
| datetime.isBeforeDay | 判断第一个日期是否早于第二个日期 | date1[required:yes,type:value,valueType:any]; date2[required:yes,type:value,valueType:any] | boolean | datetime.isBeforeDay(event.created, event.deadline) |
|
|
328
|
+
| datetime.strToLocalDate | 将日期字符串转换为LocalDate | dateStr[required:yes,type:value,valueType:string] | date | datetime.strToLocalDate(event.dateString) |
|
|
329
|
+
|
|
330
|
+
### custom (14)
|
|
331
|
+
|
|
332
|
+
| name | description | parameters (required/type) | returnType | example |
|
|
333
|
+
| --- | --- | --- | --- | --- |
|
|
334
|
+
| user.getUserStatus | 根据员工ID获取用户状态 | emplid[required:yes,type:value,valueType:string] | number | user.getUserStatus(user.emplid) |
|
|
335
|
+
| user.getUserEmplidByEmail | 根据邮箱获取员工ID | email[required:yes,type:value,valueType:string] | string | user.getUserEmplidByEmail(user.email) |
|
|
336
|
+
| ipUser.getUser | 根据IP获取用户信息 | ip[required:yes,type:value,valueType:string]; timestamp[required:no,type:value,valueType:number] | object | ipUser.getUser(client_ip, event.timestamp) |
|
|
337
|
+
| intelligence.ifWhiteIp | 检查IP是否在白名单中 | ip[required:yes,type:value,valueType:string] | boolean | intelligence.ifWhiteIp(client_ip) |
|
|
338
|
+
| intelligence.ifBlackIp | 检查IP是否在黑名单中 | ip[required:yes,type:value,valueType:string] | boolean | intelligence.ifBlackIp(client_ip) |
|
|
339
|
+
| intelligence.ifBlackDomain | 检查域名是否在黑名单中 | domain[required:yes,type:value,valueType:string] | boolean | intelligence.ifBlackDomain(request.host) |
|
|
340
|
+
| intelligence.ifBlackUrl | 检查URL是否在黑名单中 | url[required:yes,type:value,valueType:string] | boolean | intelligence.ifBlackUrl(request.uri) |
|
|
341
|
+
| intelligence.ifBlackHash | 检查Hash是否在黑名单中 | hash[required:yes,type:value,valueType:string] | boolean | intelligence.ifBlackHash(file.hash) |
|
|
342
|
+
| intelligence.checkIfInnerIp | 检查IP是否为内网IP | ip[required:yes,type:value,valueType:string] | boolean | intelligence.checkIfInnerIp(client_ip) |
|
|
343
|
+
| isTimeInRange.isTimestampInRange | 检查时间戳是否在指定时间范围内 | country[required:yes,type:value,valueType:string]; timestamp[required:yes,type:value,valueType:number]; startTime[required:yes,type:value,valueType:number]; endTime[required:yes,type:value,valueType:number] | boolean | isTimeInRange.isTimestampInRange("CN", event.timestamp, 9, 18) |
|
|
344
|
+
| IPScene.isIpInNetmaskList | 检查IP是否在指定网段列表中的任意一个 | ip[required:yes,type:value,valueType:string]; netmaskList[required:yes,type:value,valueType:list] | boolean | IPScene.isIpInNetmaskList(client_ip, seq.list("10.128.16.0/20", "10.128.16.0/23")) |
|
|
345
|
+
| IPScene.isIoaIP | 检查是否为IOA IP | ip[required:yes,type:value,valueType:string] | boolean | IPScene.isIoaIP(client_ip) |
|
|
346
|
+
| filter.checkInWhiteList | 检查值是否在白名单中 | whiteType[required:yes,type:value,valueType:string]; value[required:yes,type:value,valueType:string] | boolean | filter.checkInWhiteList("domain", request.host) |
|
|
347
|
+
| enhance.getValue | 获取包含特殊字符的路径字段值 | path[required:yes,type:value,valueType:string] | any | enhance.getValue("a-b.c-d") |
|
|
348
|
+
|
|
349
|
+
## FAQ & Troubleshooting / 常见问题
|
|
350
|
+
|
|
351
|
+
### 1) Why is my save button disabled? / 为什么保存按钮是灰色?
|
|
352
|
+
- EN: Modal save is disabled when the current expression string is empty.
|
|
353
|
+
- 中文:当当前表达式为空字符串时,Modal 的保存按钮会禁用。
|
|
354
|
+
|
|
355
|
+
### 2) Why do I get validation errors? / 为什么会出现校验错误?
|
|
356
|
+
- EN: Typical causes are missing field/comparison/value, missing required function parameters, or empty expanded groups.
|
|
357
|
+
- 中文:常见原因包括条件缺字段/操作符/值、函数节点缺必填参数、展开分组为空。
|
|
358
|
+
|
|
359
|
+
### 3) What if I only have JSON payload examples? / 只有 JSON 示例,没有字段定义怎么办?
|
|
360
|
+
- EN: Use `extractFieldsFromJson` to bootstrap field options, then refine types manually.
|
|
361
|
+
- 中文:可以先用 `extractFieldsFromJson` 自动提取字段,再按业务手工修正类型。
|
|
362
|
+
|
|
363
|
+
### 4) Which import path should I use? / 应该用哪个导入路径?
|
|
364
|
+
- `aviator-expression-builder`: Vue + headless aggregated exports
|
|
365
|
+
- `aviator-expression-builder/vue`: Vue-only exports
|
|
366
|
+
- `aviator-expression-builder/headless`: parser/generator/validator/service APIs
|
|
367
|
+
- `aviator-expression-builder/legacy`: legacy modal
|
|
368
|
+
- `aviator-expression-builder/style.css`: style sheet
|