@steroidsjs/core 3.0.0-beta.1 → 3.0.0-beta.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/components/ClientStorageComponent.js +1 -0
- package/components/HtmlComponent.js +3 -1
- package/components/HttpComponent.d.ts +1 -0
- package/components/HttpComponent.js +3 -0
- package/components/LocaleComponent.js +6 -5
- package/components/ResourceComponent.js +2 -0
- package/components/StoreComponent.js +2 -0
- package/components/social/FacebookProvider.js +2 -0
- package/hooks/useAbsolutePositioning.js +7 -4
- package/hooks/useAddressBar.js +2 -0
- package/hooks/useDispatch.d.ts +1 -1
- package/hooks/useLayout.js +6 -0
- package/hooks/useList.js +6 -0
- package/hooks/useUniqueId.d.ts +1 -1
- package/hooks/useUniqueId.js +1 -1
- package/index.d.ts +1 -1
- package/package.json +12 -14
- package/reducers/fields.d.ts +9 -7
- package/reducers/fields.js +3 -2
- package/reducers/index.d.ts +1 -2
- package/reducers/index.js +2 -5
- package/ui/content/Calendar/Calendar.d.ts +1 -1
- package/ui/content/Card/demo/basic.js +1 -0
- package/ui/content/Card/demo/border color.js +2 -1
- package/ui/content/Card/demo/color.js +2 -1
- package/ui/content/Card/demo/header.d.ts +0 -5
- package/ui/content/Card/demo/header.js +4 -3
- package/ui/content/Card/demo/hover.d.ts +0 -5
- package/ui/content/Card/demo/hover.js +3 -2
- package/ui/content/Card/demo/link.d.ts +0 -5
- package/ui/content/Card/demo/link.js +2 -1
- package/ui/content/Card/demo/orientation.js +2 -1
- package/ui/content/Collapse/demo/icon.js +1 -0
- package/ui/content/CopyToClipboard/CopyToClipboard.js +2 -0
- package/ui/content/Detail/demo/colors.js +2 -1
- package/ui/crud/Crud/Crud.js +4 -0
- package/ui/crud/Crud/CrudContent.js +2 -0
- package/ui/form/Button/Button.js +2 -0
- package/ui/form/DateField/useDateInputState.js +4 -1
- package/ui/form/DateField/useDateRange.js +1 -0
- package/ui/form/DateField/useDateTime.js +2 -0
- package/ui/form/Form/Form.js +5 -1
- package/ui/form/RadioListField/RadioListField.js +3 -2
- package/ui/form/SliderField/SliderField.d.ts +3 -3
- package/ui/form/validate.d.ts +1 -4
- package/ui/form/validate.js +10 -8
- package/ui/layout/Notifications/Notifications.js +2 -0
- package/ui/layout/Notifications/demo/basic.js +2 -0
- package/ui/layout/Notifications/demo/position.js +2 -0
- package/ui/layout/Notifications/demo/timeOut.js +4 -1
- package/ui/layout/Portal.d.ts +6 -1
- package/ui/layout/Portal.js +1 -1
- package/ui/layout/ProgressBar/index.d.ts +1 -1
- package/ui/layout/Skeleton/index.d.ts +1 -1
- package/ui/layout/Tooltip/Tooltip.d.ts +1 -1
- package/ui/layout/Tooltip/TooltipPortalInner.d.ts +4 -4
- package/ui/layout/Tooltip/TooltipPortalInner.js +8 -38
- package/ui/list/CheckboxColumn/demo/basic.js +1 -1
- package/ui/list/Grid/demo/empty.js +1 -1
- package/ui/list/Grid/demo/search-form.js +1 -1
- package/ui/list/List/demo/condition.js +1 -1
- package/ui/list/List/demo/sort.js +1 -1
- package/ui/list/Pagination/Pagination.js +2 -2
- package/ui/list/Steps/Steps.d.ts +1 -1
- package/ui/list/Steps/Steps.js +14 -5
- package/ui/list/Steps/index.d.ts +1 -1
- package/ui/modal/Modal/Modal.js +1 -0
- package/ui/nav/Router/ConnectedRouter.d.ts +1 -1
- package/ui/nav/Router/Router.js +2 -0
- package/utils/data.d.ts +1 -0
- package/utils/data.js +4 -3
- package/utils/form.d.ts +7 -2
- package/utils/text.d.ts +1 -1
- package/utils/text.js +1 -0
- package/actions/screen.d.ts +0 -7
- package/actions/screen.js +0 -33
- package/reducers/screen.d.ts +0 -26
- package/reducers/screen.js +0 -54
|
@@ -22,6 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
exports.__esModule = true;
|
|
25
|
+
/* eslint-disable no-unused-expressions */
|
|
25
26
|
var cookie = __importStar(require("js-cookie"));
|
|
26
27
|
var moment_1 = __importDefault(require("moment"));
|
|
27
28
|
/**
|
|
@@ -58,9 +58,11 @@ var HtmlComponent = /** @class */ (function () {
|
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
HtmlComponent.prototype.closest = function (element, className) {
|
|
61
|
+
// eslint-disable-next-line no-cond-assign
|
|
61
62
|
while ((element = element.parentElement)
|
|
63
|
+
// eslint-disable-next-line no-empty
|
|
62
64
|
&& !element.classList.contains(className)) {
|
|
63
|
-
}
|
|
65
|
+
}
|
|
64
66
|
return element;
|
|
65
67
|
};
|
|
66
68
|
HtmlComponent.prototype._applyModifiers = function (entity, modifiers) {
|
|
@@ -263,6 +263,9 @@ var HttpComponent = /** @class */ (function () {
|
|
|
263
263
|
if (options.cancelToken) {
|
|
264
264
|
axiosConfig.cancelToken = options.cancelToken;
|
|
265
265
|
}
|
|
266
|
+
if (options.responseType) {
|
|
267
|
+
axiosConfig.responseType = options.responseType;
|
|
268
|
+
}
|
|
266
269
|
if (options.lazy) {
|
|
267
270
|
if (this._lazyRequests[method]) {
|
|
268
271
|
clearTimeout(this._lazyRequests[method]);
|
|
@@ -43,6 +43,7 @@ var LocaleComponent = /** @class */ (function () {
|
|
|
43
43
|
this.translations = {};
|
|
44
44
|
// Publish to global
|
|
45
45
|
if (process.env.IS_SSR) {
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
46
47
|
// @ts-ignore
|
|
47
48
|
global.__ = this.translate.bind(this);
|
|
48
49
|
}
|
|
@@ -81,7 +82,7 @@ var LocaleComponent = /** @class */ (function () {
|
|
|
81
82
|
message = this.translations[message] || message;
|
|
82
83
|
// Cut react components
|
|
83
84
|
var components = {};
|
|
84
|
-
Object.keys(params).
|
|
85
|
+
Object.keys(params).forEach(function (key) {
|
|
85
86
|
if (isObject_1["default"](params[key])) {
|
|
86
87
|
components[key] = params[key];
|
|
87
88
|
params[key] = "!!" + key + "!!";
|
|
@@ -101,7 +102,7 @@ var LocaleComponent = /** @class */ (function () {
|
|
|
101
102
|
}
|
|
102
103
|
// Index components
|
|
103
104
|
var indexedComponents = [];
|
|
104
|
-
Object.keys(components).
|
|
105
|
+
Object.keys(components).forEach(function (key) {
|
|
105
106
|
var index = message.indexOf("!!" + key + "!!");
|
|
106
107
|
if (index !== -1) {
|
|
107
108
|
indexedComponents.push({
|
|
@@ -123,19 +124,19 @@ var LocaleComponent = /** @class */ (function () {
|
|
|
123
124
|
// Split text to array, paste components
|
|
124
125
|
var result = [];
|
|
125
126
|
var textParts = message.split('!!component!!');
|
|
126
|
-
for (var i = 0, j = 0; i < textParts.length; i
|
|
127
|
+
for (var i = 0, j = 0; i < textParts.length; i += 1) {
|
|
127
128
|
var isComponentAdded = false;
|
|
128
129
|
if (j === 0
|
|
129
130
|
&& j < indexedComponents.length
|
|
130
131
|
&& indexedComponents[j].index === 0) {
|
|
131
132
|
result.push(React.createElement("span", { key: "element-" + j }, indexedComponents[j].component));
|
|
132
133
|
isComponentAdded = true;
|
|
133
|
-
j
|
|
134
|
+
j += 1;
|
|
134
135
|
}
|
|
135
136
|
result.push(React.createElement("span", { key: "text-" + i }, textParts[i]));
|
|
136
137
|
if (!isComponentAdded && j < indexedComponents.length) {
|
|
137
138
|
result.push(React.createElement("span", { key: "element" + j }, indexedComponents[j].component));
|
|
138
|
-
j
|
|
139
|
+
j += 1;
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
142
|
return React.createElement("span", null, result);
|
|
@@ -22,6 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
exports.__esModule = true;
|
|
25
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
25
26
|
var queryString = __importStar(require("qs"));
|
|
26
27
|
var isArray_1 = __importDefault(require("lodash-es/isArray"));
|
|
27
28
|
/**
|
|
@@ -63,6 +64,7 @@ var ResourceComponent = /** @class */ (function () {
|
|
|
63
64
|
if (window.ymaps) {
|
|
64
65
|
return new Promise(function (resolve) {
|
|
65
66
|
// @ts-ignore
|
|
67
|
+
// eslint-disable-next-line implicit-arrow-linebreak
|
|
66
68
|
return window.ymaps.ready(function () { return resolve(window.ymaps); });
|
|
67
69
|
});
|
|
68
70
|
}
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
exports.__esModule = true;
|
|
17
|
+
/* eslint-disable no-restricted-globals */
|
|
17
18
|
var redux_1 = require("redux");
|
|
18
19
|
var connected_react_router_1 = require("connected-react-router");
|
|
19
20
|
var history_1 = require("history");
|
|
@@ -119,6 +120,7 @@ var StoreComponent = /** @class */ (function () {
|
|
|
119
120
|
return action(function (p) { return _this._prepare(p, dispatch, getState); }, getState, this._components);
|
|
120
121
|
}
|
|
121
122
|
// Promise, detect errors on rejects
|
|
123
|
+
// eslint-disable-next-line max-len
|
|
122
124
|
// Detect action through instanceof Promise is not working in production mode, then used single detection by type
|
|
123
125
|
if (typeof action === 'object'
|
|
124
126
|
&& typeof action.then === 'function'
|
|
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
exports.__esModule = true;
|
|
39
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
39
40
|
var FacebookProvider = /** @class */ (function () {
|
|
40
41
|
function FacebookProvider(components, config) {
|
|
41
42
|
this._components = components;
|
|
@@ -76,6 +77,7 @@ var FacebookProvider = /** @class */ (function () {
|
|
|
76
77
|
});
|
|
77
78
|
}
|
|
78
79
|
else {
|
|
80
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
79
81
|
reject('FB error: ' + response.status);
|
|
80
82
|
}
|
|
81
83
|
}, {
|
|
@@ -24,7 +24,8 @@ function useAbsolutePositioning(props) {
|
|
|
24
24
|
case 'topRight':
|
|
25
25
|
// Проверка - выходит ли tooltip за верхний край страницы?
|
|
26
26
|
// Если да - меняем позицию на bottom
|
|
27
|
-
if (useAutoPositioning
|
|
27
|
+
if (useAutoPositioning
|
|
28
|
+
&& ((parentDimensions.top - window.scrollY) <= Math.round(componentSize.height + props.gap))) {
|
|
28
29
|
newStyle.top = parentDimensions.top + parentDimensions.height;
|
|
29
30
|
newPosition = newPosition.replace('top', 'bottom');
|
|
30
31
|
}
|
|
@@ -37,8 +38,8 @@ function useAbsolutePositioning(props) {
|
|
|
37
38
|
case 'bottomRight':
|
|
38
39
|
// Проверка - выходит ли tooltip за нижний край страницы?
|
|
39
40
|
// Если да - меняем позицию на top
|
|
40
|
-
if (useAutoPositioning
|
|
41
|
-
<= Math.round(componentSize.height + props.gap)) {
|
|
41
|
+
if (useAutoPositioning
|
|
42
|
+
&& ((window.innerHeight - (parentDimensions.top + parentDimensions.height - window.scrollY))) <= Math.round(componentSize.height + props.gap)) {
|
|
42
43
|
newStyle.top = parentDimensions.top - componentSize.height;
|
|
43
44
|
newPosition = newPosition.replace('bottom', 'top');
|
|
44
45
|
}
|
|
@@ -64,7 +65,8 @@ function useAbsolutePositioning(props) {
|
|
|
64
65
|
case 'rightBottom':
|
|
65
66
|
// Проверка - выходит ли tooltip за правый край страницы?
|
|
66
67
|
// Если да - меняем позицию на left
|
|
67
|
-
if (useAutoPositioning
|
|
68
|
+
if (useAutoPositioning
|
|
69
|
+
&& (document.body.clientWidth - parentDimensions.right <= Math.round(componentSize.width + props.gap))) {
|
|
68
70
|
newStyle.left = parentDimensions.left - componentSize.width;
|
|
69
71
|
newPosition = newPosition.replace('right', 'left');
|
|
70
72
|
}
|
|
@@ -137,6 +139,7 @@ function useAbsolutePositioning(props) {
|
|
|
137
139
|
}
|
|
138
140
|
setStyle(newStyle);
|
|
139
141
|
setPosition(newPosition);
|
|
142
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
140
143
|
}, [props.gap]);
|
|
141
144
|
var onShow = react_1.useCallback(function () {
|
|
142
145
|
if (timerRef.current) {
|
package/hooks/useAddressBar.js
CHANGED
|
@@ -136,6 +136,8 @@ function useAddressBar(config) {
|
|
|
136
136
|
}, {});
|
|
137
137
|
if (!isEqual_1["default"](initialQueryRef.current, normalizedValues)) {
|
|
138
138
|
initialQueryRef.current = normalizedValues;
|
|
139
|
+
//TODO Remove @ts-ignore
|
|
140
|
+
//@ts-ignore
|
|
139
141
|
dispatch(exports.queryReplace(config.model, location, normalizedValues, config.useHash));
|
|
140
142
|
}
|
|
141
143
|
}
|
package/hooks/useDispatch.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function useDispatch():
|
|
1
|
+
export default function useDispatch(): import("redux").Dispatch<import("redux").AnyAction>;
|
package/hooks/useLayout.js
CHANGED
|
@@ -100,6 +100,8 @@ function useLayout(initAction) {
|
|
|
100
100
|
react_use_1.useMount(function () {
|
|
101
101
|
// Callback for load initial page data (return promise)
|
|
102
102
|
if (isFunction_1["default"](initAction)) {
|
|
103
|
+
//TODO Remove @ts-ignore
|
|
104
|
+
//@ts-ignore
|
|
103
105
|
dispatch(auth_2.init(true));
|
|
104
106
|
}
|
|
105
107
|
else {
|
|
@@ -114,6 +116,8 @@ function useLayout(initAction) {
|
|
|
114
116
|
exports.runInitAction(initAction, components, dispatch)
|
|
115
117
|
.then(function () {
|
|
116
118
|
if (redirectPageId) {
|
|
119
|
+
//TODO Remove @ts-ignore
|
|
120
|
+
//@ts-ignore
|
|
117
121
|
dispatch(router_2.goToRoute(redirectPageId));
|
|
118
122
|
}
|
|
119
123
|
})["catch"](function (e) {
|
|
@@ -139,6 +143,8 @@ function useLayout(initAction) {
|
|
|
139
143
|
}
|
|
140
144
|
if (intersection_1["default"](pageRoles, userRoles).length === 0) {
|
|
141
145
|
if (loginRouteId && route.id !== loginRouteId) {
|
|
146
|
+
//TODO Remove @ts-ignore
|
|
147
|
+
//@ts-ignore
|
|
142
148
|
dispatch(router_2.goToRoute(loginRouteId));
|
|
143
149
|
}
|
|
144
150
|
else {
|
package/hooks/useList.js
CHANGED
|
@@ -227,6 +227,8 @@ function useList(config) {
|
|
|
227
227
|
updateQuery(formValues);
|
|
228
228
|
// Send request
|
|
229
229
|
if (config.autoFetchOnFormChanges !== false) {
|
|
230
|
+
//TODO Remove @ts-ignore
|
|
231
|
+
//@ts-ignore
|
|
230
232
|
dispatch(list_2.listLazyFetch(config.listId));
|
|
231
233
|
}
|
|
232
234
|
}
|
|
@@ -244,6 +246,8 @@ function useList(config) {
|
|
|
244
246
|
}, [formId, prevQuery, config.query, dispatch]);
|
|
245
247
|
// Check change items
|
|
246
248
|
react_use_1.useUpdateEffect(function () {
|
|
249
|
+
//TODO Remove @ts-ignore
|
|
250
|
+
//@ts-ignore
|
|
247
251
|
dispatch([
|
|
248
252
|
list_2.listSetItems(config.listId, config.items),
|
|
249
253
|
]);
|
|
@@ -257,6 +261,8 @@ function useList(config) {
|
|
|
257
261
|
});
|
|
258
262
|
var onFetch = react_1.useCallback(function (params) {
|
|
259
263
|
if (params === void 0) { params = {}; }
|
|
264
|
+
//TODO Remove @ts-ignore
|
|
265
|
+
//@ts-ignore
|
|
260
266
|
dispatch(list_2.listFetch(config.listId, params));
|
|
261
267
|
}, [config.listId, dispatch]);
|
|
262
268
|
var onSort = react_1.useCallback(function (value) {
|
package/hooks/useUniqueId.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function useUniqueId(prefix: string):
|
|
1
|
+
export default function useUniqueId(prefix: string): string;
|
package/hooks/useUniqueId.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.__esModule = true;
|
|
|
6
6
|
var react_1 = require("react");
|
|
7
7
|
var uniqueId_1 = __importDefault(require("lodash-es/uniqueId"));
|
|
8
8
|
function useUniqueId(prefix) {
|
|
9
|
-
var idRef = react_1.useRef();
|
|
9
|
+
var idRef = react_1.useRef('');
|
|
10
10
|
if (!idRef.current) {
|
|
11
11
|
idRef.current = uniqueId_1["default"](prefix);
|
|
12
12
|
}
|
package/index.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ declare type CustomStyle = React.CSSProperties;
|
|
|
88
88
|
* Переопределение view React компонента для кастомизации отображения
|
|
89
89
|
* @example MyCustomView
|
|
90
90
|
*/
|
|
91
|
-
declare type CustomView = React.ReactNode;
|
|
91
|
+
declare type CustomView = React.ReactNode | React.FunctionComponent;
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
94
|
* HTTP метод
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steroidsjs/core",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Vladimir Kozhin <hello@kozhindev.com>",
|
|
6
6
|
"repository": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"docs": "typedoc --ignoreCompilerErrors --json typedoc.json .",
|
|
22
22
|
"test": "jest",
|
|
23
|
+
"lint": "eslint --ext .js,.jsx,.ts,.tsx ./src ./tests",
|
|
23
24
|
"build": "tsc && cp ./{package.json,LICENSE,README.md} dist/ && cp src/index.d.ts dist/",
|
|
24
25
|
"watch": "tsc -p tsconfig-debug.json"
|
|
25
26
|
},
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"dot-prop-immutable": "^2.1.0",
|
|
31
32
|
"fileup-core": "^1.2.7",
|
|
32
33
|
"history": "^4.10.1",
|
|
33
|
-
"intl-messageformat": "^
|
|
34
|
+
"intl-messageformat": "^10.1.4",
|
|
34
35
|
"js-cookie": "^2.2.1",
|
|
35
36
|
"load-js": "^3.0.3",
|
|
36
37
|
"lodash": "^4.17.21",
|
|
@@ -39,18 +40,18 @@
|
|
|
39
40
|
"path-to-regexp": "^1.7.0",
|
|
40
41
|
"qs": "^6.9.4",
|
|
41
42
|
"query-string": "^6.14.0",
|
|
42
|
-
"react": "^
|
|
43
|
+
"react": "^18.2.0",
|
|
43
44
|
"react-click-outside": "^3.0.1",
|
|
44
|
-
"react-day-picker": "^
|
|
45
|
-
"react-dom": "^
|
|
45
|
+
"react-day-picker": "^8.2.1",
|
|
46
|
+
"react-dom": "^18.2.0",
|
|
46
47
|
"react-grid-gallery": "^0.4.8",
|
|
47
48
|
"react-helmet": "^6.1.0",
|
|
48
49
|
"react-image-crop": "^9.0.2",
|
|
49
50
|
"react-input-mask": "^3.0.0-alpha.2",
|
|
50
|
-
"react-redux": "
|
|
51
|
+
"react-redux": "^8.0.5",
|
|
51
52
|
"react-router": "^5.2.0",
|
|
52
53
|
"react-router-dom": "^5.2.0",
|
|
53
|
-
"react-use": "^17.
|
|
54
|
+
"react-use": "^17.4.0",
|
|
54
55
|
"redux": "^4.0.4",
|
|
55
56
|
"redux-mock-store": "^1.5.4",
|
|
56
57
|
"set-cookie-parser": "^2.4.8"
|
|
@@ -61,13 +62,15 @@
|
|
|
61
62
|
"@babel/preset-env": "^7.13.15",
|
|
62
63
|
"@babel/preset-react": "^7.13.13",
|
|
63
64
|
"@babel/preset-typescript": "^7.13.0",
|
|
65
|
+
"@steroidsjs/eslint-config": "^2.1.2",
|
|
64
66
|
"@types/enzyme": "^3.10.8",
|
|
65
67
|
"@types/enzyme-adapter-react-16": "^1.0.6",
|
|
66
68
|
"@types/jest": "^26.0.22",
|
|
67
|
-
"@types/markdown-to-jsx": "^
|
|
69
|
+
"@types/markdown-to-jsx": "^7.0.1",
|
|
68
70
|
"@types/reach__router": "^1.3.7",
|
|
69
|
-
"@types/react": "
|
|
71
|
+
"@types/react": "^18.0.20",
|
|
70
72
|
"@types/react-color": "^3.0.4",
|
|
73
|
+
"@types/react-dom": "^18.0.6",
|
|
71
74
|
"@types/react-syntax-highlighter": "^13.5.0",
|
|
72
75
|
"@types/webpack-env": "^1.16.0",
|
|
73
76
|
"@typescript-eslint/eslint-plugin": "^4.15.0",
|
|
@@ -75,11 +78,6 @@
|
|
|
75
78
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.4.1",
|
|
76
79
|
"enzyme": "^3.11.0",
|
|
77
80
|
"eslint": "^7.20.0",
|
|
78
|
-
"eslint-config-airbnb": "18.2.1",
|
|
79
|
-
"eslint-plugin-import": "^2.22.1",
|
|
80
|
-
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
81
|
-
"eslint-plugin-react": "^7.21.5",
|
|
82
|
-
"eslint-plugin-react-hooks": "^1.7.0",
|
|
83
81
|
"jest": "^26.6.3",
|
|
84
82
|
"jest-enzyme": "^7.1.2",
|
|
85
83
|
"ts-jest": "^26.5.1",
|
package/reducers/fields.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
props:
|
|
3
|
-
dataProvider:
|
|
4
|
-
meta: any;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export interface IFieldsState {
|
|
2
|
+
props: Record<string, any>;
|
|
3
|
+
dataProvider: Record<string, any>;
|
|
4
|
+
meta: Record<string, any> | null;
|
|
5
|
+
}
|
|
6
|
+
export declare const normalizeName: (name: any) => any;
|
|
7
|
+
declare const _default: (state: IFieldsState, action: any) => {
|
|
8
8
|
meta: any;
|
|
9
|
+
props: Record<string, any>;
|
|
10
|
+
dataProvider: Record<string, any>;
|
|
9
11
|
};
|
|
10
12
|
export default _default;
|
|
11
13
|
export declare const isMetaFetched: (state: any) => boolean;
|
package/reducers/fields.js
CHANGED
|
@@ -14,7 +14,7 @@ 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.getDataProviderItems = exports.getModel = exports.getEnumLabels = exports.isMetaFetched = void 0;
|
|
17
|
+
exports.getDataProviderItems = exports.getModel = exports.getEnumLabels = exports.isMetaFetched = exports.normalizeName = void 0;
|
|
18
18
|
var isString_1 = __importDefault(require("lodash-es/isString"));
|
|
19
19
|
var get_1 = __importDefault(require("lodash-es/get"));
|
|
20
20
|
var fields_1 = require("../actions/fields");
|
|
@@ -24,6 +24,7 @@ var initialState = {
|
|
|
24
24
|
meta: null
|
|
25
25
|
};
|
|
26
26
|
var normalizeName = function (name) { return name.replace(/\\/g, '.').replace(/^\./, ''); };
|
|
27
|
+
exports.normalizeName = normalizeName;
|
|
27
28
|
exports["default"] = (function (state, action) {
|
|
28
29
|
var _a;
|
|
29
30
|
if (state === void 0) { state = initialState; }
|
|
@@ -46,7 +47,7 @@ exports.getEnumLabels = getEnumLabels;
|
|
|
46
47
|
var warnings = {};
|
|
47
48
|
var getModel = function (state, name) {
|
|
48
49
|
if (isString_1["default"](name)) {
|
|
49
|
-
name = normalizeName(name);
|
|
50
|
+
name = exports.normalizeName(name);
|
|
50
51
|
var meta = get_1["default"](state, ['fields', 'meta', name]) || null;
|
|
51
52
|
if (!meta && exports.isMetaFetched(state) && !warnings[name]) {
|
|
52
53
|
warnings[name] = true;
|
package/reducers/index.d.ts
CHANGED
|
@@ -5,8 +5,7 @@ import list from './list';
|
|
|
5
5
|
import notifications from './notifications';
|
|
6
6
|
import modal from './modal';
|
|
7
7
|
import router from './router';
|
|
8
|
-
|
|
9
|
-
export { form, auth, fields, list, notifications, modal, router, screen, };
|
|
8
|
+
export { form, auth, fields, list, notifications, modal, router, };
|
|
10
9
|
declare const _default: (asyncReducers: any) => import("redux").Reducer<import("redux").CombinedState<{
|
|
11
10
|
[x: string]: unknown;
|
|
12
11
|
}>, never>;
|
package/reducers/index.js
CHANGED
|
@@ -14,7 +14,7 @@ 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.
|
|
17
|
+
exports.router = exports.modal = exports.notifications = exports.list = exports.fields = exports.auth = exports.form = void 0;
|
|
18
18
|
var redux_1 = require("redux");
|
|
19
19
|
var auth_1 = __importDefault(require("./auth"));
|
|
20
20
|
exports.auth = auth_1["default"];
|
|
@@ -30,12 +30,9 @@ var modal_1 = __importDefault(require("./modal"));
|
|
|
30
30
|
exports.modal = modal_1["default"];
|
|
31
31
|
var router_1 = __importDefault(require("./router"));
|
|
32
32
|
exports.router = router_1["default"];
|
|
33
|
-
var screen_1 = __importDefault(require("./screen"));
|
|
34
|
-
exports.screen = screen_1["default"];
|
|
35
33
|
exports["default"] = (function (asyncReducers) { return redux_1.combineReducers(__assign(__assign({ form: form_1["default"],
|
|
36
34
|
auth: auth_1["default"],
|
|
37
35
|
fields: fields_1["default"],
|
|
38
36
|
list: list_1["default"],
|
|
39
37
|
notifications: notifications_1["default"],
|
|
40
|
-
modal: modal_1["default"],
|
|
41
|
-
screen: screen_1["default"] }, asyncReducers), { router: function (state, action) { return router_1["default"](asyncReducers.router ? asyncReducers.router(state, action) : {}, action); } })); });
|
|
38
|
+
modal: modal_1["default"] }, asyncReducers), { router: function (state, action) { return router_1["default"](asyncReducers.router ? asyncReducers.router(state, action) : {}, action); } })); });
|
|
@@ -72,7 +72,7 @@ export interface ICalendarViewProps extends ICalendarProps {
|
|
|
72
72
|
*/
|
|
73
73
|
isCaptionPanelVisible: boolean;
|
|
74
74
|
/**
|
|
75
|
-
* Функция
|
|
75
|
+
* Функция изменения состояние отображения панели для выбора месяца/года
|
|
76
76
|
*/
|
|
77
77
|
toggleCaptionPanel: () => void;
|
|
78
78
|
}
|
|
@@ -22,6 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
exports.__esModule = true;
|
|
25
|
+
/* eslint-disable max-len */
|
|
25
26
|
var React = __importStar(require("react"));
|
|
26
27
|
var Card_1 = __importDefault(require("../Card"));
|
|
27
28
|
/**
|
|
@@ -39,9 +39,10 @@ var colors = {
|
|
|
39
39
|
lg: 'light',
|
|
40
40
|
dr: 'dark'
|
|
41
41
|
};
|
|
42
|
+
var text = 'Some quick example text to build on the card title and make up the bulk of the card\'s content.';
|
|
42
43
|
function capitalize(s) {
|
|
43
44
|
return s[0].toUpperCase() + s.slice(1);
|
|
44
45
|
}
|
|
45
46
|
exports["default"] = (function () { return (React.createElement("div", { style: { display: 'flex', flexWrap: 'wrap' } }, Object.values(colors).map(function (color) { return (React.createElement("div", { style: { marginRight: '30px', marginBottom: '30px' }, key: color },
|
|
46
47
|
React.createElement(React.Fragment, null,
|
|
47
|
-
React.createElement(Card_1["default"], { style: { width: '320px' }, header: 'Header', title: capitalize(color) + ' card title', borderColor: color },
|
|
48
|
+
React.createElement(Card_1["default"], { style: { width: '320px' }, header: 'Header', title: capitalize(color) + ' card title', borderColor: color }, text)))); }))); });
|
|
@@ -39,9 +39,10 @@ var colors = {
|
|
|
39
39
|
lg: 'light',
|
|
40
40
|
dr: 'dark'
|
|
41
41
|
};
|
|
42
|
+
var text = 'Some quick example text to build on the card title and make up the bulk of the card\'s content.';
|
|
42
43
|
function capitalize(s) {
|
|
43
44
|
return s[0].toUpperCase() + s.slice(1);
|
|
44
45
|
}
|
|
45
46
|
exports["default"] = (function () { return (React.createElement("div", { style: { display: 'flex', flexWrap: 'wrap' } }, Object.values(colors).map(function (color) { return (React.createElement("div", { style: { marginRight: '30px', marginBottom: '30px' }, key: color },
|
|
46
47
|
React.createElement(React.Fragment, null,
|
|
47
|
-
React.createElement(Card_1["default"], { style: { width: '320px' }, header: 'Header', title: capitalize(color) + ' card title', color: color },
|
|
48
|
+
React.createElement(Card_1["default"], { style: { width: '320px' }, header: 'Header', title: capitalize(color) + ' card title', color: color }, text)))); }))); });
|
|
@@ -30,13 +30,14 @@ var Card_1 = __importDefault(require("../Card"));
|
|
|
30
30
|
* @order 3
|
|
31
31
|
* @col 12
|
|
32
32
|
*/
|
|
33
|
+
var text = 'Some quick example text to build on the card title and make up the bulk of the card\'s content.';
|
|
33
34
|
exports["default"] = (function () { return (React.createElement("div", { style: { display: 'grid', gridAutoFlow: 'column', gridGap: '30px' } },
|
|
34
35
|
React.createElement(Card_1["default"], { title: 'Card title', header: 'Header' },
|
|
35
|
-
|
|
36
|
+
text,
|
|
36
37
|
React.createElement(form_1.Button, null, "Button")),
|
|
37
38
|
React.createElement(Card_1["default"], { title: 'Card title', footer: 'Footer' },
|
|
38
|
-
|
|
39
|
+
text,
|
|
39
40
|
React.createElement(form_1.Button, null, "Button")),
|
|
40
41
|
React.createElement(Card_1["default"], { title: 'Card title', header: 'Header', footer: 'Footer' },
|
|
41
|
-
|
|
42
|
+
text,
|
|
42
43
|
React.createElement(form_1.Button, null, "Button")))); });
|
|
@@ -30,8 +30,9 @@ var Card_1 = __importDefault(require("../Card"));
|
|
|
30
30
|
* @order 1
|
|
31
31
|
* @col 8
|
|
32
32
|
*/
|
|
33
|
+
var text = 'Some quick example text to build on the card title and make up the bulk of the card\'s content.';
|
|
33
34
|
exports["default"] = (function () { return (React.createElement("div", { style: { display: 'flex', gridGap: '15px' } },
|
|
34
35
|
React.createElement(Card_1["default"], { title: 'Card title', cover: 'https://i.ibb.co/rK9tsnJ/swamp.png' },
|
|
35
|
-
|
|
36
|
+
text,
|
|
36
37
|
React.createElement(form_1.Button, null, "Button")),
|
|
37
|
-
React.createElement(Card_1["default"], { title: 'Card title', cover: 'https://i.ibb.co/rK9tsnJ/swamp.png' },
|
|
38
|
+
React.createElement(Card_1["default"], { title: 'Card title', cover: 'https://i.ibb.co/rK9tsnJ/swamp.png' }, text))); });
|
|
@@ -30,9 +30,10 @@ var Card_1 = __importDefault(require("../Card"));
|
|
|
30
30
|
* @order 2
|
|
31
31
|
* @col 4
|
|
32
32
|
*/
|
|
33
|
+
var text = 'Some quick example text to build on the card title and make up the bulk of the card\'s content.';
|
|
33
34
|
exports["default"] = (function () { return (React.createElement(React.Fragment, null,
|
|
34
35
|
React.createElement(Card_1["default"], { title: 'Card title' },
|
|
35
|
-
|
|
36
|
+
text,
|
|
36
37
|
React.createElement("div", { style: { display: 'flex', gridGap: '16px', padding: 0 } },
|
|
37
38
|
React.createElement(form_1.Button, { link: true }, "Link"),
|
|
38
39
|
React.createElement(form_1.Button, { link: true }, "Another link"))))); });
|
|
@@ -34,8 +34,9 @@ var orientations = {
|
|
|
34
34
|
vr: 'vertical-reverse',
|
|
35
35
|
hz: 'horizontal'
|
|
36
36
|
};
|
|
37
|
+
var text = 'Some quick example text to build on the card title and make up the bulk of the card\'s content.';
|
|
37
38
|
exports["default"] = (function () { return (React.createElement("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr 2fr' } }, Object.values(orientations).map(function (orientation) { return (React.createElement("div", { style: { marginRight: '30px' }, key: orientation },
|
|
38
39
|
React.createElement(React.Fragment, null,
|
|
39
40
|
React.createElement(Card_1["default"], { title: 'Card title', orientation: orientation, cover: 'https://i.ibb.co/rK9tsnJ/swamp.png' },
|
|
40
|
-
|
|
41
|
+
text,
|
|
41
42
|
React.createElement("p", { style: { color: '#C0C0C0', fontSize: '12px' } }, "Last updated 3 mins ago"))))); }))); });
|
|
@@ -22,6 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
exports.__esModule = true;
|
|
25
|
+
/* eslint-disable max-len */
|
|
25
26
|
var React = __importStar(require("react"));
|
|
26
27
|
var Collapse_1 = __importDefault(require("../Collapse"));
|
|
27
28
|
var CollapseItem_1 = __importDefault(require("../CollapseItem"));
|
|
@@ -99,6 +99,8 @@ function CopyToClipboard(props) {
|
|
|
99
99
|
case 3:
|
|
100
100
|
if (props.notification) {
|
|
101
101
|
notification = __assign({ level: 'info', params: undefined }, (typeof props.notification === 'string' ? { message: props.notification } : props.notification));
|
|
102
|
+
//TODO Remove @ts-ignore
|
|
103
|
+
//@ts-ignore
|
|
102
104
|
dispatch(notifications_1.showNotification(notification.message, notification.level, notification.params));
|
|
103
105
|
}
|
|
104
106
|
setIsCopied(true);
|
|
@@ -31,9 +31,10 @@ var colors = {
|
|
|
31
31
|
lg: 'light',
|
|
32
32
|
dr: 'dark'
|
|
33
33
|
};
|
|
34
|
+
var text = 'Some quick example text to build on the card title and make up the bulk of the card\'s content.';
|
|
34
35
|
function capitalize(s) {
|
|
35
36
|
return s[0].toUpperCase() + s.slice(1);
|
|
36
37
|
}
|
|
37
38
|
exports["default"] = (function () { return (React.createElement("div", { style: { display: 'flex', flexWrap: 'wrap' } }, Object.values(colors).map(function (color) { return (React.createElement("div", { style: { marginRight: '30px', marginBottom: '30px' }, key: color },
|
|
38
39
|
React.createElement(React.Fragment, null,
|
|
39
|
-
React.createElement(content_1.Card, { style: { width: '320px' }, header: 'Header', title: capitalize(color) + ' card title', color: color },
|
|
40
|
+
React.createElement(content_1.Card, { style: { width: '320px' }, header: 'Header', title: capitalize(color) + ' card title', color: color }, text)))); }))); });
|
package/ui/crud/Crud/Crud.js
CHANGED
|
@@ -67,12 +67,16 @@ function Crud(props) {
|
|
|
67
67
|
var goToAction = react_1.useCallback(function (nextAction) {
|
|
68
68
|
var _a;
|
|
69
69
|
if (nextAction === utils_1.CRUD_ACTION_INDEX) {
|
|
70
|
+
//TODO remove @ts-ignore
|
|
71
|
+
//@ts-ignore
|
|
70
72
|
dispatch(list_1.listRefresh(crudId));
|
|
71
73
|
}
|
|
72
74
|
if (routeAction !== nextAction) {
|
|
73
75
|
if (mode === MODE_MODAL) {
|
|
74
76
|
dispatch(modal_1.closeModal(crudId));
|
|
75
77
|
}
|
|
78
|
+
//TODO remove @ts-ignore
|
|
79
|
+
//@ts-ignore
|
|
76
80
|
dispatch(router_1.goToRoute(routeId, __assign(__assign({}, routeParams), (_a = {}, _a[props.queryKey] = null, _a[props.queryKey + 'Action'] = null, _a))));
|
|
77
81
|
}
|
|
78
82
|
}, [crudId, dispatch, mode, props.queryKey, routeAction, routeId, routeParams]);
|
|
@@ -57,6 +57,8 @@ function CrudContent(props) {
|
|
|
57
57
|
}, [props.action, props.primaryKey, props.record, props.recordId]);
|
|
58
58
|
var onFormComplete = react_1.useCallback(function () {
|
|
59
59
|
window.scrollTo(0, 0);
|
|
60
|
+
//TODO remove @ts-ignore
|
|
61
|
+
//@ts-ignore
|
|
60
62
|
dispatch(notifications_1.showNotification(__('Запись успешно обновлена.')));
|
|
61
63
|
props.goToAction.call(null, utils_1.CRUD_ACTION_INDEX);
|
|
62
64
|
}, [dispatch, props.goToAction]);
|