@nutui/nutui-react-taro 2.3.5 → 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.
package/dist/style.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.3.5 Fri Jan 05 2024 14:39:30 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
  */
@@ -62,7 +62,11 @@ export interface ImagePreviewProps extends BasicComponent {
62
62
  * @default false
63
63
  */
64
64
  showMenuByLongpress: boolean
65
- onChange: (value: number) => void;
65
+ /**
66
+ * 切换时触发
67
+ * @default -
68
+ */
69
+ onChange: (value: number) => void
66
70
  /**
67
71
  * 点击遮罩关闭图片预览时触发
68
72
  * @default -
@@ -32,7 +32,7 @@ export interface InfiniteLoadingProps extends BasicComponent {
32
32
  */
33
33
  loadingText: ReactNode
34
34
  /**
35
- * “没有更多数”据展示文案
35
+ * “没有更多数据”展示文案
36
36
  * @default 哎呀,这里是底部了啦
37
37
  */
38
38
  loadMoreText: ReactNode
@@ -18,7 +18,7 @@ export interface SpaceProps extends BasicComponent {
18
18
  justify: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'stretch'
19
19
  /**
20
20
  * 是否自动换行,仅在 horizontal 时有效
21
- * @default -
21
+ * @default false
22
22
  */
23
23
  wrap: boolean
24
24
  }
@@ -55,17 +55,17 @@ export interface SwipeProps extends BasicComponent {
55
55
  */
56
56
  onActionClick?: (event: MouseEvent<HTMLDivElement>, position: SwipeSide) => void
57
57
  /**
58
- * onTouchStart
58
+ * 开始触碰时触发
59
59
  * @default -
60
60
  */
61
61
  onTouchStart?: (event: BaseEventOrig<HTMLDivElement>) => void
62
62
  /**
63
- * onTouchEnd
63
+ * 结束触碰时触发
64
64
  * @default -
65
65
  */
66
66
  onTouchEnd?: (event: BaseEventOrig<HTMLDivElement>) => void
67
67
  /**
68
- * onTouchMove
68
+ * 滑动时触发
69
69
  * @default -
70
70
  */
71
71
  onTouchMove?: (event: BaseEventOrig<HTMLDivElement>) => void
@@ -45,7 +45,7 @@ export interface TabsProps extends BasicComponent {
45
45
  */
46
46
  duration: number | string
47
47
  /**
48
- * 标题左对齐
48
+ * 标题对齐方式
49
49
  * @default -
50
50
  */
51
51
  align: 'left' | 'right'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutui/nutui-react-taro",
3
- "version": "2.3.5",
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
- };