@steroidsjs/core 2.2.82 → 2.2.85
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/actions/list.d.ts +2 -1
- package/actions/list.js +9 -5
- package/package.json +1 -1
- package/ui/list/Pagination/Pagination.js +9 -5
- package/utils/form.js +1 -1
package/actions/list.d.ts
CHANGED
|
@@ -84,8 +84,9 @@ export declare const listDestroy: (listId: string) => {
|
|
|
84
84
|
listId: string;
|
|
85
85
|
type: string;
|
|
86
86
|
};
|
|
87
|
-
export declare const add: (listId: any, item: any) => {
|
|
87
|
+
export declare const add: (listId: any, item: any, prepend?: boolean) => {
|
|
88
88
|
item: any;
|
|
89
|
+
prepend: boolean;
|
|
89
90
|
listId: any;
|
|
90
91
|
type: string;
|
|
91
92
|
};
|
package/actions/list.js
CHANGED
|
@@ -269,11 +269,15 @@ var listDestroy = function (listId) {
|
|
|
269
269
|
};
|
|
270
270
|
};
|
|
271
271
|
exports.listDestroy = listDestroy;
|
|
272
|
-
var add = function (listId, item) {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
var add = function (listId, item, prepend) {
|
|
273
|
+
if (prepend === void 0) { prepend = false; }
|
|
274
|
+
return ({
|
|
275
|
+
item: item,
|
|
276
|
+
prepend: prepend,
|
|
277
|
+
listId: listId,
|
|
278
|
+
type: exports.LIST_ITEM_ADD
|
|
279
|
+
});
|
|
280
|
+
};
|
|
277
281
|
exports.add = add;
|
|
278
282
|
var update = function (listId, item, condition) { return ({
|
|
279
283
|
item: item,
|
package/package.json
CHANGED
|
@@ -75,11 +75,15 @@ function Pagination(props) {
|
|
|
75
75
|
}) || initialValues, page = _e.page, pageSize = _e.pageSize;
|
|
76
76
|
var totalPages = Math.ceil((((_c = props.list) === null || _c === void 0 ? void 0 : _c.total) || 0) / (pageSize || 1));
|
|
77
77
|
var pages = react_1.useMemo(function () { return exports.generatePages(page, totalPages, props.aroundCount)
|
|
78
|
-
.map(function (pageItem
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
.map(function (pageItem, index, pages) {
|
|
79
|
+
// Номер страницы для '...' кнопки (выбирает страницу между двумя соседними пронумерованными)
|
|
80
|
+
var pageNumberForButtonWithDots = Math.floor(((pages[index + 1] + pages[index - 1]) / 2));
|
|
81
|
+
return {
|
|
82
|
+
page: pageItem !== '...' ? pageItem : pageNumberForButtonWithDots,
|
|
83
|
+
label: pageItem,
|
|
84
|
+
isActive: page === pageItem
|
|
85
|
+
};
|
|
86
|
+
}); }, [page, props.aroundCount, totalPages]);
|
|
83
87
|
var onSelect = react_1.useCallback(function (newPage) {
|
|
84
88
|
if (formDispatch) {
|
|
85
89
|
formDispatch(form_1.formChange(formId, props.attribute, newPage));
|
package/utils/form.js
CHANGED
|
@@ -64,7 +64,7 @@ var mergeLayoutProp = function (layout1, layout2) {
|
|
|
64
64
|
exports.mergeLayoutProp = mergeLayoutProp;
|
|
65
65
|
var cleanEmptyObject = function (object) {
|
|
66
66
|
// if all properties are null substitute the object with null
|
|
67
|
-
if (!Object.values(object).some(function (x) { return x; })) {
|
|
67
|
+
if (!Object.values(object).some(function (x) { return x !== null; })) {
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
70
70
|
Object.keys(object).forEach(function (key) {
|