@steroidsjs/core 3.0.16 → 3.0.17

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.
@@ -4170,6 +4170,15 @@
4170
4170
  }
4171
4171
  ]
4172
4172
  },
4173
+ {
4174
+ "name": "renderLoading",
4175
+ "decorators": [],
4176
+ "description": "",
4177
+ "required": false,
4178
+ "type": "any",
4179
+ "example": null,
4180
+ "parameters": []
4181
+ },
4173
4182
  {
4174
4183
  "name": "renderPagination",
4175
4184
  "decorators": [],
@@ -6892,6 +6901,24 @@
6892
6901
  "example": null
6893
6902
  }
6894
6903
  ]
6904
+ },
6905
+ {
6906
+ "name": "onTodayButtonClick",
6907
+ "decorators": [],
6908
+ "description": "Callback вызываемый при нажатии на кнопку 'Сегодня'",
6909
+ "required": false,
6910
+ "type": "void",
6911
+ "example": null,
6912
+ "parameters": [
6913
+ {
6914
+ "name": "newDate",
6915
+ "decorators": [],
6916
+ "description": "текущая дата\n",
6917
+ "required": true,
6918
+ "type": "Date",
6919
+ "example": null
6920
+ }
6921
+ ]
6895
6922
  }
6896
6923
  ]
6897
6924
  },
@@ -7092,6 +7119,24 @@
7092
7119
  }
7093
7120
  ]
7094
7121
  },
7122
+ {
7123
+ "name": "onTodayButtonClick",
7124
+ "decorators": [],
7125
+ "description": "Callback вызываемый при нажатии на кнопку 'Сегодня'",
7126
+ "required": false,
7127
+ "type": "void",
7128
+ "example": null,
7129
+ "parameters": [
7130
+ {
7131
+ "name": "newDate",
7132
+ "decorators": [],
7133
+ "description": "текущая дата\n",
7134
+ "required": true,
7135
+ "type": "Date",
7136
+ "example": null
7137
+ }
7138
+ ]
7139
+ },
7095
7140
  {
7096
7141
  "name": "toggleCaptionPanel",
7097
7142
  "decorators": [],
@@ -7541,6 +7586,15 @@
7541
7586
  "example": null,
7542
7587
  "defaultValue": null
7543
7588
  },
7589
+ {
7590
+ "name": "asideCalendarProps",
7591
+ "decorators": [],
7592
+ "description": "Дополнительные свойства для бокового календаря",
7593
+ "required": false,
7594
+ "type": "ICalendarProps",
7595
+ "example": null,
7596
+ "defaultValue": null
7597
+ },
7544
7598
  {
7545
7599
  "name": "calendarModalProps",
7546
7600
  "decorators": [],
@@ -7562,7 +7616,7 @@
7562
7616
  {
7563
7617
  "name": "dayGrid",
7564
7618
  "decorators": [],
7565
- "description": "Свойства для сетки дня",
7619
+ "description": "Свойства для сетки дня",
7566
7620
  "required": false,
7567
7621
  "type": "IGridViews",
7568
7622
  "example": null,
@@ -7589,7 +7643,7 @@
7589
7643
  {
7590
7644
  "name": "monthGrid",
7591
7645
  "decorators": [],
7592
- "description": "Свойства для сетки месяца",
7646
+ "description": "Свойства для сетки месяца",
7593
7647
  "required": false,
7594
7648
  "type": "IGridViews",
7595
7649
  "example": null,
@@ -7625,7 +7679,7 @@
7625
7679
  {
7626
7680
  "name": "weekGrid",
7627
7681
  "decorators": [],
7628
- "description": "Свойства для сетки недели",
7682
+ "description": "Свойства для сетки недели",
7629
7683
  "required": false,
7630
7684
  "type": "IGridViews",
7631
7685
  "example": null,
@@ -7636,7 +7690,7 @@
7636
7690
  {
7637
7691
  "name": "onChangeCalendarType",
7638
7692
  "decorators": [],
7639
- "description": "Функция, которая вызовется при смене типа календаря",
7693
+ "description": "Функция, которая вызывется при смене типа календаря",
7640
7694
  "required": false,
7641
7695
  "type": "void",
7642
7696
  "example": null,
@@ -7662,7 +7716,7 @@
7662
7716
  "defaultProps": null,
7663
7717
  "extends": [
7664
7718
  "Pick<ICalendarSystemProps",
7665
- "'className' | 'style' | 'additionalViewProps' | 'users'>"
7719
+ "'className' | 'style' | 'additionalViewProps' | 'users' | 'asideCalendarProps'>"
7666
7720
  ],
7667
7721
  "properties": [
7668
7722
  {
@@ -7673,6 +7727,14 @@
7673
7727
  "type": "Record",
7674
7728
  "example": null
7675
7729
  },
7730
+ {
7731
+ "name": "asideCalendarProps",
7732
+ "decorators": [],
7733
+ "description": "Дополнительные свойства для бокового календаря",
7734
+ "required": false,
7735
+ "type": "ICalendarProps",
7736
+ "example": null
7737
+ },
7676
7738
  {
7677
7739
  "name": "calendarType",
7678
7740
  "decorators": [],
@@ -35000,6 +35062,15 @@
35000
35062
  }
35001
35063
  ]
35002
35064
  },
35065
+ {
35066
+ "name": "renderLoading",
35067
+ "decorators": [],
35068
+ "description": "",
35069
+ "required": false,
35070
+ "type": "any",
35071
+ "example": null,
35072
+ "parameters": []
35073
+ },
35003
35074
  {
35004
35075
  "name": "renderPagination",
35005
35076
  "decorators": [],
@@ -35653,6 +35724,15 @@
35653
35724
  }
35654
35725
  ]
35655
35726
  },
35727
+ {
35728
+ "name": "renderLoading",
35729
+ "decorators": [],
35730
+ "description": "",
35731
+ "required": false,
35732
+ "type": "any",
35733
+ "example": null,
35734
+ "parameters": []
35735
+ },
35656
35736
  {
35657
35737
  "name": "renderPagination",
35658
35738
  "decorators": [],
package/en.json CHANGED
@@ -988,9 +988,10 @@
988
988
  "Количество элементов на странице, используется для корректного отображения пагинации": "",
989
989
  "Параметры роутинга": "",
990
990
  "Сохранение в localStorage уровней вложенности.": "",
991
- "Свойства для сетки дня": "",
992
- "Свойства для сетки месяца": "",
993
- "Свойства для сетки недели": "",
991
+ "Дополнительные свойства для бокового календаря": "",
992
+ "Свойства для сетки дня": "",
993
+ "Свойства для сетки месяца": "",
994
+ "Свойства для сетки недели": "",
994
995
  "Конечная дата": "",
995
996
  "Начальная дата": "",
996
997
  "Дополнительные данные которые попадут в дата аттрибут data-icon": "",
@@ -203,6 +203,7 @@ export interface IListOutput {
203
203
  layoutNamesPosition: ListControlPosition;
204
204
  renderList: (children: any) => any;
205
205
  renderEmpty: () => any;
206
+ renderLoading: () => any;
206
207
  renderPagination: () => any;
207
208
  renderPaginationSize: () => any;
208
209
  renderLayoutNames: () => any;
package/hooks/useList.js CHANGED
@@ -57,6 +57,7 @@ var useInitial_1 = __importDefault(require("../hooks/useInitial"));
57
57
  var Pagination_1 = require("../ui/list/Pagination/Pagination");
58
58
  var PaginationSize_1 = require("../ui/list/PaginationSize/PaginationSize");
59
59
  var Empty_1 = require("../ui/list/Empty/Empty");
60
+ var layout_1 = require("../ui/layout");
60
61
  exports.defaultConfig = {
61
62
  actionMethod: 'get',
62
63
  primaryKey: 'id',
@@ -116,12 +117,16 @@ function useList(config) {
116
117
  var list = (0, useSelector_1["default"])(function (state) { return (0, list_1.getList)(state, config.listId); });
117
118
  // Normalize sort config
118
119
  var sort = (0, exports.normalizeSortProps)(config.sort);
120
+ // Loading
121
+ var renderLoading = function () { return (list === null || list === void 0 ? void 0 : list.isLoading)
122
+ ? react_1["default"].createElement(layout_1.Loader, null)
123
+ : null; };
119
124
  // Empty
120
125
  var Empty = require('../ui/list/Empty')["default"];
121
126
  var emptyProps = (0, Empty_1.normalizeEmptyProps)(config.empty);
122
127
  var renderEmpty = function () {
123
128
  var _a;
124
- if (!emptyProps.enable || (list === null || list === void 0 ? void 0 : list.isLoading) || ((_a = list === null || list === void 0 ? void 0 : list.items) === null || _a === void 0 ? void 0 : _a.length) > 0) {
129
+ if (!emptyProps.enable || ((_a = list === null || list === void 0 ? void 0 : list.items) === null || _a === void 0 ? void 0 : _a.length) > 0 || !(list === null || list === void 0 ? void 0 : list.isFetched)) {
125
130
  return null;
126
131
  }
127
132
  return (react_1["default"].createElement(Empty, __assign({ list: list }, emptyProps)));
@@ -129,13 +134,13 @@ function useList(config) {
129
134
  // Pagination size
130
135
  var PaginationSize = require('../ui/list/PaginationSize')["default"];
131
136
  var paginationSizeProps = (0, PaginationSize_1.normalizePaginationSizeProps)(config.paginationSize);
132
- var renderPaginationSize = function () { return paginationSizeProps.enable
137
+ var renderPaginationSize = function () { return paginationSizeProps.enable && (list === null || list === void 0 ? void 0 : list.isFetched)
133
138
  ? (react_1["default"].createElement(PaginationSize, __assign({ list: list }, paginationSizeProps)))
134
139
  : null; };
135
140
  // Pagination
136
141
  var Pagination = require('../ui/list/Pagination')["default"];
137
142
  var paginationProps = (0, Pagination_1.normalizePaginationProps)(config.pagination);
138
- var renderPagination = function () { return paginationProps.enable
143
+ var renderPagination = function () { return paginationProps.enable && (list === null || list === void 0 ? void 0 : list.isFetched)
139
144
  ? (react_1["default"].createElement(Pagination, __assign({ list: list }, paginationProps, { sizeAttribute: paginationSizeProps.attribute })))
140
145
  : null; };
141
146
  // Layout switcher
@@ -284,6 +289,7 @@ function useList(config) {
284
289
  paginationSizePosition: paginationSizeProps.position,
285
290
  layoutNamesPosition: layoutNamesProps.position,
286
291
  renderList: renderList,
292
+ renderLoading: renderLoading,
287
293
  renderEmpty: renderEmpty,
288
294
  renderPagination: renderPagination,
289
295
  renderPaginationSize: renderPaginationSize,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "3.0.16",
3
+ "version": "3.0.17",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {
@@ -45,6 +45,11 @@ export interface ICalendarProps extends IUiComponent {
45
45
  * Отображать Footer для календаря (содержит todayButton)
46
46
  */
47
47
  showFooter?: boolean;
48
+ /**
49
+ * Callback вызываемый при нажатии на кнопку 'Сегодня'
50
+ * @param newDate - текущая дата
51
+ */
52
+ onTodayButtonClick?: (newDate: Date) => void;
48
53
  /**
49
54
  * Количество отображаемых за раз месяцев
50
55
  * @example 1
@@ -24,7 +24,11 @@ function Calendar(props) {
24
24
  if (props.onChange) {
25
25
  props.onChange.call(null, (0, calendar_1.convertDate)(date, null, props.valueFormat, false, true));
26
26
  }
27
- }, [props.onChange, props.valueFormat]);
27
+ if (props.onTodayButtonClick) {
28
+ props.onTodayButtonClick(date);
29
+ setMonth(date);
30
+ }
31
+ }, [props]);
28
32
  var toggleCaptionPanel = (0, react_1.useCallback)(function () {
29
33
  setIsCaptionPanelVisible(!isCaptionPanelVisible);
30
34
  }, [isCaptionPanelVisible]);
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { ICalendarProps } from '../../../ui/content/Calendar/Calendar';
2
3
  import { IModalProps } from '../../../ui/modal/Modal/Modal';
3
4
  import CalendarEnum from './enums/CalendarType';
4
5
  import { ICustomViews } from './hooks/useCustomViews';
@@ -95,7 +96,7 @@ export interface IGridViews {
95
96
  */
96
97
  export interface ICalendarSystemProps extends IUiComponent {
97
98
  /**
98
- * Функция, которая вызовется при смене типа календаря
99
+ * Функция, которая вызывется при смене типа календаря
99
100
  */
100
101
  onChangeCalendarType?: (newType: string) => void;
101
102
  /**
@@ -120,15 +121,15 @@ export interface ICalendarSystemProps extends IUiComponent {
120
121
  eventGroups: IEventGroup[];
121
122
  };
122
123
  /**
123
- * Свойства для сетки дня
124
+ * Свойства для сетки дня
124
125
  */
125
126
  dayGrid?: IGridViews;
126
127
  /**
127
- * Свойства для сетки недели
128
+ * Свойства для сетки недели
128
129
  */
129
130
  weekGrid?: IGridViews;
130
131
  /**
131
- * Свойства для сетки месяца
132
+ * Свойства для сетки месяца
132
133
  */
133
134
  monthGrid?: IGridViews;
134
135
  users: ICalendarUser[];
@@ -136,9 +137,13 @@ export interface ICalendarSystemProps extends IUiComponent {
136
137
  * Дополнительные свойства, которые передаются во view компонента
137
138
  */
138
139
  additionalViewProps?: Record<string, any>;
140
+ /**
141
+ * Дополнительные свойства для бокового календаря
142
+ */
143
+ asideCalendarProps?: ICalendarProps;
139
144
  [key: string]: any;
140
145
  }
141
- export interface ICalendarSystemViewProps extends Pick<ICalendarSystemProps, 'className' | 'style' | 'additionalViewProps' | 'users'> {
146
+ export interface ICalendarSystemViewProps extends Pick<ICalendarSystemProps, 'className' | 'style' | 'additionalViewProps' | 'users' | 'asideCalendarProps'> {
142
147
  onCalendarChangedMonth: (newDate: Date) => void;
143
148
  eventGroups: IEventGroup[];
144
149
  eventGroupsTitle: string;
@@ -36,6 +36,7 @@ function CalendarSystem(props) {
36
36
  additionalViewProps: props.additionalViewProps,
37
37
  users: calendarSystem.users,
38
38
  eventGroupsTitle: props.eventBlock.title,
39
+ asideCalendarProps: props.asideCalendarProps,
39
40
  dateToDisplay: calendarSystem.dateToDisplay,
40
41
  eventGroups: calendarSystem.innerEventGroups,
41
42
  calendarType: calendarSystem.calendarType,
@@ -50,7 +51,7 @@ function CalendarSystem(props) {
50
51
  monthGridProps: __assign({ monthGridWeekDays: calendarSystem.monthGridWeekDays, monthGridCalendarDays: calendarSystem.monthGridCalendarDays }, monthGridViews),
51
52
  weekGridProps: __assign({ weekGridTwentyFourHoursArray: calendarSystem.weekGridTwentyFourHoursArray, weekGridCurrentWeekDays: calendarSystem.weekGridCurrentWeekDays }, weekGridViews),
52
53
  dayGridProps: __assign({ dayGridTwentyFourHoursArray: calendarSystem.dayGridTwentyFourHoursArray, dayGridCurrentDay: calendarSystem.dayGridCurrentDay }, dayGridViews)
53
- }); }, [props.className, props.style, props.additionalViewProps, props.eventBlock.title, calendarSystem, monthGridViews, weekGridViews, dayGridViews]);
54
+ }); }, [props.className, props.style, props.additionalViewProps, props.eventBlock.title, props.asideCalendarProps, calendarSystem, monthGridViews, weekGridViews, dayGridViews]);
54
55
  return components.ui.renderView(props.view || 'content.CalendarSystemView', viewProps);
55
56
  }
56
57
  exports["default"] = CalendarSystem;
@@ -192,6 +192,7 @@ export interface IGridViewProps extends Omit<IGridProps, 'onFetch'> {
192
192
  layoutNamesPosition: ListControlPosition;
193
193
  renderList: (children: any) => any;
194
194
  renderEmpty: () => any;
195
+ renderLoading: () => any;
195
196
  renderPagination: () => any;
196
197
  renderPaginationSize: () => any;
197
198
  renderLayoutNames: () => any;
@@ -69,7 +69,7 @@ function Grid(props) {
69
69
  initialItems: props.initialItems,
70
70
  initialTotal: props.initialTotal,
71
71
  autoFetchOnFormChanges: props.autoFetchOnFormChanges
72
- }), list = _a.list, model = _a.model, searchModel = _a.searchModel, paginationPosition = _a.paginationPosition, paginationSizePosition = _a.paginationSizePosition, layoutNamesPosition = _a.layoutNamesPosition, renderList = _a.renderList, renderEmpty = _a.renderEmpty, renderPagination = _a.renderPagination, renderPaginationSize = _a.renderPaginationSize, renderLayoutNames = _a.renderLayoutNames, renderSearchForm = _a.renderSearchForm, onFetch = _a.onFetch, onSort = _a.onSort;
72
+ }), list = _a.list, model = _a.model, searchModel = _a.searchModel, paginationPosition = _a.paginationPosition, paginationSizePosition = _a.paginationSizePosition, layoutNamesPosition = _a.layoutNamesPosition, renderList = _a.renderList, renderLoading = _a.renderLoading, renderEmpty = _a.renderEmpty, renderPagination = _a.renderPagination, renderPaginationSize = _a.renderPaginationSize, renderLayoutNames = _a.renderLayoutNames, renderSearchForm = _a.renderSearchForm, onFetch = _a.onFetch, onSort = _a.onSort;
73
73
  var renderLabel = (0, react_1.useCallback)(function (column) {
74
74
  if (column.headerView) {
75
75
  var HeaderView = column.headerView;
@@ -124,6 +124,7 @@ function Grid(props) {
124
124
  paginationSizePosition: paginationSizePosition,
125
125
  layoutNamesPosition: layoutNamesPosition,
126
126
  renderList: renderList,
127
+ renderLoading: renderLoading,
127
128
  renderEmpty: renderEmpty,
128
129
  renderPagination: renderPagination,
129
130
  renderPaginationSize: renderPaginationSize,
@@ -143,7 +144,7 @@ function Grid(props) {
143
144
  primaryKey: props.primaryKey
144
145
  }); }, [columns, layoutNamesPosition, list, onFetch, onSort, paginationPosition, paginationSizePosition, props.className,
145
146
  props.hasAlternatingColors, props.isLoading, props.listId, props.primaryKey, props.searchForm, props.size, renderEmpty,
146
- renderLayoutNames, renderList, renderPagination, renderPaginationSize, renderSearchForm, renderValue]);
147
+ renderLayoutNames, renderList, renderPagination, renderPaginationSize, renderSearchForm, renderValue, renderLoading]);
147
148
  return components.ui.renderView(props.view || 'list.GridView', viewProps);
148
149
  }
149
150
  exports["default"] = Grid;
@@ -67,7 +67,7 @@ function List(props) {
67
67
  initialItems: props.initialItems,
68
68
  initialTotal: props.initialTotal,
69
69
  autoFetchOnFormChanges: props.autoFetchOnFormChanges
70
- }), list = _a.list, paginationPosition = _a.paginationPosition, paginationSizePosition = _a.paginationSizePosition, layoutNamesPosition = _a.layoutNamesPosition, renderList = _a.renderList, renderEmpty = _a.renderEmpty, renderPagination = _a.renderPagination, renderPaginationSize = _a.renderPaginationSize, renderLayoutNames = _a.renderLayoutNames, renderSearchForm = _a.renderSearchForm;
70
+ }), list = _a.list, paginationPosition = _a.paginationPosition, paginationSizePosition = _a.paginationSizePosition, layoutNamesPosition = _a.layoutNamesPosition, renderList = _a.renderList, renderLoading = _a.renderLoading, renderEmpty = _a.renderEmpty, renderPagination = _a.renderPagination, renderPaginationSize = _a.renderPaginationSize, renderLayoutNames = _a.renderLayoutNames, renderSearchForm = _a.renderSearchForm;
71
71
  var ItemView = props.itemView || components.ui.getView('list.ListItemView');
72
72
  var content = ((list === null || list === void 0 ? void 0 : list.items) || []).map(function (item, index) { return (React.createElement(ItemView, __assign({}, props.itemProps, { key: item[props.primaryKey] || index, primaryKey: props.primaryKey, item: item, index: index, layoutSelected: list.layoutName }))); });
73
73
  var viewProps = (0, react_1.useMemo)(function () { return ({
@@ -76,6 +76,7 @@ function List(props) {
76
76
  paginationSizePosition: paginationSizePosition,
77
77
  layoutNamesPosition: layoutNamesPosition,
78
78
  renderList: renderList,
79
+ renderLoading: renderLoading,
79
80
  renderEmpty: renderEmpty,
80
81
  renderPagination: renderPagination,
81
82
  renderPaginationSize: renderPaginationSize,
@@ -86,7 +87,7 @@ function List(props) {
86
87
  className: props.className,
87
88
  contentClassName: props.contentClassName
88
89
  }); }, [content, layoutNamesPosition, list, paginationPosition, paginationSizePosition, props.className, props.contentClassName,
89
- props.isLoading, renderEmpty, renderLayoutNames, renderList, renderPagination, renderPaginationSize, renderSearchForm]);
90
+ props.isLoading, renderEmpty, renderLayoutNames, renderList, renderPagination, renderPaginationSize, renderSearchForm, renderLoading]);
90
91
  return components.ui.renderView(props.view || 'list.ListView', viewProps);
91
92
  }
92
93
  exports["default"] = List;