@nutui/nutui-react-taro 3.0.19-cpp.27 → 3.0.19-cpp.28
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 +7 -0
- package/dist/cjs/locales/base.d.ts +1 -0
- package/dist/cjs/locales/en-US.js +12 -1
- package/dist/cjs/locales/id-ID.js +12 -1
- package/dist/cjs/locales/ja-JP.js +10 -1
- package/dist/cjs/locales/tr-TR.js +12 -1
- package/dist/cjs/locales/zh-CN.js +10 -1
- package/dist/cjs/locales/zh-TW.js +10 -1
- package/dist/cjs/locales/zh-UG.js +12 -1
- package/dist/cjs/packages/calendarcard/calendarcard.js +30 -8
- package/dist/cjs/packages/price/price.js +14 -3
- package/dist/cjs/types/spec/calendarcard/base.d.ts +2 -0
- package/dist/cjs/utils/should-render-price-raw.d.ts +1 -0
- package/dist/cjs/utils/should-render-price-raw.js +34 -0
- package/dist/es/locales/base.d.ts +1 -0
- package/dist/es/locales/en-US.js +12 -1
- package/dist/es/locales/id-ID.js +12 -1
- package/dist/es/locales/ja-JP.js +10 -1
- package/dist/es/locales/tr-TR.js +12 -1
- package/dist/es/locales/zh-CN.js +10 -1
- package/dist/es/locales/zh-TW.js +10 -1
- package/dist/es/locales/zh-UG.js +12 -1
- package/dist/es/packages/calendarcard/calendarcard.js +31 -9
- package/dist/es/packages/price/price.js +14 -3
- package/dist/es/types/spec/calendarcard/base.d.ts +2 -0
- package/dist/es/utils/should-render-price-raw.d.ts +1 -0
- package/dist/es/utils/should-render-price-raw.js +24 -0
- package/dist/nutui.react.umd.js +76 -12
- package/dist/style-jmapp.css +1 -1
- package/dist/style-jmapp.scss +43 -43
- package/dist/style-jrkf.css +1 -1
- package/dist/style-jrkf.scss +36 -36
- package/dist/style.css +1 -1
- package/dist/style.scss +37 -37
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# v3.0.19-cpp.28
|
|
2
|
+
|
|
3
|
+
`2026-04-27`
|
|
4
|
+
|
|
5
|
+
- 🚀 feat(price): 组件增加原样渲染的兜底逻辑,支持输入内容包含无价格或多个价格时直接原样返回 (#3440)
|
|
6
|
+
- ♿️ feat(calendarcard): 补充无障碍支持 (A11y),增加 `dayAriaLabel` 多语言配置,开放 `renderDayAriaLabel` 以及在 Web 端支持了 `weekdays` 属性自定义星期的表头
|
|
7
|
+
|
|
1
8
|
# v3.0.19-cpp.27
|
|
2
9
|
|
|
3
10
|
`2026-04-24`
|
|
@@ -63,7 +63,18 @@ var enUS = {
|
|
|
63
63
|
},
|
|
64
64
|
today: 'Today',
|
|
65
65
|
loadPreviousMonth: 'Load Previous Month',
|
|
66
|
-
noEarlierMonth: 'No Earlier Month'
|
|
66
|
+
noEarlierMonth: 'No Earlier Month',
|
|
67
|
+
dayAriaLabel: function dayAriaLabel(year, month, day, today, isActive, isDisable) {
|
|
68
|
+
var dateStr = "".concat(year, "-").concat(month, "-").concat(day);
|
|
69
|
+
var label = today ? "Today, ".concat(dateStr) : dateStr;
|
|
70
|
+
if (isActive) {
|
|
71
|
+
label = "Selected ".concat(label);
|
|
72
|
+
}
|
|
73
|
+
if (isDisable) {
|
|
74
|
+
label = "".concat(label, " disabled");
|
|
75
|
+
}
|
|
76
|
+
return label;
|
|
77
|
+
}
|
|
67
78
|
},
|
|
68
79
|
shortpassword: {
|
|
69
80
|
title: 'Please input a password',
|
|
@@ -63,7 +63,18 @@ var idID = {
|
|
|
63
63
|
},
|
|
64
64
|
today: 'Hari ini',
|
|
65
65
|
loadPreviousMonth: 'Muat Bulan Sebelumnya',
|
|
66
|
-
noEarlierMonth: 'Tidak Ada Bulan Sebelumnya'
|
|
66
|
+
noEarlierMonth: 'Tidak Ada Bulan Sebelumnya',
|
|
67
|
+
dayAriaLabel: function dayAriaLabel(year, month, day, today, isActive, isDisable) {
|
|
68
|
+
var dateStr = "".concat(year, "-").concat(month, "-").concat(day);
|
|
69
|
+
var label = today ? "Hari ini, ".concat(dateStr) : dateStr;
|
|
70
|
+
if (isActive) {
|
|
71
|
+
label = "Dipilih ".concat(label);
|
|
72
|
+
}
|
|
73
|
+
if (isDisable) {
|
|
74
|
+
label = "".concat(label, " dinonaktifkan");
|
|
75
|
+
}
|
|
76
|
+
return label;
|
|
77
|
+
}
|
|
67
78
|
},
|
|
68
79
|
shortpassword: {
|
|
69
80
|
title: 'SIlakan masukan kata sandi',
|
|
@@ -63,7 +63,16 @@ var jaJP = {
|
|
|
63
63
|
},
|
|
64
64
|
today: '今日',
|
|
65
65
|
loadPreviousMonth: '前の月を読み込む',
|
|
66
|
-
noEarlierMonth: 'これより前の月はありません'
|
|
66
|
+
noEarlierMonth: 'これより前の月はありません',
|
|
67
|
+
dayAriaLabel: function dayAriaLabel(year, month, day, today, isActive, isDisable) {
|
|
68
|
+
if (isActive) {
|
|
69
|
+
return today ? "今日".concat(month, "月").concat(day, "日を選択しました") : "".concat(month, "月").concat(day, "日を選択しました");
|
|
70
|
+
}
|
|
71
|
+
if (isDisable) {
|
|
72
|
+
return today ? "今日".concat(month, "月").concat(day, "日は無効です") : "".concat(month, "月").concat(day, "日は無効です");
|
|
73
|
+
}
|
|
74
|
+
return today ? "今日".concat(month, "月").concat(day, "日") : "".concat(month, "月").concat(day, "日");
|
|
75
|
+
}
|
|
67
76
|
},
|
|
68
77
|
shortpassword: {
|
|
69
78
|
title: 'パスワードを入力してください',
|
|
@@ -63,7 +63,18 @@ var trTR = {
|
|
|
63
63
|
},
|
|
64
64
|
today: 'Bugün',
|
|
65
65
|
loadPreviousMonth: 'Önceki ayı yükle',
|
|
66
|
-
noEarlierMonth: 'Önceki ay yok'
|
|
66
|
+
noEarlierMonth: 'Önceki ay yok',
|
|
67
|
+
dayAriaLabel: function dayAriaLabel(year, month, day, today, isActive, isDisable) {
|
|
68
|
+
var dateStr = "".concat(year, "-").concat(month, "-").concat(day);
|
|
69
|
+
var label = today ? "Bug\xfcn, ".concat(dateStr) : dateStr;
|
|
70
|
+
if (isActive) {
|
|
71
|
+
label = "Se\xe7ili ".concat(label);
|
|
72
|
+
}
|
|
73
|
+
if (isDisable) {
|
|
74
|
+
label = "".concat(label, " devre dışı");
|
|
75
|
+
}
|
|
76
|
+
return label;
|
|
77
|
+
}
|
|
67
78
|
},
|
|
68
79
|
shortpassword: {
|
|
69
80
|
title: 'Lütfen şifrenizi girin',
|
|
@@ -63,7 +63,16 @@ var zhCN = {
|
|
|
63
63
|
},
|
|
64
64
|
today: '今天',
|
|
65
65
|
loadPreviousMonth: '加载上一个月',
|
|
66
|
-
noEarlierMonth: '没有更早月份'
|
|
66
|
+
noEarlierMonth: '没有更早月份',
|
|
67
|
+
dayAriaLabel: function dayAriaLabel(year, month, day, today, isActive, isDisable) {
|
|
68
|
+
if (isActive) {
|
|
69
|
+
return today ? "已选定今日".concat(month, "月").concat(day, "号") : "已选定".concat(month, "月").concat(day, "号");
|
|
70
|
+
}
|
|
71
|
+
if (isDisable) {
|
|
72
|
+
return today ? "".concat(month, "月").concat(day, "号今日按钮变暗") : "".concat(month, "月").concat(day, "号按钮变暗");
|
|
73
|
+
}
|
|
74
|
+
return today ? "".concat(month, "月").concat(day, "号今日") : "".concat(month, "月").concat(day, "号");
|
|
75
|
+
}
|
|
67
76
|
},
|
|
68
77
|
shortpassword: {
|
|
69
78
|
title: '请输入密码',
|
|
@@ -63,7 +63,16 @@ var zhCN = {
|
|
|
63
63
|
},
|
|
64
64
|
today: '今天',
|
|
65
65
|
loadPreviousMonth: '加載上一個月',
|
|
66
|
-
noEarlierMonth: '沒有更早月份'
|
|
66
|
+
noEarlierMonth: '沒有更早月份',
|
|
67
|
+
dayAriaLabel: function dayAriaLabel(year, month, day, today, isActive, isDisable) {
|
|
68
|
+
if (isActive) {
|
|
69
|
+
return today ? "已選定今日".concat(month, "月").concat(day, "號") : "已選定".concat(month, "月").concat(day, "號");
|
|
70
|
+
}
|
|
71
|
+
if (isDisable) {
|
|
72
|
+
return today ? "".concat(month, "月").concat(day, "號今日按鈕變暗") : "".concat(month, "月").concat(day, "號按鈕變暗");
|
|
73
|
+
}
|
|
74
|
+
return today ? "".concat(month, "月").concat(day, "號今日") : "".concat(month, "月").concat(day, "號");
|
|
75
|
+
}
|
|
67
76
|
},
|
|
68
77
|
shortpassword: {
|
|
69
78
|
title: '請輸入密碼',
|
|
@@ -63,7 +63,18 @@ var zhUG = {
|
|
|
63
63
|
},
|
|
64
64
|
today: 'بۈگۈن',
|
|
65
65
|
loadPreviousMonth: 'ئالدىنقى ئاي',
|
|
66
|
-
noEarlierMonth: 'تۈگىدى'
|
|
66
|
+
noEarlierMonth: 'تۈگىدى',
|
|
67
|
+
dayAriaLabel: function dayAriaLabel(year, month, day, today, isActive, isDisable) {
|
|
68
|
+
var dateStr = "".concat(year, "-").concat(month, "-").concat(day);
|
|
69
|
+
var label = today ? "بۈگۈن, ".concat(dateStr) : dateStr;
|
|
70
|
+
if (isActive) {
|
|
71
|
+
label = "تاللانغان ".concat(label);
|
|
72
|
+
}
|
|
73
|
+
if (isDisable) {
|
|
74
|
+
label = "".concat(label, " چەكلەنگەن");
|
|
75
|
+
}
|
|
76
|
+
return label;
|
|
77
|
+
}
|
|
67
78
|
},
|
|
68
79
|
shortpassword: {
|
|
69
80
|
title: 'مەخپى نومۇرنى كىرگۈزۈڭ',
|
|
@@ -24,12 +24,13 @@ var _index = require("../configprovider/index");
|
|
|
24
24
|
var _usepropsvalue = require("../../hooks/use-props-value");
|
|
25
25
|
var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
|
|
26
26
|
type: 'single',
|
|
27
|
-
firstDayOfWeek: 0
|
|
27
|
+
firstDayOfWeek: 0,
|
|
28
|
+
weekdays: []
|
|
28
29
|
});
|
|
29
30
|
var prefixCls = 'nut-calendarcard';
|
|
30
31
|
var CalendarCard = /*#__PURE__*/ _react.default.forwardRef(function(props, ref) {
|
|
31
32
|
var locale = (0, _index.useConfig)().locale;
|
|
32
|
-
var _$_object_spread = (0, _object_spread._)({}, defaultProps, props), style = _$_object_spread.style, className = _$_object_spread.className, type = _$_object_spread.type, title = _$_object_spread.title, value = _$_object_spread.value, defaultValue = _$_object_spread.defaultValue, firstDayOfWeek = _$_object_spread.firstDayOfWeek, startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, disableDay = _$_object_spread.disableDay, renderDay = _$_object_spread.renderDay, renderDayTop = _$_object_spread.renderDayTop, renderDayBottom = _$_object_spread.renderDayBottom, onDayClick = _$_object_spread.onDayClick, onPageChange = _$_object_spread.onPageChange, onChange = _$_object_spread.onChange;
|
|
33
|
+
var _$_object_spread = (0, _object_spread._)({}, defaultProps, props), style = _$_object_spread.style, className = _$_object_spread.className, type = _$_object_spread.type, title = _$_object_spread.title, value = _$_object_spread.value, defaultValue = _$_object_spread.defaultValue, firstDayOfWeek = _$_object_spread.firstDayOfWeek, startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, disableDay = _$_object_spread.disableDay, renderDay = _$_object_spread.renderDay, renderDayTop = _$_object_spread.renderDayTop, renderDayBottom = _$_object_spread.renderDayBottom, renderDayAriaLabel = _$_object_spread.renderDayAriaLabel, weekdays = _$_object_spread.weekdays, onDayClick = _$_object_spread.onDayClick, onPageChange = _$_object_spread.onPageChange, onChange = _$_object_spread.onChange;
|
|
33
34
|
var onPageChangeRef = (0, _react.useRef)(onPageChange);
|
|
34
35
|
// 当前月份信息
|
|
35
36
|
var _useState = (0, _sliced_to_array._)((0, _react.useState)(function() {
|
|
@@ -179,6 +180,19 @@ var CalendarCard = /*#__PURE__*/ _react.default.forwardRef(function(props, ref)
|
|
|
179
180
|
var d = new Date(day.year, day.month - 1, day.date).getDay();
|
|
180
181
|
return d === 0 || d === 6;
|
|
181
182
|
};
|
|
183
|
+
var isToday = function isToday(day) {
|
|
184
|
+
var today = new Date();
|
|
185
|
+
return day.year === today.getFullYear() && day.month === today.getMonth() + 1 && day.date === today.getDate();
|
|
186
|
+
};
|
|
187
|
+
// 日期无障碍朗读
|
|
188
|
+
var getAriaLabel = function getAriaLabel(day) {
|
|
189
|
+
var _locale_calendaritem_dayAriaLabel, _locale_calendaritem;
|
|
190
|
+
if (renderDayAriaLabel) {
|
|
191
|
+
return renderDayAriaLabel(day);
|
|
192
|
+
}
|
|
193
|
+
var today = isToday(day);
|
|
194
|
+
return (_locale_calendaritem_dayAriaLabel = (_locale_calendaritem = locale.calendaritem).dayAriaLabel) === null || _locale_calendaritem_dayAriaLabel === void 0 ? void 0 : _locale_calendaritem_dayAriaLabel.call(_locale_calendaritem, day.year, day.month, day.date, today, isActive(day), isDisable(day));
|
|
195
|
+
};
|
|
182
196
|
var getClasses = function getClasses(day) {
|
|
183
197
|
/**
|
|
184
198
|
* active: single、multiple 激活日期
|
|
@@ -363,15 +377,20 @@ var CalendarCard = /*#__PURE__*/ _react.default.forwardRef(function(props, ref)
|
|
|
363
377
|
}
|
|
364
378
|
}, /*#__PURE__*/ _react.default.createElement(_icon.DoubleRight, null))));
|
|
365
379
|
};
|
|
366
|
-
var
|
|
367
|
-
var
|
|
380
|
+
var weekHeader = (0, _react.useMemo)(function() {
|
|
381
|
+
var weekdaysList = weekdays.length > 0 ? weekdays : locale.calendaritem.weekdays;
|
|
382
|
+
var weekdaysData = weekdaysList.map(function(day, index) {
|
|
368
383
|
return {
|
|
369
384
|
name: day,
|
|
370
385
|
key: index
|
|
371
386
|
};
|
|
372
387
|
});
|
|
373
|
-
return (0, _to_consumable_array._)(
|
|
374
|
-
}
|
|
388
|
+
return (0, _to_consumable_array._)(weekdaysData.slice(firstDayOfWeek, 7)).concat((0, _to_consumable_array._)(weekdaysData.slice(0, firstDayOfWeek)));
|
|
389
|
+
}, [
|
|
390
|
+
weekdays,
|
|
391
|
+
firstDayOfWeek,
|
|
392
|
+
locale.calendaritem.weekdays
|
|
393
|
+
]);
|
|
375
394
|
var renderContent = function renderContent() {
|
|
376
395
|
return /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
377
396
|
className: "".concat(prefixCls, "-content")
|
|
@@ -392,11 +411,14 @@ var CalendarCard = /*#__PURE__*/ _react.default.forwardRef(function(props, ref)
|
|
|
392
411
|
key: "".concat(day.year, "-").concat(day.month, "-").concat(day.date),
|
|
393
412
|
onClick: function onClick() {
|
|
394
413
|
return handleDayClick(day);
|
|
395
|
-
}
|
|
414
|
+
},
|
|
415
|
+
ariaLabel: getAriaLabel(day),
|
|
416
|
+
ariaRole: "button"
|
|
396
417
|
}, /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
397
418
|
className: "".concat(prefixCls, "-day-top")
|
|
398
419
|
}, renderDayTop ? renderDayTop(day) : ''), /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
399
|
-
className: "".concat(prefixCls, "-day-inner")
|
|
420
|
+
className: "".concat(prefixCls, "-day-inner"),
|
|
421
|
+
ariaHidden: true
|
|
400
422
|
}, renderDay ? renderDay(day) : day.date), /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
401
423
|
className: "".concat(prefixCls, "-day-bottom")
|
|
402
424
|
}, renderDayBottom ? renderDayBottom(day) : ''));
|
|
@@ -20,6 +20,7 @@ var _typings = require("../../utils/typings");
|
|
|
20
20
|
var _index = require("../configprovider/index");
|
|
21
21
|
var _types = require("../../types");
|
|
22
22
|
var _platform = require("../../utils/taro/platform");
|
|
23
|
+
var _shouldrenderpriceraw = require("../../utils/should-render-price-raw");
|
|
23
24
|
var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
|
|
24
25
|
color: 'primary',
|
|
25
26
|
price: 0,
|
|
@@ -34,10 +35,17 @@ var Price = function Price(props) {
|
|
|
34
35
|
var _$_object_spread = (0, _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;
|
|
35
36
|
var classPrefix = 'nut-price';
|
|
36
37
|
var rtl = (0, _index.useRtl)();
|
|
38
|
+
var isRenderPriceRaw = (0, _react.useMemo)(function() {
|
|
39
|
+
return typeof originalPrice === 'string' && (0, _shouldrenderpriceraw.shouldRenderPriceAsRaw)(originalPrice);
|
|
40
|
+
}, [
|
|
41
|
+
originalPrice
|
|
42
|
+
]);
|
|
37
43
|
var price = (0, _react.useMemo)(function() {
|
|
44
|
+
if (isRenderPriceRaw) return '';
|
|
38
45
|
return originalPrice.toString().replace(/[^\d.]/g, '');
|
|
39
46
|
}, [
|
|
40
|
-
originalPrice
|
|
47
|
+
originalPrice,
|
|
48
|
+
isRenderPriceRaw
|
|
41
49
|
]);
|
|
42
50
|
var isCustomPriceColor = (0, _react.useMemo)(function() {
|
|
43
51
|
var specificPriceColor = Object.values(_types.PriceColorEnum);
|
|
@@ -118,12 +126,15 @@ var Price = function Price(props) {
|
|
|
118
126
|
style: priceColorStyle
|
|
119
127
|
}, formatDecimal(price))) : null, symbol && position === 'after' ? renderSymbol() : null);
|
|
120
128
|
};
|
|
129
|
+
var renderRawContent = function renderRawContent() {
|
|
130
|
+
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, originalPrice);
|
|
131
|
+
};
|
|
121
132
|
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, (0, _platform.harmony)() || process.env.TARO_ENV === 'dynamic' ? /*#__PURE__*/ _react.default.createElement(_components.Text, {
|
|
122
133
|
className: "".concat(classPrefix, " ").concat(classPrefix, "-").concat(color, " ").concat(className),
|
|
123
134
|
style: style
|
|
124
|
-
}, renderInner()) : /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
135
|
+
}, isRenderPriceRaw ? renderRawContent() : renderInner()) : /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
125
136
|
className: "".concat(classPrefix, " ").concat(classPrefix, "-").concat(color, " ").concat(className),
|
|
126
137
|
style: style
|
|
127
|
-
}, renderInner()));
|
|
138
|
+
}, isRenderPriceRaw ? renderRawContent() : renderInner()));
|
|
128
139
|
};
|
|
129
140
|
Price.displayName = 'NutPrice';
|
|
@@ -23,10 +23,12 @@ export interface BaseCalendarCard extends BaseProps {
|
|
|
23
23
|
firstDayOfWeek: number;
|
|
24
24
|
startDate: Date;
|
|
25
25
|
endDate: Date;
|
|
26
|
+
weekdays?: string[];
|
|
26
27
|
disableDay: (day: CalendarCardDay) => boolean;
|
|
27
28
|
renderDay: (day: CalendarCardDay) => ReactNode;
|
|
28
29
|
renderDayTop: (day: CalendarCardDay) => ReactNode;
|
|
29
30
|
renderDayBottom: (day: CalendarCardDay) => ReactNode;
|
|
31
|
+
renderDayAriaLabel?: (day: CalendarCardDay) => string;
|
|
30
32
|
onDayClick: (day: CalendarCardDay) => void;
|
|
31
33
|
onPageChange: (data: CalendarCardMonth) => void;
|
|
32
34
|
onChange: (value: CalendarCardValue) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function shouldRenderPriceAsRaw(s: string): boolean;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "shouldRenderPriceAsRaw", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return shouldRenderPriceAsRaw;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var CJK = /[\u4E00-\u9FFF]/;
|
|
12
|
+
var RE_NUM = /\d+(?:\.\d+)?/g;
|
|
13
|
+
function hasNoExtractablePrice(s) {
|
|
14
|
+
var t = s.trim();
|
|
15
|
+
if (!t) return true;
|
|
16
|
+
if (!/\d/.test(t)) return true;
|
|
17
|
+
if (t.replace(/[^\d.]/g, '') === '') return true;
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
function shouldRenderPriceAsRaw(s) {
|
|
21
|
+
if (hasNoExtractablePrice(s)) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
var t = s.trim();
|
|
25
|
+
if (!CJK.test(t)) return false;
|
|
26
|
+
var matches = Array.from(t.matchAll(RE_NUM));
|
|
27
|
+
if (matches.length < 2) return false;
|
|
28
|
+
var a = matches[0];
|
|
29
|
+
var b = matches[1];
|
|
30
|
+
var i0 = a.index;
|
|
31
|
+
var i1 = b.index;
|
|
32
|
+
var between = t.slice(i0 + a[0].length, i1);
|
|
33
|
+
return CJK.test(between);
|
|
34
|
+
}
|
package/dist/es/locales/en-US.js
CHANGED
|
@@ -53,7 +53,18 @@ var enUS = {
|
|
|
53
53
|
},
|
|
54
54
|
today: 'Today',
|
|
55
55
|
loadPreviousMonth: 'Load Previous Month',
|
|
56
|
-
noEarlierMonth: 'No Earlier Month'
|
|
56
|
+
noEarlierMonth: 'No Earlier Month',
|
|
57
|
+
dayAriaLabel: function(year, month, day, today, isActive, isDisable) {
|
|
58
|
+
var dateStr = "".concat(year, "-").concat(month, "-").concat(day);
|
|
59
|
+
var label = today ? "Today, ".concat(dateStr) : dateStr;
|
|
60
|
+
if (isActive) {
|
|
61
|
+
label = "Selected ".concat(label);
|
|
62
|
+
}
|
|
63
|
+
if (isDisable) {
|
|
64
|
+
label = "".concat(label, " disabled");
|
|
65
|
+
}
|
|
66
|
+
return label;
|
|
67
|
+
}
|
|
57
68
|
},
|
|
58
69
|
shortpassword: {
|
|
59
70
|
title: 'Please input a password',
|
package/dist/es/locales/id-ID.js
CHANGED
|
@@ -53,7 +53,18 @@ var idID = {
|
|
|
53
53
|
},
|
|
54
54
|
today: 'Hari ini',
|
|
55
55
|
loadPreviousMonth: 'Muat Bulan Sebelumnya',
|
|
56
|
-
noEarlierMonth: 'Tidak Ada Bulan Sebelumnya'
|
|
56
|
+
noEarlierMonth: 'Tidak Ada Bulan Sebelumnya',
|
|
57
|
+
dayAriaLabel: function(year, month, day, today, isActive, isDisable) {
|
|
58
|
+
var dateStr = "".concat(year, "-").concat(month, "-").concat(day);
|
|
59
|
+
var label = today ? "Hari ini, ".concat(dateStr) : dateStr;
|
|
60
|
+
if (isActive) {
|
|
61
|
+
label = "Dipilih ".concat(label);
|
|
62
|
+
}
|
|
63
|
+
if (isDisable) {
|
|
64
|
+
label = "".concat(label, " dinonaktifkan");
|
|
65
|
+
}
|
|
66
|
+
return label;
|
|
67
|
+
}
|
|
57
68
|
},
|
|
58
69
|
shortpassword: {
|
|
59
70
|
title: 'SIlakan masukan kata sandi',
|
package/dist/es/locales/ja-JP.js
CHANGED
|
@@ -53,7 +53,16 @@ var jaJP = {
|
|
|
53
53
|
},
|
|
54
54
|
today: '今日',
|
|
55
55
|
loadPreviousMonth: '前の月を読み込む',
|
|
56
|
-
noEarlierMonth: 'これより前の月はありません'
|
|
56
|
+
noEarlierMonth: 'これより前の月はありません',
|
|
57
|
+
dayAriaLabel: function(year, month, day, today, isActive, isDisable) {
|
|
58
|
+
if (isActive) {
|
|
59
|
+
return today ? "今日".concat(month, "月").concat(day, "日を選択しました") : "".concat(month, "月").concat(day, "日を選択しました");
|
|
60
|
+
}
|
|
61
|
+
if (isDisable) {
|
|
62
|
+
return today ? "今日".concat(month, "月").concat(day, "日は無効です") : "".concat(month, "月").concat(day, "日は無効です");
|
|
63
|
+
}
|
|
64
|
+
return today ? "今日".concat(month, "月").concat(day, "日") : "".concat(month, "月").concat(day, "日");
|
|
65
|
+
}
|
|
57
66
|
},
|
|
58
67
|
shortpassword: {
|
|
59
68
|
title: 'パスワードを入力してください',
|
package/dist/es/locales/tr-TR.js
CHANGED
|
@@ -53,7 +53,18 @@ var trTR = {
|
|
|
53
53
|
},
|
|
54
54
|
today: 'Bugün',
|
|
55
55
|
loadPreviousMonth: 'Önceki ayı yükle',
|
|
56
|
-
noEarlierMonth: 'Önceki ay yok'
|
|
56
|
+
noEarlierMonth: 'Önceki ay yok',
|
|
57
|
+
dayAriaLabel: function(year, month, day, today, isActive, isDisable) {
|
|
58
|
+
var dateStr = "".concat(year, "-").concat(month, "-").concat(day);
|
|
59
|
+
var label = today ? "Bug\xfcn, ".concat(dateStr) : dateStr;
|
|
60
|
+
if (isActive) {
|
|
61
|
+
label = "Se\xe7ili ".concat(label);
|
|
62
|
+
}
|
|
63
|
+
if (isDisable) {
|
|
64
|
+
label = "".concat(label, " devre dışı");
|
|
65
|
+
}
|
|
66
|
+
return label;
|
|
67
|
+
}
|
|
57
68
|
},
|
|
58
69
|
shortpassword: {
|
|
59
70
|
title: 'Lütfen şifrenizi girin',
|
package/dist/es/locales/zh-CN.js
CHANGED
|
@@ -53,7 +53,16 @@ var zhCN = {
|
|
|
53
53
|
},
|
|
54
54
|
today: '今天',
|
|
55
55
|
loadPreviousMonth: '加载上一个月',
|
|
56
|
-
noEarlierMonth: '没有更早月份'
|
|
56
|
+
noEarlierMonth: '没有更早月份',
|
|
57
|
+
dayAriaLabel: function(year, month, day, today, isActive, isDisable) {
|
|
58
|
+
if (isActive) {
|
|
59
|
+
return today ? "已选定今日".concat(month, "月").concat(day, "号") : "已选定".concat(month, "月").concat(day, "号");
|
|
60
|
+
}
|
|
61
|
+
if (isDisable) {
|
|
62
|
+
return today ? "".concat(month, "月").concat(day, "号今日按钮变暗") : "".concat(month, "月").concat(day, "号按钮变暗");
|
|
63
|
+
}
|
|
64
|
+
return today ? "".concat(month, "月").concat(day, "号今日") : "".concat(month, "月").concat(day, "号");
|
|
65
|
+
}
|
|
57
66
|
},
|
|
58
67
|
shortpassword: {
|
|
59
68
|
title: '请输入密码',
|
package/dist/es/locales/zh-TW.js
CHANGED
|
@@ -53,7 +53,16 @@ var zhCN = {
|
|
|
53
53
|
},
|
|
54
54
|
today: '今天',
|
|
55
55
|
loadPreviousMonth: '加載上一個月',
|
|
56
|
-
noEarlierMonth: '沒有更早月份'
|
|
56
|
+
noEarlierMonth: '沒有更早月份',
|
|
57
|
+
dayAriaLabel: function(year, month, day, today, isActive, isDisable) {
|
|
58
|
+
if (isActive) {
|
|
59
|
+
return today ? "已選定今日".concat(month, "月").concat(day, "號") : "已選定".concat(month, "月").concat(day, "號");
|
|
60
|
+
}
|
|
61
|
+
if (isDisable) {
|
|
62
|
+
return today ? "".concat(month, "月").concat(day, "號今日按鈕變暗") : "".concat(month, "月").concat(day, "號按鈕變暗");
|
|
63
|
+
}
|
|
64
|
+
return today ? "".concat(month, "月").concat(day, "號今日") : "".concat(month, "月").concat(day, "號");
|
|
65
|
+
}
|
|
57
66
|
},
|
|
58
67
|
shortpassword: {
|
|
59
68
|
title: '請輸入密碼',
|
package/dist/es/locales/zh-UG.js
CHANGED
|
@@ -53,7 +53,18 @@ var zhUG = {
|
|
|
53
53
|
},
|
|
54
54
|
today: 'بۈگۈن',
|
|
55
55
|
loadPreviousMonth: 'ئالدىنقى ئاي',
|
|
56
|
-
noEarlierMonth: 'تۈگىدى'
|
|
56
|
+
noEarlierMonth: 'تۈگىدى',
|
|
57
|
+
dayAriaLabel: function(year, month, day, today, isActive, isDisable) {
|
|
58
|
+
var dateStr = "".concat(year, "-").concat(month, "-").concat(day);
|
|
59
|
+
var label = today ? "بۈگۈن, ".concat(dateStr) : dateStr;
|
|
60
|
+
if (isActive) {
|
|
61
|
+
label = "تاللانغان ".concat(label);
|
|
62
|
+
}
|
|
63
|
+
if (isDisable) {
|
|
64
|
+
label = "".concat(label, " چەكلەنگەن");
|
|
65
|
+
}
|
|
66
|
+
return label;
|
|
67
|
+
}
|
|
57
68
|
},
|
|
58
69
|
shortpassword: {
|
|
59
70
|
title: 'مەخپى نومۇرنى كىرگۈزۈڭ',
|
|
@@ -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, { useCallback, useEffect, useState, useRef } from "react";
|
|
5
|
+
import React, { useCallback, useEffect, useState, useRef, useMemo } from "react";
|
|
6
6
|
import classNames from "classnames";
|
|
7
7
|
import { View } from "@tarojs/components";
|
|
8
8
|
import { ArrowLeft, ArrowRight, DoubleLeft, DoubleRight } from "./icon";
|
|
@@ -12,12 +12,13 @@ import { useConfig } from "../configprovider/index";
|
|
|
12
12
|
import { usePropsValue } from "../../hooks/use-props-value";
|
|
13
13
|
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
14
14
|
type: 'single',
|
|
15
|
-
firstDayOfWeek: 0
|
|
15
|
+
firstDayOfWeek: 0,
|
|
16
|
+
weekdays: []
|
|
16
17
|
});
|
|
17
18
|
var prefixCls = 'nut-calendarcard';
|
|
18
19
|
export var CalendarCard = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
19
20
|
var locale = useConfig().locale;
|
|
20
|
-
var _$_object_spread = _object_spread({}, defaultProps, props), style = _$_object_spread.style, className = _$_object_spread.className, type = _$_object_spread.type, title = _$_object_spread.title, value = _$_object_spread.value, defaultValue = _$_object_spread.defaultValue, firstDayOfWeek = _$_object_spread.firstDayOfWeek, startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, disableDay = _$_object_spread.disableDay, renderDay = _$_object_spread.renderDay, renderDayTop = _$_object_spread.renderDayTop, renderDayBottom = _$_object_spread.renderDayBottom, onDayClick = _$_object_spread.onDayClick, onPageChange = _$_object_spread.onPageChange, onChange = _$_object_spread.onChange;
|
|
21
|
+
var _$_object_spread = _object_spread({}, defaultProps, props), style = _$_object_spread.style, className = _$_object_spread.className, type = _$_object_spread.type, title = _$_object_spread.title, value = _$_object_spread.value, defaultValue = _$_object_spread.defaultValue, firstDayOfWeek = _$_object_spread.firstDayOfWeek, startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, disableDay = _$_object_spread.disableDay, renderDay = _$_object_spread.renderDay, renderDayTop = _$_object_spread.renderDayTop, renderDayBottom = _$_object_spread.renderDayBottom, renderDayAriaLabel = _$_object_spread.renderDayAriaLabel, weekdays = _$_object_spread.weekdays, onDayClick = _$_object_spread.onDayClick, onPageChange = _$_object_spread.onPageChange, onChange = _$_object_spread.onChange;
|
|
21
22
|
var onPageChangeRef = useRef(onPageChange);
|
|
22
23
|
// 当前月份信息
|
|
23
24
|
var _useState = _sliced_to_array(useState(function() {
|
|
@@ -167,6 +168,19 @@ export var CalendarCard = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
167
168
|
var d = new Date(day.year, day.month - 1, day.date).getDay();
|
|
168
169
|
return d === 0 || d === 6;
|
|
169
170
|
};
|
|
171
|
+
var isToday = function(day) {
|
|
172
|
+
var today = new Date();
|
|
173
|
+
return day.year === today.getFullYear() && day.month === today.getMonth() + 1 && day.date === today.getDate();
|
|
174
|
+
};
|
|
175
|
+
// 日期无障碍朗读
|
|
176
|
+
var getAriaLabel = function(day) {
|
|
177
|
+
var _locale_calendaritem_dayAriaLabel, _locale_calendaritem;
|
|
178
|
+
if (renderDayAriaLabel) {
|
|
179
|
+
return renderDayAriaLabel(day);
|
|
180
|
+
}
|
|
181
|
+
var today = isToday(day);
|
|
182
|
+
return (_locale_calendaritem_dayAriaLabel = (_locale_calendaritem = locale.calendaritem).dayAriaLabel) === null || _locale_calendaritem_dayAriaLabel === void 0 ? void 0 : _locale_calendaritem_dayAriaLabel.call(_locale_calendaritem, day.year, day.month, day.date, today, isActive(day), isDisable(day));
|
|
183
|
+
};
|
|
170
184
|
var getClasses = function(day) {
|
|
171
185
|
/**
|
|
172
186
|
* active: single、multiple 激活日期
|
|
@@ -351,15 +365,20 @@ export var CalendarCard = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
351
365
|
}
|
|
352
366
|
}, /*#__PURE__*/ React.createElement(DoubleRight, null))));
|
|
353
367
|
};
|
|
354
|
-
var
|
|
355
|
-
var
|
|
368
|
+
var weekHeader = useMemo(function() {
|
|
369
|
+
var weekdaysList = weekdays.length > 0 ? weekdays : locale.calendaritem.weekdays;
|
|
370
|
+
var weekdaysData = weekdaysList.map(function(day, index) {
|
|
356
371
|
return {
|
|
357
372
|
name: day,
|
|
358
373
|
key: index
|
|
359
374
|
};
|
|
360
375
|
});
|
|
361
|
-
return _to_consumable_array(
|
|
362
|
-
}
|
|
376
|
+
return _to_consumable_array(weekdaysData.slice(firstDayOfWeek, 7)).concat(_to_consumable_array(weekdaysData.slice(0, firstDayOfWeek)));
|
|
377
|
+
}, [
|
|
378
|
+
weekdays,
|
|
379
|
+
firstDayOfWeek,
|
|
380
|
+
locale.calendaritem.weekdays
|
|
381
|
+
]);
|
|
363
382
|
var renderContent = function() {
|
|
364
383
|
return /*#__PURE__*/ React.createElement(View, {
|
|
365
384
|
className: "".concat(prefixCls, "-content")
|
|
@@ -380,11 +399,14 @@ export var CalendarCard = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
380
399
|
key: "".concat(day.year, "-").concat(day.month, "-").concat(day.date),
|
|
381
400
|
onClick: function() {
|
|
382
401
|
return handleDayClick(day);
|
|
383
|
-
}
|
|
402
|
+
},
|
|
403
|
+
ariaLabel: getAriaLabel(day),
|
|
404
|
+
ariaRole: "button"
|
|
384
405
|
}, /*#__PURE__*/ React.createElement(View, {
|
|
385
406
|
className: "".concat(prefixCls, "-day-top")
|
|
386
407
|
}, renderDayTop ? renderDayTop(day) : ''), /*#__PURE__*/ React.createElement(View, {
|
|
387
|
-
className: "".concat(prefixCls, "-day-inner")
|
|
408
|
+
className: "".concat(prefixCls, "-day-inner"),
|
|
409
|
+
ariaHidden: true
|
|
388
410
|
}, renderDay ? renderDay(day) : day.date), /*#__PURE__*/ React.createElement(View, {
|
|
389
411
|
className: "".concat(prefixCls, "-day-bottom")
|
|
390
412
|
}, renderDayBottom ? renderDayBottom(day) : ''));
|
|
@@ -8,6 +8,7 @@ import { ComponentDefaults } from "../../utils/typings";
|
|
|
8
8
|
import { useRtl } from "../configprovider/index";
|
|
9
9
|
import { PriceColorEnum } from "../../types";
|
|
10
10
|
import { harmony } from "../../utils/taro/platform";
|
|
11
|
+
import { shouldRenderPriceAsRaw } from "../../utils/should-render-price-raw";
|
|
11
12
|
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
12
13
|
color: 'primary',
|
|
13
14
|
price: 0,
|
|
@@ -22,10 +23,17 @@ export var Price = function(props) {
|
|
|
22
23
|
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;
|
|
23
24
|
var classPrefix = 'nut-price';
|
|
24
25
|
var rtl = useRtl();
|
|
26
|
+
var isRenderPriceRaw = useMemo(function() {
|
|
27
|
+
return typeof originalPrice === 'string' && shouldRenderPriceAsRaw(originalPrice);
|
|
28
|
+
}, [
|
|
29
|
+
originalPrice
|
|
30
|
+
]);
|
|
25
31
|
var price = useMemo(function() {
|
|
32
|
+
if (isRenderPriceRaw) return '';
|
|
26
33
|
return originalPrice.toString().replace(/[^\d.]/g, '');
|
|
27
34
|
}, [
|
|
28
|
-
originalPrice
|
|
35
|
+
originalPrice,
|
|
36
|
+
isRenderPriceRaw
|
|
29
37
|
]);
|
|
30
38
|
var isCustomPriceColor = useMemo(function() {
|
|
31
39
|
var specificPriceColor = Object.values(PriceColorEnum);
|
|
@@ -106,12 +114,15 @@ export var Price = function(props) {
|
|
|
106
114
|
style: priceColorStyle
|
|
107
115
|
}, formatDecimal(price))) : null, symbol && position === 'after' ? renderSymbol() : null);
|
|
108
116
|
};
|
|
117
|
+
var renderRawContent = function() {
|
|
118
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, originalPrice);
|
|
119
|
+
};
|
|
109
120
|
return /*#__PURE__*/ React.createElement(React.Fragment, null, harmony() || process.env.TARO_ENV === 'dynamic' ? /*#__PURE__*/ React.createElement(Text, {
|
|
110
121
|
className: "".concat(classPrefix, " ").concat(classPrefix, "-").concat(color, " ").concat(className),
|
|
111
122
|
style: style
|
|
112
|
-
}, renderInner()) : /*#__PURE__*/ React.createElement(View, {
|
|
123
|
+
}, isRenderPriceRaw ? renderRawContent() : renderInner()) : /*#__PURE__*/ React.createElement(View, {
|
|
113
124
|
className: "".concat(classPrefix, " ").concat(classPrefix, "-").concat(color, " ").concat(className),
|
|
114
125
|
style: style
|
|
115
|
-
}, renderInner()));
|
|
126
|
+
}, isRenderPriceRaw ? renderRawContent() : renderInner()));
|
|
116
127
|
};
|
|
117
128
|
Price.displayName = 'NutPrice';
|
|
@@ -44,6 +44,7 @@ export interface BaseCalendarCard extends BaseProps {
|
|
|
44
44
|
* 限制范围结束日期
|
|
45
45
|
*/
|
|
46
46
|
endDate: Date
|
|
47
|
+
weekdays?: string[];
|
|
47
48
|
/**
|
|
48
49
|
* 设置不可选日期
|
|
49
50
|
*/
|
|
@@ -60,6 +61,7 @@ export interface BaseCalendarCard extends BaseProps {
|
|
|
60
61
|
* 日期底部信息
|
|
61
62
|
*/
|
|
62
63
|
renderDayBottom: (day: CalendarCardDay) => ReactNode
|
|
64
|
+
renderDayAriaLabel?: (day: CalendarCardDay) => string;
|
|
63
65
|
/**
|
|
64
66
|
* 点击后触发
|
|
65
67
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function shouldRenderPriceAsRaw(s: string): boolean;
|