@nutui/nutui-react 3.1.0-beta.1 → 3.1.0

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 (37) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/locales/base.d.ts +6 -0
  3. package/dist/cjs/locales/en-US.js +17 -1
  4. package/dist/cjs/locales/id-ID.js +17 -1
  5. package/dist/cjs/locales/ja-JP.js +16 -2
  6. package/dist/cjs/locales/tr-TR.js +17 -1
  7. package/dist/cjs/locales/vi-VN.js +17 -1
  8. package/dist/cjs/locales/zh-CN.js +15 -1
  9. package/dist/cjs/locales/zh-TW.js +15 -1
  10. package/dist/cjs/locales/zh-UG.js +17 -1
  11. package/dist/cjs/utils/scale-f.d.ts +0 -17
  12. package/dist/cjs/utils/scale-f.js +14 -105
  13. package/dist/cjs/utils/taro/get-system-info.d.ts +0 -5
  14. package/dist/cjs/utils/taro/get-system-info.js +2 -7
  15. package/dist/es/hooks/taro/use-custom-event.js +1 -0
  16. package/dist/es/locales/base.d.ts +6 -0
  17. package/dist/es/locales/en-US.js +17 -1
  18. package/dist/es/locales/id-ID.js +17 -1
  19. package/dist/es/locales/ja-JP.js +16 -2
  20. package/dist/es/locales/tr-TR.js +17 -1
  21. package/dist/es/locales/vi-VN.js +17 -1
  22. package/dist/es/locales/zh-CN.js +15 -1
  23. package/dist/es/locales/zh-TW.js +15 -1
  24. package/dist/es/locales/zh-UG.js +17 -1
  25. package/dist/es/utils/scale-f.d.ts +0 -17
  26. package/dist/es/utils/scale-f.js +15 -106
  27. package/dist/es/utils/taro/get-system-info.d.ts +0 -5
  28. package/dist/es/utils/taro/get-system-info.js +8 -7
  29. package/dist/nutui.react.umd.js +21 -96
  30. package/dist/style-jmapp.css +1 -1
  31. package/dist/style-jmapp.scss +28 -28
  32. package/dist/style-jrkf.css +1 -1
  33. package/dist/style-jrkf.scss +27 -27
  34. package/dist/style.css +1 -1
  35. package/dist/style.scss +30 -30
  36. package/dist/styles/variables-daojia.scss +993 -1971
  37. package/package.json +1 -1
@@ -9,6 +9,11 @@ var viVN = {
9
9
  edit: 'Chỉnh sửa',
10
10
  reset: 'Đặt lại',
11
11
  close: 'Đóng',
12
+ back: 'Quay lại',
13
+ clear: 'Xóa',
14
+ image: {
15
+ errorTip: 'Tải ảnh không thành công'
16
+ },
12
17
  video: {
13
18
  errorTip: 'Tải video không thành công',
14
19
  clickRetry: 'Nhấn để thử lại'
@@ -48,7 +53,18 @@ var viVN = {
48
53
  },
49
54
  today: 'Hôm nay',
50
55
  loadPreviousMonth: 'Tải dữ liệu của tháng trước',
51
- noEarlierMonth: 'Không có tháng nào sớm hơn'
56
+ noEarlierMonth: 'Không có tháng nào sớm hơn',
57
+ dayAriaLabel: function(year, month, day, today, isActive, isDisable) {
58
+ var dateStr = "".concat(year, "-").concat(month, "-").concat(day);
59
+ var label = today ? "H\xf4m nay, ".concat(dateStr) : dateStr;
60
+ if (isActive) {
61
+ label = "Đ\xe3 chọn ".concat(label);
62
+ }
63
+ if (isDisable) {
64
+ label = "".concat(label, " bị v\xf4 hiệu");
65
+ }
66
+ return label;
67
+ }
52
68
  },
53
69
  shortpassword: {
54
70
  title: 'Vui lòng nhập mật khẩu',
@@ -9,6 +9,11 @@ var zhCN = {
9
9
  edit: '编辑',
10
10
  reset: '重置',
11
11
  close: '关闭',
12
+ back: '返回',
13
+ clear: '清除',
14
+ image: {
15
+ errorTip: '图片加载失败'
16
+ },
12
17
  video: {
13
18
  errorTip: '视频加载失败',
14
19
  clickRetry: '点击重试'
@@ -48,7 +53,16 @@ var zhCN = {
48
53
  },
49
54
  today: '今天',
50
55
  loadPreviousMonth: '加载上一个月',
51
- 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
+ }
52
66
  },
53
67
  shortpassword: {
54
68
  title: '请输入密码',
@@ -9,6 +9,11 @@ var zhCN = {
9
9
  edit: '編輯',
10
10
  reset: '重置',
11
11
  close: '關閉',
12
+ back: '返回',
13
+ clear: '清除',
14
+ image: {
15
+ errorTip: '圖片加載失敗'
16
+ },
12
17
  video: {
13
18
  errorTip: '視頻加載失敗',
14
19
  clickRetry: '點擊重試'
@@ -48,7 +53,16 @@ var zhCN = {
48
53
  },
49
54
  today: '今天',
50
55
  loadPreviousMonth: '加載上一個月',
51
- 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
+ }
52
66
  },
53
67
  shortpassword: {
54
68
  title: '請輸入密碼',
@@ -9,6 +9,11 @@ var zhUG = {
9
9
  edit: 'يحرر',
10
10
  reset: 'إعادة ضبط',
11
11
  close: 'تاقاش',
12
+ back: 'قايتىش',
13
+ clear: 'تاقاش',
14
+ image: {
15
+ errorTip: 'رەسىم يۈكلەش مەغلۇپ بولدى'
16
+ },
12
17
  video: {
13
18
  errorTip: 'فىلىمنى قويۇش مەغلۇپ بولدى',
14
19
  clickRetry: 'قايتا سىناش'
@@ -48,7 +53,18 @@ var zhUG = {
48
53
  },
49
54
  today: 'بۈگۈن',
50
55
  loadPreviousMonth: 'ئالدىنقى ئاي',
51
- 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
+ }
52
68
  },
53
69
  shortpassword: {
54
70
  title: 'مەخپى نومۇرنى كىرگۈزۈڭ',
@@ -1,20 +1,3 @@
1
- /** 原生 DongScreenAdapterPlugin.getScale 的典型返回结构 */
2
- type NativeScaleResponse = {
3
- status?: string;
4
- data?: {
5
- scale?: number | string;
6
- };
7
- };
8
- /** jmfe 通用 callNative 签名 */
9
- type NativeCaller = (plugin: string, method: string, params: string, extra: string) => Promise<NativeScaleResponse>;
10
- /** 站内容器的 jmfe 桥接方法(可选) */
11
- declare global {
12
- interface Window {
13
- jmfe?: {
14
- callNative?: NativeCaller;
15
- };
16
- }
17
- }
18
1
  /** 字体档位:标准、大字、老年 */
19
2
  export type ScaleProfile = 'standard' | 'large' | 'elderly';
20
3
  /** 不同场景可选用不同放大比例(layout 等默认可不额外放大) */
@@ -1,11 +1,9 @@
1
1
  /**
2
- * 响应式缩放系数(--nut-scale-f):结合京东站内原生桥与站外视口规则,
2
+ * 响应式缩放系数(--nut-scale-f):按视口宽度计算,
3
3
  * 写入根节点 CSS 变量(--nut-scale-f / --nut-scale-font / --nut-scale-icon),
4
4
  * 供布局/字号/icon 等按比例换算(见 calcByProfile)。H5 与 Taro WebView 共用此实现。
5
- */ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
6
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
7
- import { canUseDom } from "./can-use-dom";
8
- /** 当前基准缩放(来自原生或视口计算) */ var scale = 1;
5
+ */ import { canUseDom } from "./can-use-dom";
6
+ /** 当前基准缩放(来自视口计算) */ var scale = 1;
9
7
  /** 大字模式下仅 font 场景的相对倍率 */ var LARGE_FONT_RATIO = 1.15;
10
8
  /** 老年模式下 font/icon/lego 场景的相对倍率 */ var ELDERLY_RATIO = 1.3;
11
9
  /** 全局当前档位,与 scale 共同参与 calcByProfile */ var profile = 'standard';
@@ -49,7 +47,7 @@ import { canUseDom } from "./can-use-dom";
49
47
  }
50
48
  return Math.round(value);
51
49
  }
52
- /** 无原生桥时按屏宽推算 scale(含平板与 375 基准窄屏区间) */ function getScaleByViewport() {
50
+ /** 按屏宽推算 scale(含平板与 375 基准窄屏区间) */ function getScaleByViewport() {
53
51
  if (!canUseDom) return 1;
54
52
  var deviceWidth = window.innerWidth;
55
53
  if (!deviceWidth) return 1;
@@ -62,81 +60,8 @@ import { canUseDom } from "./can-use-dom";
62
60
  }
63
61
  return 1;
64
62
  }
65
- /** 通过 jmfe.callNative 拉取 DongScreenAdapterPlugin;失败返回 null */ function getScaleByNative() {
66
- return _async_to_generator(function() {
67
- var _window_jmfe, _res_data, res, parsed, e;
68
- return _ts_generator(this, function(_state) {
69
- switch(_state.label){
70
- case 0:
71
- if (!canUseDom || !((_window_jmfe = window.jmfe) === null || _window_jmfe === void 0 ? void 0 : _window_jmfe.callNative)) return [
72
- 2,
73
- null
74
- ];
75
- _state.label = 1;
76
- case 1:
77
- _state.trys.push([
78
- 1,
79
- 3,
80
- ,
81
- 4
82
- ]);
83
- return [
84
- 4,
85
- window.jmfe.callNative('DongScreenAdapterPlugin', 'getScale', JSON.stringify({}), '')
86
- ];
87
- case 2:
88
- res = _state.sent();
89
- if ((res === null || res === void 0 ? void 0 : res.status) === '0' && ((_res_data = res.data) === null || _res_data === void 0 ? void 0 : _res_data.scale) !== undefined) {
90
- parsed = Number(res.data.scale);
91
- if (Number.isFinite(parsed) && parsed > 0) {
92
- return [
93
- 2,
94
- parsed
95
- ];
96
- }
97
- }
98
- return [
99
- 3,
100
- 4
101
- ];
102
- case 3:
103
- e = _state.sent();
104
- return [
105
- 3,
106
- 4
107
- ];
108
- case 4:
109
- return [
110
- 2,
111
- null
112
- ];
113
- }
114
- });
115
- })();
116
- }
117
- /** 统一获取缩放:站内原生优先,失败则用视口规则 */ function getScaleF() {
118
- return _async_to_generator(function() {
119
- var nativeScale;
120
- return _ts_generator(this, function(_state) {
121
- switch(_state.label){
122
- case 0:
123
- return [
124
- 4,
125
- getScaleByNative()
126
- ];
127
- case 1:
128
- nativeScale = _state.sent();
129
- if (nativeScale) return [
130
- 2,
131
- nativeScale
132
- ];
133
- return [
134
- 2,
135
- getScaleByViewport()
136
- ];
137
- }
138
- });
139
- })();
63
+ /** 统一获取缩放:按视口规则计算 */ function getScaleF() {
64
+ return getScaleByViewport();
140
65
  }
141
66
  /** 校验后更新内存中的 scale,并写入 --nut-scale-f */ function setScaleF(nextScale) {
142
67
  var validScale = Number.isFinite(nextScale) && nextScale > 0 ? nextScale : 1;
@@ -144,31 +69,15 @@ import { canUseDom } from "./can-use-dom";
144
69
  applyScaleCssVars(validScale);
145
70
  return scale;
146
71
  }
147
- /** 重新拉取缩放;可选同时切换 profile,避免与当前值相同时重复写 DOM */ function refreshScaleF(nextProfile) {
148
- return _async_to_generator(function() {
149
- var nextScale;
150
- return _ts_generator(this, function(_state) {
151
- switch(_state.label){
152
- case 0:
153
- if (nextProfile) {
154
- setScaleProfile(nextProfile);
155
- }
156
- return [
157
- 4,
158
- getScaleF()
159
- ];
160
- case 1:
161
- nextScale = _state.sent();
162
- if (!scale || nextScale !== scale) {
163
- setScaleF(nextScale);
164
- }
165
- return [
166
- 2,
167
- scale
168
- ];
169
- }
170
- });
171
- })();
72
+ /** 重新计算缩放;可选同时切换 profile,避免与当前值相同时重复写 DOM */ function refreshScaleF(nextProfile) {
73
+ if (nextProfile) {
74
+ setScaleProfile(nextProfile);
75
+ }
76
+ var nextScale = getScaleF();
77
+ if (!scale || nextScale !== scale) {
78
+ setScaleF(nextScale);
79
+ }
80
+ return scale;
172
81
  }
173
82
  /** 首次计算缩放并订阅 resize;返回卸载函数(SSR 下为空函数) */ export function initScaleF(nextProfile) {
174
83
  if (!canUseDom) return function() {};
@@ -14,9 +14,4 @@ export declare const getDeviceInfo: () => IDeviceInfo;
14
14
  * @returns {Taro.getWindowInfo.Result} 窗口信息
15
15
  */
16
16
  export declare const getWindowInfo: () => Taro.getWindowInfo.Result;
17
- /**
18
- * 获取应用基础信息,兼容新旧 API
19
- * @returns {Taro.getAppBaseInfo.Result} 应用基础信息
20
- */
21
- export declare const getAppBaseInfo: () => Taro.getAppBaseInfo.Result;
22
17
  export {};
@@ -13,10 +13,11 @@ import Taro from "@tarojs/taro";
13
13
  * @returns {Taro.getWindowInfo.Result} 窗口信息
14
14
  */ export var getWindowInfo = function() {
15
15
  return typeof Taro.getWindowInfo === 'function' ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
16
- };
17
- /**
18
- * 获取应用基础信息,兼容新旧 API
19
- * @returns {Taro.getAppBaseInfo.Result} 应用基础信息
20
- */ export var getAppBaseInfo = function() {
21
- return typeof Taro.getAppBaseInfo === 'function' ? Taro.getAppBaseInfo() : Taro.getSystemInfoSync();
22
- };
16
+ } // /**
17
+ // * 获取应用基础信息,兼容新旧 API
18
+ // * @returns {Taro.getAppBaseInfo.Result} 应用基础信息
19
+ // */
20
+ // export const getAppBaseInfo = (): Taro.getAppBaseInfo.Result => {
21
+ // return canIUse('getAppBaseInfo') ? taroGetAppBaseInfo() : getSystemInfoSync()
22
+ // }
23
+ ;
@@ -1791,6 +1791,11 @@ React keys must be passed directly to JSX without using spread:
1791
1791
  edit: "编辑",
1792
1792
  reset: "重置",
1793
1793
  close: "关闭",
1794
+ back: "返回",
1795
+ clear: "清除",
1796
+ image: {
1797
+ errorTip: "图片加载失败"
1798
+ },
1794
1799
  video: {
1795
1800
  errorTip: "视频加载失败",
1796
1801
  clickRetry: "点击重试"
@@ -1830,7 +1835,16 @@ React keys must be passed directly to JSX without using spread:
1830
1835
  },
1831
1836
  today: "今天",
1832
1837
  loadPreviousMonth: "加载上一个月",
1833
- noEarlierMonth: "没有更早月份"
1838
+ noEarlierMonth: "没有更早月份",
1839
+ dayAriaLabel: function(year, month, day, today, isActive, isDisable) {
1840
+ if (isActive) {
1841
+ return today ? "已选定今日".concat(month, "月").concat(day, "号") : "已选定".concat(month, "月").concat(day, "号");
1842
+ }
1843
+ if (isDisable) {
1844
+ return today ? "".concat(month, "月").concat(day, "号今日按钮变暗") : "".concat(month, "月").concat(day, "号按钮变暗");
1845
+ }
1846
+ return today ? "".concat(month, "月").concat(day, "号今日") : "".concat(month, "月").concat(day, "号");
1847
+ }
1834
1848
  },
1835
1849
  shortpassword: {
1836
1850
  title: "请输入密码",
@@ -2746,81 +2760,8 @@ React keys must be passed directly to JSX without using spread:
2746
2760
  }
2747
2761
  return 1;
2748
2762
  }
2749
- function getScaleByNative() {
2750
- return _async_to_generator(function() {
2751
- var _window_jmfe, _res_data, res, parsed;
2752
- return __generator(this, function(_state) {
2753
- switch (_state.label) {
2754
- case 0:
2755
- if (!canUseDom || !((_window_jmfe = window.jmfe) === null || _window_jmfe === void 0 ? void 0 : _window_jmfe.callNative)) return [
2756
- 2,
2757
- null
2758
- ];
2759
- _state.label = 1;
2760
- case 1:
2761
- _state.trys.push([
2762
- 1,
2763
- 3,
2764
- ,
2765
- 4
2766
- ]);
2767
- return [
2768
- 4,
2769
- window.jmfe.callNative("DongScreenAdapterPlugin", "getScale", JSON.stringify({}), "")
2770
- ];
2771
- case 2:
2772
- res = _state.sent();
2773
- if ((res === null || res === void 0 ? void 0 : res.status) === "0" && ((_res_data = res.data) === null || _res_data === void 0 ? void 0 : _res_data.scale) !== void 0) {
2774
- parsed = Number(res.data.scale);
2775
- if (Number.isFinite(parsed) && parsed > 0) {
2776
- return [
2777
- 2,
2778
- parsed
2779
- ];
2780
- }
2781
- }
2782
- return [
2783
- 3,
2784
- 4
2785
- ];
2786
- case 3:
2787
- _state.sent();
2788
- return [
2789
- 3,
2790
- 4
2791
- ];
2792
- case 4:
2793
- return [
2794
- 2,
2795
- null
2796
- ];
2797
- }
2798
- });
2799
- })();
2800
- }
2801
2763
  function getScaleF() {
2802
- return _async_to_generator(function() {
2803
- var nativeScale;
2804
- return __generator(this, function(_state) {
2805
- switch (_state.label) {
2806
- case 0:
2807
- return [
2808
- 4,
2809
- getScaleByNative()
2810
- ];
2811
- case 1:
2812
- nativeScale = _state.sent();
2813
- if (nativeScale) return [
2814
- 2,
2815
- nativeScale
2816
- ];
2817
- return [
2818
- 2,
2819
- getScaleByViewport()
2820
- ];
2821
- }
2822
- });
2823
- })();
2764
+ return getScaleByViewport();
2824
2765
  }
2825
2766
  function setScaleF(nextScale) {
2826
2767
  var validScale = Number.isFinite(nextScale) && nextScale > 0 ? nextScale : 1;
@@ -2829,27 +2770,11 @@ React keys must be passed directly to JSX without using spread:
2829
2770
  return scale;
2830
2771
  }
2831
2772
  function refreshScaleF(nextProfile) {
2832
- return _async_to_generator(function() {
2833
- var nextScale;
2834
- return __generator(this, function(_state) {
2835
- switch (_state.label) {
2836
- case 0:
2837
- return [
2838
- 4,
2839
- getScaleF()
2840
- ];
2841
- case 1:
2842
- nextScale = _state.sent();
2843
- if (!scale || nextScale !== scale) {
2844
- setScaleF(nextScale);
2845
- }
2846
- return [
2847
- 2,
2848
- scale
2849
- ];
2850
- }
2851
- });
2852
- })();
2773
+ var nextScale = getScaleF();
2774
+ if (!scale || nextScale !== scale) {
2775
+ setScaleF(nextScale);
2776
+ }
2777
+ return scale;
2853
2778
  }
2854
2779
  function initScaleF(nextProfile) {
2855
2780
  if (!canUseDom) return function() {