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

feat: pagination 增加 few模式。 #1446

Merged
merged 91 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from 89 commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
3cdd8d5
feat: 日历组件支持在 footer 部分的children自定义,增加demo 日历+datepicker的交互demo
xiaoyatong Aug 2, 2023
1c260c6
docs: 补充文档
xiaoyatong Aug 2, 2023
d5b7cf9
fix: review
xiaoyatong Aug 3, 2023
e6af187
Merge branch 'jdf2e:next' into next-new
xiaoyatong Aug 3, 2023
2f2f52c
Merge branch 'next-new' into next-theme
xiaoyatong Aug 3, 2023
bad3b22
feat: 修改名字,废弃-0
xiaoyatong Aug 3, 2023
6885536
feat: 修订名称。
xiaoyatong Aug 4, 2023
543b928
Merge branch 'jdf2e:next' into next-new
xiaoyatong Aug 9, 2023
1d1b477
Merge branch 'next-new' into next-theme
xiaoyatong Aug 9, 2023
aeb07fe
feat: 通用字号。
xiaoyatong Aug 9, 2023
6f1b27b
feat: 通用+button,button的样式展示逻辑做了修订。
xiaoyatong Aug 9, 2023
53aa65e
docs: button
xiaoyatong Aug 9, 2023
cf26bcb
feat: button 增加 rightIcon ,增加仅有icon的样式处理。
xiaoyatong Aug 9, 2023
c947b16
chore: add templates (#1327)
oasis-cloud Aug 28, 2023
7cff81f
feat: support next.js (#1326)
oasis-cloud Aug 28, 2023
a99b9bd
fix: dialog content 失效 (#1323)
oasis-cloud Aug 28, 2023
d7cae1c
Merge branch 'next-theme' of https://github.com/xiaoyatong/nutui-reac…
xiaoyatong Aug 29, 2023
d53f7a2
fix: 修复重复代码。
xiaoyatong Aug 29, 2023
72ab8e1
Merge branch 'jdf2e:next-theme' into next-theme
xiaoyatong Aug 29, 2023
2ac86b9
chore(ci): add renovate (#1338)
renovate[bot] Aug 29, 2023
2d73fc7
feat: checkbox
xiaoyatong Aug 29, 2023
f669375
chore(deps): update actions-cool/issues-helper action to v3 (#1341)
renovate[bot] Aug 29, 2023
c356046
chore(deps): update actions/setup-node action to v3 (#1343)
renovate[bot] Aug 29, 2023
d60f17d
chore(deps): update actions/checkout action to v3 (#1342)
renovate[bot] Aug 29, 2023
cd1d64f
chore(tabs): 更新文档与 demo (#1339)
eiinu Aug 29, 2023
b8da9b0
fix: checkbox review fix
xiaoyatong Aug 29, 2023
16d2f88
Merge branch 'jdf2e:next-theme' into next-theme
xiaoyatong Aug 29, 2023
f2e7736
chore: 模板配置修改 (#1352)
oasis-cloud Aug 30, 2023
fe7b76b
chore(deps): update commitlint monorepo to v17 (#1348)
renovate[bot] Aug 30, 2023
a5e8a18
chore(deps): update dependency husky to v8 (#1349)
renovate[bot] Aug 30, 2023
5135006
chore(deps): update dependency lint-staged to v14 (#1350)
renovate[bot] Aug 30, 2023
32f9103
chore(release): v2.0.15
oasis-cloud Aug 30, 2023
75f8221
chore(deps): update dependency eslint-config-prettier to v9 (#1355)
renovate[bot] Aug 30, 2023
98c2cc8
chore(deps): update dependency eslint-plugin-markdown to v3 (#1356)
renovate[bot] Aug 30, 2023
30cb37a
chore(deps): update dependency eslint-plugin-unused-imports to v3 (#1…
renovate[bot] Aug 30, 2023
bb8790a
chore: rm package lock file
oasis-cloud Aug 30, 2023
a7f5cdb
chore(deps): update dependency eslint to v8 (#1363)
renovate[bot] Aug 30, 2023
1fa34c8
chore(deps): update dependency release-it to v16 (#1364)
renovate[bot] Aug 31, 2023
d51a198
fix(deps): update dependency chalk to v5 (#1366)
renovate[bot] Aug 31, 2023
7ed60ba
Merge branch 'jdf2e:next-theme' into next-theme
xiaoyatong Sep 1, 2023
21474cc
fix: csstransition using findDOMNode which is deprecated (#1370)
oasis-cloud Sep 4, 2023
3aa5bf1
fix: 多个 Swipe 的滑动选项完全相等 (#1334)
clayzx Sep 4, 2023
4677668
chore(deps): update dependency @types/react-syntax-highlighter to v15…
renovate[bot] Sep 4, 2023
edae423
chore(deps): update dependency @testing-library/react to v14 (#1377)
renovate[bot] Sep 4, 2023
4dd95e4
chore(deps): update dependency @types/node to v18 (#1381)
renovate[bot] Sep 4, 2023
e91f905
chore(deps): update dependency @rollup/plugin-commonjs to v25 (#1375)
renovate[bot] Sep 4, 2023
85097d4
chore(deps): update dependency @testing-library/jest-dom to v6 (#1376)
renovate[bot] Sep 4, 2023
9866739
docs: toast组件完善了样式变量 (#1379)
ivan-My Sep 4, 2023
acdc131
fix(pulltorefresh): 修复 H5 卡顿 & 小程序滑动距离问题
eiinu Sep 4, 2023
c5fc137
chore(deps): update dependency stylelint to v15 (#1387)
renovate[bot] Sep 4, 2023
069dced
fix: swipe 阻止页面滚动 (#1380)
oasis-cloud Sep 5, 2023
1cbf930
feat: form 支持分割线 (#1389)
oasis-cloud Sep 6, 2023
9941ad0
fix: dialog 的函数调用增加对 classname 和 style 的支持 (#1391)
oasis-cloud Sep 6, 2023
6de12d0
chore(deps): update dependency prettier to v3 (#1386)
renovate[bot] Sep 6, 2023
4b0b1de
fix: useForm 在类组件下报错,可以采用 ref 的方式使用 FormInstance (#1383)
oasis-cloud Sep 6, 2023
98af0b2
chore(deps): update dependency eslint-plugin-prettier to v5 (#1385)
renovate[bot] Sep 6, 2023
878691e
Merge branch 'jdf2e:next-theme' into next-theme
xiaoyatong Sep 6, 2023
cd6dc93
chore(deps): update dependency eslint-config-airbnb to v19 (#1384)
renovate[bot] Sep 6, 2023
4e546ed
chore(deps): update dependency axios to v1 (#1392)
renovate[bot] Sep 6, 2023
0c7c509
chore(deps): update dependency fs-extra to v11 (#1393)
renovate[bot] Sep 6, 2023
9b9657c
chore(deps): update actions/checkout action to v4 (#1396)
renovate[bot] Sep 6, 2023
5c19e86
chore(deps): update dependency marked to v8 (#1395)
renovate[bot] Sep 6, 2023
f2646ff
chore(deps): update dependency glob to v10 (#1394)
renovate[bot] Sep 6, 2023
ba33129
chore(release): v2.0.16
oasis-cloud Sep 6, 2023
868433b
chore: deps update
oasis-cloud Sep 6, 2023
d995623
chore(deps): update dependency prettier to v3 (#1403)
renovate[bot] Sep 7, 2023
967c45c
fix: table expose rowIndex (#1400)
oasis-cloud Sep 7, 2023
7020d1f
Merge branch 'jdf2e:next-theme' into next-theme
xiaoyatong Sep 8, 2023
b017770
fix: lint errors (#1406)
xiaoyatong Sep 8, 2023
ce11ca7
chore(deps): update typescript-eslint monorepo to v6 (#1404)
renovate[bot] Sep 11, 2023
bf3e7b0
chore(deps): update all non-major dependencies (#1419)
renovate[bot] Sep 11, 2023
95eba1f
chore(deps): update dependency inquirer to v9 (#1420)
renovate[bot] Sep 11, 2023
eef15e7
chore(deps): update dependency marked to v9 (#1421)
renovate[bot] Sep 11, 2023
2f2f0af
fix: review package update (#1423)
xiaoyatong Sep 11, 2023
dabb49d
chore: swc 版本恢复 (#1425)
oasis-cloud Sep 11, 2023
3e4fb09
fix: button 使用问题修复
xiaoyatong Sep 12, 2023
d6b617c
Merge branch 'next' into next-theme
xiaoyatong Sep 12, 2023
9736ee7
chore: glob & prettier update (#1427)
xiaoyatong Sep 13, 2023
1606904
fix: form label position left (#1412)
oasis-cloud Sep 13, 2023
c207b9f
Revert "fix(pulltorefresh): 修复 H5 卡顿 & 小程序滑动距离问题" (#1431)
eiinu Sep 13, 2023
2f31877
fix: toast组件 duration 设置无效 (#1424)
oasis-cloud Sep 13, 2023
bd35cc9
feat: form 增加 validateTrigger 和 getFieldsValue (#1411)
oasis-cloud Sep 13, 2023
11bd1ad
fix: swipe component fails to slide in Alipay (#1399)
oasis-cloud Sep 13, 2023
c08d276
fix: add popupProps (#1426)
oasis-cloud Sep 13, 2023
45b264c
chore(release): v2.0.17
oasis-cloud Sep 13, 2023
66dbd2c
Merge branch 'next-theme' of https://github.com/xiaoyatong/nutui-reac…
xiaoyatong Sep 14, 2023
ae450b4
Merge branch 'next' into next-theme
xiaoyatong Sep 14, 2023
d27d0c1
Merge branch 'jdf2e:next-theme' into next-theme
xiaoyatong Sep 14, 2023
db5a17e
feat: pagination 适配 v12
xiaoyatong Sep 14, 2023
2ab6e1b
fix: review fixed
xiaoyatong Sep 15, 2023
40b134d
fix: review fixed
xiaoyatong Sep 15, 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
14 changes: 14 additions & 0 deletions src/packages/pagination/demo.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Header from '@/sites/components/header'
interface T {
basic: string
simple: string
few: string
ellipse: string
custom: string
uncontrolled: string
Expand All @@ -18,20 +19,23 @@ const PaginationDemo = () => {
'zh-CN': {
basic: '基础用法',
simple: '简单模式',
few: '少量模式',
ellipse: '显示省略号',
custom: '自定义按钮',
uncontrolled: '非受控方式',
},
'zh-TW': {
basic: '基礎用法',
simple: '簡單模式',
few: '少量模式',
ellipse: '顯示省略號',
custom: '自定義按鈕',
uncontrolled: '非受控方式',
},
'en-US': {
basic: 'Basic usage',
simple: 'Simple mode',
few: 'Few Mode',
ellipse: 'Show ellipsis',
custom: 'Custom button',
uncontrolled: 'Uncontrolled mode',
Expand Down Expand Up @@ -87,6 +91,16 @@ const PaginationDemo = () => {
onChange={pageChange2}
/>
</Cell>
<h2>{translated.few}</h2>
<Cell>
<Pagination
value={currentPage2}
total={12}
pageSize={1}
mode="few"
onChange={pageChange2}
/>
</Cell>
<h2>{translated.ellipse}</h2>
<Cell>
<Pagination
Expand Down
14 changes: 14 additions & 0 deletions src/packages/pagination/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useTranslate } from '../../sites/assets/locale'
interface T {
basic: string
simple: string
few: string
ellipse: string
custom: string
uncontrolled: string
Expand All @@ -17,20 +18,23 @@ const PaginationDemo = () => {
'zh-CN': {
basic: '基础用法',
simple: '简单模式',
few: '少量模式',
ellipse: '显示省略号',
custom: '自定义按钮',
uncontrolled: '非受控方式',
},
'zh-TW': {
basic: '基礎用法',
simple: '簡單模式',
few: '少量模式',
ellipse: '顯示省略號',
custom: '自定義按鈕',
uncontrolled: '非受控方式',
},
'en-US': {
basic: 'Basic usage',
simple: 'Simple mode',
few: 'Few Mode',
ellipse: 'Show ellipsis',
custom: 'Custom button',
uncontrolled: 'Uncontrolled mode',
Expand Down Expand Up @@ -84,6 +88,16 @@ const PaginationDemo = () => {
onChange={pageChange2}
/>
</Cell>
<h2>{translated.few}</h2>
<Cell>
<Pagination
value={currentPage2}
total={12}
pageSize={1}
mode="few"
onChange={pageChange2}
/>
</Cell>
<h2>{translated.ellipse}</h2>
<Cell>
<Pagination
Expand Down
8 changes: 7 additions & 1 deletion src/packages/pagination/doc.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,14 @@ The component provides the following CSS variables, which can be used to customi
| \--nutui-pagination-color | font color | `$color-primary` |
| \--nutui-pagination-font-size | font size | `$font-size` |
| \--nutui-pagination-item-border-color | border color | `$color-border` |
| \--nutui-pagination-active-background-color | background color of current page | `$color-primary` |
| \--nutui-pagination-disable-color | disable color | `$color-text-disable` |
| \--nutui-pagination-disable-background-color | disable background color | `$color-text-disable` |
| \--nutui-pagination-item-border-width | border width | `1px` |
| \--nutui-pagination-item-border-radius | border radius | `2px` |
| \--nutui-pagination-prev-next-padding | padding | `0 11px` |
| \--nutui-pagination-prev-next-padding | padding | `0 11px` |
| \--nutui-pagination-few-width | Few mode width | `40px` |
| \--nutui-pagination-few-height | Few mode height | `20px` |
| \--nutui-pagination-few-radius| Few mode radius | `12px` |
| \--nutui-pagination-few-background-color | Few mode background color | `var(--nutui-black-7)` |
| \--nutui-pagination-few-active-background-color | Few mode background color of current page | `var(--nutui-black-5)` |
8 changes: 7 additions & 1 deletion src/packages/pagination/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,14 @@ export default App;
| \--nutui-pagination-color | 页码字色 | `$color-primary` |
| \--nutui-pagination-font-size | 页码字号 | `$font-size` |
| \--nutui-pagination-item-border-color | 边框颜色 | `$color-border` |
| \--nutui-pagination-active-background-color | 当前页码的背景色 | `$color-primary` |
| \--nutui-pagination-disable-color | 不可用色 | `$color-text-disable` |
| \--nutui-pagination-disable-background-color | 不可用背景色 | `$color-text-disable` |
| \--nutui-pagination-item-border-width | 边框宽度 | `1px` |
| \--nutui-pagination-item-border-radius | 边框圆角 | `2px` |
| \--nutui-pagination-prev-next-padding | padding 值 | `0 11px` |
| \--nutui-pagination-prev-next-padding | padding 值 | `0 11px` |
| \--nutui-pagination-few-width | Few模式下的宽度 | `40px` |
| \--nutui-pagination-few-height | Few模式下的高度 | `20px` |
| \--nutui-pagination-few-radius| Few模式下的圆角 | `12px` |
| \--nutui-pagination-few-background-color | Few模式下的默认背景色 | `var(--nutui-black-7)` |
| \--nutui-pagination-few-active-background-color | Few模式下的当前选中的背景色 | `var(--nutui-black-5)` |
8 changes: 7 additions & 1 deletion src/packages/pagination/doc.taro.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,14 @@ export default App;
| \--nutui-pagination-color | 页码字色 | `$color-primary` |
| \--nutui-pagination-font-size | 页码字号 | `$font-size` |
| \--nutui-pagination-item-border-color | 边框颜色 | `$color-border` |
| \--nutui-pagination-active-background-color | 当前页码的背景色 | `$color-primary` |
| \--nutui-pagination-disable-color | 不可用色 | `$color-text-disable` |
| \--nutui-pagination-disable-background-color | 不可用背景色 | `$color-text-disable` |
| \--nutui-pagination-item-border-width | 边框宽度 | `1px` |
| \--nutui-pagination-item-border-radius | 边框圆角 | `2px` |
| \--nutui-pagination-prev-next-padding | padding 值 | `0 11px` |
| \--nutui-pagination-prev-next-padding | padding 值 | `0 11px` |
| \--nutui-pagination-few-width | Few模式下的宽度 | `40px` |
| \--nutui-pagination-few-height | Few模式下的高度 | `20px` |
| \--nutui-pagination-few-radius| Few模式下的圆角 | `12px` |
| \--nutui-pagination-few-background-color | Few模式下的默认背景色 | `var(--nutui-black-7)` |
| \--nutui-pagination-few-active-background-color | Few模式下的当前选中的背景色 | `var(--nutui-black-5)` |
8 changes: 7 additions & 1 deletion src/packages/pagination/doc.zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,14 @@ export default App;
| \--nutui-pagination-color | 頁碼字色 | `$color-primary` |
| \--nutui-pagination-font-size | 頁碼字號 | `$font-size` |
| \--nutui-pagination-item-border-color | 邊框顏色 | `$color-border` |
| \--nutui-pagination-active-background-color | 當前頁碼的背景色 | `$color-primary` |
| \--nutui-pagination-disable-color | 不可用色 | `$color-text-disable` |
| \--nutui-pagination-disable-background-color | 不可用背景色 | `$color-text-disable` |
| \--nutui-pagination-item-border-width | 邊框寬度 | `1px` |
| \--nutui-pagination-item-border-radius | 邊框圓角 | `2px` |
| \--nutui-pagination-prev-next-padding | padding 值 | `0 11px` |
| \--nutui-pagination-prev-next-padding | padding 值 | `0 11px` |
| \--nutui-pagination-few-width | Few模式下的寬度 | `40px` |
| \--nutui-pagination-few-height | Few模式下的高度 | `20px` |
| \--nutui-pagination-few-radius| Few模式下的圓角 | `12px` |
| \--nutui-pagination-few-background-color | Few模式下的默認背景色 | `var(--nutui-black-7)` |
| \--nutui-pagination-few-active-background-color | Few模式下的當前選中的背景色 | `var(--nutui-black-5)` |
23 changes: 23 additions & 0 deletions src/packages/pagination/pagination.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,27 @@
background-color: $pagination-disable-background-color;
cursor: not-allowed;
}

&-few {
width: $pagination-few-width;
height: $pagination-few-height;
display: flex;
font-size: $font-size-xs;
color: $color-primary-text;
background-color: $pagination-few-background-color;
border-radius: $pagination-few-radius;
&-active,
&-default {
display: flex;
align-items: center;
justify-content: center;
width: $pagination-few-height;
height: $pagination-few-height;
}
&-active {
border-radius: $pagination-few-radius;
font-size: $font-size-small;
background-color: $pagination-few-active-background-color;
}
}
}
97 changes: 55 additions & 42 deletions src/packages/pagination/pagination.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { BasicComponent, ComponentDefaults } from '@/utils/typings'
export interface PaginationProps extends BasicComponent {
defaultValue: number
value: number
mode: 'multi' | 'simple'
mode: 'multi' | 'simple' | 'few'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改为 lite 或 capsule ?

prev: ReactNode
next: ReactNode
total: number
Expand Down Expand Up @@ -106,51 +106,64 @@ export const Pagination: FunctionComponent<

return (
<div className={classNames(classPrefix, className)} {...rest}>
<div
className={classNames(
`${classPrefix}__prev`,
mode === 'multi' ? '' : 'simple-border',
currentPage === 1 ? 'disabled' : ''
)}
onClick={(e) => handleSelectPage(currentPage - 1)}
>
{prev || locale.pagination.prev}
</div>
{mode === 'multi' && (
<div className={`${classPrefix}__contain`}>
{pages.map((item: any, index: number) => {
return (
<div
key={`${index}pagination`}
className={classNames(`${classPrefix}__item`, {
active: item.number === currentPage,
})}
onClick={(e) => {
item.number !== currentPage && handleSelectPage(item.number)
}}
>
{itemRender ? itemRender(item) : item.text}
{(mode === 'multi' || mode === 'simple') && (
<>
<div
className={classNames(
`${classPrefix}__prev`,
mode === 'multi' ? '' : 'simple-border',
currentPage === 1 ? 'disabled' : ''
)}
onClick={(e) => handleSelectPage(currentPage - 1)}
>
{prev || locale.pagination.prev}
</div>
{mode === 'multi' && (
<div className={`${classPrefix}__contain`}>
{pages.map((item: any, index: number) => {
return (
<div
key={`${index}pagination`}
className={classNames(`${classPrefix}__item`, {
active: item.number === currentPage,
})}
onClick={(e) => {
item.number !== currentPage &&
handleSelectPage(item.number)
}}
>
{itemRender ? itemRender(item) : item.text}
</div>
)
})}
</div>
)}
{mode === 'simple' && (
<div className={`${classPrefix}__contain`}>
<div className={`${classPrefix}__simple`}>
{currentPage}/{pageCount}
</div>
)
})}
</div>
</div>
)}
<div
className={classNames(
`${classPrefix}__next`,
currentPage >= pageCount ? 'disabled' : ''
)}
onClick={(e) => handleSelectPage(currentPage + 1)}
>
{next || locale.pagination.next}
</div>
</>
)}
{mode === 'simple' && (
<div className={`${classPrefix}__contain`}>
<div className={`${classPrefix}__simple`}>
{currentPage}/{pageCount}
{mode === 'few' && (
<>
<div className={`${classPrefix}-few`}>
<div className={`${classPrefix}-few-active`}>{2}</div>
<div className={`${classPrefix}-few-default`}>{8}</div>
</div>
</div>
</>
)}
<div
className={classNames(
`${classPrefix}__next`,
currentPage >= pageCount ? 'disabled' : ''
)}
onClick={(e) => handleSelectPage(currentPage + 1)}
>
{next || locale.pagination.next}
</div>
</div>
)
}
Expand Down
Loading