+
{translated.basic}
- |
-
- |
+
{translated.customStyle}
-
-
- |
+
{translated.noShowPercentage}
-
-
- |
- {translated.customContent}
-
-
- |
+
+ {!harmonyAndRn() && (
+ <>
+ {translated.customContent}
+
+ >
+ )}
{translated.customSize}
{translated.statusDisplay}
+
{translated.dynamicChange}
- {translated.lazy}
-
-
- |
+ {!harmonyAndRn() && (
+ <>
+ {translated.lazy}
+
+ >
+ )}
>
)
diff --git a/src/packages/progress/demo.tsx b/src/packages/progress/demo.tsx
index 373867889a..8742d579f0 100644
--- a/src/packages/progress/demo.tsx
+++ b/src/packages/progress/demo.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import { useTranslate } from '../../sites/assets/locale'
-import { Cell } from '@/packages/cell/cell'
import Demo1 from './demos/h5/demo1'
import Demo2 from './demos/h5/demo2'
import Demo3 from './demos/h5/demo3'
@@ -48,21 +47,13 @@ const ProgressDemo = () => {
<>
{translated.basic}
-
-
- |
+
{translated.customStyle}
-
-
- |
+
{translated.noShowPercentage}
-
-
- |
+
{translated.customContent}
-
-
- |
+
{translated.customSize}
{translated.statusDisplay}
@@ -70,9 +61,7 @@ const ProgressDemo = () => {
{translated.dynamicChange}
{translated.lazy}
-
-
- |
+
>
)
diff --git a/src/packages/progress/demos/h5/demo1.tsx b/src/packages/progress/demos/h5/demo1.tsx
index da817f698e..9c3617fd48 100644
--- a/src/packages/progress/demos/h5/demo1.tsx
+++ b/src/packages/progress/demos/h5/demo1.tsx
@@ -1,7 +1,11 @@
import React from 'react'
-import { Progress } from '@nutui/nutui-react'
+import { Cell, Progress } from '@nutui/nutui-react'
const Demo1 = () => {
- return
+ return (
+
+
+ |
+ )
}
export default Demo1
diff --git a/src/packages/progress/demos/h5/demo2.tsx b/src/packages/progress/demos/h5/demo2.tsx
index 540c554d4b..ef49c6067f 100644
--- a/src/packages/progress/demos/h5/demo2.tsx
+++ b/src/packages/progress/demos/h5/demo2.tsx
@@ -1,14 +1,16 @@
import React from 'react'
-import { Progress } from '@nutui/nutui-react'
+import { Progress, Cell } from '@nutui/nutui-react'
const Demo2 = () => {
return (
-
+
+
+ |
)
}
export default Demo2
diff --git a/src/packages/progress/demos/h5/demo3.tsx b/src/packages/progress/demos/h5/demo3.tsx
index a1a8ac0101..5d1368ecdf 100644
--- a/src/packages/progress/demos/h5/demo3.tsx
+++ b/src/packages/progress/demos/h5/demo3.tsx
@@ -1,7 +1,11 @@
import React from 'react'
-import { Progress } from '@nutui/nutui-react'
+import { Cell, Progress } from '@nutui/nutui-react'
const Demo3 = () => {
- return
+ return (
+
+
+ |
+ )
}
export default Demo3
diff --git a/src/packages/progress/demos/h5/demo4.tsx b/src/packages/progress/demos/h5/demo4.tsx
index 376c8040af..393f2ec18b 100644
--- a/src/packages/progress/demos/h5/demo4.tsx
+++ b/src/packages/progress/demos/h5/demo4.tsx
@@ -1,15 +1,17 @@
import React from 'react'
-import { Progress, Image } from '@nutui/nutui-react'
+import { Progress, Image, Cell } from '@nutui/nutui-react'
const Demo4 = () => {
return (
-
+
+
+ |
)
}
export default Demo4
diff --git a/src/packages/progress/demos/h5/demo8.tsx b/src/packages/progress/demos/h5/demo8.tsx
index 33ae6c3c4a..6e8af3eaf7 100644
--- a/src/packages/progress/demos/h5/demo8.tsx
+++ b/src/packages/progress/demos/h5/demo8.tsx
@@ -1,7 +1,11 @@
import React from 'react'
-import { Progress } from '@nutui/nutui-react'
+import { Cell, Progress } from '@nutui/nutui-react'
const Demo8 = () => {
- return
+ return (
+
+
+ |
+ )
}
export default Demo8
diff --git a/src/packages/progress/demos/taro/demo1.tsx b/src/packages/progress/demos/taro/demo1.tsx
index a196ee8d24..a1c0566acf 100644
--- a/src/packages/progress/demos/taro/demo1.tsx
+++ b/src/packages/progress/demos/taro/demo1.tsx
@@ -1,7 +1,11 @@
import React from 'react'
-import { Progress } from '@nutui/nutui-react-taro'
+import { Cell, Progress } from '@nutui/nutui-react-taro'
const Demo1 = () => {
- return
+ return (
+
+
+ |
+ )
}
export default Demo1
diff --git a/src/packages/progress/demos/taro/demo2.tsx b/src/packages/progress/demos/taro/demo2.tsx
index 165bb53917..eca916fadf 100644
--- a/src/packages/progress/demos/taro/demo2.tsx
+++ b/src/packages/progress/demos/taro/demo2.tsx
@@ -1,14 +1,17 @@
import React from 'react'
-import { Progress } from '@nutui/nutui-react-taro'
+import { Cell, Progress } from '@nutui/nutui-react-taro'
+import { harmonyAndRn } from '@/utils/platform-taro'
const Demo2 = () => {
return (
-
+
+
+ |
)
}
export default Demo2
diff --git a/src/packages/progress/demos/taro/demo3.tsx b/src/packages/progress/demos/taro/demo3.tsx
index 444838a990..8b0d6af10a 100644
--- a/src/packages/progress/demos/taro/demo3.tsx
+++ b/src/packages/progress/demos/taro/demo3.tsx
@@ -1,7 +1,11 @@
import React from 'react'
-import { Progress } from '@nutui/nutui-react-taro'
+import { Cell, Progress } from '@nutui/nutui-react-taro'
const Demo3 = () => {
- return
+ return (
+
+
+ |
+ )
}
export default Demo3
diff --git a/src/packages/progress/demos/taro/demo4.tsx b/src/packages/progress/demos/taro/demo4.tsx
index 4cd774d925..24d6b7995d 100644
--- a/src/packages/progress/demos/taro/demo4.tsx
+++ b/src/packages/progress/demos/taro/demo4.tsx
@@ -1,15 +1,17 @@
import React from 'react'
-import { Progress, Image } from '@nutui/nutui-react-taro'
+import { Progress, Image, Cell } from '@nutui/nutui-react-taro'
const Demo4 = () => {
return (
-
+
+
+ |
)
}
export default Demo4
diff --git a/src/packages/progress/demos/taro/demo6.tsx b/src/packages/progress/demos/taro/demo6.tsx
index 91ef3a5d8a..60ac132b88 100644
--- a/src/packages/progress/demos/taro/demo6.tsx
+++ b/src/packages/progress/demos/taro/demo6.tsx
@@ -1,6 +1,7 @@
import React from 'react'
import { Progress, Cell } from '@nutui/nutui-react-taro'
import { Checked, Tips } from '@nutui/icons-react-taro'
+import { harmonyAndRn } from '@/utils/platform-taro'
const Demo6 = () => {
return (
@@ -8,21 +9,32 @@ const Demo6 = () => {
|
-
+ {!harmonyAndRn() && (
+
+ )}
|
-
-
+
+ {!harmonyAndRn() && (
+
+ )}
|
>
)
diff --git a/src/packages/progress/demos/taro/demo7.tsx b/src/packages/progress/demos/taro/demo7.tsx
index e9087600aa..5d683d408c 100644
--- a/src/packages/progress/demos/taro/demo7.tsx
+++ b/src/packages/progress/demos/taro/demo7.tsx
@@ -1,5 +1,8 @@
import React, { useState } from 'react'
-import { Progress, Cell, Button, Toast } from '@nutui/nutui-react-taro'
+import { Cell, Button, Toast, Progress } from '@nutui/nutui-react-taro'
+import { Text } from '@tarojs/components'
+import pxTransform from '@/utils/px-transform'
+import { harmonyAndRn } from '@/utils/platform-taro'
const Demo7 = () => {
const [value, setValue] = useState(0)
@@ -7,22 +10,24 @@ const Demo7 = () => {
const [toastMsg, setToastMsg] = useState('')
return (
- {
- setShow(false)
- }}
- />
+ {!harmonyAndRn() && (
+ {
+ setShow(false)
+ }}
+ />
+ )}
+
- {value}%
|
+ {value}%
|
)
diff --git a/src/packages/progress/demos/taro/demo8.tsx b/src/packages/progress/demos/taro/demo8.tsx
index 652fe66cea..071d65ad3b 100644
--- a/src/packages/progress/demos/taro/demo8.tsx
+++ b/src/packages/progress/demos/taro/demo8.tsx
@@ -1,7 +1,11 @@
import React from 'react'
-import { Progress } from '@nutui/nutui-react-taro'
+import { Progress, Cell } from '@nutui/nutui-react-taro'
const Demo8 = () => {
- return
+ return (
+
+
+ |
+ )
}
export default Demo8
diff --git a/src/packages/progress/progress.harmony.css b/src/packages/progress/progress.harmony.css
index 2fef8db7bf..00a5f8da97 100644
--- a/src/packages/progress/progress.harmony.css
+++ b/src/packages/progress/progress.harmony.css
@@ -8,7 +8,7 @@
flex: auto;
border-radius: 12px;
height: 10px;
- background: #F7F8FC;
+ background: #f5f6fa;
}
.nut-progress-outer .nut-progress-active:before {
content: "";
@@ -27,7 +27,7 @@
justify-content: center;
transition: all 0.4s;
border-radius: 12px;
- background: linear-gradient(135deg, #FF0F23 0%, #FF0F23 100%);
+ background-color: #ff0f23;
}
.nut-progress-text {
display: flex;
@@ -36,10 +36,11 @@
top: -4px;
bottom: -4px;
transition: all 0.4s;
- transform: translate(-50%);
}
.nut-progress-text-inner {
display: flex;
+ flex-direction: row;
+ justify-content: center;
align-items: center;
height: 100%;
width: 100%;
@@ -48,7 +49,7 @@
border-radius: 5px;
font-size: 9px;
line-height: 1;
- background: linear-gradient(135deg, #FF0F23 0%, #FF0F23 100%);
+ background: #ff0f23;
}
@keyframes progressActive {
0% {
diff --git a/src/packages/progress/progress.scss b/src/packages/progress/progress.scss
index 5eebd11a18..b7d865ad3a 100644
--- a/src/packages/progress/progress.scss
+++ b/src/packages/progress/progress.scss
@@ -29,7 +29,7 @@
justify-content: center;
transition: all 0.4s;
border-radius: $progress-border-radius;
- background: $progress-color;
+ background-color: $progress-color;
}
&-text {
@@ -39,10 +39,12 @@
top: $progress-text-position-top;
bottom: $progress-text-position-bottom;
transition: all 0.4s;
- transform: translate(-50%);
+ // transform: translate(-50%);
&-inner {
display: flex;
+ flex-direction: row;
+ justify-content: center;
align-items: center;
height: 100%;
width: 100%;
diff --git a/src/packages/progress/progress.taro.tsx b/src/packages/progress/progress.taro.tsx
index ff529046c0..f93da6218a 100644
--- a/src/packages/progress/progress.taro.tsx
+++ b/src/packages/progress/progress.taro.tsx
@@ -1,9 +1,12 @@
import React, { FunctionComponent, useEffect, useRef, useState } from 'react'
import classNames from 'classnames'
import Taro, { PageInstance } from '@tarojs/taro'
+import { View } from '@tarojs/components'
+import pxTransform from '@/utils/px-transform'
import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import { useRtl } from '../configprovider/index.taro'
import useUuid from '@/utils/use-uuid'
+import { harmony, harmonyAndRn, rn, web } from '@/utils/platform-taro'
export interface ProgressProps extends BasicComponent {
percent: number
@@ -54,15 +57,20 @@ export const Progress: FunctionComponent<
})
const stylesOuter: React.CSSProperties = {
- height: `${strokeWidth}px`,
- background,
+ width: '100%',
+ backgroundColor: background,
}
const [displayPercent, setDispalyPercent] = useState(0)
const stylesInner: React.CSSProperties = {
width: `${displayPercent}%`,
- background: color,
+ backgroundColor: color || '#FF0F23',
+ }
+
+ if (strokeWidth) {
+ stylesOuter.height = pxTransform(Number(strokeWidth))
+ stylesInner.height = pxTransform(Number(strokeWidth))
}
const handlePercent = () => {
let timer: any = null
@@ -74,7 +82,7 @@ export const Progress: FunctionComponent<
}
return () => {
- lazy && resetObserver(Taro.getEnv())
+ lazy && resetObserver()
timer && clearTimeout(timer)
}
}
@@ -87,8 +95,8 @@ export const Progress: FunctionComponent<
const webObserver: any = useRef(null)
const uuid = useUuid()
const selector = `${classPrefix}-lazy-${uuid}`
- const resetObserver = (env: string, observer: any = null) => {
- if (env === 'WEB') {
+ const resetObserver = (observer: any = null) => {
+ if (web()) {
webObserver.current.disconnect && webObserver.current.disconnect()
} else {
observer && observer.disconnect()
@@ -107,6 +115,7 @@ export const Progress: FunctionComponent<
}, [intersecting])
const handleWebObserver = () => {
/// web环境
+
if (lazy) {
webObserver.current = new IntersectionObserver(
(entires, self) => {
@@ -144,47 +153,90 @@ export const Progress: FunctionComponent<
}
useEffect(() => {
- if (Taro.getEnv() === 'WEB') {
+ if (web()) {
handleWebObserver()
- } else {
+ } else if (!harmonyAndRn()) {
handleOtherObserver()
}
}, [])
-
+ const getTextStyle = () => {
+ const value = harmony() ? '90%' : '99%'
+ return rtl ? { right: value } : { left: value }
+ }
+ const computeRight = () => {
+ if (children) {
+ return 0
+ }
+ if (!harmonyAndRn()) {
+ return Math.floor((`${percent}%`.length * 9) / 2)
+ }
+ if (rn()) {
+ return `${percent}%`.length * 9 + 4
+ }
+ return Math.floor((`${percent}%`.length * 9 + 4) / 2)
+ }
+ const computeInnerStyle = () => {
+ const style: any = {
+ backgroundColor: color || '#ff0f23',
+ }
+ if (harmonyAndRn()) {
+ style.width = harmony()
+ ? pxTransform(`${percent}%`.length * 9 + 4)
+ : `${percent}%`.length * 9 + 4
+ }
+ return style
+ }
return (
-
-
-
+
+
{showText && (
-
- {children || (
-
- {percent}%
-
- )}
-
+
+ {children || (
+
+ {`${percent}%`}
+
+ )}
+
+
)}
-
-
-
+
+
+
)
}
diff --git a/src/packages/progress/progress.tsx b/src/packages/progress/progress.tsx
index a47ec44fbd..902d6c3553 100644
--- a/src/packages/progress/progress.tsx
+++ b/src/packages/progress/progress.tsx
@@ -61,7 +61,7 @@ export const Progress: FunctionComponent<
const stylesInner: React.CSSProperties = {
width: `${displayPercent}%`,
- background: color,
+ backgroundColor: color || '#FF0F23',
}
useEffect(() => {
diff --git a/src/styles/variables-jmapp.scss b/src/styles/variables-jmapp.scss
index ec25df8eea..2410dec893 100644
--- a/src/styles/variables-jmapp.scss
+++ b/src/styles/variables-jmapp.scss
@@ -1652,7 +1652,7 @@ $progress-text-color: var(
) !default;
$progress-text-background: var(
--nutui-progress-text-background,
- $progress-color
+ #ff0f23
) !default;
$progress-text-padding: var(--nutui-progress-text-padding, 0 5px) !default;
$progress-text-font-size: var(--nutui-progress-text-font-size, 9px) !default;
diff --git a/src/styles/variables.scss b/src/styles/variables.scss
index 1a5d2002ee..e6c1da6599 100644
--- a/src/styles/variables.scss
+++ b/src/styles/variables.scss
@@ -1625,10 +1625,7 @@ $popover-menu-item-padding: var(
//progress(✅)
$progress-height: var(--nutui-progress-height, 10px) !default;
-$progress-color: var(
- --nutui-progress-color,
- $color-primary-gradient-1
-) !default;
+$progress-color: var(--nutui-progress-color, #ff0f23) !default;
$progress-background: var(
--nutui-progress-background,
$color-background
@@ -1640,7 +1637,7 @@ $progress-text-color: var(
) !default;
$progress-text-background: var(
--nutui-progress-text-background,
- $progress-color
+ #ff0f23
) !default;
$progress-text-padding: var(--nutui-progress-text-padding, 0 5px) !default;
$progress-text-font-size: var(--nutui-progress-text-font-size, 9px) !default;