@gravity-ui/blog-constructor 2.0.1 → 2.0.2
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/CHANGELOG.md +7 -0
- package/build/cjs/components/Paginator/Paginator.css +3 -0
- package/build/cjs/components/Paginator/components/PaginatorItem.js +31 -4
- package/build/cjs/utils/common.d.ts +1 -0
- package/build/cjs/utils/common.js +6 -1
- package/build/esm/components/Paginator/Paginator.css +3 -0
- package/build/esm/components/Paginator/components/PaginatorItem.js +9 -2
- package/build/esm/utils/common.d.ts +1 -0
- package/build/esm/utils/common.js +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [2.0.2](https://github.com/gravity-ui/blog-constructor/compare/v2.0.1...v2.0.2) (2023-04-05)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* covering pagination buttons into 'a' tag ([#23](https://github.com/gravity-ui/blog-constructor/issues/23)) ([e603f2e](https://github.com/gravity-ui/blog-constructor/commit/e603f2e2b0f86d492132174a1c8172786e7a09a1))
|
9
|
+
|
3
10
|
## [2.0.1](https://github.com/gravity-ui/blog-constructor/compare/v2.0.0...v2.0.1) (2023-04-04)
|
4
11
|
|
5
12
|
|
@@ -1,15 +1,42 @@
|
|
1
1
|
"use strict";
|
2
|
-
var
|
3
|
-
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
4
24
|
};
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
26
|
exports.PaginatorItem = void 0;
|
7
|
-
const react_1 =
|
27
|
+
const react_1 = __importStar(require("react"));
|
8
28
|
const uikit_1 = require("@gravity-ui/uikit");
|
29
|
+
const LocaleContext_1 = require("../../../contexts/LocaleContext");
|
30
|
+
const common_1 = require("../../../utils/common");
|
9
31
|
const cn_1 = require("../../../utils/cn");
|
10
32
|
const b = (0, cn_1.block)('paginator');
|
11
33
|
const PaginatorItem = ({ dataKey, mods, content, onClick, loading = false, }) => {
|
34
|
+
const { locale } = (0, react_1.useContext)(LocaleContext_1.LocaleContext);
|
35
|
+
const urlPath = (0, common_1.getBlogPath)((locale === null || locale === void 0 ? void 0 : locale.pathPrefix) || '');
|
12
36
|
const itemKey = Number(dataKey) > 0 ? Number(dataKey) : dataKey;
|
13
|
-
|
37
|
+
const navTag = itemKey > 0 ? `${mods.type || 'page'}=${itemKey}` : itemKey;
|
38
|
+
const navigationLink = `${urlPath || ''}?${navTag}`;
|
39
|
+
return (react_1.default.createElement("a", { href: navigationLink, className: b('link', mods), onClick: (event) => event.preventDefault() },
|
40
|
+
react_1.default.createElement(uikit_1.Button, { view: "flat", size: "xl", className: b('item', mods), onClick: () => onClick === null || onClick === void 0 ? void 0 : onClick(itemKey), loading: loading && Boolean(mods.active) }, content)));
|
14
41
|
};
|
15
42
|
exports.PaginatorItem = PaginatorItem;
|
@@ -34,6 +34,7 @@ type GetBreadcrumbsProps = {
|
|
34
34
|
tags?: Tag[];
|
35
35
|
pathPrefix?: string;
|
36
36
|
};
|
37
|
+
export declare const getBlogPath: (pathPrefix: string) => string;
|
37
38
|
export declare const getBreadcrumbs: ({ tags, pathPrefix }: GetBreadcrumbsProps) => HeaderBreadCrumbsProps;
|
38
39
|
export declare const isMetrikaExist: (goal: NewMetrikaGoal, existGoals: NewMetrikaGoal[]) => boolean;
|
39
40
|
export declare const getBlogElementMetrika: (blogCustomGoal: NewMetrikaGoal, existingGoals?: MetrikaGoal) => string | string[] | NewMetrikaGoal[];
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
11
11
|
return t;
|
12
12
|
};
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
14
|
-
exports.scrollOnPageChange = exports.getFeedQueryParams = exports.getBlogElementMetrika = exports.isMetrikaExist = exports.getBreadcrumbs = exports.updateContentSizes = exports.getTagFilterUrl = exports.postLikeStatus = exports.getTags = exports.scrollToHash = exports.getPageSearchParams = exports.getAbsolutePath = void 0;
|
14
|
+
exports.scrollOnPageChange = exports.getFeedQueryParams = exports.getBlogElementMetrika = exports.isMetrikaExist = exports.getBreadcrumbs = exports.getBlogPath = exports.updateContentSizes = exports.getTagFilterUrl = exports.postLikeStatus = exports.getTags = exports.scrollToHash = exports.getPageSearchParams = exports.getAbsolutePath = void 0;
|
15
15
|
const url_1 = require("url");
|
16
16
|
const lodash_1 = require("lodash");
|
17
17
|
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
@@ -65,6 +65,11 @@ const updateContentSizes = (_a) => {
|
|
65
65
|
return (Object.assign(Object.assign({}, contentData), { size: size || constants_1.CONTENT_DEFAULT_SIZE, colSizes: colSizes || constants_1.CONTENT_DEFAULT_COL_SIZES, theme: theme || constants_1.CONTENT_DEFAULT_THEME }));
|
66
66
|
};
|
67
67
|
exports.updateContentSizes = updateContentSizes;
|
68
|
+
const getBlogPath = (pathPrefix) => {
|
69
|
+
const prefix = pathPrefix ? `/${pathPrefix}/` : '/';
|
70
|
+
return `${prefix}blog`;
|
71
|
+
};
|
72
|
+
exports.getBlogPath = getBlogPath;
|
68
73
|
const getBreadcrumbs = ({ tags, pathPrefix }) => {
|
69
74
|
const prefix = pathPrefix ? `/${pathPrefix}/` : '/';
|
70
75
|
const breadcrumbs = {
|
@@ -1,9 +1,16 @@
|
|
1
|
-
import React from 'react';
|
1
|
+
import React, { useContext } from 'react';
|
2
2
|
import { Button } from '@gravity-ui/uikit';
|
3
|
+
import { LocaleContext } from '../../../contexts/LocaleContext';
|
4
|
+
import { getBlogPath } from '../../../utils/common';
|
3
5
|
import { block } from '../../../utils/cn';
|
4
6
|
import '../Paginator.css';
|
5
7
|
const b = block('paginator');
|
6
8
|
export const PaginatorItem = ({ dataKey, mods, content, onClick, loading = false, }) => {
|
9
|
+
const { locale } = useContext(LocaleContext);
|
10
|
+
const urlPath = getBlogPath((locale === null || locale === void 0 ? void 0 : locale.pathPrefix) || '');
|
7
11
|
const itemKey = Number(dataKey) > 0 ? Number(dataKey) : dataKey;
|
8
|
-
|
12
|
+
const navTag = itemKey > 0 ? `${mods.type || 'page'}=${itemKey}` : itemKey;
|
13
|
+
const navigationLink = `${urlPath || ''}?${navTag}`;
|
14
|
+
return (React.createElement("a", { href: navigationLink, className: b('link', mods), onClick: (event) => event.preventDefault() },
|
15
|
+
React.createElement(Button, { view: "flat", size: "xl", className: b('item', mods), onClick: () => onClick === null || onClick === void 0 ? void 0 : onClick(itemKey), loading: loading && Boolean(mods.active) }, content)));
|
9
16
|
};
|
@@ -34,6 +34,7 @@ type GetBreadcrumbsProps = {
|
|
34
34
|
tags?: Tag[];
|
35
35
|
pathPrefix?: string;
|
36
36
|
};
|
37
|
+
export declare const getBlogPath: (pathPrefix: string) => string;
|
37
38
|
export declare const getBreadcrumbs: ({ tags, pathPrefix }: GetBreadcrumbsProps) => HeaderBreadCrumbsProps;
|
38
39
|
export declare const isMetrikaExist: (goal: NewMetrikaGoal, existGoals: NewMetrikaGoal[]) => boolean;
|
39
40
|
export declare const getBlogElementMetrika: (blogCustomGoal: NewMetrikaGoal, existingGoals?: MetrikaGoal) => string | string[] | NewMetrikaGoal[];
|
@@ -57,6 +57,10 @@ export const updateContentSizes = (_a) => {
|
|
57
57
|
var { size, colSizes, theme } = _a, contentData = __rest(_a, ["size", "colSizes", "theme"]);
|
58
58
|
return (Object.assign(Object.assign({}, contentData), { size: size || CONTENT_DEFAULT_SIZE, colSizes: colSizes || CONTENT_DEFAULT_COL_SIZES, theme: theme || CONTENT_DEFAULT_THEME }));
|
59
59
|
};
|
60
|
+
export const getBlogPath = (pathPrefix) => {
|
61
|
+
const prefix = pathPrefix ? `/${pathPrefix}/` : '/';
|
62
|
+
return `${prefix}blog`;
|
63
|
+
};
|
60
64
|
export const getBreadcrumbs = ({ tags, pathPrefix }) => {
|
61
65
|
const prefix = pathPrefix ? `/${pathPrefix}/` : '/';
|
62
66
|
const breadcrumbs = {
|