@steroidsjs/core 2.2.83 → 2.2.86

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.
@@ -8,6 +8,7 @@ import { IComponents } from '../providers/ComponentsProvider';
8
8
  import { IRouteItem } from '../ui/nav/Router/Router';
9
9
  import MetricsComponent from '../components/MetricsComponent';
10
10
  import { IScreenProviderProps } from '../providers/ScreenProvider';
11
+ import { IFetchConfig } from '../hooks/useFetch';
11
12
  /**
12
13
  * Application HOC
13
14
  * Обертка над корневым компонентом приложения, используется только в `Application.tsx`. Добавляет через React Context
@@ -27,6 +28,10 @@ export interface IApplicationHookConfig {
27
28
  layoutView?: () => CustomView;
28
29
  layoutProps?: Record<string, unknown>;
29
30
  screen?: boolean | Omit<IScreenProviderProps, 'children'>;
31
+ /**
32
+ * These fetch configurations will be used to preload and store for no matter what route matched in case of SSR
33
+ */
34
+ defaultFetches?: IFetchConfig[];
30
35
  }
31
36
  export interface IApplicationHookResult {
32
37
  renderApplication: (children?: any) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "2.2.83",
3
+ "version": "2.2.86",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {
@@ -75,11 +75,15 @@ function Pagination(props) {
75
75
  }) || initialValues, page = _e.page, pageSize = _e.pageSize;
76
76
  var totalPages = Math.ceil((((_c = props.list) === null || _c === void 0 ? void 0 : _c.total) || 0) / (pageSize || 1));
77
77
  var pages = react_1.useMemo(function () { return exports.generatePages(page, totalPages, props.aroundCount)
78
- .map(function (pageItem) { return ({
79
- page: pageItem !== '...' ? pageItem : null,
80
- label: pageItem,
81
- isActive: page === pageItem
82
- }); }); }, [page, props.aroundCount, totalPages]);
78
+ .map(function (pageItem, index, pages) {
79
+ // Номер страницы для '...' кнопки (выбирает страницу между двумя соседними пронумерованными)
80
+ var pageNumberForButtonWithDots = Math.floor(((pages[index + 1] + pages[index - 1]) / 2));
81
+ return {
82
+ page: pageItem !== '...' ? pageItem : pageNumberForButtonWithDots,
83
+ label: pageItem,
84
+ isActive: page === pageItem
85
+ };
86
+ }); }, [page, props.aroundCount, totalPages]);
83
87
  var onSelect = react_1.useCallback(function (newPage) {
84
88
  if (formDispatch) {
85
89
  formDispatch(form_1.formChange(formId, props.attribute, newPage));
package/utils/form.js CHANGED
@@ -64,7 +64,7 @@ var mergeLayoutProp = function (layout1, layout2) {
64
64
  exports.mergeLayoutProp = mergeLayoutProp;
65
65
  var cleanEmptyObject = function (object) {
66
66
  // if all properties are null substitute the object with null
67
- if (!Object.values(object).some(function (x) { return x; })) {
67
+ if (!Object.values(object).some(function (x) { return x !== null; })) {
68
68
  return null;
69
69
  }
70
70
  Object.keys(object).forEach(function (key) {