@steroidsjs/core 2.2.13 → 2.2.16
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/hooks/useDataProvider.js +2 -1
- package/hooks/useLayout.js +1 -1
- package/hooks/useList.d.ts +5 -0
- package/hooks/useList.js +5 -3
- package/package.json +1 -1
- package/ui/list/Grid/Grid.js +2 -1
- package/ui/list/List/List.js +2 -1
package/hooks/useDataProvider.js
CHANGED
|
@@ -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
|
|
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
|
}
|
package/hooks/useLayout.js
CHANGED
|
@@ -91,7 +91,7 @@ function useLayout(initAction) {
|
|
|
91
91
|
isInitialized: auth_1.isInitialized(state),
|
|
92
92
|
initializeCounter: auth_1.getInitializeCounter(state),
|
|
93
93
|
redirectPageId: state.auth.redirectPageId,
|
|
94
|
-
loginRouteId: Object.keys(routesMap).find(function (name) { return routesMap[name].role === Router_1.ROUTER_ROLE_LOGIN; })
|
|
94
|
+
loginRouteId: routesMap && Object.keys(routesMap).find(function (name) { return routesMap[name].role === Router_1.ROUTER_ROLE_LOGIN; })
|
|
95
95
|
};
|
|
96
96
|
}), route = _a.route, user = _a.user, data = _a.data, isInitialized = _a.isInitialized, initializeCounter = _a.initializeCounter, redirectPageId = _a.redirectPageId, loginRouteId = _a.loginRouteId;
|
|
97
97
|
var _b = react_1.useState(null), error = _b[0], setError = _b[1];
|
package/hooks/useList.d.ts
CHANGED
|
@@ -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
|
-
|
|
229
|
+
if (config.autoFetchOnFormChanges !== false) {
|
|
230
|
+
dispatch(list_2.listLazyFetch(config.listId));
|
|
231
|
+
}
|
|
230
232
|
}
|
|
231
|
-
}, [config.listId, dispatch, formId, formValues,
|
|
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
package/ui/list/Grid/Grid.js
CHANGED
|
@@ -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) {
|
package/ui/list/List/List.js
CHANGED
|
@@ -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 }))); });
|