Skip to content

Commit 3fd6c9c

Browse files
committed
fix: merge
2 parents fb84882 + 2d0aa82 commit 3fd6c9c

File tree

15 files changed

+315
-58
lines changed

15 files changed

+315
-58
lines changed

src/packages/ellipsis/ellipsis.taro.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import React, { FunctionComponent, useState, useRef, useEffect } from 'react'
22
import { nextTick, createSelectorQuery } from '@tarojs/taro'
33
import classNames from 'classnames'
44
import { View } from '@tarojs/components'
5-
import { getRectInMultiPlatform } from '@/utils/taro/get-rect'
5+
import {
6+
getRectInMultiPlatform,
7+
getRectInMultiPlatformWithoutCache,
8+
} from '@/utils/taro/get-rect'
69
import { ComponentDefaults } from '@/utils/typings'
710
import { useRtl } from '../configprovider/index.taro'
811
import { TaroEllipsisProps } from '@/types'
@@ -195,7 +198,7 @@ export const Ellipsis: FunctionComponent<
195198

196199
// 验证省略号
197200
const verifyEllipsis = async () => {
198-
const refe = await getRectInMultiPlatform(rootContain.current)
201+
const refe = await getRectInMultiPlatformWithoutCache(rootContain.current)
199202
if (refe && refe.height && refe.height > maxHeight.current) {
200203
if (direction === 'end') {
201204
ellipsis.current.leading = ellipsis.current?.leading?.slice(

src/packages/price/demo.taro.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import Demo6 from './demos/taro/demo6'
1212
import Demo7 from './demos/taro/demo7'
1313
import Demo8 from './demos/taro/demo8'
1414
import Demo9 from './demos/taro/demo9'
15+
import Demo10 from './demos/taro/demo10'
16+
import Demo11 from './demos/taro/demo11'
1517

1618
const PriceDemo = () => {
1719
const [translated] = useTranslate({
@@ -25,6 +27,8 @@ const PriceDemo = () => {
2527
title7: '不展示 symbol 符号',
2628
title8: '划线价',
2729
title9: '场域分类:原子级、模块级、列表级、页面级',
30+
title10: '自定义颜色',
31+
title11: '数据原样输出',
2832
},
2933
'zh-TW': {
3034
title1: '支持尺寸:small、normal、large、xlarge',
@@ -36,6 +40,8 @@ const PriceDemo = () => {
3640
title7: '不展示 symbol 符號',
3741
title8: '劃線價',
3842
title9: '場域分類:原子級、模塊級、列表級、頁面級',
43+
title10: '自定義顏色',
44+
title11: '數據原樣輸出',
3945
},
4046
'en-US': {
4147
title1: 'Support sizes:small、normal、large、xlarge',
@@ -48,6 +54,8 @@ const PriceDemo = () => {
4854
title7: 'Do not display symbol',
4955
title8: 'Line-through price',
5056
title9: 'Field classification: atomic, module, list, page',
57+
title10: 'Custom color',
58+
title11: 'Data original output',
5159
},
5260
})
5361
return (
@@ -72,6 +80,10 @@ const PriceDemo = () => {
7280
<Demo7 />
7381
<View className="h2">{translated.title8}</View>
7482
<Demo8 />
83+
<View className="h2">{translated.title10}</View>
84+
<Demo10 />
85+
<View className="h2">{translated.title11}</View>
86+
<Demo11 />
7587
</ScrollView>
7688
</>
7789
)

src/packages/price/demo.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import Demo6 from './demos/h5/demo6'
99
import Demo7 from './demos/h5/demo7'
1010
import Demo8 from './demos/h5/demo8'
1111
import Demo9 from './demos/h5/demo9'
12+
import Demo10 from './demos/h5/demo10'
13+
import Demo11 from './demos/h5/demo11'
1214

1315
const PriceDemo = () => {
1416
const [translated] = useTranslate({
@@ -22,6 +24,8 @@ const PriceDemo = () => {
2224
title7: '不展示 symbol 符号',
2325
title8: '划线价',
2426
title9: '场域分类:原子级、模块级、列表级、页面级',
27+
title10: '自定义颜色',
28+
title11: '数据原样输出',
2529
},
2630
'zh-TW': {
2731
title1: '支持尺寸:small、normal、large、xlarge',
@@ -45,6 +49,8 @@ const PriceDemo = () => {
4549
title7: 'Do not display symbol',
4650
title8: 'Line-through price',
4751
title9: 'Field classification: atomic, module, list, page',
52+
title10: 'Custom color',
53+
title11: 'Data original output',
4854
},
4955
})
5056

@@ -68,6 +74,10 @@ const PriceDemo = () => {
6874
<Demo7 />
6975
<h2>{translated.title8}</h2>
7076
<Demo8 />
77+
<h2>{translated.title10}</h2>
78+
<Demo10 />
79+
<h2>{translated.title11}</h2>
80+
<Demo11 />
7181
</div>
7282
)
7383
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react'
2+
import { Price, Cell, CellGroup } from '@nutui/nutui-react'
3+
4+
const Demo10 = () => {
5+
return (
6+
<CellGroup>
7+
<Cell>
8+
<Price price={618.68} size="small" thousands color="darkgray" />
9+
</Cell>
10+
<Cell>
11+
<Price price={618.68} size="normal" thousands color="dark" />
12+
</Cell>
13+
<Cell>
14+
<Price price={618.68} size="large" thousands color="blue" />
15+
</Cell>
16+
<Cell>
17+
<Price price={618.68} size="xlarge" thousands color="#b5691a" />
18+
</Cell>
19+
</CellGroup>
20+
)
21+
}
22+
export default Demo10
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react'
2+
import { Price, Cell, CellGroup } from '@nutui/nutui-react'
3+
4+
const Demo11 = () => {
5+
return (
6+
<CellGroup>
7+
<Cell>
8+
<Price price={618} size="small" thousands digits={null} />
9+
</Cell>
10+
<Cell>
11+
<Price price={618.6} size="normal" thousands digits={null} />
12+
</Cell>
13+
<Cell>
14+
<Price price={618.18} size="large" thousands digits={null} />
15+
</Cell>
16+
<Cell>
17+
<Price price={618.111} size="xlarge" thousands digits={null} />
18+
</Cell>
19+
</CellGroup>
20+
)
21+
}
22+
export default Demo11
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react'
2+
import { Price, Cell, CellGroup } from '@nutui/nutui-react-taro'
3+
4+
const Demo10 = () => {
5+
return (
6+
<CellGroup>
7+
<Cell>
8+
<Price price={618.68} size="small" thousands color="darkgray" />
9+
</Cell>
10+
<Cell>
11+
<Price price={618.68} size="normal" thousands color="dark" />
12+
</Cell>
13+
<Cell>
14+
<Price price={618.68} size="large" thousands color="blue" />
15+
</Cell>
16+
<Cell>
17+
<Price price={618.68} size="xlarge" thousands color="#b5691a" />
18+
</Cell>
19+
</CellGroup>
20+
)
21+
}
22+
export default Demo10
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react'
2+
import { Price, Cell, CellGroup } from '@nutui/nutui-react-taro'
3+
4+
const Demo11 = () => {
5+
return (
6+
<CellGroup>
7+
<Cell>
8+
<Price price={618} size="small" thousands digits={null} />
9+
</Cell>
10+
<Cell>
11+
<Price price={618.6} size="normal" thousands digits={null} />
12+
</Cell>
13+
<Cell>
14+
<Price price={618.18} size="large" thousands digits={null} />
15+
</Cell>
16+
<Cell>
17+
<Price price={618.111} size="xlarge" thousands digits={null} />
18+
</Cell>
19+
</CellGroup>
20+
)
21+
}
22+
export default Demo11

src/packages/price/doc.en-US.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,35 @@ import { Price } from '@nutui/nutui-react'
8282

8383
:::
8484

85+
### Custom color
86+
87+
:::demo
88+
89+
<CodeBlock src='h5/demo10.tsx'></CodeBlock>
90+
91+
:::
92+
93+
### Data original output
94+
95+
:::demo
96+
97+
<CodeBlock src='h5/demo11.tsx'></CodeBlock>
98+
99+
:::
100+
85101
## Price
86102

87103
### Props
88104

89105
| Property | Description | Type | Default |
90106
| --- | --- | --- | --- |
91-
| color | Price type | `primary` \| `gray` \| `darkgray` | `primary` |
107+
| color | Price type, supports custom colors | `primary` \| `gray` \| `darkgray` \| `string` | `primary` |
92108
| price | Price | `number` | `0` |
93109
| symbol | Symbol type | `string` | `&yen;` |
94-
| digits | Decimal digits | `number` | `2` |
110+
| digits | Decimal digits, pass `null` for original data output | `number` \| `null` | `2` |
95111
| thousands | Thousands separation | `boolean` | `false` |
96112
| position | The symbol appear before or after the price,`before``after` | `string` | `before` |
97-
| size | Size,`xlarge` \| `large` \| `normal` \| `small` | `string` | `large` |
113+
| size | Size,`xlarge` \| `large` \| `normal` \| `small` | `string` | `normal` |
98114
| line | Line-through price | `boolean` | `false` |
99115

100116
## Theming
@@ -105,9 +121,9 @@ The component provides the following CSS variables, which can be used to customi
105121

106122
| Name | Description | Default |
107123
| --- | --- | --- |
108-
| \--nutui-price-primary-color | Text color when type is primary | `#ff0f23` |
109-
| \--nutui-price-color | Text color when type is gray | `#888b94` |
110-
| \--nutui-price-darkgray-color | Text color when type is darkgray | `#1a1a1a` |
124+
| \--nutui-price-primary-color | Text color when color is primary | `#ff0f23` |
125+
| \--nutui-price-color | Text color when color is gray | `#888b94` |
126+
| \--nutui-price-darkgray-color | Text color when color is darkgray | `#1a1a1a` |
111127
| \--nutui-price-line-color | Underline price color | `#888b94` |
112128
| \--nutui-price-symbol-padding-right | Right padding of symbol | `0px` |
113129
| \--nutui-price-symbol-xlarge-size | xlarge size symbol font size | `12px` |

src/packages/price/doc.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,32 @@ import { Price } from '@nutui/nutui-react'
8282

8383
:::
8484

85+
### 自定义颜色
86+
87+
:::demo
88+
89+
<CodeBlock src='h5/demo10.tsx'></CodeBlock>
90+
91+
:::
92+
93+
### 数据原样输出
94+
95+
:::demo
96+
97+
<CodeBlock src='h5/demo11.tsx'></CodeBlock>
98+
99+
:::
100+
85101
## Price
86102

87103
### Props
88104

89105
| 属性 | 说明 | 类型 | 默认值 |
90106
| --- | --- | --- | --- |
91-
| color | 价格类型 | `primary` \| `gray` \| `darkgray` | `primary` |
107+
| color | 价格类型, 支持自定义颜色 | `primary` \| `gray` \| `darkgray` \| `string` | `primary` |
92108
| price | 价格数量 | `number` | `0` |
93109
| symbol | 符号类型 | `string` | `&yen;` |
94-
| digits | 小数位位数 | `number` | `2` |
110+
| digits | 小数位位数,传入`null`数据原样输出 | `number` \| `null` | `2` |
95111
| thousands | 是否按照千分号形式显示 | `boolean` | `false` |
96112
| position | 符号显示在价格前或者后,`before``after` | `string` | `before` |
97113
| size | 价格尺寸,`xlarge` \| `large` \| `normal` \| `small` | `string` | `normal` |

src/packages/price/doc.taro.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,32 @@ import { Price } from '@nutui/nutui-react-taro'
8282

8383
:::
8484

85+
### 自定义颜色
86+
87+
:::demo
88+
89+
<CodeBlock src='taro/demo10.tsx'></CodeBlock>
90+
91+
:::
92+
93+
### 数据原样输出
94+
95+
:::demo
96+
97+
<CodeBlock src='taro/demo11.tsx'></CodeBlock>
98+
99+
:::
100+
85101
## Price
86102

87103
### Props
88104

89105
| 属性 | 说明 | 类型 | 默认值 |
90106
| --- | --- | --- | --- |
91-
| type | 价格类型 | `primary` \| `gray` \| `darkgray` | `primary` |
107+
| color | 价格类型, 支持自定义颜色 | `primary` \| `gray` \| `darkgray` \| `string` | `primary` |
108+
| price | 价格数量 | `number` | `0` |
92109
| symbol | 符号类型 | `string` | `&yen;` |
93-
| digits | 小数位位数 | `number` | `2` |
110+
| digits | 小数位位数,传入`null`数据原样输出 | `number` \| `null` | `2` |
94111
| thousands | 是否按照千分号形式显示 | `boolean` | `false` |
95112
| position | 符号显示在价格前或者后,`before``after` | `string` | `before` |
96113
| size | 价格尺寸,`xlarge` \| `large` \| `normal` \| `small` | `string` | `normal` |
@@ -104,9 +121,9 @@ import { Price } from '@nutui/nutui-react-taro'
104121

105122
| 名称 | 说明 | 默认值 |
106123
| --- | --- | --- |
107-
| \--nutui-price-primary-color | type为primary时文字颜色 | `#ff0f23` |
108-
| \--nutui-price-color | type为gray时文字颜色 | `#888b94` |
109-
| \--nutui-price-darkgray-color | type为darkgray时文字颜色 | `#1a1a1a` |
124+
| \--nutui-price-primary-color | color为primary时文字颜色 | `#ff0f23` |
125+
| \--nutui-price-color | color为gray时文字颜色 | `#888b94` |
126+
| \--nutui-price-darkgray-color | color为darkgray时文字颜色 | `#1a1a1a` |
110127
| \--nutui-price-line-color | 划线价颜色 | `#888b94` |
111128
| \--nutui-price-symbol-padding-right | 符号的右内边距 | `0px` |
112129
| \--nutui-price-symbol-xlarge-size | xlarge 尺寸符号字体大小 | `12px` |

0 commit comments

Comments
 (0)