@steroidsjs/core 3.0.18 → 3.0.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.
package/README.md CHANGED
@@ -24,3 +24,11 @@ Our Open-Source **Steroids** framework is an ecosystem based on React and Redux
24
24
 
25
25
  Explore and immerse yourself in the world of rapid development through documentation [Documentation](https://steroids.kozhin.dev/ru/docs/getting-started).
26
26
 
27
+ ## Directions for applied use of the Steroids framework
28
+
29
+ - Creation of various websites (for example, an online store website)
30
+ - Creation of CRM and ERP systems
31
+ - Creation of SPA applications
32
+ - Creation of admin panels
33
+ - Creation of personal accounts
34
+
@@ -7604,6 +7604,15 @@
7604
7604
  "example": null,
7605
7605
  "defaultValue": null
7606
7606
  },
7607
+ {
7608
+ "name": "children",
7609
+ "decorators": [],
7610
+ "description": "Дочерние элементы",
7611
+ "required": false,
7612
+ "type": "ReactNode",
7613
+ "example": null,
7614
+ "defaultValue": null
7615
+ },
7607
7616
  {
7608
7617
  "name": "className",
7609
7618
  "decorators": [],
@@ -7743,6 +7752,14 @@
7743
7752
  "type": "default",
7744
7753
  "example": null
7745
7754
  },
7755
+ {
7756
+ "name": "children",
7757
+ "decorators": [],
7758
+ "description": "",
7759
+ "required": true,
7760
+ "type": "ReactNode",
7761
+ "example": null
7762
+ },
7746
7763
  {
7747
7764
  "name": "className",
7748
7765
  "decorators": [],
@@ -86,7 +86,7 @@ var defaultProps = {
86
86
  */
87
87
  function useDataProvider(config) {
88
88
  var _this = this;
89
- var _a;
89
+ var _a, _b;
90
90
  var components = (0, index_1.useComponents)();
91
91
  var dispatch = (0, index_1.useDispatch)();
92
92
  var reduxDataProviderId = (_a = config.dataProvider) === null || _a === void 0 ? void 0 : _a.reduxId;
@@ -95,10 +95,10 @@ function useDataProvider(config) {
95
95
  // Initial items
96
96
  var initialItems = (0, data_1.normalizeItems)(enumItems || config.items);
97
97
  // Items state
98
- var _b = (0, react_1.useState)(initialItems), items = _b[0], setItems = _b[1];
99
- var _c = (0, react_1.useState)(false), isLoading = _c[0], setIsLoading = _c[1];
98
+ var _c = (0, react_1.useState)(initialItems), items = _c[0], setItems = _c[1];
99
+ var _d = (0, react_1.useState)(false), isLoading = _d[0], setIsLoading = _d[1];
100
100
  // Source items state (redux or local)
101
- var _d = (0, react_1.useState)(initialItems), sourceInternalItems = _d[0], setSourceInternalItems = _d[1];
101
+ var _e = (0, react_1.useState)(initialItems), sourceInternalItems = _e[0], setSourceInternalItems = _e[1];
102
102
  var sourceReduxItems = (0, react_redux_1.useSelector)(function (state) { return (0, fields_2.getDataProviderItems)(state, reduxDataProviderId); });
103
103
  var sourceItems = reduxDataProviderId ? sourceReduxItems : sourceInternalItems;
104
104
  var setSourceItems = (0, react_1.useCallback)(function (value) {
@@ -125,7 +125,9 @@ function useDataProvider(config) {
125
125
  var prevQuery = (0, react_use_1.usePrevious)(config.query);
126
126
  var prevParams = (0, react_use_1.usePrevious)(dataProvider.params);
127
127
  var prevValues = (0, react_use_1.usePrevious)(config.initialSelectedIds);
128
+ var prevAction = (0, react_use_1.usePrevious)((_b = config === null || config === void 0 ? void 0 : config.dataProvider) === null || _b === void 0 ? void 0 : _b.action);
128
129
  (0, react_1.useEffect)(function () {
130
+ var _a;
129
131
  var fetchRemote = function (isAuto) { return __awaiter(_this, void 0, void 0, function () {
130
132
  var searchHandler, result, newItems;
131
133
  var _a;
@@ -169,6 +171,10 @@ function useDataProvider(config) {
169
171
  fetchRemote(false);
170
172
  }
171
173
  else if (autoComplete.enable || (config.autoFetch && isAutoFetchedRef.current === true)) {
174
+ // Fetch data when action changes
175
+ if (prevAction !== ((_a = config === null || config === void 0 ? void 0 : config.dataProvider) === null || _a === void 0 ? void 0 : _a.action)) {
176
+ fetchRemote(false);
177
+ }
172
178
  if (delayTimerRef.current) {
173
179
  clearTimeout(delayTimerRef.current);
174
180
  }
@@ -178,9 +184,8 @@ function useDataProvider(config) {
178
184
  delayTimerRef.current = setTimeout(fetchRemote, autoComplete.delay);
179
185
  }
180
186
  }
181
- }, [autoComplete, components.http, config.autoFetch,
182
- config.dataProvider, config.initialSelectedIds, config.query, dataProvider,
183
- dataProvider.action, dataProvider.onSearch, prevParams, prevQuery, prevValues, setSourceItems, sourceItems]);
187
+ }, [autoComplete, components.http, config.autoFetch, config.dataProvider, config.initialSelectedIds, config.query, dataProvider,
188
+ dataProvider.action, dataProvider.onSearch, prevAction, prevParams, prevQuery, prevValues, setSourceItems, sourceItems]);
184
189
  return {
185
190
  sourceItems: sourceItems,
186
191
  items: items,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "3.0.18",
3
+ "version": "3.0.20",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {
@@ -141,6 +141,10 @@ export interface ICalendarSystemProps extends IUiComponent {
141
141
  * Дополнительные свойства для бокового календаря
142
142
  */
143
143
  asideCalendarProps?: ICalendarProps;
144
+ /**
145
+ * Дочерние элементы
146
+ */
147
+ children?: React.ReactNode;
144
148
  [key: string]: any;
145
149
  }
146
150
  export interface ICalendarSystemViewProps extends Pick<ICalendarSystemProps, 'className' | 'style' | 'additionalViewProps' | 'users' | 'asideCalendarProps'> {
@@ -153,6 +157,7 @@ export interface ICalendarSystemViewProps extends Pick<ICalendarSystemProps, 'cl
153
157
  handleCalendarTypeChange: (newType: string) => void;
154
158
  onClickControl: (event: React.MouseEvent<HTMLElement>) => void;
155
159
  calendarType: CalendarEnum;
160
+ children: React.ReactNode;
156
161
  getEventsFromDate: (dateFromDay: Date, currentCalendarType: CalendarEnum) => IEvent[];
157
162
  openEditModal: (event: IEvent) => void;
158
163
  openCreateModal: (eventInitialDay?: IDay) => void;
@@ -37,6 +37,7 @@ function CalendarSystem(props) {
37
37
  users: calendarSystem.users,
38
38
  eventGroupsTitle: props.eventBlock.title,
39
39
  asideCalendarProps: props.asideCalendarProps,
40
+ children: props.children,
40
41
  dateToDisplay: calendarSystem.dateToDisplay,
41
42
  eventGroups: calendarSystem.innerEventGroups,
42
43
  calendarType: calendarSystem.calendarType,
@@ -51,7 +52,7 @@ function CalendarSystem(props) {
51
52
  monthGridProps: __assign({ monthGridWeekDays: calendarSystem.monthGridWeekDays, monthGridCalendarDays: calendarSystem.monthGridCalendarDays }, monthGridViews),
52
53
  weekGridProps: __assign({ weekGridTwentyFourHoursArray: calendarSystem.weekGridTwentyFourHoursArray, weekGridCurrentWeekDays: calendarSystem.weekGridCurrentWeekDays }, weekGridViews),
53
54
  dayGridProps: __assign({ dayGridTwentyFourHoursArray: calendarSystem.dayGridTwentyFourHoursArray, dayGridCurrentDay: calendarSystem.dayGridCurrentDay }, dayGridViews)
54
- }); }, [props.className, props.style, props.additionalViewProps, props.eventBlock.title, props.asideCalendarProps, calendarSystem, monthGridViews, weekGridViews, dayGridViews]);
55
+ }); }, [props.className, props.style, props.additionalViewProps, props.eventBlock.title, props.asideCalendarProps, props.children, calendarSystem, monthGridViews, weekGridViews, dayGridViews]);
55
56
  return components.ui.renderView(props.view || 'content.CalendarSystemView', viewProps);
56
57
  }
57
58
  exports["default"] = CalendarSystem;
@@ -35,8 +35,8 @@ function TextField(props) {
35
35
  var onClear = (0, react_1.useCallback)(function () { return props.input.onChange(''); }, [props.input]);
36
36
  var inputProps = (0, react_1.useMemo)(function () {
37
37
  var _a;
38
- return (__assign({ name: props.input.name, value: (_a = props.input.value) !== null && _a !== void 0 ? _a : '', onChange: handleChange, onKeyUp: onKeyUp, placeholder: props.placeholder, disabled: props.disabled, ref: inputRef }, props.inputProps));
39
- }, [props.input.name, props.input.value, props.placeholder, props.disabled, props.inputProps, handleChange, onKeyUp, inputRef]);
38
+ return (__assign({ name: props.input.name, value: (_a = props.input.value) !== null && _a !== void 0 ? _a : '', onChange: handleChange, onKeyUp: onKeyUp, placeholder: props.placeholder, disabled: props.disabled, required: props.required, ref: inputRef }, props.inputProps));
39
+ }, [props.input.name, props.input.value, props.placeholder, props.disabled, props.required, props.inputProps, handleChange, onKeyUp, inputRef]);
40
40
  var viewProps = (0, react_1.useMemo)(function () { return (__assign(__assign({}, props.viewProps), { inputProps: inputProps, onClear: onClear, errors: props.errors, size: props.size, className: props.className, showClear: props.showClear })); }, [inputProps, onClear, props.className, props.errors, props.showClear, props.size, props.viewProps]);
41
41
  return components.ui.renderView(props.view || 'form.TextFieldView', viewProps);
42
42
  }