Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputFormula 公式编辑器 添加clearDefaultFormula 属性,可清除默认函数 #8035

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
834d0e3
排序字段中间态 orderDir 没有置空问题
May 23, 2022
f721fce
修改代码规范
May 23, 2022
6adf08e
去掉 setting.json 配置 里的ts 格式
May 23, 2022
e1946bc
Merge branch 'baidu:master' into fix-order
srleng May 23, 2022
57959bb
格式化代码
Jun 1, 2022
2d3e842
Merge branch 'baidu:master' into fix-order
srleng Jun 1, 2022
e5ce847
Merge branch 'fix-order' of https://github.com/lengqingfeng/amis into…
Jul 26, 2022
8cedef1
Merge branch 'baidu:master' into master
srleng Aug 2, 2022
da0383f
Merge branch 'baidu:master' into master
srleng Aug 5, 2022
ed5a4e0
Merge branch 'baidu:master' into master
srleng Aug 8, 2022
749cfbd
Merge branch 'baidu:master' into master
srleng Aug 9, 2022
4a9e8de
Merge branch 'baidu:master' into master
srleng Aug 10, 2022
b6b2f30
Merge branch 'baidu:master' into master
srleng Aug 26, 2022
04c1a7b
Merge branch 'baidu:master' into master
srleng Aug 30, 2022
416b3cb
Merge branch 'baidu:master' into master
srleng Aug 30, 2022
5b2a2b0
Merge branch 'baidu:master' into master
srleng Sep 6, 2022
5cdd828
Merge branch 'baidu:master' into master
srleng Sep 6, 2022
b505213
Merge branch 'baidu:master' into master
srleng Mar 17, 2023
eb3718b
Merge branch 'baidu:master' into master
srleng Mar 23, 2023
f5574cd
Merge branch 'baidu:master' into master
srleng Mar 24, 2023
de9253d
Merge branch 'baidu:master' into master
srleng Mar 28, 2023
03a2520
Merge branch 'baidu:master' into master
srleng Apr 11, 2023
82f230f
Merge branch 'baidu:master' into master
srleng May 17, 2023
59e0770
Merge branch 'baidu:master' into master
srleng Jun 2, 2023
b77d395
Merge branch 'baidu:master' into master
srleng Aug 24, 2023
962663b
Merge branch 'baidu:master' into master
srleng Sep 7, 2023
9ec52a5
添加清除公式属性
Sep 7, 2023
48d0b6e
添加清除默认函数属性
Sep 7, 2023
c666796
去除log
Sep 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 40 additions & 27 deletions docs/zh-CN/components/form/input-formula.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,25 @@ order: 21

用来输入公式。还是 beta 版本,整体待优化。

```schema: scope="body"
```schema:
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-formula",
"functions": [
{
"groupName": "mysql",
"items": [
{
"name": "sum",
"example": "SUM(1,X)",
"description":"求和"
}
]
}
],
"name": "formula",
"label": "公式",
"evalMode": true,
Expand Down Expand Up @@ -92,7 +104,7 @@ order: 21

设置`"inputMode": "button"`可以切换编辑器的展示模式为按钮模式。

```schema: scope="body"
```schema:
{
"type": "form",
"debug": true,
Expand Down Expand Up @@ -162,7 +174,7 @@ order: 21

设置`"inputMode": "input-group"`可以切换编辑器的展示模式为输入框组合模式,1.10.0 及以上版本。

```schema: scope="body"
```schema:
{
"type": "form",
"debug": true,
Expand Down Expand Up @@ -234,7 +246,7 @@ order: 21

设置不同`variableMode`字段切换变量展示模式,树形结构:

```schema: scope="body"
```schema:
{
"type": "form",
"debug": true,
Expand Down Expand Up @@ -302,7 +314,7 @@ order: 21

Tab 结构:

```schema: scope="body"
```schema:
{
"type": "form",
"debug": true,
Expand Down Expand Up @@ -372,7 +384,7 @@ Tab 结构:

通过配置`allowInput`为`false`可以高亮文本内容,但是只能在编辑器中编辑

```schema: scope="body"
```schema:
{
"type": "form",
"debug": true,
Expand Down Expand Up @@ -443,7 +455,7 @@ Tab 结构:

当配置 `evalMode` 为 false 时则为模板模式,意思是说默认不当做表达式,只有 `${`和`}`包裹的部分才是表达式。

```schema: scope="body"
```schema:
{
"type": "form",
"debug": true,
Expand Down Expand Up @@ -513,7 +525,7 @@ Tab 结构:

混合模式的意思是支持输入文本和输入公式两种格式的值,当输入公式时值会自动用 `${` 和 `}` 包裹,如果不是这种格式则认为是输入普通的字符串。通过 `mixedMode` 为 true 启用这种模式

```schema: scope="body"
```schema:
{
"type": "form",
"debug": true,
Expand Down Expand Up @@ -581,22 +593,23 @@ Tab 结构:

## 属性表

| 属性名 | 类型 | 默认值 | 说明 |
| ----------------- | ------------------------------------------------------------------------------------------ | -------------- | ------------------------------------------------------------------------------ |
| title | `string` | `'公式编辑器'` | 弹框标题 |
| header | `string` | - | 编辑器 header 标题,如果不设置,默认使用表单项`label`字段 |
| evalMode | `boolean` | `true` | 表达式模式 或者 模板模式,模板模式则需要将表达式写在 `${` 和 `}` 中间。 |
| variables | `{label: string; value: string; children?: any[]; tag?: string}[]` | `[]` | 可用变量 |
| variableMode | `string` | `list` | 可配置成 `tabs` 或者 `tree` 默认为列表,支持分组。 |
| functions | `Object[]` | - | 可以不设置,默认就是 amis-formula 里面定义的函数,如果扩充了新的函数则需要指定 |
| inputMode | `'button' \| 'input-button' \| 'input-group'` | - | 控件的展示模式 |
| icon | `string` | - | 按钮图标,例如`fa fa-list` |
| btnLabel | `string` | `'公示编辑'` | 按钮文本,`inputMode`为`button`时生效 |
| level | `'info' \| 'success' \| 'warning' \| 'danger' \| 'link' \| 'primary' \| 'dark' \| 'light'` | `default` | 按钮样式 |
| allowInput | `boolean` | - | 输入框是否可输入 |
| btnSize | `'xs' \| 'sm' \| 'md' \| 'lg'` | - | 按钮大小 |
| borderMode | `'full' \| 'half' \| 'none'` | - | 输入框边框模式 |
| placeholder | `string` | `'暂无数据'` | 输入框占位符 |
| className | `string` | - | 控件外层 CSS 样式类名 |
| variableClassName | `string` | - | 变量面板 CSS 样式类名 |
| functionClassName | `string` | - | 函数面板 CSS 样式类名 |
| 属性名 | 类型 | 默认值 | 说明 |
| ------------------- | ------------------------------------------------------------------------------------------ | --------- | ---------------------------------------------- |
| title | `string` | `'公式编辑器'` | 弹框标题 |
| header | `string` | - | 编辑器 header 标题,如果不设置,默认使用表单项`label`字段 |
| evalMode | `boolean` | `true` | 表达式模式 或者 模板模式,模板模式则需要将表达式写在 `${` 和 `}` 中间。 |
| variables | `{label: string; value: string; children?: any[]; tag?: string}[]` | `[]` | 可用变量 |
| variableMode | `string` | `list` | 可配置成 `tabs` 或者 `tree` 默认为列表,支持分组。 |
| functions | `Object[]` | - | 可以不设置,默认就是 amis-formula 里面定义的函数,如果扩充了新的函数则需要指定 |
| clearDefaultFormula | boolean | false | 清除默认你公式,配合functions属性,创建需要的公式 |
| inputMode | `'button' \| 'input-button' \| 'input-group'` | - | 控件的展示模式 |
| icon | `string` | - | 按钮图标,例如`fa fa-list` |
| btnLabel | `string` | `'公示编辑'` | 按钮文本,`inputMode`为`button`时生效 |
| level | `'info' \| 'success' \| 'warning' \| 'danger' \| 'link' \| 'primary' \| 'dark' \| 'light'` | `default` | 按钮样式 |
| allowInput | `boolean` | - | 输入框是否可输入 |
| btnSize | `'xs' \| 'sm' \| 'md' \| 'lg'` | - | 按钮大小 |
| borderMode | `'full' \| 'half' \| 'none'` | - | 输入框边框模式 |
| placeholder | `string` | `'暂无数据'` | 输入框占位符 |
| className | `string` | - | 控件外层 CSS 样式类名 |
| variableClassName | `string` | - | 变量面板 CSS 样式类名 |
| functionClassName | `string` | - | 函数面板 CSS 样式类名 |
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
},
"dependencies": {
"postcss": "^8.4.14",
"qs": "6.9.7"
"qs": "6.9.7",
"rc-component": "^0.1.0"
},
"devDependencies": {
"@babel/generator": "^7.22.9",
Expand Down
Loading
Loading