@nutui/nutui-react-taro 3.0.0-beta.2 → 3.0.0-beta.3

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 (90) hide show
  1. package/dist/cjs/packages/avatar/avatar.js +14 -16
  2. package/dist/cjs/packages/avatar/style/avatar.scss +7 -60
  3. package/dist/cjs/packages/avatar/style/style.css +5 -43
  4. package/dist/cjs/packages/avatar/style/style.harmony.css +5 -43
  5. package/dist/cjs/packages/badge/badge.js +67 -12
  6. package/dist/cjs/packages/badge/style/badge.scss +18 -24
  7. package/dist/cjs/packages/badge/style/style.css +17 -15
  8. package/dist/cjs/packages/badge/style/style.harmony.css +22 -17
  9. package/dist/cjs/packages/calendarcard/calendarcard.js +8 -3
  10. package/dist/cjs/packages/calendarcard/icon.js +14 -2
  11. package/dist/cjs/packages/calendarcard/style/calendarcard.scss +25 -4
  12. package/dist/cjs/packages/calendarcard/style/style.css +27 -2
  13. package/dist/cjs/packages/image/image.js +5 -5
  14. package/dist/cjs/packages/input/style/style.harmony.css +4 -0
  15. package/dist/cjs/packages/navbar/navbar.js +17 -8
  16. package/dist/cjs/packages/navbar/style/navbar.scss +46 -101
  17. package/dist/cjs/packages/navbar/style/style.css +44 -89
  18. package/dist/cjs/packages/navbar/style/style.harmony.css +45 -93
  19. package/dist/cjs/packages/pagination/pagination.js +2 -0
  20. package/dist/cjs/packages/pagination/style/pagination.scss +6 -12
  21. package/dist/cjs/packages/pagination/style/style.css +8 -14
  22. package/dist/cjs/packages/radio/index.d.ts +8 -2
  23. package/dist/cjs/packages/radio/index.js +6 -1
  24. package/dist/cjs/packages/radio/radio.d.ts +2 -5
  25. package/dist/cjs/packages/radio/radio.js +2 -4
  26. package/dist/cjs/packages/radio/style/radio.scss +1 -0
  27. package/dist/cjs/packages/radiogroup/radiogroup.d.ts +2 -1
  28. package/dist/cjs/packages/radiogroup/radiogroup.js +3 -2
  29. package/dist/cjs/packages/safearea/style/safearea.scss +1 -1
  30. package/dist/cjs/packages/safearea/style/style.css +1 -1
  31. package/dist/cjs/packages/safearea/style/style.harmony.css +1 -1
  32. package/dist/cjs/packages/searchbar/searchbar.d.ts +1 -1
  33. package/dist/cjs/packages/searchbar/searchbar.js +31 -33
  34. package/dist/cjs/packages/searchbar/style/searchbar.scss +10 -7
  35. package/dist/cjs/packages/searchbar/style/style.css +11 -8
  36. package/dist/cjs/packages/searchbar/style/style.harmony.css +25 -12
  37. package/dist/cjs/packages/skeleton/style/style.css +5 -43
  38. package/dist/cjs/packages/tabbar/style/style.css +17 -15
  39. package/dist/cjs/packages/tabbaritem/style/style.css +17 -15
  40. package/dist/cjs/packages/video/video.js +3 -3
  41. package/dist/es/packages/avatar/avatar.js +14 -16
  42. package/dist/es/packages/avatar/style/avatar.scss +7 -60
  43. package/dist/es/packages/avatar/style/style.css +5 -43
  44. package/dist/es/packages/avatar/style/style.harmony.css +5 -43
  45. package/dist/es/packages/badge/badge.d.ts +7 -35
  46. package/dist/es/packages/badge/badge.js +66 -12
  47. package/dist/es/packages/badge/style/badge.scss +18 -24
  48. package/dist/es/packages/badge/style/style.css +17 -15
  49. package/dist/es/packages/badge/style/style.harmony.css +22 -17
  50. package/dist/es/packages/calendarcard/calendarcard.d.ts +13 -65
  51. package/dist/es/packages/calendarcard/calendarcard.js +9 -4
  52. package/dist/es/packages/calendarcard/icon.js +15 -3
  53. package/dist/es/packages/calendarcard/style/calendarcard.scss +25 -4
  54. package/dist/es/packages/calendarcard/style/style.css +27 -2
  55. package/dist/es/packages/image/image.js +5 -5
  56. package/dist/es/packages/input/style/style.harmony.css +4 -0
  57. package/dist/es/packages/loading/loading.d.ts +3 -15
  58. package/dist/es/packages/navbar/navbar.js +17 -8
  59. package/dist/es/packages/navbar/style/navbar.scss +46 -101
  60. package/dist/es/packages/navbar/style/style.css +44 -89
  61. package/dist/es/packages/navbar/style/style.harmony.css +45 -93
  62. package/dist/es/packages/pagination/pagination.js +2 -0
  63. package/dist/es/packages/pagination/style/pagination.scss +6 -12
  64. package/dist/es/packages/pagination/style/style.css +8 -14
  65. package/dist/es/packages/radio/index.d.ts +8 -2
  66. package/dist/es/packages/radio/index.js +5 -1
  67. package/dist/es/packages/radio/radio.d.ts +11 -50
  68. package/dist/es/packages/radio/radio.js +3 -5
  69. package/dist/es/packages/radio/style/radio.scss +1 -0
  70. package/dist/es/packages/radiogroup/radiogroup.d.ts +9 -36
  71. package/dist/es/packages/radiogroup/radiogroup.js +3 -2
  72. package/dist/es/packages/safearea/safearea.d.ts +1 -5
  73. package/dist/es/packages/safearea/style/safearea.scss +1 -1
  74. package/dist/es/packages/safearea/style/style.css +1 -1
  75. package/dist/es/packages/safearea/style/style.harmony.css +1 -1
  76. package/dist/es/packages/searchbar/searchbar.d.ts +19 -95
  77. package/dist/es/packages/searchbar/searchbar.js +32 -34
  78. package/dist/es/packages/searchbar/style/searchbar.scss +10 -7
  79. package/dist/es/packages/searchbar/style/style.css +11 -8
  80. package/dist/es/packages/searchbar/style/style.harmony.css +25 -12
  81. package/dist/es/packages/skeleton/style/style.css +5 -43
  82. package/dist/es/packages/tabbar/style/style.css +17 -15
  83. package/dist/es/packages/tabbaritem/style/style.css +17 -15
  84. package/dist/es/packages/video/video.d.ts +5 -25
  85. package/dist/es/packages/video/video.js +3 -3
  86. package/dist/nutui.react.umd.js +256 -199
  87. package/dist/style.css +1 -1
  88. package/dist/styles/themes/default.scss +25 -25
  89. package/dist/styles/variables.scss +7 -4
  90. package/package.json +2 -2
@@ -2,70 +2,18 @@ import React, { ReactNode } from 'react';
2
2
  import { BasicComponent } from "../../utils/typings";
3
3
  import type { CalendarCardDay, CalendarCardMonth, CalendarCardRef, CalendarCardValue } from './types';
4
4
  export interface CalendarCardProps extends BasicComponent {
5
- /**
6
- * 类型,单个日期 single,多个日期 multiple,日期范围 range,周选择 week
7
- * @default single
8
- */
9
- type: 'single' | 'multiple' | 'range' | 'week'
10
- /**
11
- * 受控模式下的值,与 onChange 搭配使用
12
- * @default -
13
- */
14
- value?: CalendarCardValue
15
- /**
16
- * 默认值,单个日期 Date 格式,多个日期/范围选择 Date[] 格式
17
- * @default -
18
- */
19
- defaultValue?: CalendarCardValue
20
- /**
21
- * 设置周起始日,0 为周日,1 为周一
22
- * @default 1
23
- */
24
- firstDayOfWeek?: number
25
- /**
26
- * 限制范围开始日期
27
- * @default -
28
- */
29
- startDate?: Date
30
- /**
31
- * 限制范围结束日期
32
- * @default -
33
- */
34
- endDate?: Date
35
- /**
36
- * 设置不可选日期
37
- * @default -
38
- */
39
- disableDay?: (day: CalendarCardDay) => boolean
40
- /**
41
- * 日期信息
42
- * @default -
43
- */
44
- renderDay?: (day: CalendarCardDay) => ReactNode
45
- /**
46
- * 日期顶部信息
47
- * @default -
48
- */
49
- renderDayTop?: (day: CalendarCardDay) => ReactNode
50
- /**
51
- * 日期底部信息
52
- * @default -
53
- */
54
- renderDayBottom?: (day: CalendarCardDay) => ReactNode
55
- /**
56
- * 点击后触发
57
- * @default -
58
- */
59
- onDayClick?: (day: CalendarCardDay) => void
60
- /**
61
- * 切换月份时触发
62
- * @default -
63
- */
64
- onPageChange: (data: CalendarCardMonth) => void
65
- /**
66
- * 选择值发生变化时触发
67
- * @default -
68
- */
69
- onChange: (value: CalendarCardValue) => void
5
+ type: 'single' | 'multiple' | 'range' | 'week';
6
+ value?: CalendarCardValue;
7
+ defaultValue?: CalendarCardValue;
8
+ firstDayOfWeek?: number;
9
+ startDate?: Date;
10
+ endDate?: Date;
11
+ disableDay?: (day: CalendarCardDay) => boolean;
12
+ renderDay?: (day: CalendarCardDay) => ReactNode;
13
+ renderDayTop?: (day: CalendarCardDay) => ReactNode;
14
+ renderDayBottom?: (day: CalendarCardDay) => ReactNode;
15
+ onDayClick?: (day: CalendarCardDay) => void;
16
+ onPageChange: (data: CalendarCardMonth) => void;
17
+ onChange: (value: CalendarCardValue) => void;
70
18
  }
71
19
  export declare const CalendarCard: React.ForwardRefExoticComponent<Partial<CalendarCardProps> & React.RefAttributes<CalendarCardRef>>;
@@ -2,7 +2,7 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
2
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
3
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
4
4
  import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
5
- import React, { useState, useEffect } from "react";
5
+ import React, { useCallback, useEffect, useState } from "react";
6
6
  import classNames from "classnames";
7
7
  import { View } from "@tarojs/components";
8
8
  import { ArrowLeft, ArrowRight, DoubleLeft, DoubleRight } from "./icon";
@@ -71,7 +71,7 @@ export var CalendarCard = /*#__PURE__*/ React.forwardRef(function(props, ref) {
71
71
  onChange === null || onChange === void 0 ? void 0 : onChange(val);
72
72
  }
73
73
  };
74
- var getDays = function(month) {
74
+ var getDays = useCallback(function(month) {
75
75
  var y = month.year;
76
76
  var m = month.month;
77
77
  var days = _to_consumable_array(getPrevMonthDays(y, m, firstDayOfWeek)).concat(_to_consumable_array(getCurrentMonthDays(y, m)));
@@ -88,13 +88,18 @@ export var CalendarCard = /*#__PURE__*/ React.forwardRef(function(props, ref) {
88
88
  });
89
89
  }
90
90
  return days;
91
- };
91
+ }, [
92
+ firstDayOfWeek
93
+ ]);
92
94
  useEffect(function() {
93
95
  var newDays = getDays(month);
94
96
  setDays(newDays);
95
97
  onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(month);
96
98
  }, [
97
- month
99
+ month,
100
+ getDays,
101
+ onPageChange,
102
+ firstDayOfWeek
98
103
  ]);
99
104
  var isSameDay = function(day1, day2) {
100
105
  return (day1 === null || day1 === void 0 ? void 0 : day1.year) === (day2 === null || day2 === void 0 ? void 0 : day2.year) && (day1 === null || day1 === void 0 ? void 0 : day1.month) === (day2 === null || day2 === void 0 ? void 0 : day2.month) && (day1 === null || day1 === void 0 ? void 0 : day1.date) === (day2 === null || day2 === void 0 ? void 0 : day2.date);
@@ -1,17 +1,29 @@
1
1
  import React from "react";
2
- import { View } from "@tarojs/components";
2
+ import { Image, View } from "@tarojs/components";
3
3
  var left = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgdmlld0JveD0iMCAwIDE4IDE4Ij48cGF0aCBkPSJNNi42MDUgOS40OWEuNzcxLjc3MSAwIDAgMSAwLS45OGwzLjYtNC4zNzJhLjc3MS43NzEgMCAwIDEgMS4xOS45ODFMOC4yIDlsMy4xOTcgMy44ODFhLjc3MS43NzEgMCAxIDEtMS4xOTEuOThsLTMuNi00LjM3eiIvPjwvc3ZnPg==';
4
4
  var right = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgdmlld0JveD0iMCAwIDE4IDE4Ij48cGF0aCBkPSJNMTEuMzk2IDkuNDlhLjc3MS43NzEgMCAwIDAgMC0uOThsLTMuNi00LjM3MmEuNzcxLjc3MSAwIDAgMC0xLjE5MS45ODFMOS44IDlsLTMuMTk2IDMuODgxYS43NzEuNzcxIDAgMCAwIDEuMTkuOThsMy42LTQuMzd6Ii8+PC9zdmc+';
5
5
  var doubleLeft = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgdmlld0JveD0iMCAwIDE4IDE4Ij48cGF0aCBkPSJNMTMuODUzIDQuMDI2YS43NzEuNzcxIDAgMCAxIC4xMiAxLjA4NUwxMC44NjQgOWwzLjExIDMuODg5YS43NzEuNzcxIDAgMSAxLTEuMjA0Ljk2M2wtMy40OTgtNC4zN2EuNzcxLjc3MSAwIDAgMSAwLS45NjRsMy40OTctNC4zNzFhLjc3MS43NzEgMCAwIDEgMS4wODQtLjEyem0tNS4yNDUgMGEuNzcxLjc3MSAwIDAgMSAuMTIgMS4wODVMNS42MTcgOWwzLjExMSAzLjg4OWEuNzcxLjc3MSAwIDAgMS0xLjIwNS45NjNsLTMuNDk3LTQuMzdhLjc3MS43NzEgMCAwIDEgMC0uOTY0bDMuNDk3LTQuMzcxYS43NzEuNzcxIDAgMCAxIDEuMDg1LS4xMnoiLz48L3N2Zz4=';
6
6
  var doubleRight = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgdmlld0JveD0iMCAwIDE4IDE4Ij48cGF0aCBkPSJNNC4xNDcgMTMuOTc0YS43NzEuNzcxIDAgMCAxLS4xMi0xLjA4NUw3LjEzNiA5IDQuMDI4IDUuMTFhLjc3MS43NzEgMCAxIDEgMS4yMDQtLjk2M2wzLjQ5NyA0LjM3MWEuNzcxLjc3MSAwIDAgMSAwIC45NjRsLTMuNDk3IDQuMzcxYS43NzEuNzcxIDAgMCAxLTEuMDg0LjEyem01LjI0NSAwYS43NzEuNzcxIDAgMCAxLS4xMi0xLjA4NUwxMi4zODMgOSA5LjI3MiA1LjExYS43NzEuNzcxIDAgMSAxIDEuMjA1LS45NjNsMy40OTcgNC4zNzFhLjc3MS43NzEgMCAwIDEgMCAuOTY0bC0zLjQ5NyA0LjM3MWEuNzcxLjc3MSAwIDAgMS0xLjA4NS4xMnoiLz48L3N2Zz4=';
7
+ if (process.env.TARO_ENV === 'jdharmony_cpp') {
8
+ left = 'https://img11.360buyimg.com/imagetools/jfs/t1/187031/35/51586/196/6731c464F9b9f8f00/5506e32bf15e29dc.png';
9
+ right = 'https://img12.360buyimg.com/imagetools/jfs/t1/181006/25/51824/185/6731c452F9e252322/7493147dd6b4a88d.png';
10
+ doubleLeft = 'https://img13.360buyimg.com/imagetools/jfs/t1/221244/29/45876/259/6731c6bdF515df0a2/624e8eee3c8494a2.png';
11
+ doubleRight = 'https://img11.360buyimg.com/imagetools/jfs/t1/238382/25/24000/235/6731c6bdF0153286c/4a57e60b6e889af3.png';
12
+ }
7
13
  var Icon = function(param) {
8
14
  var url = param.url;
9
15
  var style = {
10
16
  background: "url('".concat(url, "') no-repeat center"),
11
17
  backgroundSize: '100% 100%',
12
- width: '18px',
13
- height: '18px'
18
+ width: 18,
19
+ height: 18
14
20
  };
21
+ if (process.env.TARO_ENV === 'jdharmony_cpp') {
22
+ return /*#__PURE__*/ React.createElement(Image, {
23
+ src: url,
24
+ style: style
25
+ });
26
+ }
15
27
  return /*#__PURE__*/ React.createElement(View, {
16
28
  style: style
17
29
  });
@@ -55,6 +55,9 @@
55
55
 
56
56
  &-top,
57
57
  &-bottom {
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
58
61
  width: 100%;
59
62
  height: 12px;
60
63
  font-size: 12px;
@@ -67,14 +70,22 @@
67
70
 
68
71
  &.active {
69
72
  background-color: $calendar-active-background-color;
70
- color: $color-primary-text;
71
73
  border-radius: $calendar-day-active-border-radius;
74
+ .nut-calendarcard-day-top,
75
+ .nut-calendarcard-day-inner,
76
+ .nut-calendarcard-day-bottom {
77
+ color: $color-primary-text;
78
+ }
72
79
  }
73
80
 
74
81
  &.start,
75
82
  &.end {
76
83
  background-color: $calendar-active-background-color;
77
- color: $color-primary-text;
84
+ .nut-calendarcard-day-top,
85
+ .nut-calendarcard-day-inner,
86
+ .nut-calendarcard-day-bottom {
87
+ color: $color-primary-text;
88
+ }
78
89
  }
79
90
 
80
91
  &.start {
@@ -89,7 +100,11 @@
89
100
 
90
101
  &.mid {
91
102
  background-color: $calendar-choose-background-color;
92
- color: $calendar-choose-color;
103
+ .nut-calendarcard-day-top,
104
+ .nut-calendarcard-day-inner,
105
+ .nut-calendarcard-day-bottom {
106
+ color: $calendar-choose-color;
107
+ }
93
108
  }
94
109
 
95
110
  .nut-calendar-day-info {
@@ -100,7 +115,11 @@
100
115
  &.prev,
101
116
  &.next,
102
117
  &.disabled {
103
- color: $calendar-disable-color;
118
+ .nut-calendarcard-day-top,
119
+ .nut-calendarcard-day-inner,
120
+ .nut-calendarcard-day-bottom {
121
+ color: $calendar-disable-color;
122
+ }
104
123
  cursor: not-allowed;
105
124
  }
106
125
  }
@@ -128,11 +147,13 @@
128
147
  }
129
148
  }
130
149
  }
150
+
131
151
  &-day {
132
152
  &.start,
133
153
  &.end {
134
154
  border-radius: 0;
135
155
  }
156
+
136
157
  &.start {
137
158
  border-top-right-radius: $calendar-day-active-border-radius;
138
159
  border-bottom-right-radius: $calendar-day-active-border-radius;
@@ -47,6 +47,9 @@
47
47
  cursor: auto;
48
48
  }
49
49
  .nut-calendarcard-day-top, .nut-calendarcard-day-bottom {
50
+ display: flex;
51
+ align-items: center;
52
+ justify-content: center;
50
53
  width: 100%;
51
54
  height: 12px;
52
55
  font-size: 12px;
@@ -57,11 +60,21 @@
57
60
  }
58
61
  .nut-calendarcard-day.active {
59
62
  background-color: var(--nutui-calendar-active-background-color, var(--nutui-color-primary, #ff0f23));
60
- color: var(--nutui-color-primary-text, #ffffff);
61
63
  border-radius: var(--nutui-calendar-day-active-border-radius, 4px);
62
64
  }
65
+ .nut-calendarcard-day.active .nut-calendarcard-day-top,
66
+ .nut-calendarcard-day.active .nut-calendarcard-day-inner,
67
+ .nut-calendarcard-day.active .nut-calendarcard-day-bottom {
68
+ color: var(--nutui-color-primary-text, #ffffff);
69
+ }
63
70
  .nut-calendarcard-day.start, .nut-calendarcard-day.end {
64
71
  background-color: var(--nutui-calendar-active-background-color, var(--nutui-color-primary, #ff0f23));
72
+ }
73
+ .nut-calendarcard-day.start .nut-calendarcard-day-top,
74
+ .nut-calendarcard-day.start .nut-calendarcard-day-inner,
75
+ .nut-calendarcard-day.start .nut-calendarcard-day-bottom, .nut-calendarcard-day.end .nut-calendarcard-day-top,
76
+ .nut-calendarcard-day.end .nut-calendarcard-day-inner,
77
+ .nut-calendarcard-day.end .nut-calendarcard-day-bottom {
65
78
  color: var(--nutui-color-primary-text, #ffffff);
66
79
  }
67
80
  .nut-calendarcard-day.start {
@@ -74,15 +87,27 @@
74
87
  }
75
88
  .nut-calendarcard-day.mid {
76
89
  background-color: var(--nutui-calendar-choose-background-color, var(--nutui-color-primary-light-pressed, #ffebf1));
90
+ }
91
+ .nut-calendarcard-day.mid .nut-calendarcard-day-top,
92
+ .nut-calendarcard-day.mid .nut-calendarcard-day-inner,
93
+ .nut-calendarcard-day.mid .nut-calendarcard-day-bottom {
77
94
  color: var(--nutui-calendar-choose-color, var(--nutui-color-primary, #ff0f23));
78
95
  }
79
96
  .nut-calendarcard-day .nut-calendar-day-info {
80
97
  color: var(--nutui-color-primary-text, #ffffff);
81
98
  }
82
99
  .nut-calendarcard-day.prev, .nut-calendarcard-day.next, .nut-calendarcard-day.disabled {
83
- color: var(--nutui-calendar-disable-color, var(--nutui-color-text-disabled, #c2c4cc));
84
100
  cursor: not-allowed;
85
101
  }
102
+ .nut-calendarcard-day.prev .nut-calendarcard-day-top,
103
+ .nut-calendarcard-day.prev .nut-calendarcard-day-inner,
104
+ .nut-calendarcard-day.prev .nut-calendarcard-day-bottom, .nut-calendarcard-day.next .nut-calendarcard-day-top,
105
+ .nut-calendarcard-day.next .nut-calendarcard-day-inner,
106
+ .nut-calendarcard-day.next .nut-calendarcard-day-bottom, .nut-calendarcard-day.disabled .nut-calendarcard-day-top,
107
+ .nut-calendarcard-day.disabled .nut-calendarcard-day-inner,
108
+ .nut-calendarcard-day.disabled .nut-calendarcard-day-bottom {
109
+ color: var(--nutui-calendar-disable-color, var(--nutui-color-text-disabled, #c2c4cc));
110
+ }
86
111
 
87
112
  [dir=rtl] .nut-calendarcard-header-left .left, [dir=rtl] .nut-calendarcard-header-right .left,
88
113
  .nut-rtl .nut-calendarcard-header-left .left,
@@ -7,7 +7,7 @@ import Taro from "@tarojs/taro";
7
7
  import { Image as TImage, View } from "@tarojs/components";
8
8
  import { Image as ImageIcon, ImageError } from "@nutui/icons-react-taro";
9
9
  import classNames from "classnames";
10
- import { harmonyAndRn } from "../../utils/platform-taro";
10
+ import pxTransform from "../../utils/px-transform";
11
11
  var defaultProps = {
12
12
  src: '',
13
13
  error: true,
@@ -30,7 +30,7 @@ export var Image = function(props) {
30
30
  var _useState = _sliced_to_array(useState(true), 2), innerLoading = _useState[0], setInnerLoading = _useState[1];
31
31
  var _useState1 = _sliced_to_array(useState(false), 2), isError = _useState1[0], setIsError = _useState1[1];
32
32
  var pxCheck = function(value) {
33
- return Number.isNaN(Number(value)) ? String(value) : "".concat(value, "px");
33
+ return Number.isNaN(Number(value)) ? String(value) : pxTransform(+value);
34
34
  };
35
35
  // 图片加载
36
36
  var handleLoad = function(e) {
@@ -47,9 +47,9 @@ export var Image = function(props) {
47
47
  };
48
48
  var containerStyle = {
49
49
  // eslint-disable-next-line no-nested-ternary
50
- height: height ? Taro.getEnv() === 'RN' ? height : pxCheck(height) : Taro.getEnv() === 'WEB' ? '' : '100%',
50
+ height: height ? pxCheck(height) : Taro.getEnv() === 'WEB' ? '' : '100%',
51
51
  // eslint-disable-next-line no-nested-ternary
52
- width: width ? Taro.getEnv() === 'RN' ? width : pxCheck(width) : Taro.getEnv() === 'WEB' ? '' : '100%',
52
+ width: width ? pxCheck(width) : Taro.getEnv() === 'WEB' ? '' : '100%',
53
53
  overflow: radius !== undefined && radius !== null ? 'hidden' : '',
54
54
  borderRadius: // eslint-disable-next-line no-nested-ternary
55
55
  radius !== undefined && radius != null ? Taro.getEnv() === 'RN' ? radius : pxCheck(radius) : ''
@@ -106,6 +106,6 @@ export var Image = function(props) {
106
106
  onError: function(e) {
107
107
  return handleError(e);
108
108
  }
109
- })), !harmonyAndRn() && /*#__PURE__*/ React.createElement(React.Fragment, null, renderLoading(), renderErrorImg()));
109
+ })), /*#__PURE__*/ React.createElement(React.Fragment, null, renderLoading(), renderErrorImg()));
110
110
  };
111
111
  Image.displayName = 'NutImage';
@@ -43,4 +43,8 @@
43
43
  background: none;
44
44
  opacity: 1;
45
45
  -webkit-text-fill-color: #c2c4cc;
46
+ }
47
+
48
+ .nut-input-clear {
49
+ flex: 0;
46
50
  }
@@ -3,20 +3,8 @@ import { BasicComponent } from "../../utils/typings";
3
3
  export type LoadingType = 'spinner' | 'circular';
4
4
  export type LoadingDirection = 'horizontal' | 'vertical';
5
5
  export interface LoadingProps extends BasicComponent {
6
- /**
7
- * loading图标的样式
8
- * @default circular
9
- */
10
- type: LoadingType
11
- /**
12
- * loading图标和文字的排列方式
13
- * @default horizontal
14
- */
15
- direction: LoadingDirection
16
- /**
17
- * 自定义loading的图标
18
- * @default -
19
- */
20
- icon?: ReactNode
6
+ type: LoadingType;
7
+ direction: LoadingDirection;
8
+ icon?: ReactNode;
21
9
  }
22
10
  export declare const Loading: FunctionComponent<Partial<LoadingProps> & React.HTMLAttributes<HTMLDivElement>>;
@@ -7,8 +7,11 @@ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
7
7
  import React, { useEffect, useRef, useState } from "react";
8
8
  import classNames from "classnames";
9
9
  import { View } from "@tarojs/components";
10
+ import { useRtl } from "../configprovider/index";
10
11
  import { ComponentDefaults } from "../../utils/typings";
11
12
  import { getRectByTaro } from "../../utils/get-rect-by-taro";
13
+ import { harmonyAndRn } from "../../utils/platform-taro";
14
+ import pxTransform from "../../utils/px-transform";
12
15
  import { SafeArea } from "../safearea/safearea";
13
16
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
14
17
  left: '',
@@ -23,6 +26,7 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
23
26
  export var NavBar = function(props) {
24
27
  var _$_object_spread = _object_spread({}, defaultProps, props), right = _$_object_spread.right, left = _$_object_spread.left, titleAlign = _$_object_spread.titleAlign, className = _$_object_spread.className, style = _$_object_spread.style, back = _$_object_spread.back, fixed = _$_object_spread.fixed, safeAreaInsetTop = _$_object_spread.safeAreaInsetTop, placeholder = _$_object_spread.placeholder, zIndex = _$_object_spread.zIndex, onBackClick = _$_object_spread.onBackClick;
25
28
  var classPrefix = 'nut-navbar';
29
+ var rtl = useRtl();
26
30
  var children = Array.isArray(props.children) ? props.children : [
27
31
  props.children
28
32
  ];
@@ -115,18 +119,21 @@ export var NavBar = function(props) {
115
119
  return _ref.apply(this, arguments);
116
120
  };
117
121
  }();
118
- init();
122
+ setTimeout(function() {
123
+ init();
124
+ }, 0);
119
125
  }, [
120
126
  left,
121
127
  right,
122
128
  back
123
129
  ]);
124
130
  var renderLeft = function() {
131
+ var _obj, _obj1;
125
132
  return back || left ? /*#__PURE__*/ React.createElement(View, {
126
- className: "".concat(classPrefix, "-left"),
133
+ className: classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix, "-left"), true), _define_property(_obj, "".concat(classPrefix, "-left-align-").concat(titleAlign), true), _define_property(_obj, "".concat(classPrefix, "-left-rtl"), rtl), _obj)),
127
134
  ref: leftRef
128
135
  }, back && /*#__PURE__*/ React.createElement(View, {
129
- className: "".concat(classPrefix, "-left-back"),
136
+ className: classNames((_obj1 = {}, _define_property(_obj1, "".concat(classPrefix, "-left-back"), true), _define_property(_obj1, "".concat(classPrefix, "-left-back-align-").concat(titleAlign), true), _define_property(_obj1, "".concat(classPrefix, "-left-back-children"), left), _define_property(_obj1, "".concat(classPrefix, "-left-back-children-rtl"), left && rtl), _obj1)),
130
137
  onClick: function(e) {
131
138
  return onBackClick(e);
132
139
  }
@@ -135,20 +142,22 @@ export var NavBar = function(props) {
135
142
  var renderContent = function() {
136
143
  var titleStyle = {};
137
144
  if (titleAlign === 'center') {
138
- var contentRealWidth = "".concat(contentWidth).concat(/%$/i.test(contentWidth) ? '' : 'px');
145
+ var width = harmonyAndRn() ? pxTransform(Number(contentWidth)) : "".concat(contentWidth, "px");
146
+ var contentRealWidth = /%$/i.test(contentWidth) ? contentWidth : width;
139
147
  titleStyle = {
140
- minWidth: contentRealWidth,
141
148
  width: contentRealWidth
142
149
  };
143
150
  }
151
+ var _obj;
144
152
  return /*#__PURE__*/ React.createElement(View, {
145
- className: "".concat(classPrefix, "-title"),
153
+ className: classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix, "-title"), true), _define_property(_obj, "".concat(classPrefix, "-title-align-").concat(titleAlign), true), _obj)),
146
154
  style: titleStyle
147
155
  }, children);
148
156
  };
149
157
  var renderRight = function() {
158
+ var _obj;
150
159
  return /*#__PURE__*/ React.createElement(View, {
151
- className: "".concat(classPrefix, "-right"),
160
+ className: classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix, "-right"), true), _define_property(_obj, "".concat(classPrefix, "-right-align-").concat(titleAlign), true), _define_property(_obj, "".concat(classPrefix, "-right-rtl"), rtl), _obj)),
152
161
  ref: rightRef
153
162
  }, right);
154
163
  };
@@ -160,7 +169,7 @@ export var NavBar = function(props) {
160
169
  }, renderLeft(), renderContent(), renderRight());
161
170
  };
162
171
  var _obj;
163
- var classes = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix, "-fixed"), fixed), _define_property(_obj, "".concat(classPrefix, "-title-align-").concat(titleAlign), true), _obj));
172
+ var classes = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix, "-fixed"), fixed), _define_property(_obj, "".concat(classPrefix, "-safe-area-inset-top"), safeAreaInsetTop), _define_property(_obj, "".concat(classPrefix, "-align-").concat(titleAlign), true), _define_property(_obj, "".concat(classPrefix, "-rtl"), rtl), _obj));
164
173
  var cls = classNames(classPrefix, classes, className);
165
174
  return /*#__PURE__*/ React.createElement(React.Fragment, null, safeAreaInsetTop && /*#__PURE__*/ React.createElement(SafeArea, {
166
175
  position: "top"
@@ -2,6 +2,8 @@
2
2
  width: $navbar-width;
3
3
  position: relative;
4
4
  display: flex;
5
+ flex-direction: row;
6
+ justify-content: center;
5
7
  align-items: center;
6
8
  height: $navbar-height;
7
9
  box-sizing: border-box;
@@ -16,6 +18,7 @@
16
18
  position: fixed;
17
19
  top: 0;
18
20
  left: 0;
21
+ right: 0;
19
22
  width: 100%;
20
23
  }
21
24
 
@@ -24,27 +27,32 @@
24
27
  width: 100%;
25
28
  }
26
29
 
30
+ &-safe-area-inset-top {
31
+ padding-top: constant(safe-area-inset-top);
32
+ padding-top: env(safe-area-inset-top);
33
+ }
34
+
35
+ &-align-left {
36
+ padding-left: 14px;
37
+ }
38
+
27
39
  &-title {
28
- min-width: 53%;
29
- margin: 0 auto;
40
+ width: 50%;
41
+ height: 100%;
30
42
  text-align: center;
31
43
  display: flex;
44
+ flex-direction: row;
32
45
  align-items: center;
33
46
  justify-content: center;
34
47
  font-size: $navbar-title-font-size;
35
48
  font-weight: $navbar-title-font-weight;
36
49
  color: $navbar-title-font-color;
37
-
38
- .nut-tabs-titles {
39
- background: transparent;
40
-
41
- &-item-text {
42
- color: $color-title;
43
- }
44
- }
45
-
46
- .nut-tabpane {
47
- display: none;
50
+ &-align-left {
51
+ min-width: 0;
52
+ flex: 1;
53
+ justify-content: flex-start;
54
+ padding: 0 8px;
55
+ text-align: left;
48
56
  }
49
57
  }
50
58
 
@@ -59,125 +67,62 @@
59
67
  bottom: 0;
60
68
  display: flex;
61
69
  align-items: center;
70
+ flex-direction: row;
71
+ height: 100%;
62
72
  cursor: pointer;
63
73
  padding: 0 14px;
64
-
74
+ /* #ifndef rn harmony jd h5 weapp*/
65
75
  .nut-icon,
66
76
  .nutui-iconfont {
67
77
  width: 20px;
68
78
  height: 20px;
69
79
  font-size: 20px;
70
80
  }
81
+ /* #endif */
71
82
  }
72
83
 
73
84
  &-left {
74
85
  left: 0;
86
+ &-rtl {
87
+ left: auto;
88
+ right: 0;
89
+ }
90
+ &-align-left {
91
+ position: static;
92
+ padding: 0;
93
+ }
75
94
 
76
95
  &-back {
77
96
  display: flex;
97
+ flex-direction: row;
78
98
  align-items: center;
79
99
  justify-content: center;
80
- margin-right: 10px;
100
+ &-children {
101
+ margin-right: 10px;
102
+ &-rtl {
103
+ margin-right: 0;
104
+ margin-left: 10px;
105
+ }
106
+ }
81
107
  }
82
108
  }
83
109
 
84
110
  &-right {
85
111
  right: 0;
86
-
87
- .nut-icon {
88
- margin-left: 12px;
89
-
90
- &:first-child {
91
- margin-left: 0;
92
- }
93
- }
94
- }
95
-
96
- &-title-align-left {
97
- padding-left: 14px;
98
-
99
- .nut-navbar-left {
100
- position: static;
101
- padding: 0;
102
-
103
- .nut-icon {
104
- margin-left: 12px;
105
-
106
- &:first-child {
107
- margin-left: 0;
108
- }
109
- }
112
+ &-rtl {
113
+ right: auto;
114
+ left: 0;
110
115
  }
111
- .nut-navbar-right {
116
+ &-align-left {
112
117
  position: static;
113
118
  display: inline-flex;
114
119
  white-space: nowrap;
115
120
  padding-left: 0;
116
121
  }
117
- .nut-navbar-left-back {
118
- margin-right: 0;
119
- }
120
-
121
- .nut-navbar-title {
122
- min-width: 0;
123
- margin: 0;
124
- flex: 1;
125
- justify-content: flex-start;
126
- padding: 0 8px;
127
- text-align: left;
128
- }
129
122
  }
130
- }
131
-
132
- [dir='rtl'] .nut-navbar,
133
- .nut-rtl .nut-navbar {
134
- &-fixed {
135
- left: auto;
136
- right: 0;
137
- }
138
-
139
- &-left {
140
- left: auto;
141
- right: 0;
123
+ &-rtl {
142
124
  .nut-icon-ArrowLeft {
143
125
  transform: rotateY(180deg);
144
126
  }
145
- &-back {
146
- margin-right: 0;
147
- margin-left: 10px;
148
- }
149
- }
150
-
151
- &-right {
152
- right: auto;
153
- left: 0;
154
- .nut-icon {
155
- margin-left: 0;
156
- margin-right: 12px;
157
-
158
- &:first-child {
159
- margin-left: 0;
160
- margin-right: 0;
161
- }
162
- }
163
- }
164
-
165
- &-title-align-left {
166
- .nut-navbar-left {
167
- .nut-icon-ArrowLeft {
168
- margin-left: 0;
169
- margin-right: 12px;
170
-
171
- &:first-child {
172
- margin-left: 0;
173
- margin-right: 0;
174
- }
175
- }
176
- }
177
-
178
- .nut-navbar-left-back {
179
- margin-right: 0;
180
- margin-left: 0;
181
- }
182
127
  }
183
128
  }