Skip to content

Commit

Permalink
Merge branch 'master' into chore-events
Browse files Browse the repository at this point in the history
  • Loading branch information
hsm-lv authored Dec 28, 2023
2 parents 667ee24 + d2f5fc2 commit 65544d0
Show file tree
Hide file tree
Showing 30 changed files with 1,087 additions and 106 deletions.
46 changes: 35 additions & 11 deletions docs/zh-CN/components/form/input-range.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,29 @@ order: 38
}
```

## 显示单位

在打开`showInput`输入框且设置了`unit`单位的前提下,开启`showInputUnit`可在input框中显示已配置的单位。

```schema: scope="body"
{
"type": "form",
"debug": true,
"api": "/api/mock2/form/saveForm",
"body": [
{
"type": "input-range",
"name": "range",
"label": "range",
"value": 20,
"unit": "个",
"showInput": true,
"showInputUnit": true
}
]
}
```

## 显示标签

标签默认在 hover 和拖拽过程中展示,通过`tooltipVisible`或者`tipFormatter`可指定标签是否展示。标签默认展示在滑块上方,通过`tooltipPlacement`可指定标签展示的位置。
Expand Down Expand Up @@ -288,17 +311,18 @@ order: 38
| showSteps | `boolean` | `false` | 是否显示步长 |
| parts | `number` or `number[]` | `1` | 分割的块数<br/>主持数组传入分块的节点 |
| marks | <code>{ [number &#124; string]: string &#124; number &#124; SchemaObject }</code> or <code>{ [number &#124; string]: { style: CSSProperties, label: string } }</code> | | 刻度标记<br/>- 支持自定义样式<br/>- 设置百分比 |
| tooltipVisible | `boolean` | `false` | 是否显示滑块标签 |
| tooltipPlacement | `auto` or `bottom` or `left` or `right` | `top` | 滑块标签的位置,默认`auto`,方向自适应<br/>前置条件:tooltipVisible 不为 false 时有效 |
| tipFormatter | `function` | | 控制滑块标签显隐函数<br/>前置条件:tooltipVisible 不为 false 时有效 |
| multiple | `boolean` | `false` | 支持选择范围 |
| joinValues | `boolean` | `true` | 默认为 `true`,选择的 `value` 会通过 `delimiter` 连接起来,否则直接将以`{min: 1, max: 100}`的形式提交<br/>前置条件:开启`multiple`时有效 |
| delimiter | `string` | `,` | 分隔符 |
| unit | `string` | | 单位 |
| clearable | `boolean` | `false` | 是否可清除<br/>前置条件:开启`showInput`时有效 |
| showInput | `boolean` | `false` | 是否显示输入框 |
| onChange | `function` | | 当 组件 的值发生改变时,会触发 onChange 事件,并把改变后的值作为参数传入 |
| onAfterChange | `function` | |`onmouseup` 触发时机一致,把当前值作为参数传入 |
| tooltipVisible | `boolean` | `false` | 是否显示滑块标签 |
| tooltipPlacement | `auto` or `bottom` or `left` or `right` | `top` | 滑块标签的位置,默认`auto`,方向自适应<br/>前置条件:tooltipVisible 不为 false 时有效 |
| tipFormatter | `function` | | 控制滑块标签显隐函数<br/>前置条件:tooltipVisible 不为 false 时有效 |
| multiple | `boolean` | `false` | 支持选择范围 |
| joinValues | `boolean` | `true` | 默认为 `true`,选择的 `value` 会通过 `delimiter` 连接起来,否则直接将以`{min: 1, max: 100}`的形式提交<br/>前置条件:开启`multiple`时有效 |
| delimiter | `string` | `,` | 分隔符 |
| unit | `string` | | 单位 |
| clearable | `boolean` | `false` | 是否可清除<br/>前置条件:开启`showInput`时有效 |
| showInput | `boolean` | `false` | 是否显示输入框 |
| showInputUnit | `boolean` | `false` | 是否显示输入框单位<br/>前置条件:开启`showInput`且配置了`unit`单位时有效 |`6.0.0`后支持变量
| onChange | `function` | | 当 组件 的值发生改变时,会触发 onChange 事件,并把改变后的值作为参数传入 |
| onAfterChange | `function` | |`onmouseup` 触发时机一致,把当前值作为参数传入 |

## 事件表

Expand Down
43 changes: 39 additions & 4 deletions docs/zh-CN/components/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ icon:
order: 73
---

分页组件
## 基本用法

```schema: scope="body"
{
Expand All @@ -28,13 +28,46 @@ order: 73
"perPageAvailable": [10, 20, 50, 100],
"showPageInput": true,
"disabled": false
}
]
}
```

## 微型模式

> `6.0.0`及以上版本
配置`"size": "sm"`可实现微型模式


```schema: scope="body"
{
"type": "service",
"api": "/api/mock2/crud/table",
"body": [
{
"type": "pagination",
"layout": "total,perPage,pager,go",
"mode": "normal",
"activePage": 1,
"lastPage": 99999,
"size": "sm",
"total": 999,
"perPage": 10,
"maxButtons": 7,
"showPerPage": true,
"perPageAvailable": [10, 20, 50, 100],
"showPageInput": true,
"disabled": false
}
]
}
```

### 简易模式
## 简洁模式

配置`"mode": "simple"`可实现简洁模式,支持input框输入指定页码跳转,input框中也可以通过键盘上下键进行页码跳转

```schema: scope="body"
{
Expand All @@ -53,8 +86,8 @@ order: 73

## 属性表

| 属性名 | 类型 | 默认值 | 说明 |
| ---------------- | -------------------------- | ---------------------------------------- | --------------------------------------------------------- |
| 属性名 | 类型 | 默认值 | 说明 | 版本 |
| ---------------- | -------------------------- | ---------------------------------------- | --------------------------------------------------------- | --- |
| type | `string` | `"pagination"` | 指定为 Pagination 渲染器 |
| mode | `normal` \| `simple` | `normal` | 迷你版本/简易版本 只显示左右箭头,配合 hasNext 使用 |
| layout | `string` \| `string[]` | `["pager"]` | 通过控制 layout 属性的顺序,调整分页结构布局 |
Expand All @@ -63,6 +96,8 @@ order: 73
| activePage | `number` \| `string` | `1` | 当前页数 |
| perPage | `number` \| `string` | `10` | 每页显示多条数据 |
| showPerPage | `boolean` | false | 是否展示 perPage 切换器 layout 和 showPerPage 都可以控制 |
| size | `'sm' \| 'md'` | `md` | 组件尺寸,支持`md``sm`设置 |`6.0.0`后支持变量
| ellipsisPageGap | `number` \| `string` | 5 | 多页跳转页数,页数较多出现`...`时点击省略号时每次前进/后退的页数,默认为5 | `6.0.0`后支持变量
| perPageAvailable | `number[]` | `[10, 20, 50, 100]` | 指定每页可以显示多少条 |
| showPageInput | `boolean` | false | 是否显示快速跳转输入框 layout 和 showPageInput 都可以控制 |
| disabled | `boolean` | false | 是否禁用 |
Expand Down
72 changes: 72 additions & 0 deletions docs/zh-CN/components/progress.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,75 @@ List 的内容、Card 卡片的内容配置同上
| strokeWidth | `number` | line 类型为`10`,circle、dashboard 类型为`6` | 进度条线宽度 |
| gapDegree | `number` | `75` | 仪表盘缺角角度,可取值 0 ~ 295 |
| gapPosition | `string` | `bottom` | 仪表盘进度条缺口位置,可选`top bottom left right` |

## 动作表

当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称``componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)

| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------------------ | ------------ |
| reset | - | 将值重置为 0 |
| setValue | `value: string` \| `number` 更新的值 | 更新数据 |

### reset

```schema: scope="body"
{
"type": "page",
"body": [
{
"type": "progress",
"name": "progress",
"id": "progress",
"value": 67
},
{
"type": "button",
"label": "重置值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "progress"
}
]
}
}
}
]
}
```

### setValue

```schema: scope="body"
{
"type": "page",
"body": [
{
"type": "progress",
"name": "progress",
"id": "progress",
"value": 67
},
{
"type": "button",
"label": "设置值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "progress",
"args": {
"value": 20
}
}
]
}
}
}
]
}
```
3 changes: 2 additions & 1 deletion packages/amis-core/src/store/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export const PaginationStore = iRendererStore
perPage: 10,
inputName: '',
outputName: '',
mode: 'normal'
mode: 'normal',
ellipsisPageGap: 5
})
.views(self => ({
get inputItems() {
Expand Down
8 changes: 6 additions & 2 deletions packages/amis-editor-core/scss/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,12 @@
z-index: 0;
}

> .cxd-Page > .cxd-Page-content {
height: auto;
> .cxd-Page {
// 这里主要是为了确保能撑开画布区
display: flex;
> .cxd-Page-content {
height: auto;
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/amis-editor-core/src/component/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,9 @@ export default class Editor extends Component<EditorProps> {
);
if (this.store.activeId === this.curCopySchemaData.$$id) {
// 复制和粘贴是同一个元素,则直接追加到当前元素后面
this.manager.appendSiblingSchema(reGenerateID(curSimpleSchema));
this.manager.appendSiblingSchema(reGenerateID(curSimpleSchema), false);
} else {
this.manager.addElem(reGenerateID(curSimpleSchema));
this.manager.addElem(reGenerateID(curSimpleSchema), false);
}
}
}
Expand Down
Loading

0 comments on commit 65544d0

Please sign in to comment.