@steroidsjs/core 2.1.0-beta.2 → 2.1.0-beta.20

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.
Files changed (136) hide show
  1. package/actions/form.d.ts +9 -0
  2. package/actions/form.js +11 -1
  3. package/actions/list.d.ts +1 -0
  4. package/actions/list.js +1 -0
  5. package/components/ClientStorageComponent.d.ts +3 -3
  6. package/components/ClientStorageComponent.js +28 -22
  7. package/components/HttpComponent.js +32 -15
  8. package/components/LocaleComponent.js +9 -9
  9. package/components/MetricsComponent.js +3 -1
  10. package/components/StoreComponent.d.ts +6 -0
  11. package/components/StoreComponent.js +6 -7
  12. package/components/UiComponent.d.ts +1 -1
  13. package/components/WebSocketComponent.d.ts +1 -1
  14. package/hoc/components.d.ts +1 -1
  15. package/hoc/components.js +1 -1
  16. package/hoc/file.d.ts +1 -0
  17. package/hooks/index.d.ts +2 -1
  18. package/hooks/index.js +3 -1
  19. package/hooks/useAbsolutePositioning.d.ts +5 -0
  20. package/hooks/useAbsolutePositioning.js +6 -6
  21. package/hooks/useApplication.d.ts +29 -26
  22. package/hooks/useApplication.js +17 -82
  23. package/hooks/useComponents.d.ts +1 -14
  24. package/hooks/useComponents.js +5 -5
  25. package/hooks/useDataProvider.js +4 -2
  26. package/hooks/useDataSelect.d.ts +12 -6
  27. package/hooks/useDataSelect.js +5 -3
  28. package/hooks/useFetch.d.ts +11 -3
  29. package/hooks/useFetch.js +34 -31
  30. package/hooks/useFile.js +14 -2
  31. package/hooks/useLayout.d.ts +9 -0
  32. package/hooks/useLayout.js +64 -44
  33. package/hooks/useList.d.ts +45 -0
  34. package/hooks/useList.js +83 -53
  35. package/hooks/useModel.js +1 -1
  36. package/hooks/useScreen.d.ts +1 -1
  37. package/hooks/useScreen.js +2 -2
  38. package/hooks/useSsr.d.ts +2 -0
  39. package/hooks/useSsr.js +8 -0
  40. package/index.d.ts +8 -2
  41. package/package.json +6 -3
  42. package/providers/ComponentsProvider.d.ts +26 -0
  43. package/providers/ComponentsProvider.js +28 -0
  44. package/providers/ScreenProvider.d.ts +20 -0
  45. package/providers/ScreenProvider.js +87 -0
  46. package/providers/SsrProvider.d.ts +17 -0
  47. package/providers/SsrProvider.js +32 -0
  48. package/providers/index.d.ts +4 -0
  49. package/providers/index.js +12 -0
  50. package/reducers/form.d.ts +1 -1
  51. package/reducers/form.js +3 -1
  52. package/reducers/index.js +1 -1
  53. package/reducers/list.js +1 -3
  54. package/reducers/router.js +1 -1
  55. package/ui/content/Alert/Alert.d.ts +50 -0
  56. package/ui/content/Alert/Alert.js +39 -0
  57. package/ui/content/Alert/index.d.ts +2 -0
  58. package/ui/content/Alert/index.js +7 -0
  59. package/ui/content/Avatar/Avatar.d.ts +53 -12
  60. package/ui/content/Avatar/Avatar.js +25 -4
  61. package/ui/content/Avatar/index.d.ts +6 -1
  62. package/ui/content/Avatar/index.js +4 -0
  63. package/ui/content/Card/Card.d.ts +61 -13
  64. package/ui/content/Card/Card.js +3 -2
  65. package/ui/content/Collapse/Collapse.d.ts +63 -0
  66. package/ui/content/Collapse/Collapse.js +75 -0
  67. package/ui/content/Collapse/CollapseItem.d.ts +67 -0
  68. package/ui/content/Collapse/CollapseItem.js +22 -0
  69. package/ui/content/Collapse/index.d.ts +7 -0
  70. package/ui/content/Collapse/index.js +8 -0
  71. package/ui/content/Detail/Detail.d.ts +102 -0
  72. package/ui/content/Detail/Detail.js +155 -0
  73. package/ui/content/Detail/DetailItem.d.ts +43 -0
  74. package/ui/content/Detail/DetailItem.js +10 -0
  75. package/ui/content/Detail/demo/basic.d.ts +8 -0
  76. package/ui/content/Detail/demo/basic.js +56 -0
  77. package/ui/content/Detail/demo/controls.d.ts +8 -0
  78. package/ui/content/Detail/demo/controls.js +56 -0
  79. package/ui/content/Detail/demo/layout.d.ts +8 -0
  80. package/ui/content/Detail/demo/layout.js +56 -0
  81. package/ui/content/Detail/demo/responsive.d.ts +8 -0
  82. package/ui/content/Detail/demo/responsive.js +71 -0
  83. package/ui/content/Detail/demo/sizes.d.ts +8 -0
  84. package/ui/content/Detail/demo/sizes.js +61 -0
  85. package/ui/content/Detail/index.d.ts +3 -0
  86. package/ui/content/Detail/index.js +10 -0
  87. package/ui/content/DropDown/DropDown.d.ts +1 -0
  88. package/ui/content/DropDown/DropDown.js +1 -0
  89. package/ui/content/index.d.ts +13 -0
  90. package/ui/content/index.js +22 -0
  91. package/ui/crud/Crud/Crud.d.ts +1 -1
  92. package/ui/crud/Crud/Crud.js +1 -1
  93. package/ui/crud/index.d.ts +1 -0
  94. package/ui/form/Button/Button.d.ts +1 -0
  95. package/ui/form/Button/Button.js +1 -0
  96. package/ui/form/DateField/useDateInputState.d.ts +4 -0
  97. package/ui/form/DateField/useDateInputState.js +3 -3
  98. package/ui/form/DateField/useDateTime.js +9 -7
  99. package/ui/form/DateTimeField/DateTimeField.js +2 -1
  100. package/ui/form/DropDownField/DropDownField.js +10 -3
  101. package/ui/form/Form/Form.js +118 -106
  102. package/ui/form/ImageField/ImageField.d.ts +87 -0
  103. package/ui/form/ImageField/ImageField.js +145 -0
  104. package/ui/form/ImageField/index.d.ts +2 -0
  105. package/ui/form/ImageField/index.js +7 -0
  106. package/ui/form/InputField/InputField.d.ts +7 -0
  107. package/ui/form/InputField/InputField.js +26 -22
  108. package/ui/form/TextField/TextField.d.ts +2 -1
  109. package/ui/form/TextField/TextField.js +1 -1
  110. package/ui/icon/Icon/Icon.js +3 -0
  111. package/ui/layout/Meta/Meta.d.ts +56 -0
  112. package/ui/layout/Meta/Meta.js +38 -0
  113. package/ui/layout/Meta/index.d.ts +2 -0
  114. package/ui/layout/Meta/index.js +7 -0
  115. package/ui/layout/Notifications/Notifications.js +1 -1
  116. package/ui/layout/Portal.js +3 -0
  117. package/ui/layout/ProgressBar/ProgressBar.d.ts +55 -0
  118. package/ui/layout/ProgressBar/ProgressBar.js +52 -0
  119. package/ui/layout/ProgressBar/index.d.ts +2 -0
  120. package/ui/layout/ProgressBar/index.js +7 -0
  121. package/ui/layout/Skeleton/Skeleton.d.ts +25 -0
  122. package/ui/layout/Skeleton/Skeleton.js +11 -0
  123. package/ui/layout/Skeleton/index.d.ts +2 -0
  124. package/ui/layout/Skeleton/index.js +7 -0
  125. package/ui/list/Steps/Steps.d.ts +32 -0
  126. package/ui/list/Steps/Steps.js +23 -0
  127. package/ui/list/Steps/index.d.ts +2 -0
  128. package/ui/list/Steps/index.js +7 -0
  129. package/ui/nav/Router/Router.d.ts +13 -0
  130. package/ui/nav/Router/Router.js +1 -1
  131. package/utils/calendar.d.ts +1 -1
  132. package/utils/calendar.js +8 -1
  133. package/ui/content/Avatar/SizeContext.d.ts +0 -1
  134. package/ui/content/Avatar/SizeContext.js +0 -14
  135. package/ui/nav/Router/SsrProvider.d.ts +0 -15
  136. package/ui/nav/Router/SsrProvider.js +0 -55
@@ -1,4 +1,6 @@
1
1
  import * as React from 'react';
2
+ import { IFetchConfig } from '../../../hooks/useFetch';
3
+ import { IListProps } from '../../list/List/List';
2
4
  import { IFetchHocConfigFunc } from '../../../hoc/fetch';
3
5
  /**
4
6
  * Router
@@ -89,6 +91,17 @@ export interface IRouteItem {
89
91
  items?: IRouteItem[] | {
90
92
  [key: string]: IRouteItem;
91
93
  };
94
+ /**
95
+ * Обработчик, который принимает параметры URL и возвращает массив с пропсами для хука useFetch и компонента
96
+ * List.
97
+ * Функция запускается перед рендерингом приложения в режиме SSR и используется для предварительной
98
+ * загрузки данных, необходимых на текущей странице.
99
+ * Хук useFetch и компонент List не будут повторно инициализироваться и делать запросы на клиенте,
100
+ * если подгруженные данные существуют.
101
+ * @param {Object} match
102
+ * @return {Array} Например, [{url: '/api/v1/some-data'}, {listId: 'someList', action: '/api/v1/some-list'}]
103
+ */
104
+ preloadData?: (match: Record<string, any>) => (IFetchConfig | IListProps)[];
92
105
  [key: string]: any;
93
106
  }
94
107
  export interface IRouterProps {
@@ -49,7 +49,7 @@ var hoc_1 = require("../../../hoc");
49
49
  var router_1 = require("../../../actions/router");
50
50
  var useDispatch_1 = __importDefault(require("../../../hooks/useDispatch"));
51
51
  var router_2 = require("../../../reducers/router");
52
- var SsrProvider_1 = require("./SsrProvider");
52
+ var SsrProvider_1 = require("../../../providers/SsrProvider");
53
53
  var findRedirectPathRecursive = function (route) {
54
54
  if (!route) {
55
55
  return null;
@@ -1,4 +1,4 @@
1
- export declare const convertDate: (date: string | Date, fromFormats: string | string[], toFormat?: string) => any;
1
+ export declare const convertDate: (date: string | Date, fromFormats: string | string[], toFormat?: string, utc?: boolean) => any;
2
2
  /**
3
3
  * Регулярка проверяет соответствие введенной строки формату 'hh:mm'
4
4
  * Максимальная величина - 23:59
package/utils/calendar.js CHANGED
@@ -5,8 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  exports.__esModule = true;
6
6
  exports.convertDate = void 0;
7
7
  var moment_1 = __importDefault(require("moment"));
8
- var convertDate = function (date, fromFormats, toFormat) {
8
+ var convertDate = function (date, fromFormats, toFormat, utc) {
9
9
  if (toFormat === void 0) { toFormat = null; }
10
+ if (utc === void 0) { utc = false; }
10
11
  if (!date) {
11
12
  return null;
12
13
  }
@@ -26,6 +27,12 @@ var convertDate = function (date, fromFormats, toFormat) {
26
27
  if (!momentDate) {
27
28
  return null;
28
29
  }
30
+ if (utc) {
31
+ momentDate = momentDate.utc();
32
+ }
33
+ else {
34
+ momentDate = momentDate.utc(true).local();
35
+ }
29
36
  return toFormat ? momentDate.format(toFormat) : momentDate.toDate();
30
37
  };
31
38
  exports.convertDate = convertDate;
@@ -1 +0,0 @@
1
- export {};
@@ -1,14 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- // const SizeContext = React.createContext<Size>('medium');
4
- // export interface SizeContextProps {
5
- // size?: Size
6
- // }
7
- // export const SizeContextProvider = ({ children, size }) => (
8
- // <SizeContext.Consumer>
9
- // {originSize => (
10
- // <SizeContext.Provider value={size || originSize}>{children}</SizeContext.Provider>
11
- // )}
12
- // </SizeContext.Consumer>
13
- // );
14
- // export default SizeContext;
@@ -1,15 +0,0 @@
1
- import * as React from 'react';
2
- interface ISsrProviderContext {
3
- history?: any;
4
- staticContext?: any;
5
- }
6
- export declare const SsrProviderContext: React.Context<ISsrProviderContext>;
7
- interface ISsrProviderProps {
8
- history?: any;
9
- store?: any;
10
- staticContext?: any;
11
- }
12
- export default class SsrProvider extends React.PureComponent<ISsrProviderProps> {
13
- render(): JSX.Element;
14
- }
15
- export {};
@@ -1,55 +0,0 @@
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
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
- exports.__esModule = true;
37
- exports.SsrProviderContext = void 0;
38
- var React = __importStar(require("react"));
39
- var react_redux_1 = require("react-redux");
40
- exports.SsrProviderContext = React.createContext(null);
41
- var SsrProvider = /** @class */ (function (_super) {
42
- __extends(SsrProvider, _super);
43
- function SsrProvider() {
44
- return _super !== null && _super.apply(this, arguments) || this;
45
- }
46
- SsrProvider.prototype.render = function () {
47
- return (React.createElement(exports.SsrProviderContext.Provider, { value: {
48
- history: this.props.history,
49
- staticContext: this.props.staticContext
50
- } },
51
- React.createElement(react_redux_1.Provider, { store: this.props.store }, this.props.children)));
52
- };
53
- return SsrProvider;
54
- }(React.PureComponent));
55
- exports["default"] = SsrProvider;