@steroidsjs/core 2.2.12 → 2.2.15

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.
@@ -53,6 +53,7 @@ exports.__esModule = true;
53
53
  var react_redux_1 = require("react-redux");
54
54
  var isString_1 = __importDefault(require("lodash-es/isString"));
55
55
  var isFunction_1 = __importDefault(require("lodash-es/isFunction"));
56
+ var isEqual_1 = __importDefault(require("lodash-es/isEqual"));
56
57
  var react_1 = require("react");
57
58
  var react_use_1 = require("react-use");
58
59
  var data_1 = require("../utils/data");
@@ -133,7 +134,7 @@ function useDataProvider(config) {
133
134
  clearTimeout(delayTimerRef.current);
134
135
  }
135
136
  // Changed query logic
136
- if (prevQuery !== config.query || prevParams !== dataProvider.params) {
137
+ if (prevQuery !== config.query || !isEqual_1["default"](prevParams, dataProvider.params)) {
137
138
  // Search with delay
138
139
  delayTimerRef.current = setTimeout(fetchRemote, autoComplete.delay);
139
140
  }
@@ -84,6 +84,11 @@ export interface IListConfig {
84
84
  * @example true
85
85
  */
86
86
  autoDestroy?: boolean;
87
+ /**
88
+ * Отправлять запрос на обновление данных при изменении данных формы. По-умолчанию - включено.
89
+ * @example false
90
+ */
91
+ autoFetchOnFormChanges?: boolean;
87
92
  /**
88
93
  * Обработчик, который вызывается при изменении значений формы, и нужен для подгрузки новых элементов коллекции
89
94
  * @param {IList} list
package/hooks/useList.js CHANGED
@@ -226,10 +226,12 @@ function useList(config) {
226
226
  // Sync with address bar
227
227
  updateQuery(formValues);
228
228
  // Send request
229
- dispatch(list_2.listLazyFetch(config.listId));
229
+ if (config.autoFetchOnFormChanges !== false) {
230
+ dispatch(list_2.listLazyFetch(config.listId));
231
+ }
230
232
  }
231
- }, [config.listId, dispatch, formId, formValues, paginationProps.attribute,
232
- paginationProps.defaultValue, prevFormValues, updateQuery]);
233
+ }, [config.autoFetchOnFormChanges, config.listId, dispatch, formId, formValues,
234
+ paginationProps.attribute, paginationProps.defaultValue, prevFormValues, updateQuery]);
233
235
  // Check change query
234
236
  var prevQuery = react_use_1.usePrevious(config.query);
235
237
  react_use_1.useUpdateEffect(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "2.2.12",
3
+ "version": "2.2.15",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {
@@ -69,8 +69,8 @@ var buildUrl = function (path, params) {
69
69
  var pathKeys = [];
70
70
  try {
71
71
  pathKeys = path_to_regexp_1.parse(path)
72
- .slice(1)
73
- .map(function (p) { return p.name; });
72
+ .map(function (p) { return typeof p === 'object' && p.name; })
73
+ .filter(Boolean);
74
74
  url = path_to_regexp_1.compile(path)(__assign({}, params));
75
75
  }
76
76
  catch (e) {
@@ -64,7 +64,8 @@ function Grid(props) {
64
64
  searchModel: props.searchModel,
65
65
  items: props.items,
66
66
  initialItems: props.initialItems,
67
- initialTotal: props.initialTotal
67
+ initialTotal: props.initialTotal,
68
+ autoFetchOnFormChanges: props.autoFetchOnFormChanges
68
69
  }), 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;
69
70
  var renderLabel = react_1.useCallback(function (column) {
70
71
  if (column.headerView) {
@@ -59,7 +59,8 @@ function List(props) {
59
59
  searchModel: props.searchModel,
60
60
  items: props.items,
61
61
  initialItems: props.initialItems,
62
- initialTotal: props.initialTotal
62
+ initialTotal: props.initialTotal,
63
+ autoFetchOnFormChanges: props.autoFetchOnFormChanges
63
64
  }), 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;
64
65
  var ItemView = props.itemView || components.ui.getView('list.ListItemView');
65
66
  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 }))); });