@steroidsjs/core 3.0.93 → 3.0.94
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/auth.js +1 -0
- package/actions/list.js +12 -10
- package/actions/notifications.d.ts +1 -1
- package/actions/notifications.js +5 -3
- package/components/ClientStorageComponent.js +1 -1
- package/components/HttpComponent.js +3 -3
- package/components/JwtHttpComponent.js +2 -2
- package/components/LocaleComponent.js +4 -3
- package/components/MetricsComponent.js +1 -1
- package/components/ResourceComponent.d.ts +2 -0
- package/components/ResourceComponent.js +9 -3
- package/components/SocialComponent.js +3 -1
- package/components/StoreComponent.d.ts +33 -21
- package/components/StoreComponent.js +5 -10
- package/components/UiComponent.js +1 -1
- package/components/social/GitlabProvider.js +3 -1
- package/docs-autogen-result.json +83 -41
- package/en.json +7 -1
- package/hooks/index.d.ts +5 -5
- package/hooks/index.js +10 -10
- package/hooks/useAddressBar.js +13 -9
- package/hooks/useApplication.d.ts +9 -9
- package/hooks/useApplication.js +17 -15
- package/hooks/useDataProvider.js +13 -7
- package/hooks/useDataSelect.js +4 -4
- package/hooks/useFetch.d.ts +6 -7
- package/hooks/useFetch.js +2 -2
- package/hooks/useFile.js +12 -7
- package/hooks/useLayout.js +25 -23
- package/hooks/useList.d.ts +4 -4
- package/hooks/useList.js +28 -22
- package/hooks/useListField.js +1 -1
- package/hooks/useSaveCursorPosition.js +1 -1
- package/hooks/useTree.d.ts +1 -1
- package/hooks/useTree.js +7 -6
- package/hooks/useUniqueId.js +1 -1
- package/index.d.ts +49 -0
- package/package.json +4 -4
- package/providers/ComponentsProvider.d.ts +5 -5
- package/providers/SsrProvider.js +7 -6
- package/providers/index.d.ts +1 -1
- package/providers/index.js +2 -2
- package/reducers/auth.js +1 -0
- package/reducers/fields.js +2 -1
- package/reducers/form.js +4 -3
- package/reducers/index.d.ts +1 -1
- package/reducers/index.js +2 -2
- package/reducers/list.js +3 -2
- package/reducers/modal.js +2 -1
- package/reducers/notifications.js +2 -1
- package/reducers/router.js +13 -7
- package/ui/content/Accordion/index.d.ts +1 -1
- package/ui/content/Accordion/index.js +2 -2
- package/ui/content/Alert/Alert.d.ts +1 -1
- package/ui/content/Badge/Badge.d.ts +1 -1
- package/ui/content/Calendar/Calendar.js +2 -2
- package/ui/content/CalendarSystem/CalendarSystem.d.ts +2 -2
- package/ui/content/CalendarSystem/CalendarSystem.js +2 -2
- package/ui/content/CalendarSystem/hooks/useCalendarControls.js +5 -3
- package/ui/content/CalendarSystem/hooks/useCalendarSystem.js +11 -11
- package/ui/content/CalendarSystem/hooks/useCalendarSystemEventGroupModals.d.ts +1 -1
- package/ui/content/CalendarSystem/hooks/useCalendarSystemEventGroupModals.js +2 -2
- package/ui/content/CalendarSystem/hooks/useCalendarSystemModals.js +6 -4
- package/ui/content/CalendarSystem/hooks/useDisplayDate.js +1 -1
- package/ui/content/CalendarSystem/hooks/useEventsFromDate.js +1 -1
- package/ui/content/CalendarSystem/utils/utils.js +6 -4
- package/ui/content/Card/Card.d.ts +1 -1
- package/ui/content/Chat/Chat.d.ts +1 -1
- package/ui/content/Chat/Chat.js +1 -1
- package/ui/content/Chat/hooks/useChat.js +5 -5
- package/ui/content/Chat/utils/addNewMessageIntoGroupedMessages.js +1 -1
- package/ui/content/Chat/utils/calculateMessageTimeAgo.js +6 -2
- package/ui/content/Chat/utils/getMessagesGroupedByDate.d.ts +1 -1
- package/ui/content/Chat/utils/getMessagesGroupedByDate.js +1 -1
- package/ui/content/Chat/utils/index.d.ts +1 -1
- package/ui/content/Chat/utils/index.js +3 -3
- package/ui/content/CopyToClipboard/CopyToClipboard.js +1 -1
- package/ui/content/Dashboard/Dashboard.js +1 -1
- package/ui/content/Detail/Detail.js +5 -3
- package/ui/content/DropDown/DropDown.js +1 -1
- package/ui/content/Kanban/Kanban.d.ts +3 -3
- package/ui/content/Kanban/Kanban.js +4 -4
- package/ui/content/Kanban/enums/KanbanPrioritiesEnum.d.ts +1 -1
- package/ui/content/Kanban/enums/KanbanPrioritiesEnum.js +6 -2
- package/ui/content/Kanban/enums/index.d.ts +1 -1
- package/ui/content/Kanban/enums/index.js +2 -2
- package/ui/content/Kanban/hooks/useKanban.js +2 -2
- package/ui/content/Kanban/reducers/kanban.js +1 -0
- package/ui/content/Slider/Slider.d.ts +1 -1
- package/ui/content/Slider/Slider.js +0 -1
- package/ui/content/index.d.ts +7 -7
- package/ui/content/index.js +15 -15
- package/ui/crud/Crud/Crud.js +4 -4
- package/ui/crud/Crud/CrudContent.d.ts +2 -2
- package/ui/crud/Crud/CrudContent.js +11 -5
- package/ui/crud/Crud/CrudModal.js +1 -1
- package/ui/crud/Crud/utils.js +5 -3
- package/ui/crud/index.d.ts +1 -1
- package/ui/form/AutoCompleteField/AutoCompleteField.js +2 -2
- package/ui/form/BlankField/BlankField.js +1 -1
- package/ui/form/Button/Button.d.ts +2 -2
- package/ui/form/Button/Button.js +4 -2
- package/ui/form/Button/index.js +1 -0
- package/ui/form/CheckboxField/CheckboxField.js +5 -3
- package/ui/form/CheckboxListField/CheckboxListField.d.ts +1 -1
- package/ui/form/CheckboxListField/CheckboxListField.js +1 -1
- package/ui/form/CheckboxTreeField/CheckboxTreeField.d.ts +3 -3
- package/ui/form/CheckboxTreeField/CheckboxTreeField.js +3 -3
- package/ui/form/DateField/DateField.d.ts +2 -2
- package/ui/form/DateField/DateField.js +7 -7
- package/ui/form/DateField/useDateInputState.js +1 -1
- package/ui/form/DateField/useDateRange.js +3 -3
- package/ui/form/DateField/useDateTime.js +1 -1
- package/ui/form/DateRangeField/DateRangeField.d.ts +2 -2
- package/ui/form/DateRangeField/DateRangeField.js +15 -13
- package/ui/form/DateTimeField/DateTimeField.d.ts +1 -1
- package/ui/form/DateTimeField/DateTimeField.js +9 -9
- package/ui/form/DateTimeField/utils.js +12 -3
- package/ui/form/DateTimeRangeField/DateTimeRangeField.d.ts +1 -1
- package/ui/form/DateTimeRangeField/DateTimeRangeField.js +15 -13
- package/ui/form/DropDownField/DropDownField.d.ts +3 -3
- package/ui/form/DropDownField/DropDownField.js +5 -5
- package/ui/form/EmailField/EmailField.d.ts +1 -1
- package/ui/form/EmailField/EmailField.js +2 -2
- package/ui/form/Field/Field.js +3 -3
- package/ui/form/Field/fieldWrapper.js +6 -6
- package/ui/form/FieldLayout/FieldLayout.js +1 -1
- package/ui/form/FieldList/FieldList.js +15 -11
- package/ui/form/FieldSet/FieldSet.js +5 -3
- package/ui/form/FileField/FileField.d.ts +1 -1
- package/ui/form/FileField/FileField.js +2 -2
- package/ui/form/Form/Form.d.ts +2 -2
- package/ui/form/Form/Form.js +28 -25
- package/ui/form/HtmlField/HtmlField.js +2 -2
- package/ui/form/ImageField/ImageField.d.ts +2 -2
- package/ui/form/ImageField/ImageField.js +4 -4
- package/ui/form/InputField/InputField.d.ts +2 -2
- package/ui/form/InputField/InputField.js +11 -11
- package/ui/form/NavField/NavField.d.ts +2 -2
- package/ui/form/NavField/NavField.js +3 -3
- package/ui/form/NumberField/NumberField.d.ts +2 -2
- package/ui/form/NumberField/NumberField.js +5 -4
- package/ui/form/NumberField/hooks/useInputTypeNumber.js +2 -2
- package/ui/form/PasswordField/PasswordField.d.ts +1 -1
- package/ui/form/PasswordField/PasswordField.js +3 -1
- package/ui/form/RateField/RateField.js +2 -2
- package/ui/form/SliderField/SliderField.d.ts +1 -1
- package/ui/form/SliderField/SliderField.js +2 -2
- package/ui/form/TextField/TextField.js +1 -1
- package/ui/form/TimeField/TimeField.js +8 -8
- package/ui/form/TimeField/utils.js +9 -2
- package/ui/form/TimeRangeField/TimeRangeField.js +11 -11
- package/ui/form/WizardForm/WizardForm.d.ts +1 -1
- package/ui/form/WizardForm/WizardForm.js +4 -4
- package/ui/form/WizardForm/utils.d.ts +1 -1
- package/ui/form/WizardForm/utils.js +3 -3
- package/ui/form/index.d.ts +2 -2
- package/ui/form/index.js +4 -4
- package/ui/form/validate.js +5 -5
- package/ui/format/EnumFormatter/EnumFormatter.js +3 -1
- package/ui/format/Format/Format.js +1 -1
- package/ui/layout/Header/Header.d.ts +3 -3
- package/ui/layout/Loader/Loader.d.ts +1 -1
- package/ui/layout/Notifications/Notifications.d.ts +1 -1
- package/ui/layout/Notifications/Notifications.js +3 -3
- package/ui/layout/ProgressBar/ProgressBar.js +1 -1
- package/ui/layout/Sidebar/Sidebar.d.ts +1 -1
- package/ui/layout/Tooltip/Tooltip.js +1 -1
- package/ui/layout/index.d.ts +1 -1
- package/ui/layout/index.js +2 -2
- package/ui/list/CheckboxColumn/CheckboxColumn.js +1 -1
- package/ui/list/Empty/Empty.js +6 -2
- package/ui/list/Grid/Grid.d.ts +1 -1
- package/ui/list/Grid/Grid.js +6 -4
- package/ui/list/InfiniteScroll/InfiniteScroll.js +5 -3
- package/ui/list/LayoutNames/LayoutNames.d.ts +2 -2
- package/ui/list/LayoutNames/LayoutNames.js +5 -3
- package/ui/list/Pagination/Pagination.js +4 -2
- package/ui/list/PaginationSize/PaginationSize.d.ts +1 -1
- package/ui/list/PaginationSize/PaginationSize.js +5 -3
- package/ui/list/SearchForm/SearchForm.js +1 -1
- package/ui/list/Steps/Steps.js +1 -1
- package/ui/list/TreeTable/TreeTable.d.ts +1 -1
- package/ui/list/TreeTable/TreeTable.js +9 -7
- package/ui/modal/ModalPortal/ModalPortal.js +2 -2
- package/ui/modal/TwoFactorModal/TwoFactorModal.js +3 -1
- package/ui/nav/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/ui/nav/Controls/Controls.d.ts +1 -1
- package/ui/nav/Nav/Nav.js +2 -2
- package/ui/nav/Router/Router.js +10 -8
- package/ui/nav/Router/helpers.js +1 -1
- package/ui/nav/index.d.ts +3 -3
- package/ui/nav/index.js +6 -6
- package/ui/typography/Text/Text.d.ts +1 -1
- package/ui/typography/Title/Title.d.ts +1 -1
- package/utils/calculateComponentAbsolutePosition.js +9 -3
- package/utils/calendar.js +2 -1
- package/utils/data.js +27 -17
- package/utils/form.js +10 -8
package/actions/auth.js
CHANGED
|
@@ -34,6 +34,7 @@ var init = function (skipInitialized) {
|
|
|
34
34
|
exports.init = init;
|
|
35
35
|
var reInit = function () { return (0, exports.init)(); };
|
|
36
36
|
exports.reInit = reInit;
|
|
37
|
+
// eslint-disable-next-line default-param-last
|
|
37
38
|
var login = function (token, redirectPageId, params) {
|
|
38
39
|
if (redirectPageId === void 0) { redirectPageId = 'root'; }
|
|
39
40
|
return function (dispatch, getState, _a) {
|
package/actions/list.js
CHANGED
|
@@ -15,17 +15,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
exports.__esModule = true;
|
|
17
17
|
exports.selectItem = exports.toggleAll = exports.toggleItem = exports.deleteItem = exports.update = exports.add = exports.listDestroy = exports.listRefresh = exports.listLazyFetch = exports.listFetch = exports.listChangeAction = exports.listSetLayout = exports.listSetItems = exports.listInit = exports.localFetchHandler = exports.httpFetchHandler = exports.LIST_SELECT_ITEM = exports.LIST_CHANGE_ACTION = exports.LIST_SET_LAYOUT = exports.LIST_TOGGLE_ALL = exports.LIST_TOGGLE_ITEM = exports.LIST_DESTROY = exports.LIST_ITEM_DELETE = exports.LIST_ITEM_UPDATE = exports.LIST_ITEM_ADD = exports.LIST_AFTER_FETCH = exports.LIST_BEFORE_FETCH = exports.LIST_SET_ITEMS = exports.LIST_INIT = void 0;
|
|
18
|
+
var axios_1 = __importDefault(require("axios"));
|
|
18
19
|
var get_1 = __importDefault(require("lodash-es/get"));
|
|
19
20
|
var isArray_1 = __importDefault(require("lodash-es/isArray"));
|
|
20
21
|
var isEmpty_1 = __importDefault(require("lodash-es/isEmpty"));
|
|
21
|
-
var orderBy_1 = __importDefault(require("lodash-es/orderBy"));
|
|
22
|
-
var trimStart_1 = __importDefault(require("lodash-es/trimStart"));
|
|
23
|
-
var isFunction_1 = __importDefault(require("lodash-es/isFunction"));
|
|
24
22
|
var isEqual_1 = __importDefault(require("lodash-es/isEqual"));
|
|
23
|
+
var isFunction_1 = __importDefault(require("lodash-es/isFunction"));
|
|
25
24
|
var isNil_1 = __importDefault(require("lodash-es/isNil"));
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
25
|
+
var orderBy_1 = __importDefault(require("lodash-es/orderBy"));
|
|
26
|
+
var trimStart_1 = __importDefault(require("lodash-es/trimStart"));
|
|
27
|
+
var form_1 = require("../actions/form");
|
|
28
|
+
var form_2 = require("../reducers/form");
|
|
29
29
|
var data_1 = require("../utils/data");
|
|
30
30
|
exports.LIST_INIT = '@list/init';
|
|
31
31
|
exports.LIST_SET_ITEMS = '@list/set_items';
|
|
@@ -148,7 +148,7 @@ var listFetch = function (listId, query) {
|
|
|
148
148
|
return [];
|
|
149
149
|
}
|
|
150
150
|
var toDispatch = [];
|
|
151
|
-
var formValues = (0,
|
|
151
|
+
var formValues = (0, form_2.formSelector)(state, list.formId, function (_a) {
|
|
152
152
|
var values = _a.values;
|
|
153
153
|
return values;
|
|
154
154
|
}) || {};
|
|
@@ -156,7 +156,7 @@ var listFetch = function (listId, query) {
|
|
|
156
156
|
// Change query
|
|
157
157
|
Object.keys(query || {}).forEach(function (key) {
|
|
158
158
|
formValues[key] = query[key];
|
|
159
|
-
toDispatch.push((0,
|
|
159
|
+
toDispatch.push((0, form_1.formChange)(list.formId, key, query[key]));
|
|
160
160
|
});
|
|
161
161
|
// Отменяем предыдущий запрос для этого listId (если есть)
|
|
162
162
|
components.http._promises = components.http._promises || {};
|
|
@@ -172,7 +172,9 @@ var listFetch = function (listId, query) {
|
|
|
172
172
|
// Создаем новый источник отмены
|
|
173
173
|
var source = axios_1["default"].CancelToken.source();
|
|
174
174
|
components.http._promises[listId] = source;
|
|
175
|
-
var options = {
|
|
175
|
+
var options = {
|
|
176
|
+
cancelToken: source.token
|
|
177
|
+
};
|
|
176
178
|
// Set `Loading...`
|
|
177
179
|
if (list.isRemote) {
|
|
178
180
|
toDispatch.push({
|
|
@@ -205,7 +207,7 @@ var listFetch = function (listId, query) {
|
|
|
205
207
|
var totalPages = Math.ceil(((list === null || list === void 0 ? void 0 : list.total) || 0) / (pageSize || 1));
|
|
206
208
|
var hasNextPage = (_a = data === null || data === void 0 ? void 0 : data.hasNextPage) !== null && _a !== void 0 ? _a : (page !== totalPages || null);
|
|
207
209
|
return [
|
|
208
|
-
(0,
|
|
210
|
+
(0, form_1.formSetErrors)(list.formId, data.errors || null),
|
|
209
211
|
{
|
|
210
212
|
items: items,
|
|
211
213
|
total: total,
|
|
@@ -12,5 +12,5 @@ export declare const closeNotification: (id?: string | null) => {
|
|
|
12
12
|
export declare const showNotification: (message: string | {
|
|
13
13
|
message: string;
|
|
14
14
|
description?: string;
|
|
15
|
-
},
|
|
15
|
+
}, notificationType?: AlertColorName, params?: IShowNotificationParameters) => (dispatch: any) => void;
|
|
16
16
|
export declare const setFlashes: (flashes: any) => ((dispatch: any) => void)[][];
|
package/actions/notifications.js
CHANGED
|
@@ -31,8 +31,10 @@ var closeNotification = function (id) {
|
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
33
|
exports.closeNotification = closeNotification;
|
|
34
|
-
var showNotification = function (message,
|
|
35
|
-
|
|
34
|
+
var showNotification = function (message,
|
|
35
|
+
// eslint-disable-next-line default-param-last
|
|
36
|
+
notificationType, params) {
|
|
37
|
+
if (notificationType === void 0) { notificationType = null; }
|
|
36
38
|
return function (dispatch) {
|
|
37
39
|
var _a = __assign(__assign({}, showNotificationDefaults), params), position = _a.position, timeOut = _a.timeOut;
|
|
38
40
|
var id = (0, uniqueId_1["default"])();
|
|
@@ -40,7 +42,7 @@ var showNotification = function (message, level, params) {
|
|
|
40
42
|
type: exports.NOTIFICATIONS_SHOW,
|
|
41
43
|
id: id,
|
|
42
44
|
message: message,
|
|
43
|
-
|
|
45
|
+
notificationType: notificationType || 'success',
|
|
44
46
|
position: position
|
|
45
47
|
});
|
|
46
48
|
if (timeOut > 0) {
|
|
@@ -28,8 +28,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
exports.__esModule = true;
|
|
29
29
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
30
30
|
/* eslint-disable no-unused-expressions */
|
|
31
|
-
var cookie = __importStar(require("js-cookie"));
|
|
32
31
|
var dayjs_1 = __importDefault(require("dayjs"));
|
|
32
|
+
var cookie = __importStar(require("js-cookie"));
|
|
33
33
|
/**
|
|
34
34
|
* Client Storage Component
|
|
35
35
|
* Слой хранения данных в браузере (cookie, local/session storage) или ReactNative
|
|
@@ -50,11 +50,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
exports.__esModule = true;
|
|
53
|
-
var
|
|
54
|
-
var trimEnd_1 = __importDefault(require("lodash-es/trimEnd"));
|
|
53
|
+
var axios_1 = __importDefault(require("axios"));
|
|
55
54
|
var isEmpty_1 = __importDefault(require("lodash-es/isEmpty"));
|
|
55
|
+
var trimEnd_1 = __importDefault(require("lodash-es/trimEnd"));
|
|
56
|
+
var trimStart_1 = __importDefault(require("lodash-es/trimStart"));
|
|
56
57
|
var set_cookie_parser_1 = __importDefault(require("set-cookie-parser"));
|
|
57
|
-
var axios_1 = __importDefault(require("axios"));
|
|
58
58
|
var notifications_1 = require("../actions/notifications");
|
|
59
59
|
/**
|
|
60
60
|
* Http Component
|
|
@@ -54,9 +54,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
54
54
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
55
|
};
|
|
56
56
|
exports.__esModule = true;
|
|
57
|
-
var axios_1 = __importDefault(require("axios"));
|
|
58
|
-
var HttpComponent_1 = __importDefault(require("@steroidsjs/core/components/HttpComponent"));
|
|
59
57
|
var auth_1 = require("@steroidsjs/core/actions/auth");
|
|
58
|
+
var HttpComponent_1 = __importDefault(require("@steroidsjs/core/components/HttpComponent"));
|
|
59
|
+
var axios_1 = __importDefault(require("axios"));
|
|
60
60
|
/**
|
|
61
61
|
* JwtHttpComponent
|
|
62
62
|
* Вариация HttpComponent с функционалом обновления токена авторизации
|
|
@@ -27,10 +27,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
exports.__esModule = true;
|
|
29
29
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
30
|
-
var React = __importStar(require("react"));
|
|
31
|
-
var intl_messageformat_1 = __importDefault(require("intl-messageformat"));
|
|
32
30
|
var dayjs_1 = __importDefault(require("dayjs"));
|
|
31
|
+
var intl_messageformat_1 = __importDefault(require("intl-messageformat"));
|
|
33
32
|
var isObject_1 = __importDefault(require("lodash-es/isObject"));
|
|
33
|
+
var React = __importStar(require("react"));
|
|
34
34
|
require("dayjs/locale/it");
|
|
35
35
|
require("dayjs/locale/ru");
|
|
36
36
|
/**
|
|
@@ -42,7 +42,8 @@ var LocaleComponent = /** @class */ (function () {
|
|
|
42
42
|
this.language = config.language || 'en';
|
|
43
43
|
this.sourceLanguage = config.sourceLanguage || 'ru';
|
|
44
44
|
this.backendTimeZone = null;
|
|
45
|
-
|
|
45
|
+
// in microseconds
|
|
46
|
+
this.backendTimeDiff = null;
|
|
46
47
|
this.translations = {};
|
|
47
48
|
// Publish to global
|
|
48
49
|
if (process.env.IS_SSR) {
|
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
var upperFirst_1 = __importDefault(require("lodash-es/upperFirst"));
|
|
7
6
|
var isEmpty_1 = __importDefault(require("lodash-es/isEmpty"));
|
|
7
|
+
var upperFirst_1 = __importDefault(require("lodash-es/upperFirst"));
|
|
8
8
|
var auth_1 = require("../reducers/auth");
|
|
9
9
|
/**
|
|
10
10
|
* Metrics Component
|
|
@@ -85,6 +85,8 @@ export interface IResourceComponent extends IResourceComponentConfig {
|
|
|
85
85
|
/**
|
|
86
86
|
* Resource Component
|
|
87
87
|
* Компонент для подгрузки внешних API: Google Maps, Yandex Maps, Twitter, ...
|
|
88
|
+
*
|
|
89
|
+
* @deprecated
|
|
88
90
|
*/
|
|
89
91
|
export default class ResourceComponent implements IResourceComponent {
|
|
90
92
|
protected _callbacks: any;
|
|
@@ -27,11 +27,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
exports.__esModule = true;
|
|
29
29
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
30
|
-
var queryString = __importStar(require("qs"));
|
|
31
30
|
var isArray_1 = __importDefault(require("lodash-es/isArray"));
|
|
31
|
+
var queryString = __importStar(require("qs"));
|
|
32
32
|
/**
|
|
33
33
|
* Resource Component
|
|
34
34
|
* Компонент для подгрузки внешних API: Google Maps, Yandex Maps, Twitter, ...
|
|
35
|
+
*
|
|
36
|
+
* @deprecated
|
|
35
37
|
*/
|
|
36
38
|
var ResourceComponent = /** @class */ (function () {
|
|
37
39
|
function ResourceComponent(components, config) {
|
|
@@ -50,7 +52,9 @@ var ResourceComponent = /** @class */ (function () {
|
|
|
50
52
|
if (window.grecaptcha) {
|
|
51
53
|
return Promise.resolve(window.grecaptcha);
|
|
52
54
|
}
|
|
53
|
-
return this.loadScript(this.RESOURCE_GOOGLE_CAPTCHA, {
|
|
55
|
+
return this.loadScript(this.RESOURCE_GOOGLE_CAPTCHA, {
|
|
56
|
+
render: this.googleCaptchaSiteKey
|
|
57
|
+
}, function () { return window.grecaptcha; });
|
|
54
58
|
};
|
|
55
59
|
ResourceComponent.prototype.loadGoogleMapApi = function () {
|
|
56
60
|
var locale = this._components.locale;
|
|
@@ -73,7 +77,7 @@ var ResourceComponent = /** @class */ (function () {
|
|
|
73
77
|
if (window.ymaps) {
|
|
74
78
|
return new Promise(function (resolve) {
|
|
75
79
|
// @ts-ignore
|
|
76
|
-
// eslint-disable-next-line implicit-arrow-linebreak
|
|
80
|
+
// eslint-disable-next-line implicit-arrow-linebreak,no-promise-executor-return
|
|
77
81
|
return window.ymaps.ready(function () { return resolve(window.ymaps); });
|
|
78
82
|
});
|
|
79
83
|
}
|
|
@@ -81,6 +85,7 @@ var ResourceComponent = /** @class */ (function () {
|
|
|
81
85
|
lang: this.language || locale.language
|
|
82
86
|
},
|
|
83
87
|
// @ts-ignore
|
|
88
|
+
// eslint-disable-next-line no-promise-executor-return
|
|
84
89
|
function () { return new Promise(function (resolve) { return window.ymaps.ready(function () { return resolve(window.ymaps); }); }); });
|
|
85
90
|
};
|
|
86
91
|
ResourceComponent.prototype.loadTwitterWidget = function () {
|
|
@@ -91,6 +96,7 @@ var ResourceComponent = /** @class */ (function () {
|
|
|
91
96
|
}
|
|
92
97
|
return this.loadScript(this.RESOURCE_TWITTER_WIDGET, {},
|
|
93
98
|
// @ts-ignore
|
|
99
|
+
// eslint-disable-next-line no-promise-executor-return
|
|
94
100
|
function () { return new Promise(function (resolve) { return window.twttr.ready(function () { return resolve(window.twttr); }); }); });
|
|
95
101
|
};
|
|
96
102
|
ResourceComponent.prototype.loadGeetest = function () {
|
|
@@ -18,7 +18,9 @@ var SocialComponent = /** @class */ (function () {
|
|
|
18
18
|
var _this = this;
|
|
19
19
|
Object.keys(this.providers).forEach(function (name) {
|
|
20
20
|
if ((0, isFunction_1["default"])(_this.providers[name])) {
|
|
21
|
-
_this.providers[name] = {
|
|
21
|
+
_this.providers[name] = {
|
|
22
|
+
className: _this.providers[name]
|
|
23
|
+
};
|
|
22
24
|
}
|
|
23
25
|
var ProviderClass = _this.providers[name].className;
|
|
24
26
|
delete _this.providers[name].className;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { IComponents } from '@steroidsjs/core/providers/ComponentsProvider';
|
|
2
|
+
import { RouterState } from 'connected-react-router';
|
|
3
|
+
import { History, LocationState } from 'history';
|
|
4
|
+
import { Store, Dispatch, Unsubscribe, Reducer, AnyAction } from 'redux';
|
|
1
5
|
declare global {
|
|
2
6
|
interface Window {
|
|
3
7
|
APP_REDUX_PRELOAD_STATES?: any;
|
|
@@ -5,26 +9,34 @@ declare global {
|
|
|
5
9
|
}
|
|
6
10
|
}
|
|
7
11
|
interface IStoreComponentConfig {
|
|
8
|
-
initialState: any
|
|
9
|
-
history:
|
|
12
|
+
initialState: Record<string, any>;
|
|
13
|
+
history: History;
|
|
10
14
|
}
|
|
15
|
+
type AsyncReducersMap = {
|
|
16
|
+
router?: Reducer<RouterState<LocationState>, AnyAction>;
|
|
17
|
+
[key: string]: Reducer<any, AnyAction> | undefined;
|
|
18
|
+
};
|
|
19
|
+
type RootState<R extends AsyncReducersMap> = {
|
|
20
|
+
[K in keyof R]: R[K] extends Reducer<infer S, AnyAction> ? S : never;
|
|
21
|
+
};
|
|
22
|
+
type CreateRootReducer = <R extends AsyncReducersMap>(reducers: R) => Reducer<RootState<R>, AnyAction>;
|
|
11
23
|
export interface IStoreComponent {
|
|
12
24
|
/**
|
|
13
25
|
* Редьюсеры
|
|
14
26
|
*/
|
|
15
|
-
reducers:
|
|
27
|
+
reducers: CreateRootReducer;
|
|
16
28
|
/**
|
|
17
29
|
* Хранилище
|
|
18
30
|
*/
|
|
19
|
-
store:
|
|
31
|
+
store: Store;
|
|
20
32
|
/**
|
|
21
33
|
* Инициализация
|
|
22
34
|
*/
|
|
23
|
-
init(): void;
|
|
35
|
+
init(config: IStoreComponentConfig): void;
|
|
24
36
|
/**
|
|
25
37
|
* Инициализация хранилища
|
|
26
38
|
*/
|
|
27
|
-
initStore(): void;
|
|
39
|
+
initStore(config: IStoreComponentConfig): void;
|
|
28
40
|
/**
|
|
29
41
|
* Конфигурация
|
|
30
42
|
*/
|
|
@@ -33,16 +45,16 @@ export interface IStoreComponent {
|
|
|
33
45
|
* Метод для dispatch
|
|
34
46
|
* @param action Экшен для изменения состояния.
|
|
35
47
|
*/
|
|
36
|
-
dispatch
|
|
48
|
+
dispatch: Dispatch<any>;
|
|
37
49
|
/**
|
|
38
50
|
* Получение состояния
|
|
39
51
|
*/
|
|
40
|
-
getState():
|
|
52
|
+
getState(): Record<string, any>;
|
|
41
53
|
/**
|
|
42
54
|
* Подписка
|
|
43
55
|
* @param handler Обработчик изменения состояния.
|
|
44
56
|
*/
|
|
45
|
-
subscribe(handler:
|
|
57
|
+
subscribe(handler: () => void): Unsubscribe;
|
|
46
58
|
/**
|
|
47
59
|
* Добавление редьюсеров
|
|
48
60
|
* @param asyncReducers Коллекция редьюсеров.
|
|
@@ -61,23 +73,23 @@ export interface IStoreComponent {
|
|
|
61
73
|
* Обертка над Redux Store со встроенными middleware (thunk, multi, promise..) и react-router.
|
|
62
74
|
*/
|
|
63
75
|
export default class StoreComponent implements IStoreComponent {
|
|
64
|
-
_asyncReducers:
|
|
65
|
-
_components:
|
|
66
|
-
reducers:
|
|
67
|
-
_routerReducer:
|
|
68
|
-
history:
|
|
76
|
+
_asyncReducers: AsyncReducersMap;
|
|
77
|
+
_components: IComponents;
|
|
78
|
+
reducers: CreateRootReducer;
|
|
79
|
+
_routerReducer: Reducer<RouterState<LocationState>>;
|
|
80
|
+
history: History | null;
|
|
69
81
|
navigationNative: any;
|
|
70
|
-
store:
|
|
82
|
+
store: Store | null;
|
|
71
83
|
lastAction: string;
|
|
72
|
-
constructor(components:
|
|
73
|
-
init(config
|
|
74
|
-
initStore(config
|
|
84
|
+
constructor(components: IComponents, config: any, lazyInit?: boolean);
|
|
85
|
+
init(config: IStoreComponentConfig): void;
|
|
86
|
+
initStore(config: IStoreComponentConfig): void;
|
|
75
87
|
configurate(): void;
|
|
76
88
|
dispatch(action: any): any;
|
|
77
89
|
getState(): any;
|
|
78
|
-
subscribe(handler: any):
|
|
79
|
-
addReducers(asyncReducers:
|
|
90
|
+
subscribe(handler: any): Unsubscribe;
|
|
91
|
+
addReducers(asyncReducers: AsyncReducersMap): void;
|
|
80
92
|
errorHandler(error: any, action: any): void;
|
|
81
|
-
_prepare(action: any, dispatch: any
|
|
93
|
+
_prepare(action: any, dispatch: Dispatch<any>, getState: Record<string, any>): any;
|
|
82
94
|
}
|
|
83
95
|
export {};
|
|
@@ -14,13 +14,12 @@ 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 */
|
|
18
|
-
var redux_1 = require("redux");
|
|
19
17
|
var connected_react_router_1 = require("connected-react-router");
|
|
20
18
|
var history_1 = require("history");
|
|
21
19
|
var get_1 = __importDefault(require("lodash-es/get"));
|
|
22
|
-
var merge_1 = __importDefault(require("lodash-es/merge"));
|
|
23
20
|
var isPlainObject_1 = __importDefault(require("lodash-es/isPlainObject"));
|
|
21
|
+
var merge_1 = __importDefault(require("lodash-es/merge"));
|
|
22
|
+
var redux_1 = require("redux");
|
|
24
23
|
/**
|
|
25
24
|
* Store Component
|
|
26
25
|
* Обертка над Redux Store со встроенными middleware (thunk, multi, promise..) и react-router.
|
|
@@ -28,10 +27,11 @@ var isPlainObject_1 = __importDefault(require("lodash-es/isPlainObject"));
|
|
|
28
27
|
var StoreComponent = /** @class */ (function () {
|
|
29
28
|
function StoreComponent(components, config, lazyInit) {
|
|
30
29
|
if (lazyInit === void 0) { lazyInit = false; }
|
|
30
|
+
var _a;
|
|
31
31
|
this._components = components;
|
|
32
32
|
this.reducers = config.reducers;
|
|
33
33
|
this.history = null;
|
|
34
|
-
this.store = config.store
|
|
34
|
+
this.store = (_a = config.store) !== null && _a !== void 0 ? _a : null;
|
|
35
35
|
this.lastAction = null;
|
|
36
36
|
this._asyncReducers = {};
|
|
37
37
|
this.getState = this.getState.bind(this);
|
|
@@ -42,13 +42,11 @@ var StoreComponent = /** @class */ (function () {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
StoreComponent.prototype.init = function (config) {
|
|
45
|
-
if (config === void 0) { config = {}; }
|
|
46
45
|
this.initStore(config);
|
|
47
46
|
this.configurate();
|
|
48
47
|
};
|
|
49
48
|
StoreComponent.prototype.initStore = function (config) {
|
|
50
49
|
var _this = this;
|
|
51
|
-
if (config === void 0) { config = {}; }
|
|
52
50
|
var initialState = __assign(__assign({}, (process.env.IS_WEB
|
|
53
51
|
? merge_1["default"].apply(void 0, (window.APP_REDUX_PRELOAD_STATES || [{}])) : {})), config.initialState);
|
|
54
52
|
if (window === null || window === void 0 ? void 0 : window.APP_REDUX_PRELOAD_STATES) {
|
|
@@ -68,10 +66,7 @@ var StoreComponent = /** @class */ (function () {
|
|
|
68
66
|
this._routerReducer = (0, connected_react_router_1.connectRouter)(this.history);
|
|
69
67
|
}
|
|
70
68
|
if (!this.store) {
|
|
71
|
-
this.store = (0, redux_1.createStore)(
|
|
72
|
-
//TODO TYPES
|
|
73
|
-
//@ts-ignore
|
|
74
|
-
this.reducers(this._routerReducer ? {
|
|
69
|
+
this.store = (0, redux_1.createStore)(this.reducers(this._routerReducer ? {
|
|
75
70
|
router: this._routerReducer
|
|
76
71
|
} : {}), initialState, (0, redux_1.compose)((0, redux_1.applyMiddleware)(function (_a) {
|
|
77
72
|
var getState = _a.getState;
|
|
@@ -37,10 +37,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
39
|
exports.__esModule = true;
|
|
40
|
-
var React = __importStar(require("react"));
|
|
41
40
|
var isFunction_1 = __importDefault(require("lodash-es/isFunction"));
|
|
42
41
|
var isObject_1 = __importDefault(require("lodash-es/isObject"));
|
|
43
42
|
var isString_1 = __importDefault(require("lodash-es/isString"));
|
|
43
|
+
var React = __importStar(require("react"));
|
|
44
44
|
/**
|
|
45
45
|
* Ui Component
|
|
46
46
|
* Компонент для подгрузки и конфигурации UI компонентов приложения
|
|
@@ -83,7 +83,9 @@ var GitlabProvider = /** @class */ (function () {
|
|
|
83
83
|
// ?provider=gitlab_kozhindev#access_token=7b87e3de0...5518198d885d&token_type=Bearer
|
|
84
84
|
var token = (/access_token=(\w+)/.exec(link) || [])[1];
|
|
85
85
|
if (token) {
|
|
86
|
-
resolve({
|
|
86
|
+
resolve({
|
|
87
|
+
token: token
|
|
88
|
+
});
|
|
87
89
|
}
|
|
88
90
|
else {
|
|
89
91
|
reject();
|