@steroidsjs/core 2.2.28 → 2.2.31
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/hooks/useFile.js +2 -2
- package/package.json +1 -1
- package/ui/form/Form/Form.js +21 -16
- package/ui/layout/Meta/Meta.js +1 -3
package/hooks/useFile.js
CHANGED
|
@@ -173,13 +173,13 @@ function useFile(props) {
|
|
|
173
173
|
//todo refactoring
|
|
174
174
|
react_1.useEffect(function () {
|
|
175
175
|
if (prevInputValue && !isEqual_1["default"](prevInputValue !== props.input.value)) {
|
|
176
|
-
var toRemove_1 = difference_1["default"]([].concat(
|
|
176
|
+
var toRemove_1 = difference_1["default"]([].concat(prevInputValue || []), [].concat(props.input.value || []));
|
|
177
177
|
if (toRemove_1.length > 0) {
|
|
178
178
|
uploader.queue.remove(uploader.queue.getFiles().filter(function (file) { return (toRemove_1.indexOf(get_1["default"](file.getResultHttpMessage(), 'id')) !== -1); }));
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
182
|
-
}, [prevInputValue]);
|
|
182
|
+
}, [prevInputValue, props.input.value]);
|
|
183
183
|
/**
|
|
184
184
|
* Show browse dialog in user browser
|
|
185
185
|
* @param {object} event
|
package/package.json
CHANGED
package/ui/form/Form/Form.js
CHANGED
|
@@ -158,7 +158,7 @@ function Form(props) {
|
|
|
158
158
|
var onSubmit = react_1.useCallback(function (e) {
|
|
159
159
|
if (e === void 0) { e = null; }
|
|
160
160
|
return __awaiter(_this, void 0, void 0, function () {
|
|
161
|
-
var cleanedValues, captchaAttribute, googleCaptcha, captchaToken, options, response, _a, data;
|
|
161
|
+
var cleanedValues, submitResult, captchaAttribute, googleCaptcha, captchaToken, options, response, _a, data;
|
|
162
162
|
var _b;
|
|
163
163
|
var _this = this;
|
|
164
164
|
return __generator(this, function (_c) {
|
|
@@ -181,14 +181,19 @@ function Form(props) {
|
|
|
181
181
|
cleanedValues = form_1.cleanEmptyObject(values);
|
|
182
182
|
// Event onBeforeSubmit
|
|
183
183
|
if (props.onBeforeSubmit && props.onBeforeSubmit.call(null, cleanedValues) === false) {
|
|
184
|
+
dispatch(form_2.formSetSubmitting(props.formId, false));
|
|
184
185
|
return [2 /*return*/, null];
|
|
185
186
|
}
|
|
186
187
|
if (props.validators) {
|
|
187
188
|
validate_1["default"](cleanedValues, props.validators);
|
|
188
189
|
}
|
|
189
|
-
if (props.onSubmit)
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
if (!props.onSubmit) return [3 /*break*/, 2];
|
|
191
|
+
return [4 /*yield*/, props.onSubmit.call(null, cleanedValues)];
|
|
192
|
+
case 1:
|
|
193
|
+
submitResult = _c.sent();
|
|
194
|
+
dispatch(form_2.formSetSubmitting(props.formId, false));
|
|
195
|
+
return [2 /*return*/, submitResult];
|
|
196
|
+
case 2:
|
|
192
197
|
captchaAttribute = null;
|
|
193
198
|
Object.entries(components.ui.getRegisteredFields(props.formId) || {}).forEach(function (_a) {
|
|
194
199
|
var attribute = _a[0], fieldType = _a[1];
|
|
@@ -196,20 +201,20 @@ function Form(props) {
|
|
|
196
201
|
captchaAttribute = attribute;
|
|
197
202
|
}
|
|
198
203
|
});
|
|
199
|
-
if (!(captchaAttribute && components.resource.googleCaptchaSiteKey)) return [3 /*break*/,
|
|
204
|
+
if (!(captchaAttribute && components.resource.googleCaptchaSiteKey)) return [3 /*break*/, 5];
|
|
200
205
|
return [4 /*yield*/, components.resource.loadGoogleCaptcha()];
|
|
201
|
-
case
|
|
206
|
+
case 3:
|
|
202
207
|
googleCaptcha = _c.sent();
|
|
203
208
|
return [4 /*yield*/, getCaptchaToken({
|
|
204
209
|
googleCaptcha: googleCaptcha,
|
|
205
210
|
siteKey: components.resource.googleCaptchaSiteKey,
|
|
206
211
|
actionName: props.captchaActionName
|
|
207
212
|
})];
|
|
208
|
-
case
|
|
213
|
+
case 4:
|
|
209
214
|
captchaToken = _c.sent();
|
|
210
215
|
cleanedValues = __assign(__assign({}, cleanedValues), (_b = {}, _b[captchaAttribute] = captchaToken, _b));
|
|
211
|
-
_c.label =
|
|
212
|
-
case
|
|
216
|
+
_c.label = 5;
|
|
217
|
+
case 5:
|
|
213
218
|
options = {
|
|
214
219
|
onTwoFactor: props.onTwoFactor
|
|
215
220
|
? function (providerName) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -234,16 +239,16 @@ function Form(props) {
|
|
|
234
239
|
}); }
|
|
235
240
|
: undefined
|
|
236
241
|
};
|
|
237
|
-
if (!(typeof props.action === 'function')) return [3 /*break*/,
|
|
242
|
+
if (!(typeof props.action === 'function')) return [3 /*break*/, 7];
|
|
238
243
|
return [4 /*yield*/, props.action.call(null, components.api, cleanedValues, options)];
|
|
239
|
-
case 4:
|
|
240
|
-
_a = _c.sent();
|
|
241
|
-
return [3 /*break*/, 7];
|
|
242
|
-
case 5: return [4 /*yield*/, components.http.send(props.actionMethod, props.action || window.location.pathname, cleanedValues, options)];
|
|
243
244
|
case 6:
|
|
244
245
|
_a = _c.sent();
|
|
245
|
-
|
|
246
|
-
case 7:
|
|
246
|
+
return [3 /*break*/, 9];
|
|
247
|
+
case 7: return [4 /*yield*/, components.http.send(props.actionMethod, props.action || window.location.pathname, cleanedValues, options)];
|
|
248
|
+
case 8:
|
|
249
|
+
_a = _c.sent();
|
|
250
|
+
_c.label = 9;
|
|
251
|
+
case 9:
|
|
247
252
|
response = _a;
|
|
248
253
|
dispatch(form_2.formSetSubmitting(props.formId, false));
|
|
249
254
|
// Skip on 2fa
|
package/ui/layout/Meta/Meta.js
CHANGED
|
@@ -27,9 +27,7 @@ function Meta(props) {
|
|
|
27
27
|
_c.map(function (attrs, index) { return (react_1["default"].createElement("style", __assign({ key: index }, attrs, { dangerouslySetInnerHTML: {
|
|
28
28
|
__html: attrs.innerHtml
|
|
29
29
|
} }))); }), (_d = props.scripts) === null || _d === void 0 ? void 0 :
|
|
30
|
-
_d.map(function (attrs, index) { return (react_1["default"].createElement("script", __assign({ key: index }, attrs,
|
|
31
|
-
__html: attrs.innerHtml
|
|
32
|
-
} }))); }), (_e = props.noScripts) === null || _e === void 0 ? void 0 :
|
|
30
|
+
_d.map(function (attrs, index) { return (react_1["default"].createElement("script", __assign({ key: index }, attrs), attrs.innerHtml || '')); }), (_e = props.noScripts) === null || _e === void 0 ? void 0 :
|
|
33
31
|
_e.map(function (attrs, index) { return (react_1["default"].createElement("noscript", { key: index, dangerouslySetInnerHTML: {
|
|
34
32
|
__html: attrs.innerHtml
|
|
35
33
|
} })); }),
|