@gravity-ui/page-constructor 4.15.1-alpha.0 → 4.15.1
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/build/cjs/blocks/HeaderSlider/schema.js +2 -2
- package/build/cjs/blocks/Info/schema.js +2 -2
- package/build/cjs/blocks/Media/schema.js +3 -2
- package/build/cjs/blocks/Questions/schema.js +2 -2
- package/build/cjs/blocks/Slider/Slider.js +6 -4
- package/build/cjs/blocks/Slider/utils.js +2 -2
- package/build/cjs/blocks/Tabs/schema.js +2 -2
- package/build/cjs/components/BalancedMasonry/BalancedMasonry.js +6 -4
- package/build/cjs/components/CardBase/CardBase.d.ts +1 -0
- package/build/cjs/components/CardBase/CardBase.js +7 -6
- package/build/cjs/components/FullWidthBackground/FullWidthBackground.js +2 -2
- package/build/cjs/components/Image/Image.d.ts +5 -0
- package/build/cjs/components/Image/Image.js +7 -8
- package/build/cjs/components/Map/GoogleMap.js +2 -2
- package/build/cjs/components/Map/YMap/YandexMap.js +2 -2
- package/build/cjs/components/Media/Image/Image.js +2 -2
- package/build/cjs/components/OverflowScroller/OverflowScroller.js +2 -2
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +2 -2
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +2 -2
- package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +2 -2
- package/build/cjs/editor/components/BlockForm/BlockForm.js +4 -3
- package/build/cjs/editor/components/PagePropsForm/PagePropsForm.js +2 -2
- package/build/cjs/editor/dynamic-forms-custom/components/OneOfCustom/OneOfCustom.js +2 -2
- package/build/cjs/editor/dynamic-forms-custom/config.js +2 -2
- package/build/cjs/editor/dynamic-forms-custom/hooks/useOneOf.js +5 -4
- package/build/cjs/editor/store/utils.js +2 -2
- package/build/cjs/editor/utils/index.js +2 -2
- package/build/cjs/hooks/useFocus.js +2 -2
- package/build/cjs/hooks/useHeightCalculator.js +2 -2
- package/build/cjs/hooks/useWindowBreakpoint.js +2 -2
- package/build/cjs/navigation/components/Navigation/Navigation.js +2 -2
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +2 -2
- package/build/cjs/navigation/schema.js +3 -2
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -2
- package/build/cjs/sub-blocks/BasicCard/schema.js +2 -2
- package/build/cjs/sub-blocks/LayoutItem/schema.js +2 -2
- package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +4 -4
- package/build/cjs/text-transform/config.js +2 -0
- package/build/cjs/text-transform/transformers.js +4 -3
- package/build/cjs/text-transform/utils.d.ts +0 -2
- package/build/cjs/text-transform/utils.js +26 -7
- package/build/cjs/utils/blocks.js +5 -3
- package/build/esm/blocks/HeaderSlider/schema.js +2 -2
- package/build/esm/blocks/Info/schema.js +2 -2
- package/build/esm/blocks/Media/schema.js +1 -1
- package/build/esm/blocks/Questions/schema.js +2 -2
- package/build/esm/blocks/Slider/Slider.js +6 -4
- package/build/esm/blocks/Slider/utils.js +2 -2
- package/build/esm/blocks/Tabs/schema.js +2 -2
- package/build/esm/components/BalancedMasonry/BalancedMasonry.js +6 -4
- package/build/esm/components/CardBase/CardBase.d.ts +1 -0
- package/build/esm/components/CardBase/CardBase.js +8 -7
- package/build/esm/components/FullWidthBackground/FullWidthBackground.js +2 -2
- package/build/esm/components/Image/Image.d.ts +5 -0
- package/build/esm/components/Image/Image.js +7 -8
- package/build/esm/components/Map/GoogleMap.js +2 -2
- package/build/esm/components/Map/YMap/YandexMap.js +2 -2
- package/build/esm/components/Media/Image/Image.js +2 -2
- package/build/esm/components/OverflowScroller/OverflowScroller.js +2 -2
- package/build/esm/components/ReactPlayer/ReactPlayer.js +2 -2
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +2 -2
- package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +2 -2
- package/build/esm/editor/components/BlockForm/BlockForm.js +4 -3
- package/build/esm/editor/components/PagePropsForm/PagePropsForm.js +2 -2
- package/build/esm/editor/dynamic-forms-custom/components/OneOfCustom/OneOfCustom.js +2 -2
- package/build/esm/editor/dynamic-forms-custom/config.js +2 -2
- package/build/esm/editor/dynamic-forms-custom/hooks/useOneOf.js +5 -4
- package/build/esm/editor/store/utils.js +2 -2
- package/build/esm/editor/utils/index.js +2 -2
- package/build/esm/hooks/useFocus.js +2 -2
- package/build/esm/hooks/useHeightCalculator.js +2 -2
- package/build/esm/hooks/useWindowBreakpoint.js +2 -2
- package/build/esm/navigation/components/Navigation/Navigation.js +2 -2
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +1 -1
- package/build/esm/navigation/schema.js +1 -1
- package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -2
- package/build/esm/sub-blocks/BasicCard/schema.js +2 -2
- package/build/esm/sub-blocks/LayoutItem/schema.js +1 -1
- package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +4 -4
- package/build/esm/text-transform/config.js +2 -0
- package/build/esm/text-transform/transformers.js +4 -3
- package/build/esm/text-transform/utils.d.ts +0 -2
- package/build/esm/text-transform/utils.js +25 -5
- package/build/esm/utils/blocks.js +2 -1
- package/package.json +1 -1
- package/server/text-transform/config.js +2 -0
- package/server/text-transform/transformers.js +4 -3
- package/server/text-transform/utils.d.ts +0 -2
- package/server/text-transform/utils.js +26 -7
- package/server/utils/blocks.js +7 -3
- package/widget/index.js +1 -1
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HeaderSliderBlock = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
6
6
|
const blocks_1 = require("../../schema/validators/blocks");
|
|
7
7
|
const common_1 = require("../../schema/validators/common");
|
|
8
8
|
exports.HeaderSliderBlock = {
|
|
9
9
|
'header-slider-block': {
|
|
10
10
|
additionalProperties: false,
|
|
11
11
|
required: ['items'],
|
|
12
|
-
properties: Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps),
|
|
12
|
+
properties: Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), (0, omit_1.default)(blocks_1.SliderProps, ['loadable', 'children'])), { items: {
|
|
13
13
|
type: 'array',
|
|
14
14
|
items: {
|
|
15
15
|
type: 'object',
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InfoBlock = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
6
6
|
const common_1 = require("../../schema/validators/common");
|
|
7
7
|
const utils_1 = require("../../schema/validators/utils");
|
|
8
8
|
const schema_1 = require("../../sub-blocks/Content/schema");
|
|
9
9
|
const ContentProps = {
|
|
10
10
|
additionalProperties: false,
|
|
11
|
-
properties:
|
|
11
|
+
properties: (0, omit_1.default)(schema_1.ContentBase, ['size', 'colSizes', 'theme']),
|
|
12
12
|
};
|
|
13
13
|
exports.InfoBlock = {
|
|
14
14
|
'info-block': {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MediaBlock = exports.MediaBlockBaseProps = exports.Media = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
5
6
|
const common_1 = require("../../schema/validators/common");
|
|
6
7
|
const schema_1 = require("../../sub-blocks/Content/schema");
|
|
7
8
|
exports.Media = {
|
|
@@ -10,7 +11,7 @@ exports.Media = {
|
|
|
10
11
|
required: [],
|
|
11
12
|
properties: common_1.MediaProps,
|
|
12
13
|
};
|
|
13
|
-
const MediaBlockContentProps = (0,
|
|
14
|
+
const MediaBlockContentProps = (0, omit_1.default)(schema_1.ContentBase, ['text', 'theme']);
|
|
14
15
|
exports.MediaBlockBaseProps = Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.AnimatableProps), MediaBlockContentProps), { description: {
|
|
15
16
|
type: 'string',
|
|
16
17
|
contentType: 'yfm',
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.QuestionsBlock = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
6
6
|
const common_1 = require("../../schema/validators/common");
|
|
7
7
|
const utils_1 = require("../../schema/validators/utils");
|
|
8
8
|
const schema_1 = require("../../sub-blocks/Content/schema");
|
|
9
|
-
const QuestionsBlockContentProps =
|
|
9
|
+
const QuestionsBlockContentProps = (0, omit_1.default)(schema_1.ContentBase, ['size', 'theme']);
|
|
10
10
|
exports.QuestionsBlock = {
|
|
11
11
|
'questions-block': {
|
|
12
12
|
additionalProperties: false,
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SliderBlock = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
7
|
+
const get_1 = tslib_1.__importDefault(require("lodash/get"));
|
|
8
|
+
const noop_1 = tslib_1.__importDefault(require("lodash/noop"));
|
|
7
9
|
const react_slick_1 = tslib_1.__importDefault(require("react-slick"));
|
|
8
10
|
const Anchor_1 = tslib_1.__importDefault(require("../../components/Anchor/Anchor"));
|
|
9
11
|
const AnimateBlock_1 = tslib_1.__importDefault(require("../../components/AnimateBlock/AnimateBlock"));
|
|
@@ -43,11 +45,11 @@ const SliderBlock = (props) => {
|
|
|
43
45
|
const autoplayTimeId = (0, react_1.useRef)();
|
|
44
46
|
const { hasFocus, unsetFocus } = (0, useFocus_1.default)((_a = slider === null || slider === void 0 ? void 0 : slider.innerSlider) === null || _a === void 0 ? void 0 : _a.list);
|
|
45
47
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
-
const onResize = (0, react_1.useCallback)(
|
|
48
|
+
const onResize = (0, react_1.useCallback)((0, debounce_1.default)(() => {
|
|
47
49
|
if (!slider) {
|
|
48
50
|
return;
|
|
49
51
|
}
|
|
50
|
-
const newBreakpoint =
|
|
52
|
+
const newBreakpoint = (0, get_1.default)(slider, 'state.breakpoint') || constants_1.BREAKPOINTS.xl;
|
|
51
53
|
if (newBreakpoint !== breakpoint) {
|
|
52
54
|
setBreakpoint(newBreakpoint);
|
|
53
55
|
setCurrentIndex(0);
|
|
@@ -196,7 +198,7 @@ const SliderBlock = (props) => {
|
|
|
196
198
|
prevArrow: react_1.default.createElement(Arrow_1.default, { type: "left", handleClick: handleArrowClick, size: arrowSize }),
|
|
197
199
|
lazyLoad,
|
|
198
200
|
};
|
|
199
|
-
return (react_1.default.createElement(OutsideClick_1.default, { onOutsideClick: isMobile ? unsetFocus :
|
|
201
|
+
return (react_1.default.createElement(OutsideClick_1.default, { onOutsideClick: isMobile ? unsetFocus : noop_1.default },
|
|
200
202
|
react_1.default.createElement(react_slick_1.default, Object.assign({}, settings), disclosedChildren),
|
|
201
203
|
react_1.default.createElement("div", { className: b('footer') },
|
|
202
204
|
renderDisclaimer(),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSlidesToShowCount = exports.getSlidesCountByBreakpoint = exports.getSliderResponsiveParams = exports.getSlidesToShowWithDefaults = exports.DEFAULT_SLIDE_BREAKPOINTS = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const pickBy_1 = tslib_1.__importDefault(require("lodash/pickBy"));
|
|
6
6
|
const constants_1 = require("../../constants");
|
|
7
7
|
const models_1 = require("./models");
|
|
8
8
|
exports.DEFAULT_SLIDE_BREAKPOINTS = {
|
|
@@ -20,7 +20,7 @@ function getSlidesToShowWithDefaults({ contentLength, breakpoints, mobileFullscr
|
|
|
20
20
|
else {
|
|
21
21
|
result = breakpoints || exports.DEFAULT_SLIDE_BREAKPOINTS;
|
|
22
22
|
}
|
|
23
|
-
return Object.assign(Object.assign(Object.assign({}, exports.DEFAULT_SLIDE_BREAKPOINTS),
|
|
23
|
+
return Object.assign(Object.assign(Object.assign({}, exports.DEFAULT_SLIDE_BREAKPOINTS), (0, pickBy_1.default)(result, (value) => !isNaN(value))), { sm: !mobileFullscreen && contentLength > 1 ? exports.DEFAULT_SLIDE_BREAKPOINTS.sm : 1 });
|
|
24
24
|
}
|
|
25
25
|
exports.getSlidesToShowWithDefaults = getSlidesToShowWithDefaults;
|
|
26
26
|
function getSliderResponsiveParams(breakpoints) {
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TabsBlock = exports.tabsItem = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
6
6
|
const schema_1 = require("../../components/Image/schema");
|
|
7
7
|
const common_1 = require("../../schema/validators/common");
|
|
8
8
|
const utils_1 = require("../../schema/validators/utils");
|
|
9
9
|
const schema_2 = require("../../sub-blocks/Content/schema");
|
|
10
|
-
const TabsItemContentProps =
|
|
10
|
+
const TabsItemContentProps = (0, omit_1.default)(schema_2.ContentBase, ['size', 'colSizes', 'centered', 'theme']);
|
|
11
11
|
exports.tabsItem = {
|
|
12
12
|
type: 'object',
|
|
13
13
|
additionalProperties: false,
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
-
const
|
|
5
|
+
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
6
|
+
const first_1 = tslib_1.__importDefault(require("lodash/first"));
|
|
7
|
+
const minBy_1 = tslib_1.__importDefault(require("lodash/minBy"));
|
|
6
8
|
const ssrContext_1 = require("../../context/ssrContext");
|
|
7
9
|
const utils_1 = require("../../utils");
|
|
8
10
|
const b = (0, utils_1.block)('BalancedMasonry');
|
|
@@ -15,7 +17,7 @@ const BalancedMasonry = (props) => {
|
|
|
15
17
|
return Number(secondBreakpoint) - Number(firstBreakpoint);
|
|
16
18
|
});
|
|
17
19
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
18
|
-
let [, result] =
|
|
20
|
+
let [, result] = (0, first_1.default)(breakpoints);
|
|
19
21
|
if (isServer) {
|
|
20
22
|
return result;
|
|
21
23
|
}
|
|
@@ -31,7 +33,7 @@ const BalancedMasonry = (props) => {
|
|
|
31
33
|
const [columns, setColumns] = (0, react_1.useState)([]);
|
|
32
34
|
const containerRef = (0, react_1.useRef)(null);
|
|
33
35
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
-
const balanceColumns = (0, react_1.useCallback)(
|
|
36
|
+
const balanceColumns = (0, react_1.useCallback)((0, debounce_1.default)(() => {
|
|
35
37
|
if (!containerRef.current) {
|
|
36
38
|
return;
|
|
37
39
|
}
|
|
@@ -46,7 +48,7 @@ const BalancedMasonry = (props) => {
|
|
|
46
48
|
if (!node) {
|
|
47
49
|
continue;
|
|
48
50
|
}
|
|
49
|
-
const minColumn =
|
|
51
|
+
const minColumn = (0, minBy_1.default)(columnsMeta, 'height') || { id: 0, height: 0 };
|
|
50
52
|
const { id: columnId } = minColumn;
|
|
51
53
|
localColumns[columnId].push(children[i]);
|
|
52
54
|
minColumn.height += node.offsetHeight;
|
|
@@ -10,6 +10,7 @@ export interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams {
|
|
|
10
10
|
target?: HTMLAttributeAnchorTarget;
|
|
11
11
|
metrikaGoals?: MetrikaGoal;
|
|
12
12
|
pixelEvents?: ButtonPixel;
|
|
13
|
+
qa?: string;
|
|
13
14
|
}
|
|
14
15
|
export interface CardHeaderBaseProps {
|
|
15
16
|
className?: string;
|
|
@@ -14,10 +14,11 @@ const Header = () => null;
|
|
|
14
14
|
const Content = () => null;
|
|
15
15
|
const Footer = () => null;
|
|
16
16
|
const Layout = (props) => {
|
|
17
|
-
const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', } = props;
|
|
17
|
+
const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', qa, } = props;
|
|
18
18
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
19
19
|
const handleAnalytics = (0, hooks_1.useAnalytics)(common_1.DefaultEventNames.CardBase, url);
|
|
20
20
|
let header, content, footer, image, headerClass, footerClass;
|
|
21
|
+
const qaAttributes = (0, utils_1.getQaAttrubutes)(qa, 'header', 'footer', 'body', 'content');
|
|
21
22
|
function handleChild(child) {
|
|
22
23
|
switch (child.type) {
|
|
23
24
|
case Header:
|
|
@@ -41,18 +42,18 @@ const Layout = (props) => {
|
|
|
41
42
|
react_1.Children.forEach(children, handleChild);
|
|
42
43
|
}
|
|
43
44
|
const cardContent = (react_1.default.createElement(react_1.Fragment, null,
|
|
44
|
-
(header || image) && (react_1.default.createElement(BackgroundImage_1.default, Object.assign({ className: b('header', headerClass) }, (typeof image === 'string' ? { src: image } : image)),
|
|
45
|
+
(header || image) && (react_1.default.createElement(BackgroundImage_1.default, Object.assign({ className: b('header', headerClass) }, (typeof image === 'string' ? { src: image } : image), { qa: qaAttributes.header }),
|
|
45
46
|
react_1.default.createElement("div", { className: b('header-content') }, header))),
|
|
46
|
-
react_1.default.createElement("div", { className: b('body', bodyClassName) },
|
|
47
|
-
react_1.default.createElement("div", { className: b('content', contentClassName) }, content),
|
|
48
|
-
footer && react_1.default.createElement("div", { className: b('footer', footerClass) }, footer))));
|
|
47
|
+
react_1.default.createElement("div", { className: b('body', bodyClassName), "data-qa": qaAttributes.body },
|
|
48
|
+
react_1.default.createElement("div", { className: b('content', contentClassName), "data-qa": qaAttributes.content }, content),
|
|
49
|
+
footer && (react_1.default.createElement("div", { className: b('footer', footerClass), "data-qa": qaAttributes.footer }, footer)))));
|
|
49
50
|
const fullClassName = b({ border }, className);
|
|
50
51
|
const onClick = () => {
|
|
51
52
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
52
53
|
handleAnalytics(analyticsEvents);
|
|
53
54
|
};
|
|
54
55
|
return url ? (react_1.default.createElement(RouterLink_1.default, { href: url },
|
|
55
|
-
react_1.default.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick }, cardContent))) : (react_1.default.createElement("div", { className: fullClassName }, cardContent));
|
|
56
|
+
react_1.default.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick, "data-qa": qa }, cardContent))) : (react_1.default.createElement("div", { className: fullClassName, "data-qa": qa }, cardContent));
|
|
56
57
|
};
|
|
57
58
|
exports.Layout = Layout;
|
|
58
59
|
exports.Layout.Header = Header;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
-
const
|
|
5
|
+
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
6
6
|
const constants_1 = require("../../constants");
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
const b = (0, utils_1.block)('FullWidthBackground');
|
|
@@ -13,7 +13,7 @@ class FullWidthBackground extends react_1.Component {
|
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
15
|
this.ref = (0, react_1.createRef)();
|
|
16
|
-
this.setBg =
|
|
16
|
+
this.setBg = (0, debounce_1.default)(() => {
|
|
17
17
|
var _a, _b;
|
|
18
18
|
if (this.ref && this.ref.current) {
|
|
19
19
|
const bg = this.ref.current;
|
|
@@ -6,5 +6,10 @@ export interface ImageProps extends Partial<ImageObjectProps>, Partial<ImageDevi
|
|
|
6
6
|
onClick?: MouseEventHandler;
|
|
7
7
|
containerClassName?: string;
|
|
8
8
|
}
|
|
9
|
+
export interface DeviceSpecificFragmentProps extends QAProps {
|
|
10
|
+
disableWebp: boolean;
|
|
11
|
+
src: string;
|
|
12
|
+
breakpoint: number;
|
|
13
|
+
}
|
|
9
14
|
declare const Image: (props: ImageProps) => JSX.Element | null;
|
|
10
15
|
export default Image;
|
|
@@ -11,6 +11,9 @@ const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
|
11
11
|
const checkWebP = (src) => {
|
|
12
12
|
return src.endsWith('.webp') ? src : src + '.webp';
|
|
13
13
|
};
|
|
14
|
+
const DeviceSpecificFragment = ({ disableWebp, src, breakpoint, qa, }) => (react_1.default.createElement(react_1.Fragment, null,
|
|
15
|
+
!disableWebp && (react_1.default.createElement("source", { srcSet: checkWebP(src), type: "image/webp", media: `(max-width: ${breakpoint}px)`, "data-qa": `${qa}-compressed` })),
|
|
16
|
+
react_1.default.createElement("source", { srcSet: src, media: `(max-width: ${breakpoint}px)`, "data-qa": qa })));
|
|
14
17
|
const Image = (props) => {
|
|
15
18
|
const projectSettings = (0, react_1.useContext)(projectSettingsContext_1.ProjectSettingsContext);
|
|
16
19
|
const { src: imageSrc, alt = (0, i18n_1.default)('img-alt'), disableCompress, tablet, desktop, mobile, style, className, onClick, containerClassName, qa, } = props;
|
|
@@ -19,19 +22,15 @@ const Image = (props) => {
|
|
|
19
22
|
if (!src) {
|
|
20
23
|
return null;
|
|
21
24
|
}
|
|
22
|
-
const qaAttributes = (0, utils_1.getQaAttrubutes)(qa, 'mobile-webp-source', 'mobile-source', 'tablet-webp-source', 'tablet-source', '
|
|
25
|
+
const qaAttributes = (0, utils_1.getQaAttrubutes)(qa, 'mobile-webp-source', 'mobile-source', 'tablet-webp-source', 'tablet-source', 'desktop-source-compressed');
|
|
23
26
|
const disableWebp = projectSettings.disableCompress ||
|
|
24
27
|
disableCompress ||
|
|
25
28
|
!(0, imageCompress_1.isCompressible)(src) ||
|
|
26
29
|
imgLoadingError;
|
|
27
30
|
return (react_1.default.createElement("picture", { className: containerClassName, "data-qa": qa },
|
|
28
|
-
mobile && (react_1.default.createElement(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
tablet && (react_1.default.createElement(react_1.Fragment, null,
|
|
32
|
-
!disableWebp && (react_1.default.createElement("source", { srcSet: checkWebP(tablet), type: "image/webp", media: `(max-width: ${constants_1.BREAKPOINTS.md}px)`, "data-qa": qaAttributes.tabletWebpSource })),
|
|
33
|
-
react_1.default.createElement("source", { srcSet: tablet, media: `(max-width: ${constants_1.BREAKPOINTS.md}px)`, "data-qa": qaAttributes.tabletSource }))),
|
|
34
|
-
src && !disableWebp && (react_1.default.createElement("source", { srcSet: checkWebP(src), type: "image/webp", "data-qa": qaAttributes.displaySource })),
|
|
31
|
+
mobile && (react_1.default.createElement(DeviceSpecificFragment, { src: mobile, disableWebp: disableWebp, breakpoint: constants_1.BREAKPOINTS.sm, qa: qaAttributes.mobileSource })),
|
|
32
|
+
tablet && (react_1.default.createElement(DeviceSpecificFragment, { src: tablet, disableWebp: disableWebp, breakpoint: constants_1.BREAKPOINTS.md, qa: qaAttributes.tabletSource })),
|
|
33
|
+
src && !disableWebp && (react_1.default.createElement("source", { srcSet: checkWebP(src), type: "image/webp", "data-qa": qaAttributes.desktopSourceCompressed })),
|
|
35
34
|
react_1.default.createElement(ImageBase_1.default, { className: className, alt: alt, src: src, style: style, onClick: onClick, onError: () => setImgLoadingError(true) })));
|
|
36
35
|
};
|
|
37
36
|
exports.default = Image;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
-
const
|
|
5
|
+
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
6
6
|
const localeContext_1 = require("../../context/localeContext/localeContext");
|
|
7
7
|
const mapsContext_1 = require("../../context/mapsContext/mapsContext");
|
|
8
8
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
@@ -23,7 +23,7 @@ const GoogleMap = (props) => {
|
|
|
23
23
|
const ref = (0, react_1.useRef)(null);
|
|
24
24
|
const src = (0, react_1.useMemo)(() => getScriptSrc({ apiKey, scriptSrc, address, lang, zoom }), [apiKey, scriptSrc, address, lang, zoom]);
|
|
25
25
|
(0, react_1.useEffect)(() => {
|
|
26
|
-
const updateSize =
|
|
26
|
+
const updateSize = (0, debounce_1.default)(() => {
|
|
27
27
|
if (ref.current) {
|
|
28
28
|
setHeight(Math.round((0, helpers_1.getMapHeight)(ref.current.offsetWidth, isMobile)));
|
|
29
29
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
|
-
const
|
|
6
|
+
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
7
7
|
const localeContext_1 = require("../../../context/localeContext/localeContext");
|
|
8
8
|
const mapsContext_1 = require("../../../context/mapsContext/mapsContext");
|
|
9
9
|
const mobileContext_1 = require("../../../context/mobileContext");
|
|
@@ -50,7 +50,7 @@ const YandexMap = (props) => {
|
|
|
50
50
|
})();
|
|
51
51
|
}, [apiKey, lang, scriptSrc, containerId, zoom, nonce, attemptsIndex, setLoading]);
|
|
52
52
|
(0, react_1.useEffect)(() => {
|
|
53
|
-
const updateSize =
|
|
53
|
+
const updateSize = (0, debounce_1.default)(() => {
|
|
54
54
|
if (ref.current) {
|
|
55
55
|
setHeight(Math.round((0, helpers_1.getMapHeight)(ref.current.offsetWidth, isMobile)));
|
|
56
56
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.defaultAnimatedDivQa = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
7
7
|
const react_spring_1 = require("react-spring");
|
|
8
8
|
const Slider_1 = tslib_1.__importDefault(require("../../../blocks/Slider/Slider"));
|
|
9
9
|
const models_1 = require("../../../models");
|
|
@@ -26,7 +26,7 @@ const Image = (props) => {
|
|
|
26
26
|
(0, react_1.useEffect)(() => {
|
|
27
27
|
if (parallax) {
|
|
28
28
|
const handleScroll = () => setScrollY(window.scrollY);
|
|
29
|
-
const debouncedHandler =
|
|
29
|
+
const debouncedHandler = (0, debounce_1.default)(handleScroll, 5);
|
|
30
30
|
window.addEventListener('scroll', debouncedHandler, { passive: true });
|
|
31
31
|
return () => window.removeEventListener('scroll', debouncedHandler);
|
|
32
32
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
-
const
|
|
5
|
+
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
6
6
|
const __1 = require("..");
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
const b = (0, utils_1.block)('overflow-scroller');
|
|
@@ -19,7 +19,7 @@ class OverflowScroller extends react_1.default.Component {
|
|
|
19
19
|
this.containerRef = (0, react_1.createRef)();
|
|
20
20
|
this.wrapperRef = (0, react_1.createRef)();
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/member-ordering, react/sort-comp
|
|
22
|
-
this.checkOverflow =
|
|
22
|
+
this.checkOverflow = (0, debounce_1.default)(() => {
|
|
23
23
|
if (this.containerRef &&
|
|
24
24
|
this.containerRef.current &&
|
|
25
25
|
this.wrapperRef &&
|
|
@@ -4,7 +4,7 @@ exports.ReactPlayerBlock = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
-
const
|
|
7
|
+
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
8
8
|
const react_player_1 = tslib_1.__importDefault(require("react-player"));
|
|
9
9
|
const metrikaContext_1 = require("../../context/metrikaContext");
|
|
10
10
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
@@ -78,7 +78,7 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
78
78
|
}
|
|
79
79
|
}, [elapsedTime, playerRef, started]);
|
|
80
80
|
(0, react_1.useEffect)(() => {
|
|
81
|
-
const updateSize =
|
|
81
|
+
const updateSize = (0, debounce_1.default)(() => {
|
|
82
82
|
if (ref.current) {
|
|
83
83
|
// We need to get parent's width does not equal 0
|
|
84
84
|
const parentElement = getParentElement(ref.current);
|
package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js
CHANGED
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ConstructorBlock = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const pick_1 = tslib_1.__importDefault(require("lodash/pick"));
|
|
7
7
|
const BlockBase_1 = tslib_1.__importDefault(require("../../../../components/BlockBase/BlockBase"));
|
|
8
8
|
const BlockDecoration_1 = require("../../../../customization/BlockDecoration");
|
|
9
9
|
const utils_1 = require("../../../../utils");
|
|
10
10
|
const b = (0, utils_1.block)('constructor-block');
|
|
11
11
|
const ConstructorBlock = ({ index = 0, data, children, }) => {
|
|
12
12
|
const { type, indent } = data;
|
|
13
|
-
const blockBaseProps = (0, react_1.useMemo)(() =>
|
|
13
|
+
const blockBaseProps = (0, react_1.useMemo)(() => (0, pick_1.default)(data, ['anchor', 'visible', 'resetPaddings']), [data]);
|
|
14
14
|
const { top, bottom } = indent || { top: 'l', bottom: 'l' };
|
|
15
15
|
return (react_1.default.createElement(BlockDecoration_1.BlockDecoration, Object.assign({ type: type, index: index }, blockBaseProps),
|
|
16
16
|
react_1.default.createElement(BlockBase_1.default, Object.assign({ className: b({ type, indentTop: top, indentBottom: bottom }) }, blockBaseProps), children)));
|
package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ConstructorBlocks = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const get_1 = tslib_1.__importDefault(require("lodash/get"));
|
|
7
7
|
const innerContext_1 = require("../../../../context/innerContext");
|
|
8
8
|
const BlockDecoration_1 = require("../../../../customization/BlockDecoration");
|
|
9
9
|
const utils_1 = require("../../../../utils");
|
|
@@ -24,7 +24,7 @@ const ConstructorBlocks = ({ items }) => {
|
|
|
24
24
|
}
|
|
25
25
|
if ('loadable' in item && item.loadable) {
|
|
26
26
|
const { source, serviceId, params } = item.loadable;
|
|
27
|
-
const config =
|
|
27
|
+
const config = (0, get_1.default)(loadables, source);
|
|
28
28
|
if (!config) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
@@ -4,7 +4,8 @@ exports.BlockForm = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const dynamic_forms_1 = require("@gravity-ui/dynamic-forms");
|
|
7
|
-
const
|
|
7
|
+
const isEqual_1 = tslib_1.__importDefault(require("lodash/isEqual"));
|
|
8
|
+
const noop_1 = tslib_1.__importDefault(require("lodash/noop"));
|
|
8
9
|
const react_final_form_1 = require("react-final-form");
|
|
9
10
|
const config_1 = require("../../dynamic-forms-custom/config");
|
|
10
11
|
const usePreviousValue_1 = tslib_1.__importDefault(require("../../hooks/usePreviousValue"));
|
|
@@ -16,10 +17,10 @@ exports.BlockForm = (0, react_1.memo)((_a) => {
|
|
|
16
17
|
if (!active) {
|
|
17
18
|
return (react_1.default.createElement(dynamic_forms_1.SimpleVerticalAccordeon, { open: false, name: type, title: spec.viewSpec.layoutTitle || type, onOpenChange: onSelect }, ' '));
|
|
18
19
|
}
|
|
19
|
-
return (react_1.default.createElement(react_final_form_1.Form, { initialValues: initialValues, onSubmit:
|
|
20
|
+
return (react_1.default.createElement(react_final_form_1.Form, { initialValues: initialValues, onSubmit: noop_1.default }, () => (react_1.default.createElement(react_1.Fragment, null,
|
|
20
21
|
react_1.default.createElement(react_final_form_1.FormSpy, { onChange: ({ values }) => {
|
|
21
22
|
// fix for FormSpy onChange called twice without content changes
|
|
22
|
-
if (!
|
|
23
|
+
if (!(0, isEqual_1.default)(values.content, prevContent)) {
|
|
23
24
|
onChange(Object.assign({ type }, values.content));
|
|
24
25
|
}
|
|
25
26
|
}, subscription: { values: true } }),
|
|
@@ -4,13 +4,13 @@ exports.PagePropsForm = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const dynamic_forms_1 = require("@gravity-ui/dynamic-forms");
|
|
7
|
-
const
|
|
7
|
+
const noop_1 = tslib_1.__importDefault(require("lodash/noop"));
|
|
8
8
|
const react_final_form_1 = require("react-final-form");
|
|
9
9
|
const config_1 = require("../../dynamic-forms-custom/config");
|
|
10
10
|
exports.PagePropsForm = (0, react_1.memo)(({ data: content, spec, onChange }) => {
|
|
11
11
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12
12
|
const initialValues = (0, react_1.useMemo)(() => ({ content }), []);
|
|
13
|
-
return (react_1.default.createElement(react_final_form_1.Form, { initialValues: initialValues, onSubmit:
|
|
13
|
+
return (react_1.default.createElement(react_final_form_1.Form, { initialValues: initialValues, onSubmit: noop_1.default }, () => (react_1.default.createElement("div", null,
|
|
14
14
|
react_1.default.createElement(react_final_form_1.FormSpy, { onChange: ({ values }) => onChange(Object.assign({}, values.content)), subscription: { values: true } }),
|
|
15
15
|
react_1.default.createElement(dynamic_forms_1.DynamicField, { name: "content", spec: spec, config: config_1.dynamicConfig })))));
|
|
16
16
|
});
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const dynamic_forms_1 = require("@gravity-ui/dynamic-forms");
|
|
7
7
|
const ajv_1 = tslib_1.__importDefault(require("ajv"));
|
|
8
|
-
const
|
|
8
|
+
const isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
|
|
9
9
|
const utils_1 = require("../../../../utils");
|
|
10
10
|
const useOneOf_1 = require("../../hooks/useOneOf");
|
|
11
11
|
const b = (0, utils_1.block)('one-of-custom');
|
|
@@ -20,7 +20,7 @@ const getOneOfCustomSpecDefaultType = (spec) => { var _a, _b; return ((_b = (_a
|
|
|
20
20
|
// dynamic-forms pass {} as default value for required properties of all types
|
|
21
21
|
// this function replaces {} with default value accordingly to selected OneOf option spec type
|
|
22
22
|
const getControllerDefautValue = (value, valueSpecType) => {
|
|
23
|
-
const isDefaultValue = typeof value === 'object' &&
|
|
23
|
+
const isDefaultValue = typeof value === 'object' && (0, isEmpty_1.default)(value);
|
|
24
24
|
const defaultValue = valueSpecType ? (0, useOneOf_1.getSpecTypeDefaultValue)(valueSpecType) : undefined;
|
|
25
25
|
return isDefaultValue ? defaultValue : value;
|
|
26
26
|
};
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.dynamicConfig = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const dynamic_forms_1 = require("@gravity-ui/dynamic-forms");
|
|
6
|
-
const
|
|
6
|
+
const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
|
|
7
7
|
const OneOfCustom_1 = require("./components/OneOfCustom/OneOfCustom");
|
|
8
8
|
const getDynamicConfig = () => {
|
|
9
|
-
const dynamicConfig =
|
|
9
|
+
const dynamicConfig = (0, cloneDeep_1.default)(dynamic_forms_1.dynamicConfig);
|
|
10
10
|
dynamicConfig.object.inputs['oneof_custom'] = { Component: OneOfCustom_1.OneOfCustom, independent: true };
|
|
11
11
|
return dynamicConfig;
|
|
12
12
|
};
|
|
@@ -5,7 +5,8 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const dynamic_forms_1 = require("@gravity-ui/dynamic-forms");
|
|
7
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
|
-
const
|
|
8
|
+
const isObjectLike_1 = tslib_1.__importDefault(require("lodash/isObjectLike"));
|
|
9
|
+
const some_1 = tslib_1.__importDefault(require("lodash/some"));
|
|
9
10
|
const MAX_TAB_TITLE_LENGTH = 20;
|
|
10
11
|
const getSpecTypeDefaultValue = (type) => {
|
|
11
12
|
switch (type) {
|
|
@@ -23,10 +24,10 @@ exports.getSpecTypeDefaultValue = getSpecTypeDefaultValue;
|
|
|
23
24
|
const useOneOf = ({ props, onTogglerChange }) => {
|
|
24
25
|
const { name, input, spec, Layout } = props;
|
|
25
26
|
const { order, disabled, oneOfParams } = spec.viewSpec;
|
|
26
|
-
const specProperties = react_1.default.useMemo(() => (
|
|
27
|
+
const specProperties = react_1.default.useMemo(() => ((0, isObjectLike_1.default)(spec.properties) ? spec.properties : {}), [spec.properties]);
|
|
27
28
|
const [oneOfValue, setOneOfValue] = react_1.default.useState(() => {
|
|
28
29
|
let valueKeys;
|
|
29
|
-
if (
|
|
30
|
+
if ((0, isObjectLike_1.default)(input.value)) {
|
|
30
31
|
const keys = Object.keys(input.value);
|
|
31
32
|
if (keys.length) {
|
|
32
33
|
valueKeys = keys;
|
|
@@ -59,7 +60,7 @@ const useOneOf = ({ props, onTogglerChange }) => {
|
|
|
59
60
|
if ((oneOfParams === null || oneOfParams === void 0 ? void 0 : oneOfParams.toggler) !== 'radio' &&
|
|
60
61
|
((oneOfParams === null || oneOfParams === void 0 ? void 0 : oneOfParams.toggler) === 'select' ||
|
|
61
62
|
options.length > 3 ||
|
|
62
|
-
|
|
63
|
+
(0, some_1.default)(options, ({ title }) => title.length > MAX_TAB_TITLE_LENGTH))) {
|
|
63
64
|
return (react_1.default.createElement(uikit_1.Select, { width: "max", value: [oneOfValue], onUpdate: onOneOfChange, options: options, disabled: disabled, filterable: options.length > 7, qa: name }));
|
|
64
65
|
}
|
|
65
66
|
return (react_1.default.createElement(uikit_1.RadioButton, { value: oneOfValue, onChange: (event) => onOneOfChange([event.target.value]), disabled: disabled, qa: name }, options.map(({ value, title }) => (react_1.default.createElement(uikit_1.RadioButton.Option, { key: value, value: value }, title)))));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getErrorBoundaryState = exports.addEditorProps = exports.addBlock = exports.getNewBlockIndex = exports.duplicateBlock = exports.changeBlocksOrder = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
|
|
6
6
|
const changeBlocksOrder = (array, oldIndex, newIndex) => {
|
|
7
7
|
const result = [...array];
|
|
8
8
|
const element = result.splice(oldIndex, 1)[0];
|
|
@@ -12,7 +12,7 @@ const changeBlocksOrder = (array, oldIndex, newIndex) => {
|
|
|
12
12
|
exports.changeBlocksOrder = changeBlocksOrder;
|
|
13
13
|
const duplicateBlock = (array, index) => {
|
|
14
14
|
const result = [...array];
|
|
15
|
-
result.splice(index + 1, 0,
|
|
15
|
+
result.splice(index + 1, 0, (0, cloneDeep_1.default)(result[index]));
|
|
16
16
|
return result;
|
|
17
17
|
};
|
|
18
18
|
exports.duplicateBlock = duplicateBlock;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkIsMobile = exports.getBlockId = exports.addCustomDecorator = exports.formatBlockName = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const capitalize_1 = tslib_1.__importDefault(require("lodash/capitalize"));
|
|
6
6
|
const types_1 = require("../types");
|
|
7
|
-
const formatBlockName = (name) =>
|
|
7
|
+
const formatBlockName = (name) => (0, capitalize_1.default)(name).replace(/(block|-)/g, ' ');
|
|
8
8
|
exports.formatBlockName = formatBlockName;
|
|
9
9
|
const addCustomDecorator = (decorators, custom = {}) => {
|
|
10
10
|
const customDecorators = custom.decorators || {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
5
|
+
const noop_1 = tslib_1.__importDefault(require("lodash/noop"));
|
|
6
6
|
const mobileContext_1 = require("../context/mobileContext");
|
|
7
7
|
function useFocus(element) {
|
|
8
8
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
@@ -28,7 +28,7 @@ function useFocus(element) {
|
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return noop_1.default;
|
|
32
32
|
}, [element, isMobile, setFocus, unsetFocus]);
|
|
33
33
|
return {
|
|
34
34
|
hasFocus,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
5
|
+
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
6
6
|
const DEFAULT_RECALCULATE_ON_RESIZE_DELAY = 1000;
|
|
7
7
|
const DEFAULT_OPTIONS = {
|
|
8
8
|
recalculateOnResizeDelay: DEFAULT_RECALCULATE_ON_RESIZE_DELAY,
|
|
@@ -15,7 +15,7 @@ const useHeightCalculator = (containerRef, options = DEFAULT_OPTIONS) => {
|
|
|
15
15
|
setContainerHeight(containerRef.current.offsetHeight);
|
|
16
16
|
}, [containerRef, containerHeight, setContainerHeight]);
|
|
17
17
|
(0, react_1.useEffect)(() => {
|
|
18
|
-
const handleResize =
|
|
18
|
+
const handleResize = (0, debounce_1.default)(calculateContainerHeight, recalculateOnResizeDelay);
|
|
19
19
|
handleResize();
|
|
20
20
|
window.addEventListener('resize', handleResize, { passive: true });
|
|
21
21
|
return () => {
|