@nutui/nutui-react 3.0.17 → 3.0.18

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/packages/lottie/animation/dark/global.gif +0 -0
  3. package/dist/cjs/packages/lottie/animation/dark/global.json +0 -0
  4. package/dist/cjs/packages/lottie/animation/dark/loading.gif +0 -0
  5. package/dist/cjs/packages/lottie/animation/dark/loading.json +0 -0
  6. package/dist/cjs/packages/lottie/animation/dark/pulltorefresh-white.gif +0 -0
  7. package/dist/cjs/packages/lottie/animation/dark/pulltorefresh-white.json +0 -0
  8. package/dist/cjs/packages/lottie/animation/dark/pulltorefresh.gif +0 -0
  9. package/dist/cjs/packages/lottie/animation/dark/pulltorefresh.json +0 -0
  10. package/dist/cjs/packages/lottie/animation/light/global.gif +0 -0
  11. package/dist/cjs/packages/lottie/animation/light/global.json +0 -0
  12. package/dist/cjs/packages/lottie/animation/light/loading.gif +0 -0
  13. package/dist/cjs/packages/lottie/animation/light/loading.json +0 -0
  14. package/dist/cjs/packages/lottie/animation/light/pulltorefresh.gif +0 -0
  15. package/dist/cjs/packages/lottie/animation/light/pulltorefresh.json +0 -0
  16. package/dist/cjs/packages/noticebar/style/noticebar.scss +6 -0
  17. package/dist/cjs/packages/noticebar/style/style.css +6 -0
  18. package/dist/cjs/packages/noticebar/style-jmapp/noticebar.scss +6 -0
  19. package/dist/cjs/packages/noticebar/style-jmapp/style.css +6 -0
  20. package/dist/cjs/packages/noticebar/style-jrkf/noticebar.scss +6 -0
  21. package/dist/cjs/packages/noticebar/style-jrkf/style.css +6 -0
  22. package/dist/cjs/packages/notify/notify.d.ts +1 -1
  23. package/dist/cjs/packages/notify/notify.js +5 -2
  24. package/dist/cjs/packages/price/price.js +42 -14
  25. package/dist/cjs/types/spec/price/base.d.ts +8 -2
  26. package/dist/cjs/types/spec/price/base.js +12 -0
  27. package/dist/cjs/utils/taro/get-rect.d.ts +1 -0
  28. package/dist/cjs/utils/taro/get-rect.js +36 -0
  29. package/dist/es/packages/lottie/animation/dark/global.gif +0 -0
  30. package/dist/es/packages/lottie/animation/dark/global.json +0 -0
  31. package/dist/es/packages/lottie/animation/dark/loading.gif +0 -0
  32. package/dist/es/packages/lottie/animation/dark/loading.json +0 -0
  33. package/dist/es/packages/lottie/animation/dark/pulltorefresh-white.gif +0 -0
  34. package/dist/es/packages/lottie/animation/dark/pulltorefresh-white.json +0 -0
  35. package/dist/es/packages/lottie/animation/dark/pulltorefresh.gif +0 -0
  36. package/dist/es/packages/lottie/animation/dark/pulltorefresh.json +0 -0
  37. package/dist/es/packages/lottie/animation/light/global.gif +0 -0
  38. package/dist/es/packages/lottie/animation/light/global.json +0 -0
  39. package/dist/es/packages/lottie/animation/light/loading.gif +0 -0
  40. package/dist/es/packages/lottie/animation/light/loading.json +0 -0
  41. package/dist/es/packages/lottie/animation/light/pulltorefresh.gif +0 -0
  42. package/dist/es/packages/lottie/animation/light/pulltorefresh.json +0 -0
  43. package/dist/es/packages/noticebar/style/noticebar.scss +6 -0
  44. package/dist/es/packages/noticebar/style/style.css +6 -0
  45. package/dist/es/packages/noticebar/style-jmapp/noticebar.scss +6 -0
  46. package/dist/es/packages/noticebar/style-jmapp/style.css +6 -0
  47. package/dist/es/packages/noticebar/style-jrkf/noticebar.scss +6 -0
  48. package/dist/es/packages/noticebar/style-jrkf/style.css +6 -0
  49. package/dist/es/packages/notify/notify.d.ts +1 -1
  50. package/dist/es/packages/notify/notify.js +5 -2
  51. package/dist/es/packages/price/price.js +41 -14
  52. package/dist/es/types/spec/price/base.d.ts +10 -4
  53. package/dist/es/types/spec/price/base.js +6 -1
  54. package/dist/es/utils/taro/get-rect.d.ts +1 -0
  55. package/dist/es/utils/taro/get-rect.js +34 -0
  56. package/dist/nutui.react.umd.js +1083 -922
  57. package/dist/style-jmapp.css +1 -1
  58. package/dist/style-jmapp.scss +31 -31
  59. package/dist/style-jrkf.css +1 -1
  60. package/dist/style-jrkf.scss +30 -30
  61. package/dist/style.css +1 -1
  62. package/dist/style.scss +44 -44
  63. package/package.json +1 -72
@@ -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%;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  declare const _default: {
3
- text(message: string | React.ReactNode, option?: {}): void;
3
+ text(message: string | React.ReactNode, option?: {}): Promise<void>;
4
4
  hide(): void;
5
5
  };
6
6
  export default _default;
@@ -27,8 +27,11 @@ function getInstance(props, callback) {
27
27
  }
28
28
  function notice(opts) {
29
29
  opts = _object_spread({}, options, opts);
30
- getInstance(opts, function(notification) {
31
- messageInstance = notification;
30
+ return new Promise(function(resolve) {
31
+ getInstance(opts, function(notification) {
32
+ messageInstance = notification;
33
+ resolve();
34
+ });
32
35
  });
33
36
  }
34
37
  var errorMsg = function(message) {
@@ -2,10 +2,11 @@ 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
4
  import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
5
- import React from "react";
5
+ import React, { useMemo } from "react";
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
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
10
11
  color: 'primary',
11
12
  price: 0,
@@ -17,7 +18,7 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
17
18
  line: false
18
19
  });
19
20
  export var Price = function(props) {
20
- var _ref = _object_spread({}, defaultProps, props), color = _ref.color, price = _ref.price, symbol = _ref.symbol, digits = _ref.digits, thousands = _ref.thousands, position = _ref.position, size = _ref.size, line = _ref.line, className = _ref.className, style = _ref.style, rest = _object_without_properties(_ref, [
21
+ var _ref = _object_spread({}, defaultProps, props), color = _ref.color, originalPrice = _ref.price, symbol = _ref.symbol, digits = _ref.digits, thousands = _ref.thousands, position = _ref.position, size = _ref.size, line = _ref.line, className = _ref.className, style = _ref.style, rest = _object_without_properties(_ref, [
21
22
  "color",
22
23
  "price",
23
24
  "symbol",
@@ -31,6 +32,25 @@ export var Price = function(props) {
31
32
  ]);
32
33
  var classPrefix = 'nut-price';
33
34
  var rtl = useRtl();
35
+ var price = useMemo(function() {
36
+ return originalPrice.toString().replace(/[^\d.]/g, '');
37
+ }, [
38
+ originalPrice
39
+ ]);
40
+ var isCustomPriceColor = useMemo(function() {
41
+ var specificPriceColor = Object.values(PriceColorEnum);
42
+ return !specificPriceColor.includes(color);
43
+ }, [
44
+ color
45
+ ]);
46
+ var priceColorStyle = useMemo(function() {
47
+ return isCustomPriceColor ? {
48
+ color: color
49
+ } : {};
50
+ }, [
51
+ isCustomPriceColor,
52
+ color
53
+ ]);
34
54
  var checkPoint = function(price) {
35
55
  return String(price).indexOf('.') > 0;
36
56
  };
@@ -52,14 +72,17 @@ export var Price = function(props) {
52
72
  decimalNum = 0;
53
73
  }
54
74
  if (checkPoint(decimalNum)) {
55
- decimalNum = Number(decimalNum).toFixed(digits);
56
- decimalNum = typeof decimalNum.split('.') === 'string' ? 0 : decimalNum.split('.')[1] || 0;
75
+ decimalNum = digits ? Number(decimalNum).toFixed(digits) : "".concat(decimalNum);
76
+ decimalNum = typeof decimalNum.split('.') === 'string' ? 0 : decimalNum.split('.')[1] || '';
57
77
  } else {
58
- decimalNum = 0;
78
+ decimalNum = '';
79
+ }
80
+ if (digits) {
81
+ var result = "0.".concat(decimalNum);
82
+ var resultFixed = Number(result).toFixed(digits);
83
+ return String(resultFixed).substring(2, resultFixed.length);
59
84
  }
60
- var result = "0.".concat(decimalNum);
61
- var resultFixed = Number(result).toFixed(digits);
62
- return String(resultFixed).substring(2, resultFixed.length);
85
+ return decimalNum;
63
86
  };
64
87
  var renderSymbol = function() {
65
88
  var _obj;
@@ -69,20 +92,24 @@ export var Price = function(props) {
69
92
  "".concat(classPrefix, "-symbol-").concat(size),
70
93
  (_obj = {}, _define_property(_obj, "".concat(classPrefix, "-line"), line), _define_property(_obj, "".concat(classPrefix, "-rtl"), rtl), _obj)
71
94
  ]),
95
+ style: priceColorStyle,
72
96
  dangerouslySetInnerHTML: {
73
97
  __html: symbol || ''
74
98
  }
75
99
  });
76
100
  };
77
101
  return /*#__PURE__*/ React.createElement("div", _object_spread({
78
- className: "".concat(classPrefix, " ").concat(classPrefix, "-").concat(color, " ").concat(className),
102
+ className: "".concat(classPrefix, " ").concat(classPrefix, "-").concat(isCustomPriceColor ? 'custom' : color, " ").concat(className),
79
103
  style: style
80
104
  }, rest), symbol && position === 'before' ? renderSymbol() : null, /*#__PURE__*/ React.createElement("div", {
81
- className: "".concat(classPrefix, "-integer ").concat(classPrefix, "-integer-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : '')
82
- }, formatThousands(price)), digits ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("div", {
83
- className: "".concat(classPrefix, "-decimal ").concat(classPrefix, "-decimal-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : '')
84
- }, "."), /*#__PURE__*/ React.createElement("div", {
85
- className: "".concat(classPrefix, "-decimal ").concat(classPrefix, "-decimal-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : '')
105
+ className: "".concat(classPrefix, "-integer ").concat(classPrefix, "-integer-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : ''),
106
+ style: priceColorStyle
107
+ }, formatThousands(price)), digits !== 0 ? /*#__PURE__*/ React.createElement(React.Fragment, null, checkPoint(price) || digits ? /*#__PURE__*/ React.createElement("div", {
108
+ className: "".concat(classPrefix, "-decimal ").concat(classPrefix, "-decimal-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : ''),
109
+ style: priceColorStyle
110
+ }, ".") : null, /*#__PURE__*/ React.createElement("div", {
111
+ className: "".concat(classPrefix, "-decimal ").concat(classPrefix, "-decimal-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : ''),
112
+ style: priceColorStyle
86
113
  }, formatDecimal(price))) : null, symbol && position === 'after' ? renderSymbol() : null);
87
114
  };
88
115
  Price.displayName = 'NutPrice';
@@ -1,10 +1,16 @@
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 PriceColor = 'primary' | 'gray' | 'darkgray';
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
12
  /**
7
- * 价格类型
13
+ * 价格类型, 支持自定义颜色
8
14
  */
9
15
  color: PriceColor
10
16
  /**
@@ -16,9 +22,9 @@ export interface BasePrice extends BaseProps {
16
22
  */
17
23
  symbol: string
18
24
  /**
19
- * 小数位位数
25
+ * 小数位位数,传入null数据原样输出
20
26
  */
21
- digits: number
27
+ digits: number | null
22
28
  /**
23
29
  * 是否按照千分号形式显示
24
30
  */
@@ -1 +1,6 @@
1
- export { };
1
+ export var PriceColorEnum = /*#__PURE__*/ function(PriceColorEnum) {
2
+ PriceColorEnum["Primary"] = "primary";
3
+ PriceColorEnum["Gray"] = "gray";
4
+ PriceColorEnum["Darkgray"] = "darkgray";
5
+ return PriceColorEnum;
6
+ }({});
@@ -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
+ }();