@nutui/nutui-react 1.3.13-beta.0 → 1.3.14-beta.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 (40) hide show
  1. package/CHANGELOG.md +19 -2
  2. package/README.md +54 -43
  3. package/dist/esm/Collapse.js +1 -1
  4. package/dist/esm/CollapseItem.js +9 -5
  5. package/dist/esm/Grid.js +9 -3
  6. package/dist/esm/GridItem.js +19 -1
  7. package/dist/esm/ImagePreview.js +27 -23
  8. package/dist/esm/NoticeBar.js +8 -5
  9. package/dist/esm/Notify.js +1 -1
  10. package/dist/esm/Toast.js +3 -3
  11. package/dist/esm/TrendArrow/style/index.js +1 -1
  12. package/dist/esm/TrendArrow.js +1 -1
  13. package/dist/esm/grid.context-e2f1ee97.js +6 -0
  14. package/dist/esm/render-f8746530.js +81 -0
  15. package/dist/esm/types/src/packages/formitem/index.taro.d.ts +1 -1
  16. package/dist/esm/types/src/packages/grid/grid.context.d.ts +6 -0
  17. package/dist/esm/types/src/packages/grid/grid.d.ts +3 -1
  18. package/dist/esm/types/src/packages/grid/grid.taro.context.d.ts +6 -0
  19. package/dist/esm/types/src/utils/render.d.ts +8 -1
  20. package/dist/locales/base.js +1 -1
  21. package/dist/locales/en-US.js +1 -1
  22. package/dist/locales/id-ID.js +1 -1
  23. package/dist/locales/zh-CN.js +1 -1
  24. package/dist/locales/zh-TW.js +1 -1
  25. package/dist/nutui.react.es.js +91 -35
  26. package/dist/nutui.react.umd.js +91 -35
  27. package/dist/packages/noticebar/noticebar.scss +0 -1
  28. package/dist/style.css +1 -1
  29. package/dist/style.es.js +1 -1
  30. package/dist/styles/font/config.json +5 -1
  31. package/dist/styles/font/demo_index.html +118 -26
  32. package/dist/styles/font/iconfont.css +23 -7
  33. package/dist/styles/font/iconfont.js +6 -6
  34. package/dist/styles/font/iconfont.json +35 -7
  35. package/dist/styles/font/iconfont.ttf +0 -0
  36. package/dist/styles/font/iconfont.woff +0 -0
  37. package/dist/styles/font/iconfont.woff2 +0 -0
  38. package/dist/types/index.d.ts +16 -15
  39. package/package.json +1 -1
  40. package/dist/esm/render-18227751.js +0 -32
package/CHANGELOG.md CHANGED
@@ -1,8 +1,25 @@
1
+ # v1.3.14
2
+ `2022-12-09`
3
+
4
+ feat: image 适配 taro (#507) @vickyYe
5
+ feat: Grid 组件添加 onClick 事件,统一管理子项点击事件,无需在GridItem组件中分别添加点击事件 (#492) @cuicuiworld
6
+ fix: react18 render 提示错误信息 (#524) @oasis-cloud
7
+ fix: noticebar 纵向滚动渲染慢问题修复,设置高度小于默认值时动效失效问题修复 (#528) @vickyYe
8
+ fix: icon 组件 mask-close 未展示叉号 (#527) @oasis-cloud
9
+ fix: #508 修改折叠面板组件修改后不刷新问题 (#521) @zhenyulei
10
+ fix: imagepreview 设置 initNo 后 active 计算错误 (#512) @oasis-cloud
11
+ fix: 移除 formitem 对 react-router-dom 的依赖 (#513) @oasis-cloud
12
+ fix: trendarrow 组件文档增加taro引入方式说明、css文件引入icon的scss文件、修改icon组件的引入方式 (#502) @irisSong
13
+ docs: 修正 virtualList 的文档错误 (#510) @Antee
14
+ docs: Readme 中英文修改 (#525) @vickyYe
15
+ docs: 文档中增加 nutui-react-taro的 import 方式 (#522) @oasis-cloud
16
+
17
+
1
18
  # v1.3.13
2
19
  `2022-11-30`
3
20
  * :sparkles: feat: 新增image组件,适配多语言,增加单元测试 (#498) @vickyYe
4
21
  * :sparkles: feat: trendarrow趋势箭头组件开发完成 (#491) @irisSong
5
- * :bug: fix: 提交skeleton骨架屏白底修改 @junjun666
22
+ * :bug: fix: 提交skeleton骨架屏白底修改 (#499) @junjun666
6
23
  * 📖 docs: pagination demo 增加白色底 (#496) @oasis-cloud
7
24
  * 📖 docs: popover demo 增加白色底 (#497) @oasis-cloud
8
25
  * :bug: fix: cell 空链接不需跳转 (#495) @oasis-cloud
@@ -41,7 +58,7 @@
41
58
  * :bug: fix: 修复Row组件的文档示例错误 (#453) @simpleStyle
42
59
  * 📖 docs: 修复 datepicker 文档中示例代码错误 (#449) @xxxnine
43
60
  * :sparkles: feat: 补全button的关于小程序API的typescript支持 (#447) @simpleStyle
44
- * :bug: fix: input组件defaultvalue值为空时不可清除问题修复 (#452) vickyYe*
61
+ * :bug: fix: input组件defaultvalue值为空时不可清除问题修复 (#452) @vickyYe
45
62
  * :sparkles: feat: menuitem 支持 ref (#450) @oasis-cloud
46
63
  * :sparkles: feat: badge组件支持className和style属性 (#444) @cuicuiworld
47
64
  * :bug: fix: 引入样式文件运行报错(#439) (#441) @hydeia
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <img alt="logo" src="https://img11.360buyimg.com/imagetools/jfs/t1/211965/25/7152/22022/61b16785E433119bb/aa41d7a9f7e823f3.png" width="150" style="margin-bottom: 10px;">
4
4
  </p>
5
5
 
6
- <p align="center">京东风格的轻量级移动端 React 组件库,支持一套代码生成 H5 和小程序</p>
6
+ <p align="center">JD-style mobile UI components based on React that support users to develop H5 and mini-programs.</p>
7
7
 
8
8
  <p align="center">
9
9
  <a href="http://makeapullrequest.com">
@@ -35,90 +35,100 @@
35
35
  </p>
36
36
 
37
37
  ---
38
- > Nut[nʌt],源自电影《冰河世纪》里松鼠 Scrat "执迷不悟",一生追求,即便引发大灾难也绝不松手的坚果。
39
38
 
40
- ## 特性
39
+ > Nut[nʌt]: the one Squirrel Scrat pursues resolutely for a lifetime and will never let go even if it causes a catastrophe from the animated film ***Ice Age***.
41
40
 
42
- * 🚀 60+ 高质量组件, 覆盖移动端主流场景
43
- * 📖 基于京东APP 10.0 视觉规范
44
- * 🍭 支持按需引用
45
- * 📖 详尽的文档和示例
46
- * 💪 支持 TypeScript
47
- * 💪 支持服务端渲染(测试阶段)
48
- * 🍭 支持定制主题
49
- * 🍭 单元测试覆盖率超过80%, 保障稳定性
50
- * 📖 提供 Sketch 设计资源
41
+ [简体中文](./README_ZH.md) | English
51
42
 
52
- ## 构建版本
43
+ ## Features
53
44
 
54
- > AMD 环境、Webpack、Vite 等构建工具环境、服务端建议使用 es 版,非模块化环境(如通过 `<script>` 标签直接引用)建议使用 umd 压缩版。
45
+ * 🚀 60+ High Quality Components
46
+ * 📖 Based on JD APP 10.0 Visual Specifications
47
+ * 🍭 Support Tree Shaking
48
+ * 📖 Extensive Documentation and Demos
49
+ * 💪 Written in TypeScript
50
+ * 💪 Support SSR (Experimental)
51
+ * 🍭 Support Custom Themes
52
+ * 🍭 80%+ Unit Test Coverage
53
+ * 📖 Provide Sketch Design Resources
55
54
 
56
- * es **nutui.react.es.js**
55
+
56
+ ## Build Versions
57
+
58
+ > If you are using AMD environment or build tools such as Webpack, Vite, etc., we recommend using the `es` version. If it is a non-module environment (such as direct reference through the `<script>` tag), it is recommended to use the `umd` compressed version.
59
+
60
+ * es **nutui.es.js**
57
61
 
58
62
  * umd **nutui.umd.js**
59
63
 
60
64
 
61
- ## 链接
65
+ ## Links
62
66
 
63
67
  <ul>
64
68
  <li>
65
69
  <a href="https://github.com/jdf2e/nutui-react/discussions">
66
- Discussions (用👍投票)
70
+ Discussions (vote with 👍)
67
71
  </a>
68
72
  </li>
69
73
  <li>
70
74
  <a href="https://github.com/jdf2e/nutui-react/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22">
71
- Feature Requests (用👍投票)
75
+ Feature Requests (vote with 👍)
72
76
  </a>
73
77
  </li>
74
78
  <li>
75
79
  <a href="https://github.com/jdf2e/nutui-react/labels/bug%203.0">
76
- Bugs (用👍投票)
80
+ Bugs (vote with 👍)
77
81
  </a>
78
82
  </li>
79
83
  <li>
80
84
  <a href="https://github.com/jdf2e/nutui-react/issues?q=is%3Aissue+is%3Aopen+label%3Aquestion">
81
- Question (用👍投票)
85
+ Question (vote with 👍)
82
86
  </a>
83
87
  </li>
84
88
  </ul>
85
89
 
86
- ## 开发交流
87
- | 版本 | 微信群 |内部咚咚群 |
90
+
91
+ ## Communication
92
+
93
+ | Version | WeChat Group | JD Dongdong Group |
88
94
  | --- | --- |--- |
89
- | [NutUI React](https://github.com/jdf2e/nutui-react/issues) | <img src="https://storage.360buyimg.com/imgtools/17c67beff6-4acf07c0-609c-11ed-a6ef-69df15b605e4.png" width="100" /> 关注后回复「NutUI-React」 | 1025679314 |
90
- | [NutUI x Taro](https://github.com/jdf2e/nutui/issues) | <img src="https://camo.githubusercontent.com/db4276b4ee4b443158195e943e9e678cb4d2afb7580f70d4d817ef0a90413aec/687474703a2f2f73746f726167652e333630627579696d672e636f6d2f7461726f2d6a642d636f6d2f7374617469632f636f6e746163745f7461726f5f6e757475695f71722e706e67" width="100" /> 关注后回复「NutUI-React」 | 1022545110 |
95
+ | [NutUI React](https://github.com/jdf2e/nutui-react/issues) | <img src="https://storage.360buyimg.com/imgtools/17c67beff6-4acf07c0-609c-11ed-a6ef-69df15b605e4.png" width="100" /> Reply 「NutUI-React」 after following | 1025679314 |
96
+ | [NutUI x Taro](https://github.com/jdf2e/nutui/issues) | <img src="https://camo.githubusercontent.com/db4276b4ee4b443158195e943e9e678cb4d2afb7580f70d4d817ef0a90413aec/687474703a2f2f73746f726167652e333630627579696d672e636f6d2f7461726f2d6a642d636f6d2f7374617469632f636f6e746163745f7461726f5f6e757475695f71722e706e67" width="100" />Reply NutUI-React」 after following | 1022545110 |
91
97
 
92
- ## 参与共建
93
98
 
94
- #### NutUI 社区共建倡议
99
+ ## Join Us
95
100
 
96
- [NutUI-React 邀您共建,Contributor 您好](https://github.com/jdf2e/nutui-react/discussions/348)
101
+ #### NutUI Community
97
102
 
98
- #### NutUI 贡献代码
103
+ [*Welcome To NutUI-React Community*](https://github.com/jdf2e/nutui-react/discussions/348)
99
104
 
100
- NutUI 的共建方向主要分为:解决 issue、修复 bug、新增组件、增加国际化、UI 定制、平台适配、跨端扩展等。
105
+ #### Contribute to NutUI
101
106
 
102
- 欢迎社区开发者参与共建,在贡献您的代码之前请先阅读 [《NutUI 贡献指南》](https://github.com/jdf2e/nutui-react/discussions/348)。
107
+ There are some choices of contributing to NutUI as follows, solving issues, fixing bugs, adding new components, i18n, UI customization, platform and cross-end adaptation, etc.
103
108
 
104
- ## 问题反馈与建议
109
+ You are very welcome to contribute code to NutUI. Before your pull requests, please read [*NutUI Developer Contributing Guide*](https://github.com/jdf2e/nutui-react/discussions/348)。
105
110
 
106
- [给 NutUI 提 Issue](https://nutui.jd.com/nutui-issue-helper/?repo=jdf2e/nutui-react&lang=zh-cn)
107
111
 
108
- > 在反馈问题之前,推荐阅读 [《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way)、[《如何向开源社区提问题》](https://github.com/seajs/seajs/issues/545)和[《如何有效地报告 Bug》](http://www.chiark.greenend.org.uk/%7Esgtatham/bugs-cn.html),这样您能够更容易获得理解和帮助。
112
+ ## Issue & Discussion
109
113
 
110
- [参与 NutUI 社区讨论](https://github.com/jdf2e/nutui-react/discussions)
114
+ [Report issues to NutUI](https://nutui.jd.com/nutui-issue-helper/?repo=jdf2e/nutui-react&lang=zh-cn)
111
115
 
112
- 如果您有任何想法、疑问或建议,都可以参与社区讨论分享您的观点。
116
+ > It is highly recommended to read [*How To Ask Questions The Smart Way*](https://github.com/ryanhanwu/, [*How To Ask Questions Of GitHub Community*](https://github.com/seajs/seajs/issues/545) and [*How to Report Bugs Effectively*](https://www.chiark.greenend.org.uk/~sgtatham/bugs.html), then you can get understanding and help more easily.
113
117
 
114
- ## 贡献者们
118
+ [NutUI Discussion](https://github.com/jdf2e/nutui-react/discussions)
119
+
120
+ If you have any ideas, questions or suggestions, you can share your opinions here.
121
+
122
+ ## Contributors
123
+
124
+ Thanks to all the following [developers](https://github.com/jdf2e/nutui-react/graphs/contributors)。 who have contributed code to NutUI.
115
125
 
116
- 感谢以下所有给 NutUI 贡献过代码的 [开发者](https://github.com/jdf2e/nutui-react/graphs/contributors)。
117
126
 
118
127
  <a href="https://github.com/jdf2e/nutui-react/graphs/contributors">
119
- <img src="https://contrib.rocks/image?repo=jdf2e/nutui-react" />
128
+ <img src="https://contrib.rocks/image?repo=jdf2e/nutui-react" alt="contributors"/>
120
129
  </a>
121
130
 
131
+
122
132
  ## Stargazers
123
133
 
124
134
  [![Stargazers repo roster for @jdf2e/nutui-react](https://reporoster.com/stars/jdf2e/nutui-react)](https://github.com/jdf2e/nutui-react/stargazers)
@@ -127,14 +137,15 @@ NutUI 的共建方向主要分为:解决 issue、修复 bug、新增组件、
127
137
 
128
138
  [![Forkers repo roster for @jdf2e/nutui-react](https://reporoster.com/forks/jdf2e/nutui-react)](https://github.com/jdf2e/nutui-react/network/members)
129
139
 
130
- ## 开发计划
140
+ ## Milestones
131
141
 
132
142
  [Milestones](https://github.com/jdf2e/nutui-react/projects)
133
143
 
134
- ## 更新日志
144
+ ## Release Notes
145
+
146
+ NutUI follows [Angular Style Commit Message Conventions](https://gist.github.com/stephenparish/9941e89d80e2bc58a153). The up-to-date release notes are available on [Release](https://github.com/jdf2e/nutui-react/releases)
135
147
 
136
- 本项目遵从 [Angular Style Commit Message Conventions](https://gist.github.com/stephenparish/9941e89d80e2bc58a153),更新日志请查阅 [Release](https://github.com/jdf2e/nutui-react/releases)。
137
148
 
138
- ## 开源协议
149
+ ## Open Source License
139
150
 
140
- 本项目基于 **MIT** 协议
151
+ This project is based on **MIT** protocol
@@ -16,7 +16,7 @@ var defaultProps = {
16
16
  rotate: 180
17
17
  };
18
18
  function areEqual(prevProps, nextProps) {
19
- return JSON.stringify(prevProps.activeName) === JSON.stringify(nextProps.activeName);
19
+ return prevProps.children === nextProps.children && JSON.stringify(prevProps.activeName) === JSON.stringify(nextProps.activeName);
20
20
  }
21
21
  var Collapse = memo(function (props) {
22
22
  var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
@@ -4,7 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  var _excluded = ["children", "title", "isOpen", "onToggle", "name", "disabled", "icon", "rotate", "subTitle", "titleIcon", "titleIconColor", "titleIconPosition", "titleIconSize", "iconSize", "iconColor", "childnull", "iconClassPrefix", "iconFontClassName"];
5
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
- import React__default, { useState, useEffect, useCallback } from 'react';
7
+ import React__default, { useState, useCallback, useEffect } from 'react';
8
8
  import { c as cn } from './bem-893ad28d.js';
9
9
  import Icon from './Icon.js';
10
10
  import { C as ComponentDefaults } from './typings-1c5f2628.js';
@@ -65,10 +65,6 @@ var CollapseItem = function CollapseItem(props) {
65
65
  iconStyle = _useState8[0],
66
66
  setIconStyle = _useState8[1];
67
67
  var colBem = cn('collapse-item');
68
- useEffect(function () {
69
- setCurrHeight('auto');
70
- setUpdate(!update);
71
- }, [children]);
72
68
  var measuredRef = useCallback(function (node) {
73
69
  if (node !== null) {
74
70
  setDomHeight(node.getBoundingClientRect().height);
@@ -88,6 +84,14 @@ var CollapseItem = function CollapseItem(props) {
88
84
  setIconStyle(newIconStyle);
89
85
  }, 10);
90
86
  }, [isOpen, domHeight, rotate]);
87
+ useEffect(function () {
88
+ if (!isOpen) {
89
+ setCurrHeight('0px');
90
+ } else {
91
+ setCurrHeight('auto');
92
+ }
93
+ setUpdate(!update);
94
+ }, [children, isOpen]);
91
95
  return React__default.createElement("div", _objectSpread({
92
96
  className: colBem()
93
97
  }, rest), React__default.createElement("div", {
package/dist/esm/Grid.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "columnNum", "border", "gutter", "center", "square", "reverse", "direction", "style", "iconSize", "iconColor", "className"];
3
+ var _excluded = ["children", "columnNum", "border", "gutter", "center", "square", "reverse", "direction", "style", "iconSize", "iconColor", "className", "onClick"];
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
  import React__default from 'react';
7
7
  import { useConfig } from './ConfigProvider.js';
8
8
  import { c as cn } from './bem-893ad28d.js';
9
+ import { G as GridContext } from './grid.context-e2f1ee97.js';
9
10
  import '@bem-react/classname';
10
11
  var defaultProps = {
11
12
  columnNum: 4,
@@ -33,6 +34,7 @@ var Grid = function Grid(props) {
33
34
  iconSize = _defaultProps$props.iconSize,
34
35
  iconColor = _defaultProps$props.iconColor,
35
36
  className = _defaultProps$props.className,
37
+ onClick = _defaultProps$props.onClick,
36
38
  rest = _objectWithoutProperties(_defaultProps$props, _excluded);
37
39
  var childrenDom = React__default.Children.toArray(children);
38
40
  var pxCheck = function pxCheck(value) {
@@ -56,7 +58,11 @@ var Grid = function Grid(props) {
56
58
  return React__default.createElement("div", _objectSpread({
57
59
  className: rootClass(),
58
60
  style: rootStyle()
59
- }, rest), childrenDom.map(function (item, idex) {
61
+ }, rest), React__default.createElement(GridContext.Provider, {
62
+ value: {
63
+ onClick: onClick
64
+ }
65
+ }, childrenDom.map(function (item, idex) {
60
66
  return React__default.cloneElement(item, {
61
67
  index: idex,
62
68
  columnNum: columnNum,
@@ -69,7 +75,7 @@ var Grid = function Grid(props) {
69
75
  parentIconSize: iconSize,
70
76
  parentIconColor: iconColor
71
77
  });
72
- }));
78
+ })));
73
79
  };
74
80
  Grid.defaultProps = defaultProps;
75
81
  Grid.displayName = 'NutGrid';
@@ -3,10 +3,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  var _excluded = ["children", "columnNum", "index", "gutter", "square", "text", "icon", "iconColor", "iconSize", "parentIconSize", "parentIconColor", "border", "center", "reverse", "direction", "iconClassPrefix", "iconFontClassName", "onClick"];
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
- import React__default from 'react';
6
+ import React__default, { useContext } from 'react';
7
7
  import { useConfig } from './ConfigProvider.js';
8
8
  import { c as cn } from './bem-893ad28d.js';
9
9
  import Icon from './Icon.js';
10
+ import { G as GridContext } from './grid.context-e2f1ee97.js';
10
11
  import { C as ComponentDefaults } from './typings-1c5f2628.js';
11
12
  import '@bem-react/classname';
12
13
  var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
@@ -47,6 +48,7 @@ var GridItem = function GridItem(props) {
47
48
  onClick = _defaultProps$props.onClick,
48
49
  rest = _objectWithoutProperties(_defaultProps$props, _excluded);
49
50
  var b = cn('grid-item');
51
+ var context = useContext(GridContext);
50
52
  var pxCheck = function pxCheck(value) {
51
53
  return Number.isNaN(Number(value)) ? String(value) : "".concat(value, "px");
52
54
  };
@@ -72,6 +74,22 @@ var GridItem = function GridItem(props) {
72
74
  };
73
75
  var handleClick = function handleClick(e) {
74
76
  onClick && onClick(e);
77
+ context.onClick && context.onClick({
78
+ text: text,
79
+ icon: icon,
80
+ iconSize: iconSize,
81
+ iconColor: iconColor,
82
+ parentIconSize: parentIconSize,
83
+ parentIconColor: parentIconColor,
84
+ index: index,
85
+ columnNum: columnNum,
86
+ border: border,
87
+ gutter: gutter,
88
+ center: center,
89
+ square: square,
90
+ reverse: reverse,
91
+ direction: direction
92
+ }, index);
75
93
  };
76
94
  return React__default.createElement("div", _objectSpread(_objectSpread({
77
95
  className: b(),
@@ -29,29 +29,33 @@ var ImagePreview = function ImagePreview(props) {
29
29
  contentClose = props.contentClose,
30
30
  onClose = props.onClose;
31
31
  var nutImagePreview = useRef(null);
32
- var _useState = useState(false),
32
+ var _useState = useState(initNo),
33
33
  _useState2 = _slicedToArray(_useState, 2),
34
- showPop = _useState2[0],
35
- setShowPop = _useState2[1];
36
- var _useState3 = useState(1),
34
+ innerNo = _useState2[0],
35
+ setInnerNo = _useState2[1];
36
+ var _useState3 = useState(false),
37
37
  _useState4 = _slicedToArray(_useState3, 2),
38
- active = _useState4[0],
39
- setActive = _useState4[1];
38
+ showPop = _useState4[0],
39
+ setShowPop = _useState4[1];
40
40
  var _useState5 = useState(1),
41
41
  _useState6 = _slicedToArray(_useState5, 2),
42
- maxNo = _useState6[0],
43
- setMaxNo = _useState6[1];
44
- var _useState7 = useState({
42
+ active = _useState6[0],
43
+ setActive = _useState6[1];
44
+ var _useState7 = useState(1),
45
+ _useState8 = _slicedToArray(_useState7, 2),
46
+ maxNo = _useState8[0],
47
+ setMaxNo = _useState8[1];
48
+ var _useState9 = useState({
45
49
  scale: 1,
46
50
  moveable: false
47
51
  }),
48
- _useState8 = _slicedToArray(_useState7, 2),
49
- store = _useState8[0],
50
- setStore = _useState8[1];
51
- var _useState9 = useState(0),
52
52
  _useState10 = _slicedToArray(_useState9, 2),
53
- lastTouchEndTime = _useState10[0],
54
- setLastTouchEndTime = _useState10[1]; // 用来辅助监听双击
53
+ store = _useState10[0],
54
+ setStore = _useState10[1];
55
+ var _useState11 = useState(0),
56
+ _useState12 = _slicedToArray(_useState11, 2),
57
+ lastTouchEndTime = _useState12[0],
58
+ setLastTouchEndTime = _useState12[1]; // 用来辅助监听双击
55
59
  var onTouchStart = function onTouchStart(event) {
56
60
  var touches = event.touches;
57
61
  var events = touches[0];
@@ -128,14 +132,14 @@ var ImagePreview = function ImagePreview(props) {
128
132
  document.addEventListener('touchcancel', onTouchEnd);
129
133
  };
130
134
  useEffect(function () {
131
- if (show !== undefined) {
132
- setShowPop(show);
133
- init();
134
- }
135
- }, [show]);
135
+ setShowPop(show);
136
+ setInnerNo(initNo);
137
+ setActive(initNo);
138
+ init();
139
+ }, [show, initNo]);
136
140
  useEffect(function () {
137
- if (initNo !== undefined) {
138
- setActive(initNo);
141
+ if (innerNo !== undefined) {
142
+ setActive(innerNo);
139
143
  }
140
144
  if (show !== undefined) {
141
145
  setShowPop(show);
@@ -195,7 +199,7 @@ var ImagePreview = function ImagePreview(props) {
195
199
  },
196
200
  direction: "horizontal",
197
201
  onChange: slideChangeEnd,
198
- initPage: initNo && (initNo > maxNo ? maxNo - 1 : initNo - 1),
202
+ initPage: innerNo && (innerNo > maxNo ? maxNo - 1 : innerNo - 1),
199
203
  paginationColor: paginationColor,
200
204
  paginationVisible: paginationVisible
201
205
  }, (videos && videos.length > 0 ? videos.map(function (item, index) {
@@ -182,16 +182,18 @@ var NoticeBar = function NoticeBar(props) {
182
182
  */
183
183
  var startRollEasy = function startRollEasy() {
184
184
  showhorseLamp();
185
- var timerCurr = setInterval(showhorseLamp, ~~(height / speed / 4) * 1000 + Number(standTime));
185
+ var time = height / speed / 4 < 1 ? Number((height / speed / 4).toFixed(1)) * 1000 : ~~(height / speed / 4) * 1000;
186
+ var timerCurr = setInterval(showhorseLamp, time + Number(standTime));
186
187
  SetTimer(timerCurr);
187
188
  };
188
189
  var showhorseLamp = function showhorseLamp() {
189
190
  SetAnimate(true);
191
+ var time = height / speed / 4 < 1 ? Number((height / speed / 4).toFixed(1)) * 1000 : ~~(height / speed / 4) * 1000;
190
192
  setTimeout(function () {
191
193
  scrollList.current.push(scrollList.current[0]);
192
194
  scrollList.current.shift();
193
195
  SetAnimate(false);
194
- }, ~~(height / speed / 4) * 1000);
196
+ }, time);
195
197
  };
196
198
  var startRoll = function startRoll() {
197
199
  var timerCurr = setInterval(function () {
@@ -254,10 +256,11 @@ var NoticeBar = function NoticeBar(props) {
254
256
  background: background,
255
257
  height: direction === 'vertical' ? "".concat(height, "px") : ''
256
258
  };
257
- var duringTime = ~~(height / speed / 4);
259
+ var duringTime = height / speed / 4 < 1 ? Number((height / speed / 4).toFixed(1)) : ~~(height / speed / 4);
260
+ var noDuring = height / speed < 1 ? (height / speed).toFixed(1) : ~~(height / speed);
258
261
  var horseLampStyle = {
259
262
  transform: complexAm ? "translateY(".concat(distance, "px)") : '',
260
- transition: animate ? "all ".concat(duringTime === 0 ? ~~(height / speed) : duringTime, "s") : '',
263
+ transition: animate ? "all ".concat(duringTime === 0 ? noDuring : duringTime, "s") : '',
261
264
  marginTop: animate ? "-".concat(height, "px") : ''
262
265
  };
263
266
  var b = cn('noticebar');
@@ -301,7 +304,7 @@ var NoticeBar = function NoticeBar(props) {
301
304
  fontClassName: iconFontClassName,
302
305
  name: rightIcon || 'close',
303
306
  color: color
304
- })) : null) : null, showNoticeBar && scrollList.current.length > 0 && direction === 'vertical' ? React__default.createElement("div", {
307
+ })) : null) : null, showNoticeBar && direction === 'vertical' ? React__default.createElement("div", {
305
308
  className: "nut-noticebar-vertical",
306
309
  style: barStyle,
307
310
  onClick: handleClick
@@ -14,7 +14,7 @@ import * as ReactDOM from 'react-dom';
14
14
  import classNames from 'classnames';
15
15
  import { CSSTransition } from 'react-transition-group';
16
16
  import { c as cn } from './bem-893ad28d.js';
17
- import { r as render } from './render-18227751.js';
17
+ import { r as render } from './render-f8746530.js';
18
18
  import '@bem-react/classname';
19
19
  var Notification = /*#__PURE__*/function (_React$PureComponent) {
20
20
  _inherits(Notification, _React$PureComponent);
package/dist/esm/Toast.js CHANGED
@@ -10,12 +10,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
10
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
12
  import * as React from 'react';
13
- import * as ReactDOM from 'react-dom';
14
13
  import classNames from 'classnames';
15
14
  import { c as cn } from './bem-893ad28d.js';
16
15
  import Icon from './Icon.js';
17
- import { r as render } from './render-18227751.js';
16
+ import { r as render, u as unmount } from './render-f8746530.js';
18
17
  import '@bem-react/classname';
18
+ import 'react-dom';
19
19
  var Notification = /*#__PURE__*/function (_React$PureComponent) {
20
20
  _inherits(Notification, _React$PureComponent);
21
21
  var _super = _createSuper(Notification);
@@ -149,7 +149,7 @@ Notification.newInstance = function (properties, callback) {
149
149
  callback({
150
150
  component: instance,
151
151
  destroy: function destroy() {
152
- ReactDOM.unmountComponentAtNode(element);
152
+ unmount(element);
153
153
  element && element.parentNode && element.parentNode.removeChild(element);
154
154
  }
155
155
  });
@@ -1,2 +1,2 @@
1
-
1
+ import '../../Icon/style'
2
2
  import '../../../packages/trendarrow/trendarrow.scss'
@@ -5,7 +5,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
  import React__default, { useRef } from 'react';
7
7
  import { c as cn } from './bem-893ad28d.js';
8
- import { I as Icon } from './icon-8dc4de10.js';
8
+ import Icon from './Icon.js';
9
9
  import '@bem-react/classname';
10
10
  var defaultProps = {
11
11
  rate: 0,
@@ -0,0 +1,6 @@
1
+ import React__default from 'react';
2
+ var gridContext = {
3
+ onClick: function onClick(item, index) {}
4
+ };
5
+ var GridContext = React__default.createContext(gridContext);
6
+ export { GridContext as G };
@@ -0,0 +1,81 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _typeof from "@babel/runtime/helpers/typeof";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
+ import * as ReactDOM from 'react-dom';
8
+
9
+ // Let compiler not to search module usage
10
+ var fullClone = _objectSpread({}, ReactDOM);
11
+ var version = fullClone.version,
12
+ reactRender = fullClone.render,
13
+ unmountComponentAtNode = fullClone.unmountComponentAtNode;
14
+ var createRoot;
15
+ try {
16
+ var mainVersion = Number((version || '').split('.')[0]);
17
+ if (mainVersion >= 18 && fullClone.createRoot) {
18
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
19
+ createRoot = fullClone.createRoot;
20
+ }
21
+ } catch (e) {
22
+ // Do nothing;
23
+ }
24
+ function toggleWarning(skip) {
25
+ var __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = fullClone.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
26
+ if (__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED && _typeof(__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === 'object') {
27
+ __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint = skip;
28
+ }
29
+ }
30
+ var MARK = '__nutui_react_root__';
31
+ function legacyRender(node, container) {
32
+ reactRender(node, container);
33
+ }
34
+ function concurrentRender(node, container) {
35
+ toggleWarning(true);
36
+ var root = container[MARK] || createRoot(container);
37
+ toggleWarning(false);
38
+ root.render(node);
39
+ container[MARK] = root;
40
+ }
41
+ function render(node, container) {
42
+ if (createRoot) {
43
+ concurrentRender(node, container);
44
+ return;
45
+ }
46
+ legacyRender(node, container);
47
+ }
48
+ // ========================== Unmount =========================
49
+ function legacyUnmount(container) {
50
+ return unmountComponentAtNode(container);
51
+ }
52
+ function concurrentUnmount(_x) {
53
+ return _concurrentUnmount.apply(this, arguments);
54
+ }
55
+ function _concurrentUnmount() {
56
+ _concurrentUnmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(container) {
57
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
58
+ while (1) {
59
+ switch (_context.prev = _context.next) {
60
+ case 0:
61
+ return _context.abrupt("return", Promise.resolve().then(function () {
62
+ var _container$MARK;
63
+ (_container$MARK = container[MARK]) === null || _container$MARK === void 0 ? void 0 : _container$MARK.unmount();
64
+ delete container[MARK];
65
+ }));
66
+ case 1:
67
+ case "end":
68
+ return _context.stop();
69
+ }
70
+ }
71
+ }, _callee);
72
+ }));
73
+ return _concurrentUnmount.apply(this, arguments);
74
+ }
75
+ function unmount(container) {
76
+ if (createRoot) {
77
+ return concurrentUnmount(container);
78
+ }
79
+ return legacyUnmount(container);
80
+ }
81
+ export { render as r, unmount as u };
@@ -1,2 +1,2 @@
1
- import { FormItem } from './formitem';
1
+ import { FormItem } from './formitem.taro';
2
2
  export default FormItem;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { GridItemProps } from '../griditem/griditem';
3
+ declare const _default: React.Context<{
4
+ onClick: (item: GridItemProps, index: number) => void;
5
+ }>;
6
+ export default _default;
@@ -1,4 +1,5 @@
1
1
  import React, { CSSProperties, FunctionComponent } from 'react';
2
+ import { GridItemProps } from '../griditem/griditem';
2
3
  export declare type GridDirection = 'horizontal' | 'vertical';
3
4
  export interface GridProps {
4
5
  columnNum: string | number;
@@ -12,5 +13,6 @@ export interface GridProps {
12
13
  iconSize?: string | number;
13
14
  iconColor?: string;
14
15
  style?: CSSProperties;
16
+ onClick: (item: GridItemProps, index: number) => void;
15
17
  }
16
- export declare const Grid: FunctionComponent<Partial<GridProps> & React.HTMLAttributes<HTMLDivElement>>;
18
+ export declare const Grid: FunctionComponent<Partial<GridProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'>>;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { GridItemProps } from '../griditem/griditem.taro';
3
+ declare const _default: React.Context<{
4
+ onClick: (item: GridItemProps, index: number) => void;
5
+ }>;
6
+ export default _default;