Skip to content

Commit d3f4658

Browse files
authored
Merge branch 'feat_v3.x' into hxy/cypress/ci-1111
2 parents 0498272 + f042dc2 commit d3f4658

File tree

22 files changed

+135
-122
lines changed

22 files changed

+135
-122
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "@nutui/nutui-react",
3-
"version": "3.0.0-beta.5",
2+
"name": "@nutui/nutui-react-taro",
3+
"version": "3.0.0-beta.6",
44
"style": "dist/style.css",
55
"main": "dist/nutui.react.umd.js",
66
"module": "dist/es/packages/nutui.react.build.js",
@@ -108,7 +108,7 @@
108108
},
109109
"dependencies": {
110110
"@babel/runtime": "^7.23.9",
111-
"@nutui/icons-react": "^1.0.5",
111+
"@nutui/icons-react": "^2.0.1",
112112
"@nutui/icons-react-taro": "^2.0.1",
113113
"@nutui/jdesign-icons-react-taro": "1.0.6-beta.2",
114114
"@nutui/touch-emulator": "^1.0.0",

packages/nutui-taro-demo/config/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ const config = {
7171
sourceRoot: 'src',
7272
outputRoot: `dist/${process.env.TARO_ENV === 'h5' ? 'demo' : process.env.TARO_ENV}`,
7373
plugins: [...plugins],
74-
compiler: 'webpack5',
74+
compiler: {
75+
type: 'webpack5',
76+
prebundle: {
77+
exclude: ['@nutui/icons-react-taro']
78+
},
79+
},
7580
alias:
7681
process.env.TARO_ENV === 'rn' || process.env.TARO_ENV === 'jdrn'
7782
? {

packages/nutui-taro-demo/src/pages/index/index.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Taro from '@tarojs/taro'
2+
import { useState } from 'react'
23
import {
34
View,
45
Image,
@@ -11,21 +12,19 @@ import {
1112
Video,
1213
Textarea,
1314
} from '@tarojs/components'
15+
import { SearchBar } from '@/packages/searchbar/searchbar.taro'
1416
import pkg from '@/packages/../config.json'
1517
import packageJson from '@/packages/../../package.json'
1618
import './index.scss'
17-
// import Schema from 'async-validator'
1819

1920
const navs = pkg.nav
20-
// console.log(navs)
2121

2222
// hack taro load button xml
2323
console.log(Button, Input, Video, Image, Swiper, SwiperItem, Textarea)
2424

25-
// try {
26-
// console.log('xxx', Schema)
27-
// } catch (e) {}
25+
2826
const Index = () => {
27+
const [search, setSearch] = useState()
2928
const gotoNext = (name: string, enName: string) => {
3029
// 跳转到目的页面,打开新页面
3130
Taro.navigateTo({
@@ -67,15 +66,22 @@ const Index = () => {
6766
</View>
6867
</View>
6968
</View>
70-
<View className="index-components">
69+
70+
<View className='index-components'>
71+
{process.env.NODE_ENV === 'development' ? <>
72+
<SearchBar style={{ background: '#fff' }} placeholder='' value={search} onChange={(e) => {
73+
setSearch(e)
74+
}} />
75+
<View style={{ height: 25 }}></View>
76+
</> : null}
7177
{navs.map((nav) => (
7278
<View key={nav.enName} className="index-components-item">
7379
{nav.enName === 'dataentry' ? null : (
7480
<View className="index-components-item-title">{nav.name}</View>
7581
)}
7682
<View className="index-components-sublist">
7783
{nav.packages.map((com) =>
78-
com.show && com.taro && com.version === '3.0.0' ? (
84+
com.show && com.taro && com.version === '3.0.0' && (!search || new RegExp(search, 'ig').test(com.name.toLowerCase())) ? (
7985
<View
8086
key={com.name}
8187
className="index-components-sublist-item"

src/config.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
"sort": 5,
189189
"show": true,
190190
"taro": true,
191-
"v14": true,
191+
"v15": true,
192192
"author": "yangxiaolu"
193193
},
194194
{
@@ -642,7 +642,7 @@
642642
"sort": 1,
643643
"show": true,
644644
"taro": true,
645-
"v14": true,
645+
"v15": true,
646646
"author": "dsj"
647647
},
648648
{
@@ -687,7 +687,7 @@
687687
"sort": 11,
688688
"show": true,
689689
"taro": true,
690-
"v14": true,
690+
"v15": true,
691691
"author": "dsj"
692692
},
693693
{
@@ -720,7 +720,7 @@
720720
"enName": "feedback",
721721
"packages": [
722722
{
723-
"version": "2.0.0",
723+
"version": "3.0.0",
724724
"name": "ActionSheet",
725725
"type": "component",
726726
"cName": "动作面板",
@@ -773,7 +773,7 @@
773773
"show": true,
774774
"taro": true,
775775
"author": "liukun",
776-
"v14": true
776+
"v15": true
777777
},
778778
{
779779
"version": "3.0.0",
@@ -784,7 +784,7 @@
784784
"sort": 15,
785785
"show": true,
786786
"taro": true,
787-
"v14": true,
787+
"v15": true,
788788
"author": "songsong"
789789
},
790790
{
@@ -899,7 +899,7 @@
899899
"sort": 1,
900900
"show": true,
901901
"taro": true,
902-
"v14": true,
902+
"v15": true,
903903
"author": "VickyYe"
904904
}
905905
]
@@ -1005,7 +1005,7 @@
10051005
"sort": 17,
10061006
"show": true,
10071007
"taro": true,
1008-
"v14": true,
1008+
"v15": true,
10091009
"author": "songsong"
10101010
},
10111011
{
@@ -1050,7 +1050,7 @@
10501050
"sort": 6,
10511051
"show": true,
10521052
"taro": true,
1053-
"v14": true,
1053+
"v15": true,
10541054
"author": "lkjh3214"
10551055
},
10561056
{
@@ -1062,7 +1062,7 @@
10621062
"sort": 6,
10631063
"show": true,
10641064
"taro": true,
1065-
"v14": true,
1065+
"v15": true,
10661066
"author": "lkjh3214"
10671067
},
10681068
{

src/packages/actionsheet/__test__/actionsheet.spec.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ test('props test has value ', async () => {
6363
'.nut-actionsheet-list .nut-actionsheet-item'
6464
)[0]
6565
expect(chooseTagEle).toHaveTextContent('选项一')
66-
expect(chooseTagEle).toHaveClass('danger')
66+
expect(chooseTagEle).toHaveClass(
67+
'nut-actionsheet-item nut-actionsheet-item-danger'
68+
)
6769
})
6870

6971
test('props test choose item and show value', async () => {
@@ -101,7 +103,9 @@ test('props test disabled item has disabled classes', async () => {
101103
'.nut-actionsheet-list .nut-actionsheet-item'
102104
)
103105
const disableItem = options[1]
104-
expect(disableItem).toHaveClass('nut-actionsheet-item disabled')
106+
expect(disableItem).toHaveClass(
107+
'nut-actionsheet-item nut-actionsheet-item-disabled'
108+
)
105109
})
106110

107111
test('props test click disabled item and not call fn', async () => {

src/packages/actionsheet/actionsheet.scss

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,26 @@
2828
line-height: $actionsheet-item-line-height;
2929
font-size: $font-size-base;
3030
color: $actionsheet-item-color;
31-
background-color: $color-background-overlay;
3231
cursor: pointer;
33-
32+
&-name {
33+
text-align: $actionsheet-item-text-align;
34+
line-height: $actionsheet-item-line-height;
35+
font-size: $font-size-base;
36+
color: $actionsheet-item-color;
37+
}
3438
&-description {
3539
display: block;
3640
font-size: $font-size-s;
3741
color: $color-text;
42+
text-align: $actionsheet-item-text-align;
43+
line-height: $actionsheet-item-line-height;
3844
}
3945

40-
&.danger {
46+
&-danger {
4147
color: $actionsheet-item-danger;
4248
}
4349

44-
&.disabled {
50+
&-disabled {
4551
color: $color-text-disabled !important;
4652
cursor: not-allowed;
4753
}

src/packages/actionsheet/actionsheet.taro.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,19 @@ export const ActionSheet: FunctionComponent<
7676
{options.length ? (
7777
<View className={`${classPrefix}-list`}>
7878
{options.map((item, index) => {
79+
const statusClass = `${item.disabled ? `${classPrefix}-item-disabled` : ''} ${item.danger ? `${classPrefix}-item-danger` : ''}`
7980
return (
8081
<View
81-
className={`${classPrefix}-item ${
82-
item.disabled ? 'disabled' : ''
83-
} ${item.danger ? 'danger' : ''}`}
82+
className={`${classPrefix}-item ${statusClass}`}
8483
key={index}
8584
onClick={() => chooseItem(item, index)}
8685
>
87-
{item[optionKey.name]}
88-
<View className={`${classPrefix}-item-description`}>
86+
<View className={`${classPrefix}-item-name ${statusClass}`}>
87+
{item[optionKey.name]}
88+
</View>
89+
<View
90+
className={`${classPrefix}-item-description ${statusClass}`}
91+
>
8992
{item[optionKey.description]}
9093
</View>
9194
</View>

src/packages/actionsheet/actionsheet.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,19 @@ export const ActionSheet: FunctionComponent<
7575
{options.length ? (
7676
<div className={`${classPrefix}-list`}>
7777
{options.map((item, index) => {
78+
const statusClass = `${item.disabled ? `${classPrefix}-item-disabled` : ''} ${item.danger ? `${classPrefix}-item-danger` : ''}`
7879
return (
7980
<div
80-
className={`${classPrefix}-item ${
81-
item.disabled ? 'disabled' : ''
82-
} ${item.danger ? 'danger' : ''}`}
81+
className={`${classPrefix}-item ${statusClass}`}
8382
key={index}
8483
onClick={() => chooseItem(item, index)}
8584
>
86-
{item[optionKey.name]}
87-
<div className={`${classPrefix}-item-description`}>
85+
<div className={`${classPrefix}-item-name ${statusClass}`}>
86+
{item[optionKey.name]}
87+
</div>
88+
<div
89+
className={`${classPrefix}-item-description ${statusClass}`}
90+
>
8891
{item[optionKey.description]}
8992
</div>
9093
</div>

src/packages/actionsheet/demos/taro/demo1.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState } from 'react'
22
import { ActionSheet, Cell } from '@nutui/nutui-react-taro'
33
import { View } from '@tarojs/components'
4+
import pxTransform from '@/utils/px-transform'
45

56
const Demo1 = () => {
67
const [val, setVal] = useState('')
@@ -25,8 +26,10 @@ const Demo1 = () => {
2526
return (
2627
<>
2728
<Cell onClick={() => setIsVisible(!isVisible)}>
28-
<span>基础用法</span>
29-
<View style={{ marginInlineStart: '10px', color: '#999' }}>{val}</View>
29+
<View>基础用法</View>
30+
<View style={{ marginLeft: pxTransform(10), color: '#999' }}>
31+
{val}
32+
</View>
3033
</Cell>
3134
<ActionSheet
3235
title="标题"

src/packages/actionsheet/demos/taro/demo2.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState } from 'react'
22
import { ActionSheet, Cell } from '@nutui/nutui-react-taro'
33
import { View } from '@tarojs/components'
4+
import pxTransform from '@/utils/px-transform'
45

56
const Demo2 = () => {
67
const [isVisible, setIsVisible] = useState(false)
@@ -23,8 +24,10 @@ const Demo2 = () => {
2324
return (
2425
<>
2526
<Cell onClick={() => setIsVisible(!isVisible)}>
26-
<span>展示取消按钮</span>
27-
<View style={{ marginInlineStart: '10px', color: '#999' }}>{val}</View>
27+
<View>展示取消按钮</View>
28+
<View style={{ marginLeft: pxTransform(10), color: '#999' }}>
29+
{val}
30+
</View>
2831
</Cell>
2932
<ActionSheet
3033
visible={isVisible}

0 commit comments

Comments
 (0)