react-vant-nova 1.0.7 → 1.1.0-test
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/bundle/react-vant-nova.es.js +8 -9
- package/bundle/react-vant-nova.js +8 -9
- package/bundle/react-vant-nova.min.js +2 -2
- package/es/popup/Popup.js +0 -3
- package/es/toast/Toast.js +23 -19
- package/es/utils/dom/event.js +8 -6
- package/lib/popup/Popup.js +0 -3
- package/lib/toast/Toast.js +23 -19
- package/lib/utils/dom/event.js +8 -6
- package/package.json +1 -1
|
@@ -120,18 +120,17 @@ function preventDefault(event, isStopPropagation) {
|
|
|
120
120
|
stopPropagation(event);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
const eventToPropRecord = {
|
|
124
|
-
"click": "onClick"
|
|
125
|
-
};
|
|
126
123
|
function withStopPropagation(events, element) {
|
|
127
124
|
const props = { ...element.props };
|
|
128
125
|
for (const key of events) {
|
|
129
|
-
const prop =
|
|
130
|
-
props[prop]
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
126
|
+
const prop = key.startsWith("on") ? key : `on${key.charAt(0).toUpperCase() + key.slice(1)}`;
|
|
127
|
+
if (typeof element.props[prop] === "function") {
|
|
128
|
+
props[prop] = function(e) {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
e.stopPropagation();
|
|
131
|
+
(_b = (_a = element.props)[prop]) == null ? void 0 : _b.call(_a, e);
|
|
132
|
+
};
|
|
133
|
+
}
|
|
135
134
|
}
|
|
136
135
|
return React.cloneElement(element, props);
|
|
137
136
|
}
|
|
@@ -140,18 +140,17 @@
|
|
|
140
140
|
stopPropagation(event);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
const eventToPropRecord = {
|
|
144
|
-
"click": "onClick"
|
|
145
|
-
};
|
|
146
143
|
function withStopPropagation(events, element) {
|
|
147
144
|
const props = { ...element.props };
|
|
148
145
|
for (const key of events) {
|
|
149
|
-
const prop =
|
|
150
|
-
props[prop]
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
146
|
+
const prop = key.startsWith("on") ? key : `on${key.charAt(0).toUpperCase() + key.slice(1)}`;
|
|
147
|
+
if (typeof element.props[prop] === "function") {
|
|
148
|
+
props[prop] = function(e2) {
|
|
149
|
+
var _a, _b;
|
|
150
|
+
e2.stopPropagation();
|
|
151
|
+
(_b = (_a = element.props)[prop]) == null ? void 0 : _b.call(_a, e2);
|
|
152
|
+
};
|
|
153
|
+
}
|
|
155
154
|
}
|
|
156
155
|
return React__default["default"].cloneElement(element, props);
|
|
157
156
|
}
|