@snack-uikit/toolbar 0.14.0 → 0.14.1-preview-2e8e737d.0
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 +8 -0
- package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/serializer.d.ts +5 -0
- package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/serializer.js +5 -3
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.js +9 -1
- package/dist/esm/components/Toolbar/hooks/usePersistState/utils/serializer.d.ts +5 -0
- package/dist/esm/components/Toolbar/hooks/usePersistState/utils/serializer.js +3 -2
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.js +1 -0
- package/package.json +2 -2
- package/src/components/Toolbar/hooks/usePersistState/utils/serializer.ts +5 -2
- package/src/components/index.ts +1 -0
package/README.md
CHANGED
|
@@ -9,6 +9,14 @@ Toolbar
|
|
|
9
9
|
|
|
10
10
|
[//]: DOCUMENTATION_SECTION_START
|
|
11
11
|
[//]: THIS_SECTION_IS_AUTOGENERATED_PLEASE_DONT_EDIT_IT
|
|
12
|
+
## formatFilterStateToRequestPayload
|
|
13
|
+
### Props
|
|
14
|
+
| name | type | default value | description |
|
|
15
|
+
|------|------|---------------|-------------|
|
|
16
|
+
| pagination | `PaginationParams` | - | |
|
|
17
|
+
| sorting | `FieldSort[]` | - | |
|
|
18
|
+
| search | `string` | - | |
|
|
19
|
+
| filter | `FiltersState` | - | |
|
|
12
20
|
## Toolbar
|
|
13
21
|
### Props
|
|
14
22
|
| name | type | default value | description |
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { RequestPayloadParams } from '@cloud-ru/ft-request-payload-transform';
|
|
1
2
|
import { FiltersState } from '@snack-uikit/chips';
|
|
2
3
|
import { PersistedFilterState } from '../../../types';
|
|
4
|
+
export declare const formatFilterStateToRequestPayload: <T extends FiltersState>(value?: PersistedFilterState<T> | null) => {
|
|
5
|
+
toObject(): Partial<RequestPayloadParams>;
|
|
6
|
+
toString(): string;
|
|
7
|
+
};
|
|
3
8
|
export declare const defaultSerializer: <T extends FiltersState>(value: PersistedFilterState<T>) => string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.defaultSerializer = void 0;
|
|
6
|
+
exports.defaultSerializer = exports.formatFilterStateToRequestPayload = void 0;
|
|
7
7
|
const ft_request_payload_transform_1 = require("@cloud-ru/ft-request-payload-transform");
|
|
8
8
|
const utils_1 = require("./utils");
|
|
9
9
|
const mapValueToString = filter => {
|
|
@@ -35,13 +35,15 @@ const mapFilterToPayload = value => {
|
|
|
35
35
|
};
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
|
-
const
|
|
38
|
+
const formatFilterStateToRequestPayload = value => {
|
|
39
39
|
var _a;
|
|
40
40
|
return (0, ft_request_payload_transform_1.createRequestPayload)({
|
|
41
41
|
pagination: value === null || value === void 0 ? void 0 : value.pagination,
|
|
42
42
|
search: (_a = value === null || value === void 0 ? void 0 : value.search) !== null && _a !== void 0 ? _a : '',
|
|
43
43
|
sort: value === null || value === void 0 ? void 0 : value.sorting,
|
|
44
44
|
filter: mapFilterToPayload(value === null || value === void 0 ? void 0 : value.filter)
|
|
45
|
-
})
|
|
45
|
+
});
|
|
46
46
|
};
|
|
47
|
+
exports.formatFilterStateToRequestPayload = formatFilterStateToRequestPayload;
|
|
48
|
+
const defaultSerializer = value => (0, exports.formatFilterStateToRequestPayload)(value).toString();
|
|
47
49
|
exports.defaultSerializer = defaultSerializer;
|
|
@@ -22,4 +22,12 @@ var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
|
22
22
|
Object.defineProperty(exports, "__esModule", {
|
|
23
23
|
value: true
|
|
24
24
|
});
|
|
25
|
-
|
|
25
|
+
exports.formatFilterStateToRequestPayload = void 0;
|
|
26
|
+
__exportStar(require("./Toolbar"), exports);
|
|
27
|
+
var utils_1 = require("./Toolbar/hooks/usePersistState/utils");
|
|
28
|
+
Object.defineProperty(exports, "formatFilterStateToRequestPayload", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return utils_1.formatFilterStateToRequestPayload;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { RequestPayloadParams } from '@cloud-ru/ft-request-payload-transform';
|
|
1
2
|
import { FiltersState } from '@snack-uikit/chips';
|
|
2
3
|
import { PersistedFilterState } from '../../../types';
|
|
4
|
+
export declare const formatFilterStateToRequestPayload: <T extends FiltersState>(value?: PersistedFilterState<T> | null) => {
|
|
5
|
+
toObject(): Partial<RequestPayloadParams>;
|
|
6
|
+
toString(): string;
|
|
7
|
+
};
|
|
3
8
|
export declare const defaultSerializer: <T extends FiltersState>(value: PersistedFilterState<T>) => string;
|
|
@@ -27,12 +27,13 @@ const mapFilterToPayload = (value) => {
|
|
|
27
27
|
field: key,
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
|
-
export const
|
|
30
|
+
export const formatFilterStateToRequestPayload = (value) => {
|
|
31
31
|
var _a;
|
|
32
32
|
return createRequestPayload({
|
|
33
33
|
pagination: value === null || value === void 0 ? void 0 : value.pagination,
|
|
34
34
|
search: (_a = value === null || value === void 0 ? void 0 : value.search) !== null && _a !== void 0 ? _a : '',
|
|
35
35
|
sort: value === null || value === void 0 ? void 0 : value.sorting,
|
|
36
36
|
filter: mapFilterToPayload(value === null || value === void 0 ? void 0 : value.filter),
|
|
37
|
-
})
|
|
37
|
+
});
|
|
38
38
|
};
|
|
39
|
+
export const defaultSerializer = (value) => formatFilterStateToRequestPayload(value).toString();
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Toolbar",
|
|
7
|
-
"version": "0.14.0",
|
|
7
|
+
"version": "0.14.1-preview-2e8e737d.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@snack-uikit/locale": "*"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "0dba3baf9e1ccde8b126ff9953894ca582e7b8ac"
|
|
56
56
|
}
|
|
@@ -40,10 +40,13 @@ const mapFilterToPayload = (value?: FiltersState): RequestPayloadParams['filter'
|
|
|
40
40
|
);
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
export const
|
|
43
|
+
export const formatFilterStateToRequestPayload = <T extends FiltersState>(value?: PersistedFilterState<T> | null) =>
|
|
44
44
|
createRequestPayload({
|
|
45
45
|
pagination: value?.pagination,
|
|
46
46
|
search: value?.search ?? '',
|
|
47
47
|
sort: value?.sorting,
|
|
48
48
|
filter: mapFilterToPayload(value?.filter),
|
|
49
|
-
})
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export const defaultSerializer = <T extends FiltersState>(value: PersistedFilterState<T>) =>
|
|
52
|
+
formatFilterStateToRequestPayload(value).toString();
|
package/src/components/index.ts
CHANGED