@steroidsjs/core 3.0.0-beta.102 → 3.0.0-beta.104
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/components/HttpComponent.d.ts +4 -4
- package/components/JwtHttpComponent.d.ts +2 -2
- package/components/LocaleComponent.d.ts +5 -5
- package/components/ResourceComponent.d.ts +2 -2
- package/components/WebSocketComponent.d.ts +6 -6
- package/docs-autogen-result.json +7486 -2759
- package/en.json +121 -97
- package/hooks/useApplication.js +4 -0
- package/hooks/useFile.d.ts +1 -0
- package/hooks/useFile.js +2 -0
- package/package.json +2 -1
- package/ui/content/CalendarSystem/CalendarSystem.d.ts +9 -2
- package/ui/content/Chat/Chat.d.ts +6 -1
- package/ui/content/Chat/utils/index.d.ts +2 -1
- package/ui/content/Chat/utils/index.js +3 -1
- package/ui/content/Chat/utils/isTodayMessage.d.ts +1 -0
- package/ui/content/Chat/utils/isTodayMessage.js +13 -0
- package/ui/content/Dashboard/Dashboard.d.ts +5 -2
- package/ui/content/Dashboard/Dashboard.js +1 -1
- package/ui/content/DropDown/DropDown.d.ts +1 -1
- package/ui/content/DropDown/DropDown.js +4 -4
- package/ui/content/Kanban/Kanban.d.ts +11 -0
- package/ui/form/EmailField/EmailField.d.ts +6 -0
- package/ui/form/EmailField/EmailField.js +0 -4
- package/ui/form/FieldList/FieldList.d.ts +5 -4
- package/ui/form/Form/Form.js +4 -1
- package/ui/form/NumberField/NumberField.js +34 -7
- package/ui/layout/Skeleton/Skeleton.d.ts +3 -1
- package/ui/list/ControlsColumn/ControlsColumn.d.ts +1 -1
- package/ui/list/TreeTable/TreeTable.d.ts +5 -4
- package/ui/list/TreeTable/TreeTable.js +0 -4
- package/ui/nav/Link/Link.d.ts +1 -1
- package/ui/nav/Nav/Nav.d.ts +3 -1
- package/ui/nav/Router/Router.js +3 -0
- package/utils/calculateComponentAbsolutePosition.js +57 -21
- package/utils/form.d.ts +1 -0
- package/utils/form.js +16 -1
|
@@ -8,7 +8,9 @@ export interface ISkeletonViewProps {
|
|
|
8
8
|
width?: string | number;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Skeleton
|
|
12
|
+
*
|
|
13
|
+
* Компонент `Skeleton` представляет собой заглушку для отображения временных данных
|
|
12
14
|
* во время загрузки или ожидания загрузки реальных данных.
|
|
13
15
|
**/
|
|
14
16
|
export interface ISkeletonProps {
|
|
@@ -8,7 +8,7 @@ export interface IControlsColumnItem extends IButtonProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* ControlsColumn
|
|
10
10
|
*
|
|
11
|
-
* Компонент ControlsColumn предоставляет колонку с контролами.
|
|
11
|
+
* Компонент `ControlsColumn` предоставляет колонку с контролами.
|
|
12
12
|
**/
|
|
13
13
|
export interface IControlsColumnProps {
|
|
14
14
|
/**
|
|
@@ -24,6 +24,11 @@ export interface ITreeTableItem {
|
|
|
24
24
|
*/
|
|
25
25
|
uniqueId?: string;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* TreeTable
|
|
29
|
+
*
|
|
30
|
+
* Компонент для представления данных коллекции в виде иерархической структуры.
|
|
31
|
+
*/
|
|
27
32
|
export interface ITreeTableProps extends Omit<IGridProps, 'items'> {
|
|
28
33
|
/**
|
|
29
34
|
* Элементы коллекции
|
|
@@ -32,8 +37,4 @@ export interface ITreeTableProps extends Omit<IGridProps, 'items'> {
|
|
|
32
37
|
items?: ITreeTableItem[];
|
|
33
38
|
}
|
|
34
39
|
export declare const addTreeColumnFieldsToFirstColumn: (columns: IGridColumn[]) => IGridColumn[];
|
|
35
|
-
/**
|
|
36
|
-
* TreeTable
|
|
37
|
-
* Компонент для представления данных коллекции в виде иерархической структуры.
|
|
38
|
-
*/
|
|
39
40
|
export default function TreeTable(props: ITreeTableProps): JSX.Element;
|
|
@@ -62,10 +62,6 @@ var addTreeColumnFieldsToFirstColumn = function (columns) {
|
|
|
62
62
|
return newColumns;
|
|
63
63
|
};
|
|
64
64
|
exports.addTreeColumnFieldsToFirstColumn = addTreeColumnFieldsToFirstColumn;
|
|
65
|
-
/**
|
|
66
|
-
* TreeTable
|
|
67
|
-
* Компонент для представления данных коллекции в виде иерархической структуры.
|
|
68
|
-
*/
|
|
69
65
|
function TreeTable(props) {
|
|
70
66
|
var columns = (0, react_1.useMemo)(function () { return (0, exports.addTreeColumnFieldsToFirstColumn)(props.columns); }, [props.columns]);
|
|
71
67
|
return (React.createElement(Grid_1["default"], __assign({}, props, { columns: columns, items: props.items, itemsIndexing: false, hasTreeItems: true })));
|
package/ui/nav/Link/Link.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { IButtonProps, IButtonViewProps } from '../../form/Button/Button';
|
|
|
3
3
|
/**
|
|
4
4
|
* Link
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* С помощью компонента `Link` вы можете легко настраивать цветовую схему элементов ссылок.
|
|
7
7
|
*/
|
|
8
8
|
export interface ILinkProps extends IButtonProps {
|
|
9
9
|
[key: string]: any;
|
package/ui/nav/Nav/Nav.d.ts
CHANGED
package/ui/nav/Router/Router.js
CHANGED
|
@@ -175,6 +175,9 @@ function Router(props) {
|
|
|
175
175
|
});
|
|
176
176
|
var result = renderComponent(routeItem, activePath, __assign(__assign({}, routeProps), { children: children }));
|
|
177
177
|
if (!result) {
|
|
178
|
+
if (children) {
|
|
179
|
+
return children;
|
|
180
|
+
}
|
|
178
181
|
// eslint-disable-next-line no-console
|
|
179
182
|
console.error('Not found component for route:', routeItem);
|
|
180
183
|
}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
+
/* eslint-disable implicit-arrow-linebreak */
|
|
3
4
|
var useAbsolutePositioning_1 = require("../hooks/useAbsolutePositioning");
|
|
5
|
+
var isComponentBeyondTop = function (parentDimensions, componentSize, gap) {
|
|
6
|
+
return (parentDimensions.top - window.scrollY) <= Math.round(componentSize.height + gap);
|
|
7
|
+
};
|
|
8
|
+
var isComponentBeyondLeft = function (parentDimensions, componentSize, gap) {
|
|
9
|
+
return parentDimensions.left <= Math.round(componentSize.width + gap);
|
|
10
|
+
};
|
|
11
|
+
var isComponentBeyondRight = function (parentDimensions, componentSize, gap) {
|
|
12
|
+
return document.body.clientWidth - parentDimensions.right <= Math.round(componentSize.width + gap);
|
|
13
|
+
};
|
|
14
|
+
var isComponentBeyondBottom = function (parentDimensions, componentSize, gap) {
|
|
15
|
+
return (window.innerHeight - (parentDimensions.top + parentDimensions.height - window.scrollY)) <= Math.round(componentSize.height + gap);
|
|
16
|
+
};
|
|
4
17
|
function calculateComponentAbsolutePosition(gap, position, parentRef, componentSize, arrowSize, hasAutoPositioning) {
|
|
5
18
|
if (arrowSize === void 0) { arrowSize = null; }
|
|
6
19
|
if (hasAutoPositioning === void 0) { hasAutoPositioning = true; }
|
|
@@ -17,10 +30,9 @@ function calculateComponentAbsolutePosition(gap, position, parentRef, componentS
|
|
|
17
30
|
case useAbsolutePositioning_1.Position.TOP:
|
|
18
31
|
case useAbsolutePositioning_1.Position.TOP_LEFT:
|
|
19
32
|
case useAbsolutePositioning_1.Position.TOP_RIGHT:
|
|
20
|
-
// Проверка - выходит ли
|
|
33
|
+
// Проверка - выходит ли component за верхний край страницы?
|
|
21
34
|
// Если да - меняем позицию на bottom
|
|
22
|
-
if (hasAutoPositioning
|
|
23
|
-
&& ((parentDimensions.top - window.scrollY) <= Math.round(componentSize.height + gap))) {
|
|
35
|
+
if (hasAutoPositioning && isComponentBeyondTop(parentDimensions, componentSize, gap)) {
|
|
24
36
|
style.top = parentDimensions.top + parentDimensions.height;
|
|
25
37
|
position = position.replace(useAbsolutePositioning_1.Position.TOP, useAbsolutePositioning_1.Position.BOTTOM);
|
|
26
38
|
}
|
|
@@ -31,11 +43,9 @@ function calculateComponentAbsolutePosition(gap, position, parentRef, componentS
|
|
|
31
43
|
case useAbsolutePositioning_1.Position.BOTTOM:
|
|
32
44
|
case useAbsolutePositioning_1.Position.BOTTOM_LEFT:
|
|
33
45
|
case useAbsolutePositioning_1.Position.BOTTOM_RIGHT:
|
|
34
|
-
/// Проверка - выходит ли
|
|
46
|
+
/// Проверка - выходит ли component за нижний край страницы?
|
|
35
47
|
// Если да - меняем позицию на top
|
|
36
|
-
if (hasAutoPositioning
|
|
37
|
-
&& ((window.innerHeight - (parentDimensions.top + parentDimensions.height - window.scrollY))
|
|
38
|
-
<= Math.round(componentSize.height + gap))) {
|
|
48
|
+
if (hasAutoPositioning && isComponentBeyondBottom(parentDimensions, componentSize, gap)) {
|
|
39
49
|
style.top = parentDimensions.top - componentSize.height;
|
|
40
50
|
position = position.replace(useAbsolutePositioning_1.Position.BOTTOM, useAbsolutePositioning_1.Position.TOP);
|
|
41
51
|
}
|
|
@@ -46,9 +56,9 @@ function calculateComponentAbsolutePosition(gap, position, parentRef, componentS
|
|
|
46
56
|
case useAbsolutePositioning_1.Position.LEFT:
|
|
47
57
|
case useAbsolutePositioning_1.Position.LEFT_TOP:
|
|
48
58
|
case useAbsolutePositioning_1.Position.LEFT_BOTTOM:
|
|
49
|
-
// Проверка - выходит ли
|
|
59
|
+
// Проверка - выходит ли component за левый край страницы?
|
|
50
60
|
// Если да - меняем позицию на right
|
|
51
|
-
if (hasAutoPositioning && (parentDimensions
|
|
61
|
+
if (hasAutoPositioning && isComponentBeyondLeft(parentDimensions, componentSize, gap)) {
|
|
52
62
|
style.left = parentDimensions.right;
|
|
53
63
|
position = position.replace(useAbsolutePositioning_1.Position.LEFT, useAbsolutePositioning_1.Position.RIGHT);
|
|
54
64
|
}
|
|
@@ -59,10 +69,9 @@ function calculateComponentAbsolutePosition(gap, position, parentRef, componentS
|
|
|
59
69
|
case useAbsolutePositioning_1.Position.RIGHT:
|
|
60
70
|
case useAbsolutePositioning_1.Position.RIGHT_TOP:
|
|
61
71
|
case useAbsolutePositioning_1.Position.RIGHT_BOTTOM:
|
|
62
|
-
// Проверка - выходит ли
|
|
72
|
+
// Проверка - выходит ли component за правый край страницы?
|
|
63
73
|
// Если да - меняем позицию на left
|
|
64
|
-
if (hasAutoPositioning
|
|
65
|
-
&& (document.body.clientWidth - parentDimensions.right <= Math.round(componentSize.width + gap))) {
|
|
74
|
+
if (hasAutoPositioning && isComponentBeyondRight(parentDimensions, componentSize, gap)) {
|
|
66
75
|
style.left = parentDimensions.left - componentSize.width;
|
|
67
76
|
position = position.replace(useAbsolutePositioning_1.Position.RIGHT, useAbsolutePositioning_1.Position.LEFT);
|
|
68
77
|
}
|
|
@@ -72,6 +81,31 @@ function calculateComponentAbsolutePosition(gap, position, parentRef, componentS
|
|
|
72
81
|
break;
|
|
73
82
|
}
|
|
74
83
|
// eslint-disable-next-line default-case
|
|
84
|
+
switch (position) {
|
|
85
|
+
case useAbsolutePositioning_1.Position.LEFT:
|
|
86
|
+
case useAbsolutePositioning_1.Position.LEFT_TOP:
|
|
87
|
+
case useAbsolutePositioning_1.Position.LEFT_BOTTOM:
|
|
88
|
+
// Проверка - выходит ли component после изменения позиции на left за левый край страницы?
|
|
89
|
+
// Если да - меняем позицию на bottom
|
|
90
|
+
if (hasAutoPositioning && isComponentBeyondLeft(parentDimensions, componentSize, gap)) {
|
|
91
|
+
style.left = null;
|
|
92
|
+
style.top = parentDimensions.top + parentDimensions.height;
|
|
93
|
+
position = useAbsolutePositioning_1.Position.BOTTOM;
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
case useAbsolutePositioning_1.Position.RIGHT:
|
|
97
|
+
case useAbsolutePositioning_1.Position.RIGHT_TOP:
|
|
98
|
+
case useAbsolutePositioning_1.Position.RIGHT_BOTTOM:
|
|
99
|
+
// Проверка - выходит ли component после изменения позиции на right за правый край страницы?
|
|
100
|
+
// Если да - меняем позицию на bottom
|
|
101
|
+
if (hasAutoPositioning && isComponentBeyondRight(parentDimensions, componentSize, gap)) {
|
|
102
|
+
style.left = null;
|
|
103
|
+
style.top = parentDimensions.top + parentDimensions.height;
|
|
104
|
+
position = useAbsolutePositioning_1.Position.BOTTOM;
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
// eslint-disable-next-line default-case
|
|
75
109
|
switch (position) {
|
|
76
110
|
case useAbsolutePositioning_1.Position.TOP:
|
|
77
111
|
case useAbsolutePositioning_1.Position.BOTTOM:
|
|
@@ -80,7 +114,7 @@ function calculateComponentAbsolutePosition(gap, position, parentRef, componentS
|
|
|
80
114
|
break;
|
|
81
115
|
case useAbsolutePositioning_1.Position.TOP_LEFT:
|
|
82
116
|
case useAbsolutePositioning_1.Position.BOTTOM_LEFT:
|
|
83
|
-
// Ширина
|
|
117
|
+
// Ширина component больше родителя - стрелка на середину родителя
|
|
84
118
|
style.left = parentDimensions.left;
|
|
85
119
|
if (arrowSize && (parentDimensions.width < componentSize.width)) {
|
|
86
120
|
arrowPosition = { left: parentDimensions.width / 2 };
|
|
@@ -88,7 +122,7 @@ function calculateComponentAbsolutePosition(gap, position, parentRef, componentS
|
|
|
88
122
|
break;
|
|
89
123
|
case useAbsolutePositioning_1.Position.TOP_RIGHT:
|
|
90
124
|
case useAbsolutePositioning_1.Position.BOTTOM_RIGHT:
|
|
91
|
-
// Ширина
|
|
125
|
+
// Ширина component больше родителя - стрелка на середину родителя
|
|
92
126
|
style.left = parentDimensions.right - componentSize.width;
|
|
93
127
|
if (arrowSize && (parentDimensions.width < componentSize.width)) {
|
|
94
128
|
arrowPosition = {
|
|
@@ -118,13 +152,13 @@ function calculateComponentAbsolutePosition(gap, position, parentRef, componentS
|
|
|
118
152
|
}
|
|
119
153
|
break;
|
|
120
154
|
}
|
|
121
|
-
|
|
155
|
+
//Проверка - при позиционировании top/bottom component не выходит за пределы страницы по горизонтали
|
|
122
156
|
if (position.includes('top') || position.includes('bottom')) {
|
|
123
157
|
if (!position.includes('Left')
|
|
124
|
-
&& (
|
|
158
|
+
&& (parentDimensions.left <= Math.round((componentSize.width - parentDimensions.width) + gap))) {
|
|
125
159
|
style.right = null;
|
|
126
160
|
position = position.replace('Right', 'Left');
|
|
127
|
-
// Если ширина
|
|
161
|
+
// Если ширина component больше ширины родителя - выставить стрелку на середину родителя
|
|
128
162
|
if (parentDimensions.left < componentSize.width) {
|
|
129
163
|
arrowPosition = { left: parentDimensions.width / 2 };
|
|
130
164
|
}
|
|
@@ -144,15 +178,17 @@ function calculateComponentAbsolutePosition(gap, position, parentRef, componentS
|
|
|
144
178
|
style.right = document.body.clientWidth - parentDimensions.right;
|
|
145
179
|
}
|
|
146
180
|
}
|
|
147
|
-
// Проверка - при позиционировании left/right
|
|
181
|
+
// Проверка - при позиционировании left/right component не выходит за пределы страницы по вертикали
|
|
148
182
|
if (position.includes('left') || position.includes('right')) {
|
|
149
183
|
if (!position.includes('Top')
|
|
150
184
|
&& parentDimensions.top - window.scrollY <= Math.round((componentSize.height - parentDimensions.height) + gap)) {
|
|
151
185
|
position = position.replace('Bottom', 'Top');
|
|
152
|
-
if (parentDimensions.height < componentSize.height) {
|
|
153
|
-
arrowPosition = { top: parentDimensions.height / 2 };
|
|
154
|
-
}
|
|
155
186
|
style.top = parentDimensions.top;
|
|
187
|
+
if (arrowSize && parentDimensions.height < componentSize.height) {
|
|
188
|
+
arrowPosition = {
|
|
189
|
+
top: parentDimensions.height / 2
|
|
190
|
+
};
|
|
191
|
+
}
|
|
156
192
|
}
|
|
157
193
|
else if (!position.includes('Bottom')
|
|
158
194
|
&& (window.innerHeight - (parentDimensions.top + parentDimensions.height - window.scrollY)
|
package/utils/form.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const setInWithPath: (state: any, value: any, path: string[], pathIndex?: number) => any;
|
|
3
3
|
export declare const cleanEmptyObject: (object: any) => any;
|
|
4
|
+
export declare const clearErrors: (values: any, prevValues: any, errors: any, setErrors: any) => void;
|
|
4
5
|
export declare const providers: {
|
|
5
6
|
redux: {
|
|
6
7
|
useForm: (formId: any, initialValues: any) => any;
|
package/utils/form.js
CHANGED
|
@@ -14,11 +14,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
exports.__esModule = true;
|
|
17
|
-
exports.providers = exports.cleanEmptyObject = exports.setInWithPath = void 0;
|
|
17
|
+
exports.providers = exports.clearErrors = exports.cleanEmptyObject = exports.setInWithPath = void 0;
|
|
18
18
|
var isPlainObject_1 = __importDefault(require("lodash-es/isPlainObject"));
|
|
19
19
|
var isArray_1 = __importDefault(require("lodash-es/isArray"));
|
|
20
20
|
var isEqual_1 = __importDefault(require("lodash-es/isEqual"));
|
|
21
21
|
var get_1 = __importDefault(require("lodash-es/get"));
|
|
22
|
+
var differenceWith_1 = __importDefault(require("lodash-es/differenceWith"));
|
|
23
|
+
var toPairs_1 = __importDefault(require("lodash-es/toPairs"));
|
|
24
|
+
var omit_1 = __importDefault(require("lodash-es/omit"));
|
|
25
|
+
var isEmpty_1 = __importDefault(require("lodash-es/isEmpty"));
|
|
22
26
|
var react_1 = require("react");
|
|
23
27
|
var react_use_1 = require("react-use");
|
|
24
28
|
var useDispatch_1 = __importDefault(require("../hooks/useDispatch"));
|
|
@@ -75,6 +79,17 @@ var cleanEmptyObject = function (object) {
|
|
|
75
79
|
return object;
|
|
76
80
|
};
|
|
77
81
|
exports.cleanEmptyObject = cleanEmptyObject;
|
|
82
|
+
var clearErrors = function (values, prevValues, errors, setErrors) {
|
|
83
|
+
if (!(0, isEmpty_1["default"])(errors) && !(0, isEqual_1["default"])(prevValues || {}, values)) {
|
|
84
|
+
// compare arrays of key-value pairs in previous and new field objects to identify the changed field
|
|
85
|
+
var changedField = (0, differenceWith_1["default"])((0, toPairs_1["default"])(values), (0, toPairs_1["default"])(prevValues), isEqual_1["default"]);
|
|
86
|
+
if (!(0, isEmpty_1["default"])(changedField)) {
|
|
87
|
+
var cleanedErrors = (0, omit_1["default"])(errors, changedField[0]);
|
|
88
|
+
setErrors((0, isEmpty_1["default"])(cleanedErrors) ? null : cleanedErrors);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
exports.clearErrors = clearErrors;
|
|
78
93
|
// Form state providers
|
|
79
94
|
exports.providers = {
|
|
80
95
|
// Redux
|