@steroidsjs/core 2.2.20 → 2.2.23
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/actions/router.js
CHANGED
|
@@ -39,7 +39,7 @@ var goToParent = function (level) {
|
|
|
39
39
|
var getRouteParams = require('../reducers/router').getRouteParams;
|
|
40
40
|
var state = getState();
|
|
41
41
|
var params = getRouteParams(state);
|
|
42
|
-
var parentRoute = getRouteParent(state, level);
|
|
42
|
+
var parentRoute = getRouteParent(state, null, level);
|
|
43
43
|
var parentRouteId = parentRoute ? parentRoute.id : null;
|
|
44
44
|
var parentRouteParams = parentRoute ? params : null;
|
|
45
45
|
if (parentRouteId) {
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IComponentsHocOutput } from '../../../hoc/components';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import { IFieldProps } from '../Field/Field';
|
|
4
3
|
import { IFormContext } from '../Form/Form';
|
|
5
4
|
/**
|
|
6
5
|
* FieldSet
|
|
7
6
|
* Компонент для группировки полей формы
|
|
8
7
|
*/
|
|
9
|
-
export interface IFieldSetProps extends IFormContext
|
|
8
|
+
export interface IFieldSetProps extends IFormContext {
|
|
10
9
|
/**
|
|
11
10
|
* Конфигурационный массив с полями формы
|
|
12
11
|
*/
|
|
@@ -32,6 +31,5 @@ export interface IFieldSetViewProps {
|
|
|
32
31
|
children?: React.ReactNode;
|
|
33
32
|
label?: string | any;
|
|
34
33
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
34
|
+
declare function FieldSet(props: IFieldSetProps): JSX.Element;
|
|
35
|
+
export default FieldSet;
|
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
var __assign = (this && this.__assign) || function () {
|
|
18
3
|
__assign = Object.assign || function(t) {
|
|
19
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -37,12 +22,6 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
37
22
|
}) : function(o, v) {
|
|
38
23
|
o["default"] = v;
|
|
39
24
|
});
|
|
40
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
41
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
42
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
43
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
44
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
45
|
-
};
|
|
46
25
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
47
26
|
if (mod && mod.__esModule) return mod;
|
|
48
27
|
var result = {};
|
|
@@ -54,35 +33,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
54
33
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
34
|
};
|
|
56
35
|
exports.__esModule = true;
|
|
57
|
-
var
|
|
36
|
+
var react_1 = __importStar(require("react"));
|
|
58
37
|
var isString_1 = __importDefault(require("lodash-es/isString"));
|
|
59
|
-
var hoc_1 = require("../../../hoc");
|
|
60
38
|
var Field_1 = __importDefault(require("../Field"));
|
|
61
39
|
var Form_1 = require("../Form/Form");
|
|
40
|
+
var hooks_1 = require("../../../hooks");
|
|
62
41
|
var form_1 = require("../../../utils/form");
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
};
|
|
83
|
-
FieldSet = __decorate([
|
|
84
|
-
hoc_1.components('ui')
|
|
85
|
-
], FieldSet);
|
|
86
|
-
return FieldSet;
|
|
87
|
-
}(React.PureComponent));
|
|
42
|
+
function FieldSet(props) {
|
|
43
|
+
var components = hooks_1.useComponents();
|
|
44
|
+
var context = react_1.useContext(Form_1.FormContext);
|
|
45
|
+
var contextValue = react_1.useMemo(function () { return ({
|
|
46
|
+
formId: props.formId || context.formId,
|
|
47
|
+
model: props.model || context.model,
|
|
48
|
+
prefix: [context.prefix, props.prefix]
|
|
49
|
+
.filter(Boolean)
|
|
50
|
+
.join('.'),
|
|
51
|
+
layout: form_1.mergeLayoutProp(context.layout, props.layout),
|
|
52
|
+
provider: context.provider,
|
|
53
|
+
reducer: context.reducer
|
|
54
|
+
}); }, [context.provider, context.reducer, props.formId, props.layout, props.model, props.prefix]);
|
|
55
|
+
var FieldSetView = props.view || components.ui.getView('form.FieldSetView');
|
|
56
|
+
return (react_1["default"].createElement(Form_1.FormContext.Provider, { value: contextValue },
|
|
57
|
+
react_1["default"].createElement(FieldSetView, __assign({ className: props.className, label: props.label }, props),
|
|
58
|
+
props.children,
|
|
59
|
+
(props.fields || []).map(function (field, index) { return (react_1["default"].createElement(Field_1["default"], __assign({ key: index }, (isString_1["default"](field) ? { attribute: field } : field), { prefix: contextValue.prefix }))); }))));
|
|
60
|
+
}
|
|
88
61
|
exports["default"] = FieldSet;
|