@panneau/core 3.0.0 → 3.0.4
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/es/hooks.js +11 -3
- package/lib/hooks.js +11 -3
- package/package.json +4 -4
package/es/hooks.js
CHANGED
|
@@ -158,6 +158,10 @@ var useForm = function useForm() {
|
|
|
158
158
|
providedValue = _opts$value === void 0 ? null : _opts$value,
|
|
159
159
|
_opts$setValue = opts.setValue,
|
|
160
160
|
setProvidedValue = _opts$setValue === void 0 ? null : _opts$setValue,
|
|
161
|
+
_opts$withoutDefault = opts.withoutDefault,
|
|
162
|
+
withoutDefault = _opts$withoutDefault === void 0 ? true : _opts$withoutDefault,
|
|
163
|
+
_opts$withoutPropagat = opts.withoutPropagation,
|
|
164
|
+
withoutPropagation = _opts$withoutPropagat === void 0 ? true : _opts$withoutPropagat,
|
|
161
165
|
_opts$onComplete = opts.onComplete,
|
|
162
166
|
onComplete = _opts$onComplete === void 0 ? null : _opts$onComplete,
|
|
163
167
|
_opts$locales = opts.locales,
|
|
@@ -260,12 +264,16 @@ var useForm = function useForm() {
|
|
|
260
264
|
}, [finalPostForm, action, value]);
|
|
261
265
|
var onSubmit = useCallback(function (e) {
|
|
262
266
|
// console.log('form submit', e); //
|
|
263
|
-
|
|
267
|
+
if (withoutDefault) {
|
|
268
|
+
e.preventDefault();
|
|
269
|
+
}
|
|
270
|
+
if (withoutPropagation) {
|
|
271
|
+
e.stopPropagation();
|
|
272
|
+
}
|
|
264
273
|
// This one is very important with multiple forms
|
|
265
274
|
// Nested forms (even in portals) will bubble the onSubmit event to the parent
|
|
266
|
-
e.stopPropagation();
|
|
267
275
|
submit();
|
|
268
|
-
}, [submit, action]);
|
|
276
|
+
}, [submit, action, withoutDefault, withoutPropagation]);
|
|
269
277
|
var status = null;
|
|
270
278
|
if (requestState.loading) {
|
|
271
279
|
status = 'loading';
|
package/lib/hooks.js
CHANGED
|
@@ -193,6 +193,10 @@ var useForm = function useForm() {
|
|
|
193
193
|
providedValue = _opts$value === void 0 ? null : _opts$value,
|
|
194
194
|
_opts$setValue = opts.setValue,
|
|
195
195
|
setProvidedValue = _opts$setValue === void 0 ? null : _opts$setValue,
|
|
196
|
+
_opts$withoutDefault = opts.withoutDefault,
|
|
197
|
+
withoutDefault = _opts$withoutDefault === void 0 ? true : _opts$withoutDefault,
|
|
198
|
+
_opts$withoutPropagat = opts.withoutPropagation,
|
|
199
|
+
withoutPropagation = _opts$withoutPropagat === void 0 ? true : _opts$withoutPropagat,
|
|
196
200
|
_opts$onComplete = opts.onComplete,
|
|
197
201
|
onComplete = _opts$onComplete === void 0 ? null : _opts$onComplete,
|
|
198
202
|
_opts$locales = opts.locales,
|
|
@@ -295,12 +299,16 @@ var useForm = function useForm() {
|
|
|
295
299
|
}, [finalPostForm, action, value]);
|
|
296
300
|
var onSubmit = react.useCallback(function (e) {
|
|
297
301
|
// console.log('form submit', e); //
|
|
298
|
-
|
|
302
|
+
if (withoutDefault) {
|
|
303
|
+
e.preventDefault();
|
|
304
|
+
}
|
|
305
|
+
if (withoutPropagation) {
|
|
306
|
+
e.stopPropagation();
|
|
307
|
+
}
|
|
299
308
|
// This one is very important with multiple forms
|
|
300
309
|
// Nested forms (even in portals) will bubble the onSubmit event to the parent
|
|
301
|
-
e.stopPropagation();
|
|
302
310
|
submit();
|
|
303
|
-
}, [submit, action]);
|
|
311
|
+
}, [submit, action, withoutDefault, withoutPropagation]);
|
|
304
312
|
var status = null;
|
|
305
313
|
if (requestState.loading) {
|
|
306
314
|
status = 'loading';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@babel/runtime": "^7.12.5",
|
|
72
|
-
"@folklore/fetch": "^0.1.
|
|
72
|
+
"@folklore/fetch": "^0.1.16",
|
|
73
73
|
"@folklore/forms": "^0.0.10",
|
|
74
74
|
"@folklore/routes": "^0.2.6",
|
|
75
75
|
"@folklore/services": "^0.1.24",
|
|
@@ -109,10 +109,10 @@
|
|
|
109
109
|
"uuid": "^8.3.2",
|
|
110
110
|
"webfontloader": "^1.6.28",
|
|
111
111
|
"wolfy87-eventemitter": "^5.2.9",
|
|
112
|
-
"wouter": "^2.
|
|
112
|
+
"wouter": "^2.11.0"
|
|
113
113
|
},
|
|
114
114
|
"publishConfig": {
|
|
115
115
|
"access": "public"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "6f7863dea57d63737d8810c673efc289bc1640da"
|
|
118
118
|
}
|