@nutui/nutui-react-taro 2.0.19 → 2.0.20

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 (55) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/esm/ActionSheet.js +2 -2
  3. package/dist/esm/Address.js +3 -3
  4. package/dist/esm/Avatar.js +3 -2
  5. package/dist/esm/Calendar.js +2 -2
  6. package/dist/esm/Cascader.js +2 -2
  7. package/dist/esm/DatePicker.js +3 -3
  8. package/dist/esm/Form.js +21 -45
  9. package/dist/esm/Grid.js +3 -2
  10. package/dist/esm/GridItem.js +2 -1
  11. package/dist/esm/Image.js +3 -1
  12. package/dist/esm/ImagePreview.js +4 -2
  13. package/dist/esm/NumberKeyboard.js +2 -2
  14. package/dist/esm/Picker.js +2 -2
  15. package/dist/esm/Popover.js +2 -2
  16. package/dist/esm/Popup.js +1 -1
  17. package/dist/esm/ShortPassword.js +2 -2
  18. package/dist/esm/SideNavBar.js +2 -2
  19. package/dist/esm/Skeleton.js +4 -3
  20. package/dist/esm/Swiper.js +7 -6
  21. package/dist/esm/TimeSelect.js +2 -2
  22. package/dist/esm/Tour.js +3 -3
  23. package/dist/esm/{actionsheet.taro-374745a3.js → actionsheet.taro-4ce9962a.js} +1 -1
  24. package/dist/esm/{address.taro-7b3ad807.js → address.taro-33910001.js} +2 -2
  25. package/dist/esm/{avatar.taro-0e574535.js → avatar.taro-1743c7c3.js} +1 -1
  26. package/dist/esm/{calendar.taro-2c342d6b.js → calendar.taro-45a9c705.js} +1 -1
  27. package/dist/esm/{cascader.taro-6ee25349.js → cascader.taro-505e8467.js} +1 -1
  28. package/dist/esm/{datepicker.taro-de668a19.js → datepicker.taro-725e96f0.js} +1 -1
  29. package/dist/esm/{grid.taro-f72acab8.js → grid.taro-13674639.js} +2 -1
  30. package/dist/esm/{griditem.taro-b7abc653.js → griditem.taro-9e1c493c.js} +2 -5
  31. package/dist/esm/{image.taro-a7ad2272.js → image.taro-fa4a92a1.js} +6 -5
  32. package/dist/esm/{imagepreview.taro-78c0a7b8.js → imagepreview.taro-fcd29363.js} +4 -3
  33. package/dist/esm/{numberkeyboard.taro-bd6a9439.js → numberkeyboard.taro-ec8f8435.js} +1 -1
  34. package/dist/esm/nutui-react.es.js +20 -19
  35. package/dist/esm/{picker.taro-e08d99a3.js → picker.taro-5f86e72b.js} +1 -1
  36. package/dist/esm/{popover.taro-6b946803.js → popover.taro-539d15e4.js} +1 -1
  37. package/dist/esm/{popup.taro-1636100a.js → popup.taro-3273aa87.js} +3 -1
  38. package/dist/esm/px-check-f83a9dc3.js +6 -0
  39. package/dist/esm/{shortpassword.taro-331d270c.js → shortpassword.taro-8e8c4102.js} +1 -1
  40. package/dist/esm/{sidenavbar.taro-39fb8ac6.js → sidenavbar.taro-97230c40.js} +1 -1
  41. package/dist/esm/{skeleton.taro-1f829d87.js → skeleton.taro-5a621338.js} +1 -1
  42. package/dist/esm/{timeselect.taro-e02f6bf9.js → timeselect.taro-892ca807.js} +1 -1
  43. package/dist/esm/{tour.taro-88cf1ba9.js → tour.taro-b38e06a5.js} +1 -1
  44. package/dist/locales/base.js +1 -1
  45. package/dist/locales/en-US.js +1 -1
  46. package/dist/locales/id-ID.js +1 -1
  47. package/dist/locales/tr-TR.js +1 -1
  48. package/dist/locales/zh-CN.js +1 -1
  49. package/dist/locales/zh-TW.js +1 -1
  50. package/dist/locales/zh-UG.js +1 -1
  51. package/dist/nutui.react.es.js +45 -65
  52. package/dist/nutui.react.umd.js +45 -65
  53. package/dist/style.mjs +1 -1
  54. package/dist/types/packages/calendar/calendar.taro.d.ts +4 -4
  55. package/package.json +1 -1
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => {
8
8
  return value;
9
9
  };
10
10
  /*!
11
- * @nutui/nutui-react-taro v2.0.19 Wed Sep 27 2023 18:15:02 GMT+0800 (China Standard Time)
11
+ * @nutui/nutui-react-taro v2.0.20 Fri Oct 13 2023 13:54:07 GMT+0800 (China Standard Time)
12
12
  * (c) 2023 @jdf2e.
13
13
  * Released under the MIT License.
14
14
  */
@@ -3238,6 +3238,9 @@ var __publicField = (obj, key, value) => {
3238
3238
  ));
3239
3239
  };
3240
3240
  ConfigProvider.displayName = "NutConfigProvider";
3241
+ const pxCheck = (value) => {
3242
+ return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
3243
+ };
3241
3244
  const defaultProps$1r = {
3242
3245
  src: "",
3243
3246
  error: true,
@@ -3272,14 +3275,13 @@ var __publicField = (obj, key, value) => {
3272
3275
  onError && onError(e);
3273
3276
  }
3274
3277
  };
3275
- const pxCheck2 = (value) => {
3276
- return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
3277
- };
3278
3278
  const containerStyle = {
3279
- height: height ? pxCheck2(height) : "",
3280
- width: width ? pxCheck2(width) : "",
3279
+ // eslint-disable-next-line no-nested-ternary
3280
+ height: height ? pxCheck(height) : Taro.getEnv() === "WEB" ? "" : "100px",
3281
+ // eslint-disable-next-line no-nested-ternary
3282
+ width: width ? pxCheck(width) : Taro.getEnv() === "WEB" ? "" : "100%",
3281
3283
  overflow: radius !== void 0 && radius !== null ? "hidden" : "",
3282
- borderRadius: radius !== void 0 && radius !== null ? pxCheck2(radius) : ""
3284
+ borderRadius: radius !== void 0 && radius !== null ? pxCheck(radius) : ""
3283
3285
  };
3284
3286
  const imgStyle = {
3285
3287
  ...style
@@ -5224,9 +5226,6 @@ var __publicField = (obj, key, value) => {
5224
5226
  }
5225
5227
  };
5226
5228
  const GridContext = React.createContext(gridContext);
5227
- const pxCheck = (value) => {
5228
- return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
5229
- };
5230
5229
  const defaultProps$1o = {
5231
5230
  text: "",
5232
5231
  columns: 4,
@@ -6191,7 +6190,9 @@ var __publicField = (obj, key, value) => {
6191
6190
  const open2 = () => {
6192
6191
  if (!innerVisible) {
6193
6192
  setInnerVisible(true);
6194
- setIndex(++_zIndex);
6193
+ if (props.zIndex === void 0) {
6194
+ setIndex(++_zIndex);
6195
+ }
6195
6196
  }
6196
6197
  if (destroyOnClose) {
6197
6198
  setShowChildren(true);
@@ -10942,11 +10943,11 @@ var __publicField = (obj, key, value) => {
10942
10943
  ...this.store,
10943
10944
  ...newStore
10944
10945
  };
10945
- this.fieldEntities.forEach((enetity) => {
10946
- const { name } = enetity.props;
10946
+ this.fieldEntities.forEach((entity) => {
10947
+ const { name } = entity.props;
10947
10948
  Object.keys(newStore).forEach((key) => {
10948
10949
  if (key === name) {
10949
- enetity.onStoreChange("update");
10950
+ entity.onStoreChange("update");
10950
10951
  }
10951
10952
  });
10952
10953
  });
@@ -10957,44 +10958,19 @@ var __publicField = (obj, key, value) => {
10957
10958
  ...callback
10958
10959
  };
10959
10960
  });
10960
- __publicField(this, "validate", () => {
10961
- const err = [];
10961
+ __publicField(this, "validateFields", async (nameList) => {
10962
+ var _a;
10963
+ let filterEntitys = [];
10964
+ const errs = [];
10962
10965
  this.errors.length = 0;
10963
- this.fieldEntities.forEach((entity) => {
10964
- var _a;
10965
- const { name, rules: rules2 = [] } = entity.props;
10966
- const descriptor = {};
10967
- if (rules2.length) {
10968
- if (rules2.length > 1) {
10969
- descriptor[name] = [];
10970
- rules2.forEach((v) => {
10971
- descriptor[name].push(v);
10972
- });
10973
- } else {
10974
- descriptor[name] = rules2[0];
10975
- }
10976
- }
10977
- const validator = new Schema(descriptor);
10978
- validator.messages();
10979
- validator.validate({ [name]: (_a = this.store) == null ? void 0 : _a[name] }, (errors) => {
10980
- if (errors) {
10981
- err.push(...errors);
10982
- this.errors[name] = errors;
10983
- }
10984
- entity.onStoreChange("validate");
10985
- });
10986
- });
10987
- return err;
10988
- });
10989
- __publicField(this, "validateFields", (nameList) => {
10990
10966
  if (!nameList || nameList.length === 0) {
10991
- this.validate();
10992
- return;
10967
+ filterEntitys = this.fieldEntities;
10968
+ } else {
10969
+ filterEntitys = this.fieldEntities.filter(
10970
+ ({ props: { name } }) => nameList.includes(name)
10971
+ );
10993
10972
  }
10994
- this.fieldEntities.filter(({ props: { name } }) => {
10995
- return nameList.includes(name);
10996
- }).forEach((entity) => {
10997
- var _a;
10973
+ for (const entity of filterEntitys) {
10998
10974
  const { name, rules: rules2 = [] } = entity.props;
10999
10975
  const descriptor = {};
11000
10976
  if (rules2.length) {
@@ -11008,19 +10984,22 @@ var __publicField = (obj, key, value) => {
11008
10984
  }
11009
10985
  }
11010
10986
  const validator = new Schema(descriptor);
11011
- validator.messages();
11012
- validator.validate({ [name]: (_a = this.store) == null ? void 0 : _a[name] }, (errors) => {
10987
+ try {
11013
10988
  this.errors[name] = [];
10989
+ await validator.validate({ [name]: (_a = this.store) == null ? void 0 : _a[name] });
10990
+ } catch ({ errors }) {
11014
10991
  if (errors) {
10992
+ errs.push(...errors);
11015
10993
  this.errors[name] = errors;
11016
10994
  }
11017
- entity.onStoreChange("validate");
11018
- });
11019
- });
10995
+ }
10996
+ entity.onStoreChange("validate");
10997
+ }
10998
+ return errs;
11020
10999
  });
11021
- __publicField(this, "submit", () => {
11000
+ __publicField(this, "submit", async () => {
11022
11001
  var _a, _b, _c, _d;
11023
- const errors = this.validate();
11002
+ const errors = await this.validateFields();
11024
11003
  if (errors.length === 0) {
11025
11004
  (_b = (_a = this.callbacks).onFinish) == null ? void 0 : _b.call(_a, this.store);
11026
11005
  } else if (errors.length > 0) {
@@ -17601,8 +17580,8 @@ var __publicField = (obj, key, value) => {
17601
17580
  {
17602
17581
  className: classNames(classPrefix$3, className),
17603
17582
  style: {
17604
- width: !width ? "100%" : `${width}px`,
17605
- height: !height ? "150px" : `${height}px`
17583
+ width: !width ? "100%" : pxCheck(width),
17584
+ height: !height ? "150px" : pxCheck(height)
17606
17585
  }
17607
17586
  },
17608
17587
  /* @__PURE__ */ React.createElement(
@@ -17610,8 +17589,8 @@ var __publicField = (obj, key, value) => {
17610
17589
  {
17611
17590
  className: "nut-swiper__inner",
17612
17591
  style: {
17613
- width: !width ? "100%" : `${width}px`,
17614
- height: !height ? "150px" : `${height}px`
17592
+ width: !width ? "100%" : pxCheck(width),
17593
+ height: !height ? "150px" : pxCheck(height)
17615
17594
  }
17616
17595
  },
17617
17596
  /* @__PURE__ */ React.createElement(
@@ -17628,8 +17607,8 @@ var __publicField = (obj, key, value) => {
17628
17607
  (_a = props.onChange) == null ? void 0 : _a.call(props, e);
17629
17608
  },
17630
17609
  style: {
17631
- width: !width ? "100%" : `${width}px`,
17632
- height: !height ? "150px" : `${height}px`
17610
+ width: !width ? "100%" : pxCheck(width),
17611
+ height: !height ? "150px" : pxCheck(height)
17633
17612
  },
17634
17613
  ...rest
17635
17614
  },
@@ -17869,13 +17848,14 @@ var __publicField = (obj, key, value) => {
17869
17848
  ));
17870
17849
  }) : []).concat(
17871
17850
  images && images.length > 0 ? images.map((item, index) => {
17872
- return /* @__PURE__ */ React.createElement(SwiperItem, { key: index }, Taro.getEnv() === "WEB" ? /* @__PURE__ */ React.createElement("img", { src: item.src, alt: "" }) : /* @__PURE__ */ React.createElement(
17873
- components.Image,
17851
+ return /* @__PURE__ */ React.createElement(SwiperItem, { key: index }, Taro.getEnv() === "WEB" ? /* @__PURE__ */ React.createElement(Image$1, { src: item.src, mode: "aspectFit" }) : /* @__PURE__ */ React.createElement(
17852
+ Image$1,
17874
17853
  {
17875
17854
  src: item.src,
17876
17855
  mode: "aspectFit",
17877
17856
  showMenuByLongpress: true,
17878
- style: { width: "100%", height: "100%" }
17857
+ width: "100%",
17858
+ height: "100%"
17879
17859
  }
17880
17860
  ));
17881
17861
  }) : []
package/dist/style.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.0.19 Wed Sep 27 2023 18:15:34 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.0.20 Fri Oct 13 2023 13:54:40 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -111,22 +111,22 @@ export interface CalendarProps {
111
111
  renderDayBottom?: (date: Day) => string | JSX.Element
112
112
  /**
113
113
  * 关闭时触发
114
- * @default
114
+ * @default -
115
115
  */
116
116
  onClose?: () => void
117
117
  /**
118
118
  * 选择之后或是点击确认按钮触发
119
- * @default
119
+ * @default -
120
120
  */
121
121
  onConfirm?: (param: string) => void
122
122
  /**
123
123
  * 点击/选择后触发
124
- * @default
124
+ * @default -
125
125
  */
126
126
  onDayClick?: (data: string) => void
127
127
  /**
128
128
  * 年月子标题到达顶部时触发
129
- * @default
129
+ * @default -
130
130
  */
131
131
  onPageChange?: (param: string) => void
132
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutui/nutui-react-taro",
3
- "version": "2.0.19",
3
+ "version": "2.0.20",
4
4
  "style": "dist/style.css",
5
5
  "main": "dist/nutui.react.umd.js",
6
6
  "module": "dist/esm/nutui-react.es.js",