Skip to content

Commit ab6d0d9

Browse files
committed
feat: 图片集放大显示模式优化
1 parent f575308 commit ab6d0d9

File tree

12 files changed

+34
-301
lines changed

12 files changed

+34
-301
lines changed

Diff for: docs/zh-CN/components/image.md

-17
Original file line numberDiff line numberDiff line change
@@ -431,22 +431,6 @@ List 的内容、Card 卡片的内容配置同上
431431
}
432432
```
433433

434-
## 内嵌模式
435-
436-
配置`"embed": true`,显示图片内嵌模式
437-
438-
```schema
439-
{
440-
"type": "page",
441-
"body": {
442-
"type": "image",
443-
"src": "https://internal-amis-res.cdn.bcebos.com/images/2020-1/1578395692722/4f3cb4202335.jpeg@s_0,w_216,l_1,f_jpg,q_80",
444-
"embed": true,
445-
"showToolbar": true
446-
}
447-
}
448-
```
449-
450434
## 属性表
451435

452436
| 属性名 | 类型 | 默认值 | 说明 | 版本 |
@@ -474,7 +458,6 @@ List 的内容、Card 卡片的内容配置同上
474458
| imageMode | `string` | `thumb` | 图片展示模式,可选:`'thumb'`, `'original'` 即:缩略图模式 或者 原图模式 |
475459
| showToolbar | `boolean` | `false` | 放大模式下是否展示图片的工具栏 | `2.2.0` |
476460
| toolbarActions | `ImageAction[]` | | 图片工具栏,支持旋转,缩放,默认操作全部开启 | `2.2.0` |
477-
| embed | `boolean` | | 内嵌模式,当是 `true` 开启内嵌显示 | `3.5.3` |
478461
| maxScale | `number`[模板](../../docs/concepts/template) | | 执行调整图片比例动作时的最大百分比 | `3.4.4` |
479462
| minScale | `number`[模板](../../docs/concepts/template) | | 执行调整图片比例动作时的最小百分比 | `3.4.4` |
480463

Diff for: docs/zh-CN/components/images.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,8 @@ Array<{
420420

421421
## 内嵌模式
422422

423+
> 6.0.1 及以上版本
424+
423425
**images 组件** 上,配置`embed``true`,支持放大预览
424426

425427
```schema
@@ -730,7 +732,7 @@ List 的内容、Card 卡片的内容配置同上。
730732
| thumbRatio | `string` | `1:1` | 预览图比例,可选:`'1:1'`, `'4:3'`, `'16:9'` |
731733
| showToolbar | `boolean` | `false` | 放大模式下是否展示图片的工具栏 | `2.2.0` |
732734
| toolbarActions | `ImageAction[]` | | 图片工具栏,支持旋转,缩放,默认操作全部开启 | `2.2.0` |
733-
| embed | `boolean` | `false` | 内嵌模式,当是 `true` 开启内嵌显示 | `3.5.3` |
734-
| imageStyle | `object` | | 设置图片列表每一项的style | `3.5.3` |
735-
| position.toolbar | `top' \| 'bottom'` | `'bottom'` | 设置图片放大时,工具栏位置 | `3.5.3` |
736-
| position.description | `'left' \| 'right'` | `'right'` | 设置图片放大时,描述对应显示框位置 | `3.5.3` |
735+
| embed | `boolean` | `false` | 内嵌模式,当是 `true` 开启内嵌显示 | `6.0.1` |
736+
| imageStyle | `object` | | 设置图片列表每一项的style | `6.0.1` |
737+
| position.toolbar | `top' \| 'bottom'` | `'bottom'` | 设置图片放大时,工具栏位置 | `6.0.1` |
738+
| position.description | `'left' \| 'right'` | `'right'` | 设置图片放大时,描述对应显示框位置 | `6.0.1` |

Diff for: packages/amis-ui/scss/components/_drag-progress.scss

-64
This file was deleted.

Diff for: packages/amis-ui/scss/components/_image-gallery.scss

+4-5
Original file line numberDiff line numberDiff line change
@@ -442,19 +442,18 @@
442442
}
443443
}
444444

445+
&-range {
446+
width: px2rem(200px);
447+
}
448+
445449
&-pagination {
446450
flex: 1;
447451
text-align: right;
448452

449453
> ul {
450-
width: px2rem(102px);
451454

452455
li {
453456
color: var(--white);
454-
455-
span {
456-
min-width: unset;
457-
}
458457

459458
svg {
460459
color: var(--white);

Diff for: packages/amis-ui/scss/components/_images.scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
.#{$ns}Images {
44
display: grid;
5-
grid-template-columns: repeat(auto-fill, 120px);
6-
grid-row-gap: 8px;
7-
grid-column-gap: 8px;
5+
grid-template-columns: repeat(auto-fill, px2rem(120px));
6+
grid-row-gap: px2rem(8px);
7+
grid-column-gap: px2rem(8px);
88
margin: calc(var(--gap-xs) * -1);
99

1010
&-item {

Diff for: packages/amis-ui/scss/themes/_common.scss

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
@import '../components/wrapper';
6868
@import '../components/status';
6969
@import '../components/carousel';
70-
@import '../components/drag-progress';
7170
@import '../components/sliding';
7271
@import '../components/image-gallery';
7372
@import '../components/images';

Diff for: packages/amis-ui/src/components/DragProgress.tsx

-156
This file was deleted.

Diff for: packages/amis-ui/src/components/ImageGallery.tsx

+12-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {autobind} from 'amis-core';
55
import Modal from './Modal';
66
import {Icon} from './icons';
77
import {LocaleProps, localeable} from 'amis-core';
8+
import Range from './Range';
89
import Spinner, {SpinnerExtraProps} from './Spinner';
910
import DragProgress from './DragProgress';
1011
import Sliding from './Sliding';
@@ -135,7 +136,7 @@ export class ImageGallery extends React.Component<
135136
},
136137
{
137138
key: ImageActionKey.DOWNLOAD,
138-
icon: 'download-new',
139+
icon: 'image-download',
139140
label: 'download'
140141
},
141142
{
@@ -356,7 +357,6 @@ export class ImageGallery extends React.Component<
356357
setIndex(cIndex: number) {
357358
const {items, index} = this.state;
358359
const bool = items[index].originalSrc === items[cIndex].originalSrc;
359-
console.log(bool);
360360
this.setState({
361361
index: cIndex,
362362
imageLoading: !bool,
@@ -488,7 +488,7 @@ export class ImageGallery extends React.Component<
488488
}
489489

490490
renderToolbar(actions: ImageAction[]) {
491-
const {classnames: cx, translate: __, className, embed} = this.props;
491+
const {classnames: cx, translate: __, className} = this.props;
492492
const {scale, index, items} = this.state;
493493

494494
return (
@@ -497,12 +497,15 @@ export class ImageGallery extends React.Component<
497497
{actions.map(action => {
498498
if (action.key === ImageActionKey.DRAG) {
499499
return (
500-
<DragProgress
501-
value={scale}
502-
onChange={this.handleDragProgress}
503-
skin={embed ? 'light' : 'dark'}
504-
max={2}
505-
/>
500+
<div className={cx('ImageGallery-toolbar-range')}>
501+
<Range
502+
onChange={this.handleDragProgress}
503+
value={scale * 100}
504+
step={1}
505+
min={0}
506+
max={200}
507+
/>
508+
</div>
506509
);
507510
}
508511

Diff for: packages/amis-ui/src/components/Pagination.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ export interface BasicPaginationProps {
113113
*/
114114
size?: string;
115115

116+
/**
117+
* 简单模式不显示输入框
118+
*/
119+
hasInputNumber?: boolean;
120+
116121
onPageChange?: (page: number, perPage?: number, dir?: string) => void;
117122
}
118123
export interface PaginationProps

0 commit comments

Comments
 (0)