@steroidsjs/core 2.2.38 → 2.2.41
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/useForm.d.ts +1 -0
- package/hooks/useForm.js +1 -0
- package/package.json +1 -1
- package/ui/form/DateField/DateField.js +1 -1
- package/ui/form/DateTimeField/DateTimeField.js +1 -1
- package/ui/form/Field/fieldWrapper.js +1 -1
- package/ui/form/FieldList/FieldList.js +2 -1
- package/ui/form/FieldSet/FieldSet.js +3 -1
- package/ui/form/Form/Form.d.ts +2 -1
- package/ui/form/Form/Form.js +7 -4
- package/ui/list/List/List.d.ts +2 -2
package/hooks/useForm.d.ts
CHANGED
package/hooks/useForm.js
CHANGED
|
@@ -9,6 +9,7 @@ function useForm() {
|
|
|
9
9
|
formId: context.formId,
|
|
10
10
|
model: context.model,
|
|
11
11
|
prefix: context.prefix,
|
|
12
|
+
size: context.size,
|
|
12
13
|
layout: context.layout,
|
|
13
14
|
formDispatch: context === null || context === void 0 ? void 0 : context.dispatch,
|
|
14
15
|
formSelector: function (selector) { var _a; return (_a = context === null || context === void 0 ? void 0 : context.provider) === null || _a === void 0 ? void 0 : _a.select(context.formId, selector); }
|
package/package.json
CHANGED
|
@@ -40,7 +40,7 @@ function DateField(props) {
|
|
|
40
40
|
onClose: onClose,
|
|
41
41
|
isOpened: isOpened,
|
|
42
42
|
inputProps: inputProps,
|
|
43
|
-
calendarProps: calendarProps, size: props.size, icon: props.icon, errors: props.errors, disabled: props.disabled, className: props.className, showRemove: props.showRemove }));
|
|
43
|
+
calendarProps: calendarProps, size: props.size, icon: props.icon, errors: props.errors, label: props.label, disabled: props.disabled, className: props.className, showRemove: props.showRemove }));
|
|
44
44
|
}
|
|
45
45
|
DateField.defaultProps = {
|
|
46
46
|
disabled: false,
|
|
@@ -62,7 +62,7 @@ function DateTimeField(props) {
|
|
|
62
62
|
onClose: onClose,
|
|
63
63
|
inputProps: inputProps,
|
|
64
64
|
calendarProps: calendarProps,
|
|
65
|
-
timePanelViewProps: timePanelViewProps, size: props.size, icon: props.icon, errors: props.errors, className: props.className, showRemove: props.showRemove, isInvalid: props.isInvalid, disabled: props.disabled }));
|
|
65
|
+
timePanelViewProps: timePanelViewProps, size: props.size, icon: props.icon, label: props.label, errors: props.errors, className: props.className, showRemove: props.showRemove, isInvalid: props.isInvalid, disabled: props.disabled }));
|
|
66
66
|
}
|
|
67
67
|
DateTimeField.defaultProps = {
|
|
68
68
|
disabled: false,
|
|
@@ -128,7 +128,7 @@ function fieldWrapper(componentId, Component, optionsConfig) {
|
|
|
128
128
|
// Resolve layout
|
|
129
129
|
var layout = react_1.useMemo(function () { return form_1.mergeLayoutProp(context.layout, props.layout); }, [context.layout, props.layout]);
|
|
130
130
|
if (layout !== null) {
|
|
131
|
-
return components.ui.renderView(FieldLayout_1["default"], __assign(__assign({}, attributesProps), { layout: layout, required: has_1["default"](props, 'required') ? props.required : metaProps.required, label: options.label === false ? null : (has_1["default"](props, 'label') ? props.label : metaProps.label), hint: has_1["default"](props, 'hint') ? props.hint : metaProps.hint, errors: props.errors, children: (React.createElement(Component.DynamicField, __assign({}, props))) }));
|
|
131
|
+
return components.ui.renderView(FieldLayout_1["default"], __assign(__assign({}, attributesProps), { layout: layout, size: props.size || context.size || null, required: has_1["default"](props, 'required') ? props.required : metaProps.required, label: options.label === false ? null : (has_1["default"](props, 'label') ? props.label : metaProps.label), hint: has_1["default"](props, 'hint') ? props.hint : metaProps.hint, errors: props.errors, children: (React.createElement(Component.DynamicField, __assign({}, props))) }));
|
|
132
132
|
}
|
|
133
133
|
return components.ui.renderView(Component.DynamicField, props);
|
|
134
134
|
};
|
|
@@ -85,10 +85,11 @@ function FieldList(props) {
|
|
|
85
85
|
formId: props.formId,
|
|
86
86
|
model: props.model,
|
|
87
87
|
prefix: props.prefix,
|
|
88
|
+
size: props.size,
|
|
88
89
|
layout: props.layout,
|
|
89
90
|
provider: context.provider,
|
|
90
91
|
reducer: context.reducer
|
|
91
|
-
}); }, [context.provider, context.reducer, props.formId, props.layout, props.model, props.prefix]);
|
|
92
|
+
}); }, [context.provider, context.reducer, props.formId, props.layout, props.model, props.prefix, props.size]);
|
|
92
93
|
var commonProps = {
|
|
93
94
|
showAdd: props.showAdd,
|
|
94
95
|
showRemove: props.showRemove,
|
|
@@ -48,10 +48,12 @@ function FieldSet(props) {
|
|
|
48
48
|
prefix: [context.prefix, props.prefix]
|
|
49
49
|
.filter(Boolean)
|
|
50
50
|
.join('.'),
|
|
51
|
+
size: props.size || context.size,
|
|
51
52
|
layout: form_1.mergeLayoutProp(context.layout, props.layout),
|
|
52
53
|
provider: context.provider,
|
|
53
54
|
reducer: context.reducer
|
|
54
|
-
}); }, [context.
|
|
55
|
+
}); }, [context.formId, context.layout, context.model, context.prefix, context.provider, context.reducer,
|
|
56
|
+
context.size, props.formId, props.layout, props.model, props.prefix, props.size]);
|
|
55
57
|
var FieldSetView = props.view || components.ui.getView('form.FieldSetView');
|
|
56
58
|
return (react_1["default"].createElement(Form_1.FormContext.Provider, { value: contextValue },
|
|
57
59
|
react_1["default"].createElement(FieldSetView, __assign({ className: props.className, label: props.label }, props),
|
package/ui/form/Form/Form.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface IFormProps {
|
|
|
29
29
|
*/
|
|
30
30
|
actionMethod?: string;
|
|
31
31
|
/**
|
|
32
|
-
* Текст ошибки при неудачной отправке данных. По-умолчанию: "
|
|
32
|
+
* Текст ошибки при неудачной отправке данных. По-умолчанию: "Ошибка сервера"
|
|
33
33
|
* @example Упс, что-то пошло не так
|
|
34
34
|
*/
|
|
35
35
|
submitErrorMessage?: string;
|
|
@@ -175,6 +175,7 @@ export interface IFormContext {
|
|
|
175
175
|
model?: any;
|
|
176
176
|
prefix?: string | boolean;
|
|
177
177
|
layout?: FormLayout;
|
|
178
|
+
size?: Size;
|
|
178
179
|
provider?: any;
|
|
179
180
|
reducer?: {
|
|
180
181
|
dispatch: React.Dispatch<any>;
|
package/ui/form/Form/Form.js
CHANGED
|
@@ -266,10 +266,9 @@ function Form(props) {
|
|
|
266
266
|
requestError_1 = _c.sent();
|
|
267
267
|
console.error(requestError_1); // eslint-disable-line no-console
|
|
268
268
|
dispatch(form_2.formSetSubmitting(props.formId, false));
|
|
269
|
-
reduxDispatch(notifications_1.showNotification(props.submitErrorMessage || __('
|
|
269
|
+
reduxDispatch(notifications_1.showNotification(props.submitErrorMessage || __('Ошибка сервера'), 'danger'));
|
|
270
270
|
return [2 /*return*/, null];
|
|
271
271
|
case 12:
|
|
272
|
-
dispatch(form_2.formSetSubmitting(props.formId, false));
|
|
273
272
|
// Skip on 2fa
|
|
274
273
|
if (response.twoFactor) {
|
|
275
274
|
dispatch(form_2.formSetSubmitting(props.formId, false));
|
|
@@ -286,6 +285,8 @@ function Form(props) {
|
|
|
286
285
|
setErrors(data.errors);
|
|
287
286
|
return [2 /*return*/, null];
|
|
288
287
|
}
|
|
288
|
+
// Clean errors
|
|
289
|
+
setErrors(null);
|
|
289
290
|
if (props.onComplete) {
|
|
290
291
|
props.onComplete.call(null, cleanedValues, data, response);
|
|
291
292
|
}
|
|
@@ -299,7 +300,8 @@ function Form(props) {
|
|
|
299
300
|
}
|
|
300
301
|
});
|
|
301
302
|
});
|
|
302
|
-
}, [dispatch, props, values, components.ui, components.resource,
|
|
303
|
+
}, [dispatch, props, values, components.ui, components.resource,
|
|
304
|
+
components.http, components.api, reduxDispatch, setErrors]);
|
|
303
305
|
// Manual submit form by reducer action
|
|
304
306
|
var prevSubmitCounter = react_use_1.usePrevious(submitCounter);
|
|
305
307
|
react_use_1.useUpdateEffect(function () {
|
|
@@ -311,11 +313,12 @@ function Form(props) {
|
|
|
311
313
|
formId: props.formId,
|
|
312
314
|
model: props.model,
|
|
313
315
|
prefix: props.prefix,
|
|
316
|
+
size: props.size,
|
|
314
317
|
layout: props.layout,
|
|
315
318
|
provider: provider,
|
|
316
319
|
reducer: reducer,
|
|
317
320
|
dispatch: dispatch
|
|
318
|
-
}); }, [dispatch, props.formId, props.layout, props.model, props.prefix, provider, reducer]);
|
|
321
|
+
}); }, [dispatch, props.formId, props.layout, props.model, props.prefix, props.size, provider, reducer]);
|
|
319
322
|
// Wait initialization (only for redux)
|
|
320
323
|
if (values === undefined) {
|
|
321
324
|
return null;
|
package/ui/list/List/List.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { IListConfig, IListOutput } from '../../../hooks/useList';
|
|
3
3
|
/**
|
|
4
4
|
* List
|
|
@@ -18,7 +18,7 @@ export interface IListProps extends IListConfig {
|
|
|
18
18
|
* Переопределение view React компонента для кастомизации отображения
|
|
19
19
|
* @example MyCustomView
|
|
20
20
|
*/
|
|
21
|
-
view?:
|
|
21
|
+
view?: CustomView;
|
|
22
22
|
/**
|
|
23
23
|
* Дополнительный CSS-класс для элемента отображения
|
|
24
24
|
*/
|