@nutui/nutui-react 1.4.12 → 1.4.13

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 CHANGED
@@ -1,3 +1,15 @@
1
+ # v1.4.13
2
+ `2023-03-29`
3
+
4
+ * :bug: fix(dialog): 修复Dialog.confirm弹框关闭后dom没有移除问题 (#851) @拧巴的猫
5
+ * :bug: fix(Elevator): 组件瘦身+taro h5适配 (#858) @拧巴的猫
6
+ * :bug: fix(picker): 修复taro版本滚动报错问题 (#852) @拧巴的猫
7
+ * :bug: fix(range): 修复 a11y 属性并补全组件的单元测试 (#849) @AnteeHub
8
+ * :bug: fix: taro-v3.6.12 complier @junjun666
9
+ * :bug: fix: 修复input 的errorMessage显隐导致input失焦问题 (#827) @Penguin-Lin
10
+ * 📖 docs: imagepreview 组件增加点击缩略图切换示例 (#854) @oasis-cloud
11
+
12
+
1
13
  # v1.4.12
2
14
  `2023-03-22`
3
15
 
@@ -8,8 +8,8 @@ import React__default, { useEffect, forwardRef } from 'react';
8
8
  import classNames from 'classnames';
9
9
  import Button from './Button.js';
10
10
  import { CSSTransition } from 'react-transition-group';
11
- import ReactDOM__default from 'react-dom';
12
- import { r as render } from './render-bbebb760.js';
11
+ import { r as render, u as unmount } from './render-bbebb760.js';
12
+ import 'react-dom';
13
13
  var Content = function Content(props) {
14
14
  var visible = props.visible,
15
15
  title = props.title,
@@ -136,10 +136,11 @@ var normalizeConfig = function normalizeConfig(_config) {
136
136
  function confirm(config, renderFunc) {
137
137
  var div = document.createElement('div');
138
138
  document.body.appendChild(div);
139
- function render$1(props) {
139
+ function render$1(props, callback) {
140
140
  render(React__default.createElement(ConfirmDialog, _objectSpread(_objectSpread({}, props), {}, {
141
141
  onCancel: onCancel
142
142
  })), div);
143
+ callback && callback();
143
144
  }
144
145
  var renderFunction = renderFunc || render$1;
145
146
  var dialogConfig = _objectSpread(_objectSpread({}, config), {}, {
@@ -170,8 +171,8 @@ function confirm(config, renderFunc) {
170
171
  dialogConfig.visible = true;
171
172
  renderFunction(dialogConfig);
172
173
  function destroy() {
173
- var unmountEle = ReactDOM__default.unmountComponentAtNode(div);
174
- if (unmountEle && div.parentNode) {
174
+ unmount(div);
175
+ if (div !== null && div !== void 0 && div.parentNode) {
175
176
  div.parentNode.removeChild(div);
176
177
  }
177
178
  }
@@ -180,9 +181,10 @@ function confirm(config, renderFunc) {
180
181
  dialogConfig.visible = false;
181
182
  dialogConfig.onClosed = function () {
182
183
  config.onClosed && config.onClosed();
183
- destroy();
184
184
  };
185
- renderFunction(dialogConfig);
185
+ renderFunction(dialogConfig, function () {
186
+ destroy();
187
+ });
186
188
  }
187
189
  function update(newConfig) {
188
190
  dialogConfig = _objectSpread(_objectSpread({}, dialogConfig), {}, {
@@ -38,9 +38,7 @@ var Elevator = function Elevator(props) {
38
38
  anchorIndex: 0,
39
39
  listHeight: [],
40
40
  listGroup: [],
41
- scrollY: 0,
42
- diff: -1,
43
- fixedTop: 0
41
+ scrollY: 0
44
42
  };
45
43
  var touchState = useRef({
46
44
  y1: 0,
@@ -75,9 +73,6 @@ var Elevator = function Elevator(props) {
75
73
  var resetScrollState = function resetScrollState() {
76
74
  setScrollStart(false);
77
75
  };
78
- var clientHeight = function clientHeight() {
79
- return listview.current ? listview.current.clientHeight : 0;
80
- };
81
76
  var getData = function getData(el, name) {
82
77
  var prefix = 'data-';
83
78
  return el.getAttribute(prefix + name);
@@ -166,7 +161,6 @@ var Elevator = function Elevator(props) {
166
161
  var height2 = listHeight[i + 1];
167
162
  if (state.current.scrollY >= height1 && state.current.scrollY < height2) {
168
163
  setCurrentIndex(i);
169
- state.current.diff = height2 - state.current.scrollY;
170
164
  return;
171
165
  }
172
166
  }
@@ -178,20 +172,6 @@ var Elevator = function Elevator(props) {
178
172
  listview.current.addEventListener('scroll', listViewScroll);
179
173
  }
180
174
  }, [listview]);
181
- useEffect(function () {
182
- var _state$current = state.current,
183
- listHeight = _state$current.listHeight,
184
- diff = _state$current.diff,
185
- scrollY = _state$current.scrollY;
186
- var fixedTop = diff > 0 && diff < titleHeight ? diff - titleHeight : 0;
187
- if (scrollY + clientHeight() === listHeight[listHeight.length - 1]) {
188
- if (fixedTop !== 0) {
189
- fixedTop = 0;
190
- }
191
- }
192
- if (state.current.fixedTop === fixedTop) return;
193
- state.current.fixedTop = fixedTop;
194
- }, [state.current.diff, titleHeight]);
195
175
  return React__default.createElement("div", _objectSpread({
196
176
  className: "".concat(b(), " ").concat(className)
197
177
  }, rest), isSticky && scrollY > 0 ? React__default.createElement("div", {
package/dist/esm/Input.js CHANGED
@@ -356,7 +356,7 @@ var Input = forwardRef(function (props, ref) {
356
356
  style: {
357
357
  textAlign: errorMessageAlign
358
358
  }
359
- }, errorMessage) : null)));
359
+ }, errorMessage) : React__default.createElement("div", null))));
360
360
  });
361
361
  Input.defaultProps = defaultProps;
362
362
  Input.displayName = 'NutInput';
package/dist/esm/Range.js CHANGED
@@ -344,7 +344,7 @@ var Range = function Range(props) {
344
344
  "aria-valuemin": +min,
345
345
  "aria-valuenow": curValue(index),
346
346
  "aria-valuemax": +max,
347
- "aria-orientation": "horizontal",
347
+ "aria-orientation": vertical ? 'vertical' : 'horizontal',
348
348
  onTouchStart: function onTouchStart(e) {
349
349
  if (typeof index === 'number') {
350
350
  // 实时更新当前拖动的按钮索引
@@ -377,7 +377,7 @@ var Range = function Range(props) {
377
377
  "aria-valuemin": +min,
378
378
  "aria-valuenow": curValue(),
379
379
  "aria-valuemax": +max,
380
- "aria-orientation": "horizontal",
380
+ "aria-orientation": vertical ? 'vertical' : 'horizontal',
381
381
  onTouchStart: function onTouchStart(e) {
382
382
  _onTouchStart(e);
383
383
  },
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.12 Wed Mar 22 2023 15:50:16 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui-react v1.4.13 Wed Mar 29 2023 16:00:17 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.12 Wed Mar 22 2023 15:50:16 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui-react v1.4.13 Wed Mar 29 2023 16:00:17 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.12 Wed Mar 22 2023 15:50:16 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui-react v1.4.13 Wed Mar 29 2023 16:00:17 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.12 Wed Mar 22 2023 15:50:16 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui-react v1.4.13 Wed Mar 29 2023 16:00:17 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.12 Wed Mar 22 2023 15:50:16 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui-react v1.4.13 Wed Mar 29 2023 16:00:17 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.12 Wed Mar 22 2023 15:50:16 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui-react v1.4.13 Wed Mar 29 2023 16:00:17 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  var _a;
8
8
  /*!
9
- * @nutui/nutui-react v1.4.12 Wed Mar 22 2023 15:49:25 GMT+0800 (中国标准时间)
9
+ * @nutui/nutui-react v1.4.13 Wed Mar 29 2023 15:59:34 GMT+0800 (China Standard Time)
10
10
  * (c) 2023 @jdf2e.
11
11
  * Released under the MIT License.
12
12
  */
@@ -8837,9 +8837,7 @@ const Elevator = (props) => {
8837
8837
  anchorIndex: 0,
8838
8838
  listHeight: [],
8839
8839
  listGroup: [],
8840
- scrollY: 0,
8841
- diff: -1,
8842
- fixedTop: 0
8840
+ scrollY: 0
8843
8841
  };
8844
8842
  const touchState = useRef({
8845
8843
  y1: 0,
@@ -8857,9 +8855,6 @@ const Elevator = (props) => {
8857
8855
  const resetScrollState = () => {
8858
8856
  setScrollStart(false);
8859
8857
  };
8860
- const clientHeight = () => {
8861
- return listview.current ? listview.current.clientHeight : 0;
8862
- };
8863
8858
  const getData = (el, name) => {
8864
8859
  const prefix2 = "data-";
8865
8860
  return el.getAttribute(prefix2 + name);
@@ -8942,7 +8937,6 @@ const Elevator = (props) => {
8942
8937
  const height2 = listHeight[i + 1];
8943
8938
  if (state.current.scrollY >= height1 && state.current.scrollY < height2) {
8944
8939
  setCurrentIndex(i);
8945
- state.current.diff = height2 - state.current.scrollY;
8946
8940
  return;
8947
8941
  }
8948
8942
  }
@@ -8954,18 +8948,6 @@ const Elevator = (props) => {
8954
8948
  listview.current.addEventListener("scroll", listViewScroll);
8955
8949
  }
8956
8950
  }, [listview]);
8957
- useEffect(() => {
8958
- const { listHeight, diff, scrollY: scrollY2 } = state.current;
8959
- let fixedTop = diff > 0 && diff < titleHeight ? diff - titleHeight : 0;
8960
- if (scrollY2 + clientHeight() === listHeight[listHeight.length - 1]) {
8961
- if (fixedTop !== 0) {
8962
- fixedTop = 0;
8963
- }
8964
- }
8965
- if (state.current.fixedTop === fixedTop)
8966
- return;
8967
- state.current.fixedTop = fixedTop;
8968
- }, [state.current.diff, titleHeight]);
8969
8951
  return /* @__PURE__ */ React__default.createElement("div", { className: `${b2()} ${className}`, ...rest }, isSticky && scrollY > 0 ? /* @__PURE__ */ React__default.createElement("div", { className: b2("list__fixed") }, /* @__PURE__ */ React__default.createElement("span", { className: "fixed-title" }, indexList[currentIndex][acceptKey])) : null, /* @__PURE__ */ React__default.createElement(
8970
8952
  "div",
8971
8953
  {
@@ -14364,7 +14346,7 @@ const Input = forwardRef((props, ref) => {
14364
14346
  }
14365
14347
  },
14366
14348
  errorMessage
14367
- ) : null))
14349
+ ) : /* @__PURE__ */ React__default.createElement("div", null)))
14368
14350
  );
14369
14351
  });
14370
14352
  Input.defaultProps = defaultProps$U;
@@ -15573,7 +15555,7 @@ const Range = (props) => {
15573
15555
  "aria-valuemin": +min,
15574
15556
  "aria-valuenow": curValue(index),
15575
15557
  "aria-valuemax": +max,
15576
- "aria-orientation": "horizontal",
15558
+ "aria-orientation": vertical ? "vertical" : "horizontal",
15577
15559
  onTouchStart: (e) => {
15578
15560
  if (typeof index === "number") {
15579
15561
  SetButtonIndex(index);
@@ -15604,7 +15586,7 @@ const Range = (props) => {
15604
15586
  "aria-valuemin": +min,
15605
15587
  "aria-valuenow": curValue(),
15606
15588
  "aria-valuemax": +max,
15607
- "aria-orientation": "horizontal",
15589
+ "aria-orientation": vertical ? "vertical" : "horizontal",
15608
15590
  onTouchStart: (e) => {
15609
15591
  onTouchStart(e);
15610
15592
  },
@@ -17277,8 +17259,9 @@ const normalizeConfig = (_config) => {
17277
17259
  function confirm(config2, renderFunc) {
17278
17260
  const div = document.createElement("div");
17279
17261
  document.body.appendChild(div);
17280
- function render$1(props) {
17262
+ function render$1(props, callback) {
17281
17263
  render(/* @__PURE__ */ React__default.createElement(ConfirmDialog, { ...props, onCancel }), div);
17264
+ callback && callback();
17282
17265
  }
17283
17266
  const renderFunction = renderFunc || render$1;
17284
17267
  let dialogConfig = {
@@ -17312,8 +17295,8 @@ function confirm(config2, renderFunc) {
17312
17295
  dialogConfig.visible = true;
17313
17296
  renderFunction(dialogConfig);
17314
17297
  function destroy() {
17315
- const unmountEle = ReactDOM__default.unmountComponentAtNode(div);
17316
- if (unmountEle && div.parentNode) {
17298
+ unmount(div);
17299
+ if (div == null ? void 0 : div.parentNode) {
17317
17300
  div.parentNode.removeChild(div);
17318
17301
  }
17319
17302
  }
@@ -17322,9 +17305,10 @@ function confirm(config2, renderFunc) {
17322
17305
  dialogConfig.visible = false;
17323
17306
  dialogConfig.onClosed = () => {
17324
17307
  config2.onClosed && config2.onClosed();
17325
- destroy();
17326
17308
  };
17327
- renderFunction(dialogConfig);
17309
+ renderFunction(dialogConfig, () => {
17310
+ destroy();
17311
+ });
17328
17312
  }
17329
17313
  function update2(newConfig) {
17330
17314
  dialogConfig = {
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
9
9
  return value;
10
10
  };
11
11
  /*!
12
- * @nutui/nutui-react v1.4.12 Wed Mar 22 2023 15:49:25 GMT+0800 (中国标准时间)
12
+ * @nutui/nutui-react v1.4.13 Wed Mar 29 2023 15:59:34 GMT+0800 (China Standard Time)
13
13
  * (c) 2023 @jdf2e.
14
14
  * Released under the MIT License.
15
15
  */
@@ -8855,9 +8855,7 @@ Please add \`${key}Action\` when creating your handler.`);
8855
8855
  anchorIndex: 0,
8856
8856
  listHeight: [],
8857
8857
  listGroup: [],
8858
- scrollY: 0,
8859
- diff: -1,
8860
- fixedTop: 0
8858
+ scrollY: 0
8861
8859
  };
8862
8860
  const touchState = React.useRef({
8863
8861
  y1: 0,
@@ -8875,9 +8873,6 @@ Please add \`${key}Action\` when creating your handler.`);
8875
8873
  const resetScrollState = () => {
8876
8874
  setScrollStart(false);
8877
8875
  };
8878
- const clientHeight = () => {
8879
- return listview.current ? listview.current.clientHeight : 0;
8880
- };
8881
8876
  const getData = (el, name) => {
8882
8877
  const prefix2 = "data-";
8883
8878
  return el.getAttribute(prefix2 + name);
@@ -8960,7 +8955,6 @@ Please add \`${key}Action\` when creating your handler.`);
8960
8955
  const height2 = listHeight[i + 1];
8961
8956
  if (state.current.scrollY >= height1 && state.current.scrollY < height2) {
8962
8957
  setCurrentIndex(i);
8963
- state.current.diff = height2 - state.current.scrollY;
8964
8958
  return;
8965
8959
  }
8966
8960
  }
@@ -8972,18 +8966,6 @@ Please add \`${key}Action\` when creating your handler.`);
8972
8966
  listview.current.addEventListener("scroll", listViewScroll);
8973
8967
  }
8974
8968
  }, [listview]);
8975
- React.useEffect(() => {
8976
- const { listHeight, diff, scrollY: scrollY2 } = state.current;
8977
- let fixedTop = diff > 0 && diff < titleHeight ? diff - titleHeight : 0;
8978
- if (scrollY2 + clientHeight() === listHeight[listHeight.length - 1]) {
8979
- if (fixedTop !== 0) {
8980
- fixedTop = 0;
8981
- }
8982
- }
8983
- if (state.current.fixedTop === fixedTop)
8984
- return;
8985
- state.current.fixedTop = fixedTop;
8986
- }, [state.current.diff, titleHeight]);
8987
8969
  return /* @__PURE__ */ React.createElement("div", { className: `${b2()} ${className}`, ...rest }, isSticky && scrollY > 0 ? /* @__PURE__ */ React.createElement("div", { className: b2("list__fixed") }, /* @__PURE__ */ React.createElement("span", { className: "fixed-title" }, indexList[currentIndex][acceptKey])) : null, /* @__PURE__ */ React.createElement(
8988
8970
  "div",
8989
8971
  {
@@ -14382,7 +14364,7 @@ Please add \`${key}Action\` when creating your handler.`);
14382
14364
  }
14383
14365
  },
14384
14366
  errorMessage
14385
- ) : null))
14367
+ ) : /* @__PURE__ */ React.createElement("div", null)))
14386
14368
  );
14387
14369
  });
14388
14370
  Input.defaultProps = defaultProps$U;
@@ -15591,7 +15573,7 @@ Please add \`${key}Action\` when creating your handler.`);
15591
15573
  "aria-valuemin": +min,
15592
15574
  "aria-valuenow": curValue(index),
15593
15575
  "aria-valuemax": +max,
15594
- "aria-orientation": "horizontal",
15576
+ "aria-orientation": vertical ? "vertical" : "horizontal",
15595
15577
  onTouchStart: (e) => {
15596
15578
  if (typeof index === "number") {
15597
15579
  SetButtonIndex(index);
@@ -15622,7 +15604,7 @@ Please add \`${key}Action\` when creating your handler.`);
15622
15604
  "aria-valuemin": +min,
15623
15605
  "aria-valuenow": curValue(),
15624
15606
  "aria-valuemax": +max,
15625
- "aria-orientation": "horizontal",
15607
+ "aria-orientation": vertical ? "vertical" : "horizontal",
15626
15608
  onTouchStart: (e) => {
15627
15609
  onTouchStart(e);
15628
15610
  },
@@ -17295,8 +17277,9 @@ Please add \`${key}Action\` when creating your handler.`);
17295
17277
  function confirm(config2, renderFunc) {
17296
17278
  const div = document.createElement("div");
17297
17279
  document.body.appendChild(div);
17298
- function render$1(props) {
17280
+ function render$1(props, callback) {
17299
17281
  render(/* @__PURE__ */ React.createElement(ConfirmDialog, { ...props, onCancel }), div);
17282
+ callback && callback();
17300
17283
  }
17301
17284
  const renderFunction = renderFunc || render$1;
17302
17285
  let dialogConfig = {
@@ -17330,8 +17313,8 @@ Please add \`${key}Action\` when creating your handler.`);
17330
17313
  dialogConfig.visible = true;
17331
17314
  renderFunction(dialogConfig);
17332
17315
  function destroy() {
17333
- const unmountEle = ReactDOM.unmountComponentAtNode(div);
17334
- if (unmountEle && div.parentNode) {
17316
+ unmount(div);
17317
+ if (div == null ? void 0 : div.parentNode) {
17335
17318
  div.parentNode.removeChild(div);
17336
17319
  }
17337
17320
  }
@@ -17340,9 +17323,10 @@ Please add \`${key}Action\` when creating your handler.`);
17340
17323
  dialogConfig.visible = false;
17341
17324
  dialogConfig.onClosed = () => {
17342
17325
  config2.onClosed && config2.onClosed();
17343
- destroy();
17344
17326
  };
17345
- renderFunction(dialogConfig);
17327
+ renderFunction(dialogConfig, () => {
17328
+ destroy();
17329
+ });
17346
17330
  }
17347
17331
  function update2(newConfig) {
17348
17332
  dialogConfig = {
package/dist/style.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.12 Wed Mar 22 2023 15:49:57 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui-react v1.4.13 Wed Mar 29 2023 15:59:59 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutui/nutui-react",
3
- "version": "1.4.12",
3
+ "version": "1.4.13",
4
4
  "style": "dist/style.css",
5
5
  "main": "dist/nutui.react.umd.js",
6
6
  "module": "dist/esm/nutui-react.es.js",