@nutui/nutui-react-taro 3.0.17 → 3.0.18-cpp
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/cjs/packages/dialog/dialog.js +12 -10
- package/dist/cjs/packages/ellipsis/ellipsis.js +1 -1
- package/dist/cjs/packages/noticebar/style/noticebar.scss +6 -0
- package/dist/cjs/packages/noticebar/style/style.css +6 -0
- package/dist/cjs/packages/noticebar/style/style.harmony.css +6 -0
- package/dist/cjs/packages/noticebar/style-jmapp/noticebar.scss +6 -0
- package/dist/cjs/packages/noticebar/style-jmapp/style.css +6 -0
- package/dist/cjs/packages/noticebar/style-jrkf/noticebar.scss +6 -0
- package/dist/cjs/packages/noticebar/style-jrkf/style.css +6 -0
- package/dist/cjs/packages/overlay/overlay.js +17 -11
- package/dist/cjs/packages/popup/popup.js +29 -17
- package/dist/cjs/packages/price/price.js +43 -15
- package/dist/cjs/types/spec/price/base.d.ts +8 -2
- package/dist/cjs/types/spec/price/base.js +12 -0
- package/dist/cjs/utils/taro/get-rect.d.ts +1 -0
- package/dist/cjs/utils/taro/get-rect.js +36 -0
- package/dist/es/packages/dialog/dialog.js +23 -19
- package/dist/es/packages/ellipsis/ellipsis.js +2 -2
- package/dist/es/packages/noticebar/style/noticebar.scss +6 -0
- package/dist/es/packages/noticebar/style/style.css +6 -0
- package/dist/es/packages/noticebar/style/style.harmony.css +6 -0
- package/dist/es/packages/noticebar/style-jmapp/noticebar.scss +6 -0
- package/dist/es/packages/noticebar/style-jmapp/style.css +6 -0
- package/dist/es/packages/noticebar/style-jrkf/noticebar.scss +6 -0
- package/dist/es/packages/noticebar/style-jrkf/style.css +6 -0
- package/dist/es/packages/overlay/overlay.js +17 -11
- package/dist/es/packages/popup/popup.js +30 -17
- package/dist/es/packages/price/price.js +42 -15
- package/dist/es/types/spec/price/base.d.ts +17 -5
- package/dist/es/types/spec/price/base.js +6 -1
- package/dist/es/utils/taro/get-rect.d.ts +1 -0
- package/dist/es/utils/taro/get-rect.js +34 -0
- package/dist/nutui.react.umd.js +9958 -9892
- package/dist/style-jmapp.css +1 -1
- package/dist/style-jmapp.scss +45 -45
- package/dist/style-jrkf.css +1 -1
- package/dist/style-jrkf.scss +39 -39
- package/dist/style.css +1 -1
- package/dist/style.scss +27 -27
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import React, { useState, useRef, useEffect } from "react";
|
|
|
9
9
|
import { nextTick, createSelectorQuery } from "@tarojs/taro";
|
|
10
10
|
import classNames from "classnames";
|
|
11
11
|
import { View } from "@tarojs/components";
|
|
12
|
-
import { getRectInMultiPlatform } from "../../utils/taro/get-rect";
|
|
12
|
+
import { getRectInMultiPlatform, getRectInMultiPlatformWithoutCache } from "../../utils/taro/get-rect";
|
|
13
13
|
import { ComponentDefaults } from "../../utils/typings";
|
|
14
14
|
import { useRtl } from "../configprovider/index";
|
|
15
15
|
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
@@ -217,7 +217,7 @@ export var Ellipsis = function(props) {
|
|
|
217
217
|
case 0:
|
|
218
218
|
return [
|
|
219
219
|
4,
|
|
220
|
-
|
|
220
|
+
getRectInMultiPlatformWithoutCache(rootContain.current)
|
|
221
221
|
];
|
|
222
222
|
case 1:
|
|
223
223
|
refe = _state.sent();
|
|
@@ -51,6 +51,9 @@
|
|
|
51
51
|
min-width: $noticebar-left-icon-width;
|
|
52
52
|
margin-right: $noticebar-icon-gap;
|
|
53
53
|
background-size: 100% 100%;
|
|
54
|
+
.nut-icon {
|
|
55
|
+
color: $noticebar-color;
|
|
56
|
+
}
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
&-right-icon {
|
|
@@ -63,12 +66,14 @@
|
|
|
63
66
|
.nut-icon {
|
|
64
67
|
width: 12px;
|
|
65
68
|
height: 12px;
|
|
69
|
+
color: $noticebar-color;
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
&-wrap {
|
|
70
74
|
display: flex;
|
|
71
75
|
flex: 1;
|
|
76
|
+
align-items: center;
|
|
72
77
|
height: $noticebar-line-height;
|
|
73
78
|
line-height: $noticebar-line-height;
|
|
74
79
|
overflow: hidden;
|
|
@@ -77,6 +82,7 @@
|
|
|
77
82
|
.nut-noticebar-box-wrap-content {
|
|
78
83
|
position: absolute;
|
|
79
84
|
white-space: nowrap;
|
|
85
|
+
color: $noticebar-color;
|
|
80
86
|
|
|
81
87
|
&.nut-ellipsis {
|
|
82
88
|
max-width: 100%;
|
|
@@ -45,6 +45,9 @@
|
|
|
45
45
|
margin-right: var(--nutui-noticebar-icon-gap, 4px);
|
|
46
46
|
background-size: 100% 100%;
|
|
47
47
|
}
|
|
48
|
+
.nut-noticebar .nut-noticebar-box-left-icon .nut-icon {
|
|
49
|
+
color: var(--nutui-noticebar-color, #d9500b);
|
|
50
|
+
}
|
|
48
51
|
.nut-noticebar .nut-noticebar-box-right-icon {
|
|
49
52
|
display: flex;
|
|
50
53
|
align-items: center;
|
|
@@ -55,10 +58,12 @@
|
|
|
55
58
|
.nut-noticebar .nut-noticebar-box-right-icon .nut-icon {
|
|
56
59
|
width: 12px;
|
|
57
60
|
height: 12px;
|
|
61
|
+
color: var(--nutui-noticebar-color, #d9500b);
|
|
58
62
|
}
|
|
59
63
|
.nut-noticebar .nut-noticebar-box-wrap {
|
|
60
64
|
display: flex;
|
|
61
65
|
flex: 1;
|
|
66
|
+
align-items: center;
|
|
62
67
|
height: var(--nutui-noticebar-line-height, 24px);
|
|
63
68
|
line-height: var(--nutui-noticebar-line-height, 24px);
|
|
64
69
|
overflow: hidden;
|
|
@@ -67,6 +72,7 @@
|
|
|
67
72
|
.nut-noticebar .nut-noticebar-box-wrap .nut-noticebar-box-wrap-content {
|
|
68
73
|
position: absolute;
|
|
69
74
|
white-space: nowrap;
|
|
75
|
+
color: var(--nutui-noticebar-color, #d9500b);
|
|
70
76
|
}
|
|
71
77
|
.nut-noticebar .nut-noticebar-box-wrap .nut-noticebar-box-wrap-content.nut-ellipsis {
|
|
72
78
|
max-width: 100%;
|
|
@@ -45,6 +45,9 @@
|
|
|
45
45
|
margin-right: var(--nutui-noticebar-icon-gap, 4px);
|
|
46
46
|
background-size: 100% 100%;
|
|
47
47
|
}
|
|
48
|
+
.nut-noticebar .nut-noticebar-box-left-icon .nut-icon {
|
|
49
|
+
color: var(--nutui-noticebar-color, #d9500b);
|
|
50
|
+
}
|
|
48
51
|
.nut-noticebar .nut-noticebar-box-right-icon {
|
|
49
52
|
display: flex;
|
|
50
53
|
align-items: center;
|
|
@@ -55,10 +58,12 @@
|
|
|
55
58
|
.nut-noticebar .nut-noticebar-box-right-icon .nut-icon {
|
|
56
59
|
width: 12px;
|
|
57
60
|
height: 12px;
|
|
61
|
+
color: var(--nutui-noticebar-color, #d9500b);
|
|
58
62
|
}
|
|
59
63
|
.nut-noticebar .nut-noticebar-box-wrap {
|
|
60
64
|
display: flex;
|
|
61
65
|
flex: 1;
|
|
66
|
+
align-items: center;
|
|
62
67
|
height: var(--nutui-noticebar-line-height, 24px);
|
|
63
68
|
line-height: var(--nutui-noticebar-line-height, 24px);
|
|
64
69
|
overflow: hidden;
|
|
@@ -67,6 +72,7 @@
|
|
|
67
72
|
.nut-noticebar .nut-noticebar-box-wrap .nut-noticebar-box-wrap-content {
|
|
68
73
|
position: absolute;
|
|
69
74
|
white-space: nowrap;
|
|
75
|
+
color: var(--nutui-noticebar-color, #d9500b);
|
|
70
76
|
}
|
|
71
77
|
.nut-noticebar .nut-noticebar-box-wrap .nut-noticebar-box-wrap-content.nut-ellipsis {
|
|
72
78
|
max-width: 100%;
|
|
@@ -51,6 +51,9 @@
|
|
|
51
51
|
min-width: $noticebar-left-icon-width;
|
|
52
52
|
margin-right: $noticebar-icon-gap;
|
|
53
53
|
background-size: 100% 100%;
|
|
54
|
+
.nut-icon {
|
|
55
|
+
color: $noticebar-color;
|
|
56
|
+
}
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
&-right-icon {
|
|
@@ -63,12 +66,14 @@
|
|
|
63
66
|
.nut-icon {
|
|
64
67
|
width: 12px;
|
|
65
68
|
height: 12px;
|
|
69
|
+
color: $noticebar-color;
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
&-wrap {
|
|
70
74
|
display: flex;
|
|
71
75
|
flex: 1;
|
|
76
|
+
align-items: center;
|
|
72
77
|
height: $noticebar-line-height;
|
|
73
78
|
line-height: $noticebar-line-height;
|
|
74
79
|
overflow: hidden;
|
|
@@ -77,6 +82,7 @@
|
|
|
77
82
|
.nut-noticebar-box-wrap-content {
|
|
78
83
|
position: absolute;
|
|
79
84
|
white-space: nowrap;
|
|
85
|
+
color: $noticebar-color;
|
|
80
86
|
|
|
81
87
|
&.nut-ellipsis {
|
|
82
88
|
max-width: 100%;
|
|
@@ -45,6 +45,9 @@
|
|
|
45
45
|
margin-right: var(--nutui-noticebar-icon-gap, 4px);
|
|
46
46
|
background-size: 100% 100%;
|
|
47
47
|
}
|
|
48
|
+
.nut-noticebar .nut-noticebar-box-left-icon .nut-icon {
|
|
49
|
+
color: var(--nutui-noticebar-color, #d9500b);
|
|
50
|
+
}
|
|
48
51
|
.nut-noticebar .nut-noticebar-box-right-icon {
|
|
49
52
|
display: flex;
|
|
50
53
|
align-items: center;
|
|
@@ -55,10 +58,12 @@
|
|
|
55
58
|
.nut-noticebar .nut-noticebar-box-right-icon .nut-icon {
|
|
56
59
|
width: 12px;
|
|
57
60
|
height: 12px;
|
|
61
|
+
color: var(--nutui-noticebar-color, #d9500b);
|
|
58
62
|
}
|
|
59
63
|
.nut-noticebar .nut-noticebar-box-wrap {
|
|
60
64
|
display: flex;
|
|
61
65
|
flex: 1;
|
|
66
|
+
align-items: center;
|
|
62
67
|
height: var(--nutui-noticebar-line-height, 24px);
|
|
63
68
|
line-height: var(--nutui-noticebar-line-height, 24px);
|
|
64
69
|
overflow: hidden;
|
|
@@ -67,6 +72,7 @@
|
|
|
67
72
|
.nut-noticebar .nut-noticebar-box-wrap .nut-noticebar-box-wrap-content {
|
|
68
73
|
position: absolute;
|
|
69
74
|
white-space: nowrap;
|
|
75
|
+
color: var(--nutui-noticebar-color, #d9500b);
|
|
70
76
|
}
|
|
71
77
|
.nut-noticebar .nut-noticebar-box-wrap .nut-noticebar-box-wrap-content.nut-ellipsis {
|
|
72
78
|
max-width: 100%;
|
|
@@ -51,6 +51,9 @@
|
|
|
51
51
|
min-width: $noticebar-left-icon-width;
|
|
52
52
|
margin-right: $noticebar-icon-gap;
|
|
53
53
|
background-size: 100% 100%;
|
|
54
|
+
.nut-icon {
|
|
55
|
+
color: $noticebar-color;
|
|
56
|
+
}
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
&-right-icon {
|
|
@@ -63,12 +66,14 @@
|
|
|
63
66
|
.nut-icon {
|
|
64
67
|
width: 12px;
|
|
65
68
|
height: 12px;
|
|
69
|
+
color: $noticebar-color;
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
&-wrap {
|
|
70
74
|
display: flex;
|
|
71
75
|
flex: 1;
|
|
76
|
+
align-items: center;
|
|
72
77
|
height: $noticebar-line-height;
|
|
73
78
|
line-height: $noticebar-line-height;
|
|
74
79
|
overflow: hidden;
|
|
@@ -77,6 +82,7 @@
|
|
|
77
82
|
.nut-noticebar-box-wrap-content {
|
|
78
83
|
position: absolute;
|
|
79
84
|
white-space: nowrap;
|
|
85
|
+
color: $noticebar-color;
|
|
80
86
|
|
|
81
87
|
&.nut-ellipsis {
|
|
82
88
|
max-width: 100%;
|
|
@@ -45,6 +45,9 @@
|
|
|
45
45
|
margin-right: var(--nutui-noticebar-icon-gap, 4px);
|
|
46
46
|
background-size: 100% 100%;
|
|
47
47
|
}
|
|
48
|
+
.nut-noticebar .nut-noticebar-box-left-icon .nut-icon {
|
|
49
|
+
color: var(--nutui-noticebar-color, #d9500b);
|
|
50
|
+
}
|
|
48
51
|
.nut-noticebar .nut-noticebar-box-right-icon {
|
|
49
52
|
display: flex;
|
|
50
53
|
align-items: center;
|
|
@@ -55,10 +58,12 @@
|
|
|
55
58
|
.nut-noticebar .nut-noticebar-box-right-icon .nut-icon {
|
|
56
59
|
width: 12px;
|
|
57
60
|
height: 12px;
|
|
61
|
+
color: var(--nutui-noticebar-color, #d9500b);
|
|
58
62
|
}
|
|
59
63
|
.nut-noticebar .nut-noticebar-box-wrap {
|
|
60
64
|
display: flex;
|
|
61
65
|
flex: 1;
|
|
66
|
+
align-items: center;
|
|
62
67
|
height: var(--nutui-noticebar-line-height, 24px);
|
|
63
68
|
line-height: var(--nutui-noticebar-line-height, 24px);
|
|
64
69
|
overflow: hidden;
|
|
@@ -67,6 +72,7 @@
|
|
|
67
72
|
.nut-noticebar .nut-noticebar-box-wrap .nut-noticebar-box-wrap-content {
|
|
68
73
|
position: absolute;
|
|
69
74
|
white-space: nowrap;
|
|
75
|
+
color: var(--nutui-noticebar-color, #d9500b);
|
|
70
76
|
}
|
|
71
77
|
.nut-noticebar .nut-noticebar-box-wrap .nut-noticebar-box-wrap-content.nut-ellipsis {
|
|
72
78
|
max-width: 100%;
|
|
@@ -3,7 +3,6 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
3
3
|
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
|
|
4
4
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
5
5
|
import React, { useEffect, useState } from "react";
|
|
6
|
-
import { CSSTransition } from "react-transition-group";
|
|
7
6
|
import classNames from "classnames";
|
|
8
7
|
import { View } from "@tarojs/components";
|
|
9
8
|
import { ComponentDefaults } from "../../utils/typings";
|
|
@@ -53,20 +52,27 @@ export var Overlay = function(props) {
|
|
|
53
52
|
return /*#__PURE__*/ React.createElement(View, _object_spread_props(_object_spread({
|
|
54
53
|
ref: nodeRef,
|
|
55
54
|
className: classes,
|
|
56
|
-
style: styles
|
|
55
|
+
style: _object_spread_props(_object_spread({}, styles), {
|
|
56
|
+
display: innerVisible ? 'block' : 'none'
|
|
57
|
+
})
|
|
57
58
|
}, rest), {
|
|
58
59
|
catchMove: lockScroll,
|
|
59
60
|
onClick: handleClick
|
|
60
61
|
}), children);
|
|
61
62
|
};
|
|
62
|
-
return /*#__PURE__*/ React.createElement(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, renderOverlay());
|
|
64
|
+
// return (
|
|
65
|
+
// <CSSTransition
|
|
66
|
+
// nodeRef={nodeRef}
|
|
67
|
+
// classNames={`${classPrefix}-slide`}
|
|
68
|
+
// unmountOnExit
|
|
69
|
+
// timeout={duration}
|
|
70
|
+
// in={innerVisible}
|
|
71
|
+
// onEntered={afterShow}
|
|
72
|
+
// onExited={afterClose}
|
|
73
|
+
// >
|
|
74
|
+
// {renderOverlay()}
|
|
75
|
+
// </CSSTransition>
|
|
76
|
+
// )
|
|
71
77
|
};
|
|
72
78
|
Overlay.displayName = 'NutOverlay';
|
|
@@ -4,7 +4,7 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
4
4
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
5
5
|
import React, { useState, useEffect } from "react";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
|
-
import { CSSTransition } from
|
|
7
|
+
// import { CSSTransition } from 'react-transition-group'
|
|
8
8
|
import classNames from "classnames";
|
|
9
9
|
import { Close } from "@nutui/icons-react-taro";
|
|
10
10
|
import { View } from "@tarojs/components";
|
|
@@ -107,26 +107,39 @@ export var Popup = function(props) {
|
|
|
107
107
|
return renderCloseIcon();
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
|
-
var
|
|
111
|
-
return /*#__PURE__*/ React.createElement(
|
|
110
|
+
var renderPop = function() {
|
|
111
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
112
112
|
ref: refObject,
|
|
113
|
-
style: popStyles,
|
|
113
|
+
style: _object_spread_props(_object_spread({}, popStyles), {
|
|
114
|
+
display: innerVisible ? 'block' : 'none'
|
|
115
|
+
}),
|
|
114
116
|
className: popClassName,
|
|
115
117
|
onClick: onClick,
|
|
116
118
|
catchMove: lockScroll
|
|
117
|
-
}, renderTitle(), showChildren ? children : null)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
119
|
+
}, renderTitle(), showChildren ? children : null);
|
|
120
|
+
// return (
|
|
121
|
+
// <CSSTransition
|
|
122
|
+
// nodeRef={refObject}
|
|
123
|
+
// classNames={transitionName}
|
|
124
|
+
// mountOnEnter
|
|
125
|
+
// unmountOnExit={destroyOnClose}
|
|
126
|
+
// timeout={duration}
|
|
127
|
+
// in={innerVisible}
|
|
128
|
+
// onEntered={afterShow}
|
|
129
|
+
// onExited={afterClose}
|
|
130
|
+
// >
|
|
131
|
+
// <View
|
|
132
|
+
// ref={refObject}
|
|
133
|
+
// style={popStyles}
|
|
134
|
+
// className={popClassName}
|
|
135
|
+
// onClick={onClick}
|
|
136
|
+
// catchMove={lockScroll}
|
|
137
|
+
// >
|
|
138
|
+
// {renderTitle()}
|
|
139
|
+
// {showChildren ? children : null}
|
|
140
|
+
// </View>
|
|
141
|
+
// </CSSTransition>
|
|
142
|
+
// )
|
|
130
143
|
};
|
|
131
144
|
var renderNode = function() {
|
|
132
145
|
return /*#__PURE__*/ React.createElement(React.Fragment, null, overlay ? /*#__PURE__*/ React.createElement(Overlay, {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
2
2
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
3
3
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
4
|
-
import React from "react";
|
|
4
|
+
import React, { useMemo } from "react";
|
|
5
5
|
import { Text, View } from "@tarojs/components";
|
|
6
6
|
import classNames from "classnames";
|
|
7
7
|
import { ComponentDefaults } from "../../utils/typings";
|
|
8
8
|
import { useRtl } from "../configprovider/index";
|
|
9
|
+
import { PriceColorEnum } from "../../types";
|
|
9
10
|
import { harmony } from "../../utils/taro/platform";
|
|
10
11
|
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
11
12
|
color: 'primary',
|
|
@@ -18,9 +19,28 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
|
18
19
|
line: false
|
|
19
20
|
});
|
|
20
21
|
export var Price = function(props) {
|
|
21
|
-
var _$_object_spread = _object_spread({}, defaultProps, props), color = _$_object_spread.color,
|
|
22
|
+
var _$_object_spread = _object_spread({}, defaultProps, props), color = _$_object_spread.color, originalPrice = _$_object_spread.price, symbol = _$_object_spread.symbol, digits = _$_object_spread.digits, thousands = _$_object_spread.thousands, position = _$_object_spread.position, size = _$_object_spread.size, line = _$_object_spread.line, className = _$_object_spread.className, style = _$_object_spread.style;
|
|
22
23
|
var classPrefix = 'nut-price';
|
|
23
24
|
var rtl = useRtl();
|
|
25
|
+
var price = useMemo(function() {
|
|
26
|
+
return originalPrice.toString().replace(/[^\d.]/g, '');
|
|
27
|
+
}, [
|
|
28
|
+
originalPrice
|
|
29
|
+
]);
|
|
30
|
+
var isCustomPriceColor = useMemo(function() {
|
|
31
|
+
var specificPriceColor = Object.values(PriceColorEnum);
|
|
32
|
+
return !specificPriceColor.includes(color);
|
|
33
|
+
}, [
|
|
34
|
+
color
|
|
35
|
+
]);
|
|
36
|
+
var priceColorStyle = useMemo(function() {
|
|
37
|
+
return isCustomPriceColor ? {
|
|
38
|
+
color: color
|
|
39
|
+
} : {};
|
|
40
|
+
}, [
|
|
41
|
+
isCustomPriceColor,
|
|
42
|
+
color
|
|
43
|
+
]);
|
|
24
44
|
var replaceSpecialChar = function(url) {
|
|
25
45
|
url = url.replace(/"/g, '"');
|
|
26
46
|
url = url.replace(/&/g, '&');
|
|
@@ -37,8 +57,8 @@ export var Price = function(props) {
|
|
|
37
57
|
if (Number(num) === 0) {
|
|
38
58
|
num = 0;
|
|
39
59
|
}
|
|
40
|
-
num = num.toString();
|
|
41
60
|
if (checkPoint(num)) {
|
|
61
|
+
num = num.toString();
|
|
42
62
|
num = typeof num.split('.') === 'string' ? num.split('.') : num.split('.')[0];
|
|
43
63
|
}
|
|
44
64
|
if (thousands) {
|
|
@@ -51,14 +71,17 @@ export var Price = function(props) {
|
|
|
51
71
|
decimalNum = 0;
|
|
52
72
|
}
|
|
53
73
|
if (checkPoint(decimalNum)) {
|
|
54
|
-
decimalNum = Number(decimalNum).toFixed(digits);
|
|
55
|
-
decimalNum = typeof decimalNum.split('.') === 'string' ? 0 : decimalNum.split('.')[1] ||
|
|
74
|
+
decimalNum = digits ? Number(decimalNum).toFixed(digits) : "".concat(decimalNum);
|
|
75
|
+
decimalNum = typeof decimalNum.split('.') === 'string' ? 0 : decimalNum.split('.')[1] || '';
|
|
56
76
|
} else {
|
|
57
|
-
decimalNum =
|
|
77
|
+
decimalNum = '';
|
|
78
|
+
}
|
|
79
|
+
if (digits) {
|
|
80
|
+
var result = "0.".concat(decimalNum);
|
|
81
|
+
var resultFixed = Number(result).toFixed(digits);
|
|
82
|
+
return String(resultFixed).substring(2, resultFixed.length);
|
|
58
83
|
}
|
|
59
|
-
|
|
60
|
-
var resultFixed = Number(result).toFixed(digits);
|
|
61
|
-
return String(resultFixed).substring(2, resultFixed.length);
|
|
84
|
+
return decimalNum;
|
|
62
85
|
};
|
|
63
86
|
var renderSymbol = function() {
|
|
64
87
|
var _obj;
|
|
@@ -67,16 +90,20 @@ export var Price = function(props) {
|
|
|
67
90
|
"".concat(classPrefix, "-symbol"),
|
|
68
91
|
"".concat(classPrefix, "-symbol-").concat(size),
|
|
69
92
|
(_obj = {}, _define_property(_obj, "".concat(classPrefix, "-line"), line), _define_property(_obj, "".concat(classPrefix, "-rtl"), rtl), _obj)
|
|
70
|
-
])
|
|
93
|
+
]),
|
|
94
|
+
style: priceColorStyle
|
|
71
95
|
}, symbol ? replaceSpecialChar(symbol) : '');
|
|
72
96
|
};
|
|
73
97
|
var renderInner = function() {
|
|
74
98
|
return /*#__PURE__*/ React.createElement(React.Fragment, null, symbol && position === 'before' ? renderSymbol() : null, /*#__PURE__*/ React.createElement(Text, {
|
|
75
|
-
className: "".concat(classPrefix, "-integer ").concat(classPrefix, "-integer-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : '')
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
99
|
+
className: "".concat(classPrefix, "-integer ").concat(classPrefix, "-integer-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : ''),
|
|
100
|
+
style: priceColorStyle
|
|
101
|
+
}, formatThousands(price)), digits !== 0 ? /*#__PURE__*/ React.createElement(React.Fragment, null, checkPoint(price) || digits ? /*#__PURE__*/ React.createElement(Text, {
|
|
102
|
+
className: "".concat(classPrefix, "-decimal ").concat(classPrefix, "-decimal-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : ''),
|
|
103
|
+
style: priceColorStyle
|
|
104
|
+
}, ".") : null, /*#__PURE__*/ React.createElement(Text, {
|
|
105
|
+
className: "".concat(classPrefix, "-decimal ").concat(classPrefix, "-decimal-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : ''),
|
|
106
|
+
style: priceColorStyle
|
|
80
107
|
}, formatDecimal(price))) : null, symbol && position === 'after' ? renderSymbol() : null);
|
|
81
108
|
};
|
|
82
109
|
return /*#__PURE__*/ React.createElement(React.Fragment, null, harmony() ? /*#__PURE__*/ React.createElement(Text, {
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import { BaseProps } from '../../base/props';
|
|
2
2
|
import { SimpleValue, UISize } from '../../base/atoms';
|
|
3
3
|
export type PriceSize = Exclude<UISize, 'mini'>;
|
|
4
|
-
export type
|
|
4
|
+
export type SpecificPriceColor = 'primary' | 'gray' | 'darkgray';
|
|
5
|
+
export type PriceColor = SpecificPriceColor | string;
|
|
6
|
+
export declare enum PriceColorEnum {
|
|
7
|
+
Primary = "primary",
|
|
8
|
+
Gray = "gray",
|
|
9
|
+
Darkgray = "darkgray"
|
|
10
|
+
}
|
|
5
11
|
export interface BasePrice extends BaseProps {
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
/**
|
|
13
|
+
* 价格类型, 支持自定义颜色
|
|
14
|
+
*/
|
|
15
|
+
color: PriceColor
|
|
16
|
+
/**
|
|
17
|
+
* 价格数量
|
|
18
|
+
*/
|
|
19
|
+
price: SimpleValue
|
|
8
20
|
/**
|
|
9
21
|
* 符号类型
|
|
10
22
|
*/
|
|
11
23
|
symbol: string
|
|
12
24
|
/**
|
|
13
|
-
*
|
|
25
|
+
* 小数位位数,传入null数据原样输出
|
|
14
26
|
*/
|
|
15
|
-
digits: number
|
|
27
|
+
digits: number | null
|
|
16
28
|
/**
|
|
17
29
|
* 是否按照千分号形式显示
|
|
18
30
|
*/
|
|
@@ -10,3 +10,4 @@ export interface Rect {
|
|
|
10
10
|
}
|
|
11
11
|
export declare function makeRect(width: number, height: number): Rect;
|
|
12
12
|
export declare const getRectInMultiPlatform: (element: any, harmonyId?: string) => Promise<Rect>;
|
|
13
|
+
export declare const getRectInMultiPlatformWithoutCache: (element: any, harmonyId?: string) => Promise<Rect>;
|
|
@@ -56,3 +56,37 @@ export var getRectInMultiPlatform = /*#__PURE__*/ function() {
|
|
|
56
56
|
return _ref.apply(this, arguments);
|
|
57
57
|
};
|
|
58
58
|
}();
|
|
59
|
+
// 获取元素位置,不走缓存
|
|
60
|
+
export var getRectInMultiPlatformWithoutCache = /*#__PURE__*/ function() {
|
|
61
|
+
var _ref = _async_to_generator(function(element) {
|
|
62
|
+
var harmonyId;
|
|
63
|
+
var _arguments = arguments;
|
|
64
|
+
return _ts_generator(this, function(_state) {
|
|
65
|
+
harmonyId = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : '';
|
|
66
|
+
if (element) {
|
|
67
|
+
if (inBrowser) {
|
|
68
|
+
return [
|
|
69
|
+
2,
|
|
70
|
+
Promise.resolve(getRect(element))
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
return [
|
|
74
|
+
2,
|
|
75
|
+
new Promise(function(resolve, reject) {
|
|
76
|
+
createSelectorQuery().select("#".concat(harmonyId || element.uid)).boundingClientRect().exec(function(param) {
|
|
77
|
+
var _param = _sliced_to_array(param, 1), rects = _param[0];
|
|
78
|
+
resolve(rects);
|
|
79
|
+
});
|
|
80
|
+
})
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
return [
|
|
84
|
+
2,
|
|
85
|
+
Promise.resolve(makeRect(0, 0))
|
|
86
|
+
];
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
return function getRectInMultiPlatformWithoutCache(element) {
|
|
90
|
+
return _ref.apply(this, arguments);
|
|
91
|
+
};
|
|
92
|
+
}();
|