@nutui/nutui-react-taro 2.3.6-beta.0 → 2.3.6

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.
@@ -27,12 +27,12 @@ import { T as T4 } from "./tabs.taro-uXbRqGVo.js";
27
27
  import { A } from "./address.taro-sTqrtuxC.js";
28
28
  import { C as C5 } from "./calendar.taro-Kf91Qo5t.js";
29
29
  import { C as C6 } from "./calendaritem.taro-G5BaVw8e.js";
30
- import { C as C7 } from "./calendarcard.taro-QStCLFET.js";
30
+ import { C as C7 } from "./calendarcard.taro-tY-cyh-F.js";
31
31
  import { C as C8 } from "./cascader.taro-DYMZD6ik.js";
32
32
  import { C as C9, a } from "./checkbox.taro-doAmyAh6.js";
33
33
  import { D as D2 } from "./datepicker.taro-OrqtwJFM.js";
34
34
  import { default as default2 } from "./Form.js";
35
- import { F as F2 } from "./formitem.taro-4ofczzxA.js";
35
+ import { F as F2 } from "./formitem.taro-atY4A0pS.js";
36
36
  import { I as I2 } from "./input.taro-8gs046AH.js";
37
37
  import { I as I3 } from "./inputnumber.taro-7QptygT3.js";
38
38
  import { M } from "./menu.taro-ODwHYGFM.js";
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.3.6-beta.0 Wed Jan 10 2024 18:04:30 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.3.6 Fri Jan 12 2024 15:52:08 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-taro v2.3.6-beta.0 Wed Jan 10 2024 18:04:30 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.3.6 Fri Jan 12 2024 15:52:08 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-taro v2.3.6-beta.0 Wed Jan 10 2024 18:04:30 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.3.6 Fri Jan 12 2024 15:52:08 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-taro v2.3.6-beta.0 Wed Jan 10 2024 18:04:30 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.3.6 Fri Jan 12 2024 15:52:08 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-taro v2.3.6-beta.0 Wed Jan 10 2024 18:04:30 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.3.6 Fri Jan 12 2024 15:52:08 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-taro v2.3.6-beta.0 Wed Jan 10 2024 18:04:30 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.3.6 Fri Jan 12 2024 15:52:08 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-taro v2.3.6-beta.0 Wed Jan 10 2024 18:04:30 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.3.6 Fri Jan 12 2024 15:52:08 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  /*!
8
- * @nutui/nutui-react-taro v2.3.6-beta.0 Wed Jan 10 2024 18:03:57 GMT+0800 (China Standard Time)
8
+ * @nutui/nutui-react-taro v2.3.6 Fri Jan 12 2024 15:51:36 GMT+0800 (China Standard Time)
9
9
  * (c) 2023 @jdf2e.
10
10
  * Released under the MIT License.
11
11
  */
@@ -7284,8 +7284,8 @@ const CalendarCard = React__default.forwardRef((props, ref) => {
7284
7284
  };
7285
7285
  const isActive = (day) => {
7286
7286
  if (type4 === "single" || type4 === "multiple") {
7287
- for (const val of innerValue) {
7288
- if (isSameDay(day, val)) {
7287
+ for (const val in innerValue) {
7288
+ if (isSameDay(day, innerValue[val])) {
7289
7289
  return true;
7290
7290
  }
7291
7291
  }
@@ -9691,7 +9691,7 @@ Schema.register = function register(type4, validator) {
9691
9691
  Schema.warning = warning;
9692
9692
  Schema.messages = messages;
9693
9693
  Schema.validators = validators;
9694
- const SECRET$1 = "NUT_FORM_INTERNAL";
9694
+ const SECRET = "NUT_FORM_INTERNAL";
9695
9695
  class FormStore {
9696
9696
  constructor() {
9697
9697
  // 初始化数据
@@ -9772,10 +9772,37 @@ class FormStore {
9772
9772
  ...callback
9773
9773
  };
9774
9774
  });
9775
- __publicField(this, "validateFields", async (nameList) => {
9775
+ __publicField(this, "validateEntities", async (entity, errs) => {
9776
9776
  var _a;
9777
+ const { name, rules: rules2 = [] } = entity.props;
9778
+ const descriptor = {};
9779
+ if (rules2.length) {
9780
+ if (rules2.length > 1) {
9781
+ descriptor[name] = [];
9782
+ rules2.forEach((v) => {
9783
+ descriptor[name].push(v);
9784
+ });
9785
+ } else {
9786
+ descriptor[name] = rules2[0];
9787
+ }
9788
+ }
9789
+ const validator = new Schema(descriptor);
9790
+ try {
9791
+ await validator.validate({ [name]: (_a = this.store) == null ? void 0 : _a[name] });
9792
+ } catch ({ errors }) {
9793
+ if (errors) {
9794
+ errs.push(...errors);
9795
+ this.errors[name] = errors;
9796
+ }
9797
+ } finally {
9798
+ if (!errs || errs.length === 0) {
9799
+ this.errors[name] = [];
9800
+ }
9801
+ }
9802
+ entity.onStoreChange("validate");
9803
+ });
9804
+ __publicField(this, "validateFields", async (nameList) => {
9777
9805
  let filterEntities = [];
9778
- const errs = [];
9779
9806
  this.errors.length = 0;
9780
9807
  if (!nameList || nameList.length === 0) {
9781
9808
  filterEntities = this.fieldEntities;
@@ -9784,34 +9811,10 @@ class FormStore {
9784
9811
  ({ props: { name } }) => nameList.includes(name)
9785
9812
  );
9786
9813
  }
9787
- for (const entity of filterEntities) {
9788
- const { name, rules: rules2 = [] } = entity.props;
9789
- const descriptor = {};
9790
- if (rules2.length) {
9791
- if (rules2.length > 1) {
9792
- descriptor[name] = [];
9793
- rules2.forEach((v) => {
9794
- descriptor[name].push(v);
9795
- });
9796
- } else {
9797
- descriptor[name] = rules2[0];
9798
- }
9799
- }
9800
- const validator = new Schema(descriptor);
9801
- try {
9802
- await validator.validate({ [name]: (_a = this.store) == null ? void 0 : _a[name] });
9803
- } catch ({ errors }) {
9804
- if (errors) {
9805
- errs.push(...errors);
9806
- this.errors[name] = errors;
9807
- }
9808
- } finally {
9809
- if (!errs || errs.length === 0) {
9810
- this.errors[name] = [];
9811
- }
9812
- }
9813
- entity.onStoreChange("validate");
9814
- }
9814
+ const errs = [];
9815
+ filterEntities.forEach((entity) => {
9816
+ this.validateEntities(entity, errs);
9817
+ });
9815
9818
  return errs;
9816
9819
  });
9817
9820
  __publicField(this, "submit", async () => {
@@ -9834,7 +9837,7 @@ class FormStore {
9834
9837
  this.validateFields([name]);
9835
9838
  });
9836
9839
  __publicField(this, "getInternal", (key) => {
9837
- if (key === SECRET$1) {
9840
+ if (key === SECRET) {
9838
9841
  return {
9839
9842
  registerField: this.registerField,
9840
9843
  setCallback: this.setCallback,
@@ -9920,7 +9923,7 @@ const Form = React__default.forwardRef(
9920
9923
  React__default.useImperativeHandle(ref, () => formInstance);
9921
9924
  formInstance.starPosition = starPosition;
9922
9925
  const { submit, resetFields } = formInstance;
9923
- const { setCallback, setInitialValues } = formInstance.getInternal(SECRET$1);
9926
+ const { setCallback, setInitialValues } = formInstance.getInternal(SECRET);
9924
9927
  setCallback({
9925
9928
  onFinish,
9926
9929
  onFinishFailed
@@ -9965,7 +9968,6 @@ function isForwardRefComponent(component) {
9965
9968
  }
9966
9969
  ).$$typeof === component.type.$$typeof;
9967
9970
  }
9968
- const SECRET = "NUT_FORM_INTERNAL";
9969
9971
  const defaultProps$Y = {
9970
9972
  ...ComponentDefaults,
9971
9973
  required: false,
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => {
8
8
  return value;
9
9
  };
10
10
  /*!
11
- * @nutui/nutui-react-taro v2.3.6-beta.0 Wed Jan 10 2024 18:03:57 GMT+0800 (China Standard Time)
11
+ * @nutui/nutui-react-taro v2.3.6 Fri Jan 12 2024 15:51:36 GMT+0800 (China Standard Time)
12
12
  * (c) 2023 @jdf2e.
13
13
  * Released under the MIT License.
14
14
  */
@@ -7300,8 +7300,8 @@ var __publicField = (obj, key, value) => {
7300
7300
  };
7301
7301
  const isActive = (day) => {
7302
7302
  if (type2 === "single" || type2 === "multiple") {
7303
- for (const val of innerValue) {
7304
- if (isSameDay(day, val)) {
7303
+ for (const val in innerValue) {
7304
+ if (isSameDay(day, innerValue[val])) {
7305
7305
  return true;
7306
7306
  }
7307
7307
  }
@@ -9707,7 +9707,7 @@ var __publicField = (obj, key, value) => {
9707
9707
  Schema.warning = warning;
9708
9708
  Schema.messages = messages;
9709
9709
  Schema.validators = validators;
9710
- const SECRET$1 = "NUT_FORM_INTERNAL";
9710
+ const SECRET = "NUT_FORM_INTERNAL";
9711
9711
  class FormStore {
9712
9712
  constructor() {
9713
9713
  // 初始化数据
@@ -9788,10 +9788,37 @@ var __publicField = (obj, key, value) => {
9788
9788
  ...callback
9789
9789
  };
9790
9790
  });
9791
- __publicField(this, "validateFields", async (nameList) => {
9791
+ __publicField(this, "validateEntities", async (entity, errs) => {
9792
9792
  var _a;
9793
+ const { name, rules: rules2 = [] } = entity.props;
9794
+ const descriptor = {};
9795
+ if (rules2.length) {
9796
+ if (rules2.length > 1) {
9797
+ descriptor[name] = [];
9798
+ rules2.forEach((v) => {
9799
+ descriptor[name].push(v);
9800
+ });
9801
+ } else {
9802
+ descriptor[name] = rules2[0];
9803
+ }
9804
+ }
9805
+ const validator = new Schema(descriptor);
9806
+ try {
9807
+ await validator.validate({ [name]: (_a = this.store) == null ? void 0 : _a[name] });
9808
+ } catch ({ errors }) {
9809
+ if (errors) {
9810
+ errs.push(...errors);
9811
+ this.errors[name] = errors;
9812
+ }
9813
+ } finally {
9814
+ if (!errs || errs.length === 0) {
9815
+ this.errors[name] = [];
9816
+ }
9817
+ }
9818
+ entity.onStoreChange("validate");
9819
+ });
9820
+ __publicField(this, "validateFields", async (nameList) => {
9793
9821
  let filterEntities = [];
9794
- const errs = [];
9795
9822
  this.errors.length = 0;
9796
9823
  if (!nameList || nameList.length === 0) {
9797
9824
  filterEntities = this.fieldEntities;
@@ -9800,34 +9827,10 @@ var __publicField = (obj, key, value) => {
9800
9827
  ({ props: { name } }) => nameList.includes(name)
9801
9828
  );
9802
9829
  }
9803
- for (const entity of filterEntities) {
9804
- const { name, rules: rules2 = [] } = entity.props;
9805
- const descriptor = {};
9806
- if (rules2.length) {
9807
- if (rules2.length > 1) {
9808
- descriptor[name] = [];
9809
- rules2.forEach((v) => {
9810
- descriptor[name].push(v);
9811
- });
9812
- } else {
9813
- descriptor[name] = rules2[0];
9814
- }
9815
- }
9816
- const validator = new Schema(descriptor);
9817
- try {
9818
- await validator.validate({ [name]: (_a = this.store) == null ? void 0 : _a[name] });
9819
- } catch ({ errors }) {
9820
- if (errors) {
9821
- errs.push(...errors);
9822
- this.errors[name] = errors;
9823
- }
9824
- } finally {
9825
- if (!errs || errs.length === 0) {
9826
- this.errors[name] = [];
9827
- }
9828
- }
9829
- entity.onStoreChange("validate");
9830
- }
9830
+ const errs = [];
9831
+ filterEntities.forEach((entity) => {
9832
+ this.validateEntities(entity, errs);
9833
+ });
9831
9834
  return errs;
9832
9835
  });
9833
9836
  __publicField(this, "submit", async () => {
@@ -9850,7 +9853,7 @@ var __publicField = (obj, key, value) => {
9850
9853
  this.validateFields([name]);
9851
9854
  });
9852
9855
  __publicField(this, "getInternal", (key) => {
9853
- if (key === SECRET$1) {
9856
+ if (key === SECRET) {
9854
9857
  return {
9855
9858
  registerField: this.registerField,
9856
9859
  setCallback: this.setCallback,
@@ -9936,7 +9939,7 @@ var __publicField = (obj, key, value) => {
9936
9939
  React.useImperativeHandle(ref, () => formInstance);
9937
9940
  formInstance.starPosition = starPosition;
9938
9941
  const { submit, resetFields } = formInstance;
9939
- const { setCallback, setInitialValues } = formInstance.getInternal(SECRET$1);
9942
+ const { setCallback, setInitialValues } = formInstance.getInternal(SECRET);
9940
9943
  setCallback({
9941
9944
  onFinish,
9942
9945
  onFinishFailed
@@ -9981,7 +9984,6 @@ var __publicField = (obj, key, value) => {
9981
9984
  }
9982
9985
  ).$$typeof === component.type.$$typeof;
9983
9986
  }
9984
- const SECRET = "NUT_FORM_INTERNAL";
9985
9987
  const defaultProps$Y = {
9986
9988
  ...ComponentDefaults,
9987
9989
  required: false,
package/dist/style.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.3.6-beta.0 Wed Jan 10 2024 18:04:18 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.3.6 Fri Jan 12 2024 15:51:57 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-taro",
3
- "version": "2.3.6-beta.0",
3
+ "version": "2.3.6",
4
4
  "style": "dist/style.css",
5
5
  "main": "dist/nutui.react.umd.js",
6
6
  "module": "dist/esm/nutui-react.es.js",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@babel/runtime": "^7.21.0",
55
- "@nutui/icons-react-taro": "^1.0.1",
55
+ "@nutui/icons-react-taro": "^1.0.2",
56
56
  "@nutui/touch-emulator": "^1.0.0",
57
57
  "@react-spring/web": "~9.6.1",
58
58
  "@use-gesture/react": "10.2.20",
@@ -1,165 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
- import React__default, { createContext } from "react";
8
- import { C as Cell } from "./cell.taro-jD6MoFTj.js";
9
- import { C as ComponentDefaults } from "./typings-buMpDfSR.js";
10
- const Context = createContext({});
11
- function isForwardRefComponent(component) {
12
- return component.type && component.type.$$typeof && // eslint-disable-next-line react/display-name
13
- React__default.forwardRef(
14
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
15
- // @ts-ignore
16
- () => {
17
- }
18
- ).$$typeof === component.type.$$typeof;
19
- }
20
- const SECRET = "NUT_FORM_INTERNAL";
21
- const defaultProps = {
22
- ...ComponentDefaults,
23
- required: false,
24
- name: "",
25
- label: "",
26
- rules: [{ required: false, message: "" }],
27
- errorMessageAlign: "left",
28
- validateTrigger: "onChange"
29
- };
30
- class FormItem extends React__default.Component {
31
- constructor(props) {
32
- super(props);
33
- __publicField(this, "cancelRegister");
34
- __publicField(this, "componentRef");
35
- // children添加value属性和onChange事件
36
- __publicField(this, "getControlled", (children) => {
37
- var _a;
38
- const { setFieldsValue, getFieldValue } = this.context;
39
- const { dispatch } = this.context.getInternal(SECRET);
40
- const { name = "" } = this.props;
41
- if ((_a = children == null ? void 0 : children.props) == null ? void 0 : _a.defaultValue) {
42
- console.warn("通过 initialValue 设置初始值");
43
- }
44
- const fieldValue = getFieldValue(name);
45
- const controlled = {
46
- ...children.props,
47
- [this.props.valuePropName || "value"]: fieldValue !== void 0 ? fieldValue : this.props.initialValue,
48
- [this.props.trigger || "onChange"]: (...args) => {
49
- const originOnChange = children.props[this.props.trigger || "onChange"];
50
- if (originOnChange) {
51
- originOnChange(...args);
52
- }
53
- let [next] = args;
54
- if (this.props.getValueFromEvent) {
55
- next = this.props.getValueFromEvent(...args);
56
- }
57
- setFieldsValue({ [name]: next });
58
- }
59
- };
60
- const { validateTrigger } = this.props;
61
- let validateTriggers = [this.props.trigger || "onChange"];
62
- if (validateTrigger) {
63
- validateTriggers = typeof validateTrigger === "string" ? [...validateTriggers, validateTrigger] : [...validateTriggers, ...validateTrigger];
64
- validateTriggers.forEach((trigger) => {
65
- const originTrigger = controlled[trigger];
66
- controlled[trigger] = (...args) => {
67
- if (originTrigger) {
68
- originTrigger(...args);
69
- }
70
- if (this.props.rules && this.props.rules.length) {
71
- dispatch({
72
- name: this.props.name
73
- });
74
- }
75
- };
76
- });
77
- }
78
- if (isForwardRefComponent(children)) {
79
- controlled.ref = (componentInstance) => {
80
- const originRef = children.ref;
81
- if (originRef) {
82
- if (typeof originRef === "function") {
83
- originRef(componentInstance);
84
- }
85
- if ("current" in originRef) {
86
- originRef.current = componentInstance;
87
- }
88
- }
89
- this.componentRef = componentInstance;
90
- };
91
- }
92
- return controlled;
93
- });
94
- __publicField(this, "refresh", () => {
95
- this.setState(({ resetCount }) => ({
96
- resetCount: resetCount + 1
97
- }));
98
- });
99
- __publicField(this, "onStoreChange", (type) => {
100
- if (type === "reset") {
101
- this.context.errors[this.props.name] = [];
102
- this.refresh();
103
- } else {
104
- this.forceUpdate();
105
- }
106
- });
107
- __publicField(this, "renderLayout", (childNode) => {
108
- var _a;
109
- const { label, name, required, rules, className, style, errorMessageAlign } = {
110
- ...defaultProps,
111
- ...this.props
112
- };
113
- const requiredInRules = rules == null ? void 0 : rules.some((rule) => rule.required);
114
- const item = name ? this.context.errors[name] : [];
115
- const { starPosition } = this.context;
116
- const renderStar = (required || requiredInRules) && React__default.createElement("i", { className: "required" });
117
- const renderLabel = React__default.createElement(
118
- React__default.Fragment,
119
- null,
120
- starPosition === "left" ? renderStar : null,
121
- label,
122
- starPosition === "right" ? renderStar : null
123
- );
124
- return React__default.createElement(
125
- Cell,
126
- { className: `nut-form-item ${className}`, style, onClick: (e) => this.props.onClick && this.props.onClick(e, this.componentRef) },
127
- label ? React__default.createElement("div", { className: "nut-cell-title nut-form-item-label" }, renderLabel) : null,
128
- React__default.createElement(
129
- "div",
130
- { className: "nut-cell-value nut-form-item-body" },
131
- React__default.createElement("div", { className: "nut-form-item-body-slots" }, childNode),
132
- React__default.createElement("div", { className: "nut-form-item-body-tips", style: {
133
- textAlign: errorMessageAlign,
134
- display: (item == null ? void 0 : item.length) ? "initial" : "none"
135
- } }, (_a = item == null ? void 0 : item[0]) == null ? void 0 : _a.message)
136
- )
137
- );
138
- });
139
- this.componentRef = React__default.createRef();
140
- this.state = {
141
- resetCount: 1
142
- };
143
- }
144
- componentDidMount() {
145
- const { registerField } = this.context.getInternal(SECRET);
146
- this.cancelRegister = registerField(this);
147
- }
148
- componentWillUnmount() {
149
- if (this.cancelRegister) {
150
- this.cancelRegister();
151
- }
152
- }
153
- render() {
154
- const { children } = this.props;
155
- const child = Array.isArray(children) ? children[0] : children;
156
- const returnChildNode = React__default.cloneElement(child, this.getControlled(child));
157
- return React__default.createElement(React__default.Fragment, { key: this.state.resetCount }, this.renderLayout(returnChildNode));
158
- }
159
- }
160
- __publicField(FormItem, "defaultProps", defaultProps);
161
- __publicField(FormItem, "contextType", Context);
162
- export {
163
- Context as C,
164
- FormItem as F
165
- };