@redneckz/wildless-cms-uni-blocks 0.3.55 → 0.3.57
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/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +69 -21
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/components/BlockContent.d.ts +2 -1
- package/dist/components/Blocks.d.ts +1 -0
- package/dist/components/Blocks.js +2 -0
- package/dist/components/Blocks.js.map +1 -1
- package/dist/components/ContentPage/ContentPage.js +3 -5
- package/dist/components/ContentPage/ContentPage.js.map +1 -1
- package/dist/components/ContentPage/CustomContentPage.d.ts +30 -0
- package/dist/components/ContentPage/CustomContentPage.js +33 -0
- package/dist/components/ContentPage/CustomContentPage.js.map +1 -0
- package/dist/components/GroupBlock/BlocksTypeProps.d.ts +36 -0
- package/dist/components/GroupBlock/BlocksTypeProps.js +2 -0
- package/dist/components/GroupBlock/BlocksTypeProps.js.map +1 -0
- package/dist/components/GroupBlock/EmbeddableGroupBlocks.d.ts +4 -0
- package/dist/components/GroupBlock/EmbeddableGroupBlocks.js +9 -0
- package/dist/components/GroupBlock/EmbeddableGroupBlocks.js.map +1 -0
- package/dist/components/GroupBlock/GroupBlock.d.ts +9 -0
- package/dist/components/GroupBlock/GroupBlock.js +19 -0
- package/dist/components/GroupBlock/GroupBlock.js.map +1 -0
- package/dist/components/GroupBlock/GroupBlockContent.d.ts +21 -0
- package/dist/components/GroupBlock/GroupBlockContent.js +2 -0
- package/dist/components/GroupBlock/GroupBlockContent.js.map +1 -0
- package/dist/components/GroupBlock/GroupBlockTabs.d.ts +10 -0
- package/dist/components/GroupBlock/GroupBlockTabs.js +18 -0
- package/dist/components/GroupBlock/GroupBlockTabs.js.map +1 -0
- package/dist/components/GroupBlock/GroupBlocksItem.d.ts +8 -0
- package/dist/components/GroupBlock/GroupBlocksItem.js +20 -0
- package/dist/components/GroupBlock/GroupBlocksItem.js.map +1 -0
- package/dist/components/GroupBlock/filterBlocksByTag.d.ts +2 -0
- package/dist/components/GroupBlock/filterBlocksByTag.js +7 -0
- package/dist/components/GroupBlock/filterBlocksByTag.js.map +1 -0
- package/dist/components/GroupBlock/renderBlocksTypes.d.ts +9 -0
- package/dist/components/GroupBlock/renderBlocksTypes.js +16 -0
- package/dist/components/GroupBlock/renderBlocksTypes.js.map +1 -0
- package/dist/components/OtherProducts/OtherProductsContent.d.ts +4 -2
- package/dist/components/ProductBlock/ProductBlockInner.js +1 -1
- package/dist/components/ProductBlock/ProductBlockInner.js.map +1 -1
- package/dist/components/ProductGalleryGreen/ProductGalleryGreen.js +9 -11
- package/dist/components/ProductGalleryGreen/ProductGalleryGreen.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/utils/style2className.d.ts +1 -0
- package/dist/utils/style2className.js +7 -0
- package/dist/utils/style2className.js.map +1 -0
- package/lib/common.css +1 -1
- package/lib/components/BlockContent.d.ts +2 -1
- package/lib/components/Blocks.d.ts +1 -0
- package/lib/components/Blocks.js +2 -0
- package/lib/components/Blocks.js.map +1 -1
- package/lib/components/ContentPage/ContentPage.js +1 -3
- package/lib/components/ContentPage/ContentPage.js.map +1 -1
- package/lib/components/ContentPage/CustomContentPage.d.ts +30 -0
- package/lib/components/ContentPage/CustomContentPage.js +31 -0
- package/lib/components/ContentPage/CustomContentPage.js.map +1 -0
- package/lib/components/GroupBlock/BlocksTypeProps.d.ts +36 -0
- package/lib/components/GroupBlock/BlocksTypeProps.js +2 -0
- package/lib/components/GroupBlock/BlocksTypeProps.js.map +1 -0
- package/lib/components/GroupBlock/EmbeddableGroupBlocks.d.ts +4 -0
- package/lib/components/GroupBlock/EmbeddableGroupBlocks.js +7 -0
- package/lib/components/GroupBlock/EmbeddableGroupBlocks.js.map +1 -0
- package/lib/components/GroupBlock/GroupBlock.d.ts +9 -0
- package/lib/components/GroupBlock/GroupBlock.fixture.d.ts +4 -0
- package/lib/components/GroupBlock/GroupBlock.js +17 -0
- package/lib/components/GroupBlock/GroupBlock.js.map +1 -0
- package/lib/components/GroupBlock/GroupBlockContent.d.ts +21 -0
- package/lib/components/GroupBlock/GroupBlockContent.js +2 -0
- package/lib/components/GroupBlock/GroupBlockContent.js.map +1 -0
- package/lib/components/GroupBlock/GroupBlockTabs.d.ts +10 -0
- package/lib/components/GroupBlock/GroupBlockTabs.js +16 -0
- package/lib/components/GroupBlock/GroupBlockTabs.js.map +1 -0
- package/lib/components/GroupBlock/GroupBlocksItem.d.ts +8 -0
- package/lib/components/GroupBlock/GroupBlocksItem.js +17 -0
- package/lib/components/GroupBlock/GroupBlocksItem.js.map +1 -0
- package/lib/components/GroupBlock/filterBlocksByTag.d.ts +2 -0
- package/lib/components/GroupBlock/filterBlocksByTag.js +4 -0
- package/lib/components/GroupBlock/filterBlocksByTag.js.map +1 -0
- package/lib/components/GroupBlock/renderBlocksTypes.d.ts +9 -0
- package/lib/components/GroupBlock/renderBlocksTypes.js +13 -0
- package/lib/components/GroupBlock/renderBlocksTypes.js.map +1 -0
- package/lib/components/OtherProducts/OtherProductsContent.d.ts +4 -2
- package/lib/components/ProductBlock/ProductBlockInner.js +1 -1
- package/lib/components/ProductBlock/ProductBlockInner.js.map +1 -1
- package/lib/components/ProductGalleryGreen/ProductGalleryGreen.js +9 -11
- package/lib/components/ProductGalleryGreen/ProductGalleryGreen.js.map +1 -1
- package/lib/types.d.ts +5 -0
- package/lib/utils/style2className.d.ts +1 -0
- package/lib/utils/style2className.js +4 -0
- package/lib/utils/style2className.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +4 -3
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/components/BlockContent.d.ts +2 -1
- package/mobile/dist/components/ContentPage/ContentPage.js +3 -5
- package/mobile/dist/components/ContentPage/ContentPage.js.map +1 -1
- package/mobile/dist/components/ContentPage/CustomContentPage.d.ts +30 -0
- package/mobile/dist/components/ContentPage/CustomContentPage.js +33 -0
- package/mobile/dist/components/ContentPage/CustomContentPage.js.map +1 -0
- package/mobile/dist/components/GroupBlock/BlocksTypeProps.d.ts +36 -0
- package/mobile/dist/components/GroupBlock/BlocksTypeProps.js +2 -0
- package/mobile/dist/components/GroupBlock/BlocksTypeProps.js.map +1 -0
- package/mobile/dist/components/GroupBlock/EmbeddableGroupBlocks.d.ts +4 -0
- package/mobile/dist/components/GroupBlock/EmbeddableGroupBlocks.js +9 -0
- package/mobile/dist/components/GroupBlock/EmbeddableGroupBlocks.js.map +1 -0
- package/mobile/dist/components/GroupBlock/GroupBlock.d.ts +9 -0
- package/mobile/dist/components/GroupBlock/GroupBlock.js +19 -0
- package/mobile/dist/components/GroupBlock/GroupBlock.js.map +1 -0
- package/mobile/dist/components/GroupBlock/GroupBlockContent.d.ts +21 -0
- package/mobile/dist/components/GroupBlock/GroupBlockContent.js +2 -0
- package/mobile/dist/components/GroupBlock/GroupBlockContent.js.map +1 -0
- package/mobile/dist/components/GroupBlock/GroupBlockTabs.d.ts +10 -0
- package/mobile/dist/components/GroupBlock/GroupBlockTabs.js +18 -0
- package/mobile/dist/components/GroupBlock/GroupBlockTabs.js.map +1 -0
- package/mobile/dist/components/GroupBlock/GroupBlocksItem.d.ts +8 -0
- package/mobile/dist/components/GroupBlock/GroupBlocksItem.js +20 -0
- package/mobile/dist/components/GroupBlock/GroupBlocksItem.js.map +1 -0
- package/mobile/dist/components/GroupBlock/filterBlocksByTag.d.ts +2 -0
- package/mobile/dist/components/GroupBlock/filterBlocksByTag.js +7 -0
- package/mobile/dist/components/GroupBlock/filterBlocksByTag.js.map +1 -0
- package/mobile/dist/components/GroupBlock/renderBlocksTypes.d.ts +9 -0
- package/mobile/dist/components/GroupBlock/renderBlocksTypes.js +16 -0
- package/mobile/dist/components/GroupBlock/renderBlocksTypes.js.map +1 -0
- package/mobile/dist/components/OtherProducts/OtherProductsContent.d.ts +4 -2
- package/mobile/dist/components/ProductGalleryGreen/ProductGalleryGreen.js +9 -11
- package/mobile/dist/components/ProductGalleryGreen/ProductGalleryGreen.js.map +1 -1
- package/mobile/dist/types.d.ts +5 -0
- package/mobile/dist/utils/style2className.d.ts +1 -0
- package/mobile/dist/utils/style2className.js +7 -0
- package/mobile/dist/utils/style2className.js.map +1 -0
- package/mobile/lib/components/BlockContent.d.ts +2 -1
- package/mobile/lib/components/ContentPage/ContentPage.js +1 -3
- package/mobile/lib/components/ContentPage/ContentPage.js.map +1 -1
- package/mobile/lib/components/ContentPage/CustomContentPage.d.ts +30 -0
- package/mobile/lib/components/ContentPage/CustomContentPage.js +31 -0
- package/mobile/lib/components/ContentPage/CustomContentPage.js.map +1 -0
- package/mobile/lib/components/GroupBlock/BlocksTypeProps.d.ts +36 -0
- package/mobile/lib/components/GroupBlock/BlocksTypeProps.js +2 -0
- package/mobile/lib/components/GroupBlock/BlocksTypeProps.js.map +1 -0
- package/mobile/lib/components/GroupBlock/EmbeddableGroupBlocks.d.ts +4 -0
- package/mobile/lib/components/GroupBlock/EmbeddableGroupBlocks.js +7 -0
- package/mobile/lib/components/GroupBlock/EmbeddableGroupBlocks.js.map +1 -0
- package/mobile/lib/components/GroupBlock/GroupBlock.d.ts +9 -0
- package/mobile/lib/components/GroupBlock/GroupBlock.js +17 -0
- package/mobile/lib/components/GroupBlock/GroupBlock.js.map +1 -0
- package/mobile/lib/components/GroupBlock/GroupBlockContent.d.ts +21 -0
- package/mobile/lib/components/GroupBlock/GroupBlockContent.js +2 -0
- package/mobile/lib/components/GroupBlock/GroupBlockContent.js.map +1 -0
- package/mobile/lib/components/GroupBlock/GroupBlockTabs.d.ts +10 -0
- package/mobile/lib/components/GroupBlock/GroupBlockTabs.js +16 -0
- package/mobile/lib/components/GroupBlock/GroupBlockTabs.js.map +1 -0
- package/mobile/lib/components/GroupBlock/GroupBlocksItem.d.ts +8 -0
- package/mobile/lib/components/GroupBlock/GroupBlocksItem.js +17 -0
- package/mobile/lib/components/GroupBlock/GroupBlocksItem.js.map +1 -0
- package/mobile/lib/components/GroupBlock/filterBlocksByTag.d.ts +2 -0
- package/mobile/lib/components/GroupBlock/filterBlocksByTag.js +4 -0
- package/mobile/lib/components/GroupBlock/filterBlocksByTag.js.map +1 -0
- package/mobile/lib/components/GroupBlock/renderBlocksTypes.d.ts +9 -0
- package/mobile/lib/components/GroupBlock/renderBlocksTypes.js +13 -0
- package/mobile/lib/components/GroupBlock/renderBlocksTypes.js.map +1 -0
- package/mobile/lib/components/OtherProducts/OtherProductsContent.d.ts +4 -2
- package/mobile/lib/components/ProductGalleryGreen/ProductGalleryGreen.js +9 -11
- package/mobile/lib/components/ProductGalleryGreen/ProductGalleryGreen.js.map +1 -1
- package/mobile/lib/types.d.ts +5 -0
- package/mobile/lib/utils/style2className.d.ts +1 -0
- package/mobile/lib/utils/style2className.js +4 -0
- package/mobile/lib/utils/style2className.js.map +1 -0
- package/mobile/src/components/BlockContent.ts +3 -1
- package/mobile/src/components/ContentPage/ContentPage.tsx +1 -4
- package/mobile/src/components/ContentPage/CustomContentPage.tsx +82 -0
- package/mobile/src/components/GroupBlock/BlocksTypeProps.ts +40 -0
- package/mobile/src/components/GroupBlock/EmbeddableGroupBlocks.tsx +7 -0
- package/mobile/src/components/GroupBlock/GroupBlock.example.json +27 -0
- package/mobile/src/components/GroupBlock/GroupBlock.tsx +43 -0
- package/mobile/src/components/GroupBlock/GroupBlockContent.ts +23 -0
- package/mobile/src/components/GroupBlock/GroupBlockTabs.tsx +54 -0
- package/mobile/src/components/GroupBlock/GroupBlocksItem.tsx +30 -0
- package/mobile/src/components/GroupBlock/filterBlocksByTag.ts +5 -0
- package/mobile/src/components/GroupBlock/renderBlocksTypes.tsx +27 -0
- package/mobile/src/components/OtherProducts/OtherProductsContent.ts +4 -2
- package/mobile/src/components/ProductGalleryGreen/ProductGalleryGreen.tsx +8 -14
- package/mobile/src/types.ts +7 -1
- package/mobile/src/utils/style2className.ts +3 -0
- package/package.json +1 -1
- package/src/components/BlockContent.ts +3 -1
- package/src/components/Blocks.ts +2 -0
- package/src/components/ContentPage/ContentPage.tsx +1 -4
- package/src/components/ContentPage/CustomContentPage.tsx +82 -0
- package/src/components/GroupBlock/BlocksTypeProps.ts +40 -0
- package/src/components/GroupBlock/EmbeddableGroupBlocks.tsx +7 -0
- package/src/components/GroupBlock/GroupBlock.example.json +27 -0
- package/src/components/GroupBlock/GroupBlock.fixture.tsx +51 -0
- package/src/components/GroupBlock/GroupBlock.tsx +43 -0
- package/src/components/GroupBlock/GroupBlockContent.ts +23 -0
- package/src/components/GroupBlock/GroupBlockTabs.tsx +54 -0
- package/src/components/GroupBlock/GroupBlocksItem.tsx +30 -0
- package/src/components/GroupBlock/filterBlocksByTag.ts +5 -0
- package/src/components/GroupBlock/renderBlocksTypes.tsx +27 -0
- package/src/components/OtherProducts/OtherProductsContent.ts +4 -2
- package/src/components/ProductBlock/ProductBlockInner.tsx +1 -1
- package/src/components/ProductGalleryGreen/ProductGalleryGreen.tsx +8 -14
- package/src/types.ts +7 -1
- package/src/utils/style2className.ts +3 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { GroupBlockDef } from './BlocksTypeProps';
|
|
2
|
+
/**
|
|
3
|
+
* @title Таб
|
|
4
|
+
*/
|
|
5
|
+
export interface GroupBlockTab {
|
|
6
|
+
/** @title Название */
|
|
7
|
+
title?: string;
|
|
8
|
+
/** @title Tег */
|
|
9
|
+
tag?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @title Блок-группировки
|
|
13
|
+
*/
|
|
14
|
+
export interface GroupBlockContent {
|
|
15
|
+
/** @title Блоки */
|
|
16
|
+
groupBlocks?: GroupBlockDef[];
|
|
17
|
+
/** @title Табы */
|
|
18
|
+
tabs?: GroupBlockTab[];
|
|
19
|
+
/** @title Показывать счетчик блоков во вкладках */
|
|
20
|
+
isShowCounter?: boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupBlockContent.js","sourceRoot":"","sources":["../../../src/components/GroupBlock/GroupBlockContent.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TabsItemProps } from './GroupBlock';
|
|
2
|
+
export declare type TabClickHandler = (tag: any) => void;
|
|
3
|
+
export interface GroupBlockTabsProps {
|
|
4
|
+
onTabClick: TabClickHandler;
|
|
5
|
+
currentTag?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
tabs?: TabsItemProps[];
|
|
8
|
+
isShowCounter?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const GroupBlockTabs: (props: import("@redneckz/uni-jsx").PropsWithChildren<GroupBlockTabsProps, any>, context?: any) => any;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
export const GroupBlockTabs = JSX((props) => {
|
|
4
|
+
const { tabs, currentTag, onTabClick, className = '', isShowCounter = true } = props;
|
|
5
|
+
return (_jsx("div", { className: `mb-2 box-border flex gap-x-1 h-12 ${className}`, role: "tablist", children: tabs?.map(renderTab(onTabClick, isShowCounter, currentTag)) }));
|
|
6
|
+
});
|
|
7
|
+
const badgeStyle = 'w-[22px] h-[22px] rounded-full text-m-sm';
|
|
8
|
+
const renderTab = (onTabClick, isShowCounter, currentTag) => (tab, i) => {
|
|
9
|
+
const isActive = currentTag === tab.tag;
|
|
10
|
+
const tabBg = isActive ? 'bg-primary-main' : 'group bg-white';
|
|
11
|
+
const tabText = isActive ? 'text-white' : 'text-secondary-text group-hover:text-primary-main';
|
|
12
|
+
const counterBlockStyle = `${badgeStyle}
|
|
13
|
+
${isActive ? 'bg-white/30 text-white' : 'bg-secondary-text/10 text-secondary-text'}`;
|
|
14
|
+
return (_jsx("div", { className: `flex h-full w-full flex-1 cursor-pointer mr-2 last:mr-0 box-content ${tabBg}`, role: "tab", onClick: () => onTabClick(tab.tag), "aria-selected": String(isActive), tag: tab?.tag, children: _jsxs("div", { className: "flex flex-1 items-center justify-center", children: [tab?.title ? _jsx("h3", { className: `mr-8 ${tabText}`, children: tab?.title }) : null, isShowCounter ? (_jsx("div", { className: `flex items-center justify-center ${counterBlockStyle}`, children: _jsx("span", { children: tab.count }) })) : null] }) }, String(i)));
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=GroupBlockTabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupBlockTabs.js","sourceRoot":"","sources":["../../../src/components/GroupBlock/GroupBlockTabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAaxC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAsB,CAAC,KAAK,EAAE,EAAE;IAC/D,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,GAAG,EAAE,EAAE,aAAa,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAErF,OAAO,CACL,cAAK,SAAS,EAAE,qCAAqC,SAAS,EAAE,EAAE,IAAI,EAAC,SAAS,YAC7E,IAAI,EAAE,GAAG,CAAC,SAAS,CAAC,UAAU,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC,GACxD,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,0CAA0C,CAAC;AAE9D,MAAM,SAAS,GACb,CAAC,UAA2B,EAAE,aAAsB,EAAE,UAAmB,EAAE,EAAE,CAC7E,CAAC,GAAkB,EAAE,CAAS,EAAE,EAAE;IAChC,MAAM,QAAQ,GAAG,UAAU,KAAK,GAAG,CAAC,GAAG,CAAC;IACxC,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAC9D,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,mDAAmD,CAAC;IAC9F,MAAM,iBAAiB,GAAG,GAAG,UAAU;QACnC,QAAQ,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,0CAA0C,EAAE,CAAC;IAEvF,OAAO,CACL,cAEE,SAAS,EAAE,uEAAuE,KAAK,EAAE,EACzF,IAAI,EAAC,KAAK,EACV,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,mBACnB,MAAM,CAAC,QAAQ,CAAC,EAC/B,GAAG,EAAE,GAAG,EAAE,GAAG,YAEb,eAAK,SAAS,EAAC,yCAAyC,aACrD,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,aAAI,SAAS,EAAE,QAAQ,OAAO,EAAE,YAAG,GAAG,EAAE,KAAK,GAAM,CAAC,CAAC,CAAC,IAAI,EACvE,aAAa,CAAC,CAAC,CAAC,CACf,cAAK,SAAS,EAAE,oCAAoC,iBAAiB,EAAE,YACrE,yBAAO,GAAG,CAAC,KAAK,GAAQ,GACpB,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,IAdD,MAAM,CAAC,CAAC,CAAC,CAeV,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
|
|
2
|
+
import type { UniBlockProps } from '../../types';
|
|
3
|
+
import type { GroupBlockDef } from './BlocksTypeProps';
|
|
4
|
+
import { GroupBlockContent } from './GroupBlockContent';
|
|
5
|
+
export interface GroupBlocksProps extends GroupBlockContent, UniBlockProps {
|
|
6
|
+
}
|
|
7
|
+
export declare const GroupBlocksItem: (props: import("@redneckz/uni-jsx").PropsWithChildren<GroupBlocksProps, any>, context?: any) => any;
|
|
8
|
+
export declare const renderBlock: (context: ContentPageContext) => (block: GroupBlockDef, i: number) => any;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { style2className } from '../../utils/style2className.js';
|
|
4
|
+
import { EmbeddableGroupBlocks } from './EmbeddableGroupBlocks.js';
|
|
5
|
+
export const GroupBlocksItem = JSX(({ groupBlocks, context }) => {
|
|
6
|
+
return (_jsx("div", { className: 'grid grid-cols-12 gap-2 box-border', children: groupBlocks?.length ? groupBlocks.map(renderBlock(context)) : null }));
|
|
7
|
+
});
|
|
8
|
+
export const renderBlock = (context) => (block, i) => {
|
|
9
|
+
const type = block?.blockType;
|
|
10
|
+
if (!type || !(type in EmbeddableGroupBlocks)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const classNameBlock = style2className(block?.style);
|
|
14
|
+
const EmbeddedBlock = EmbeddableGroupBlocks[type];
|
|
15
|
+
return (_jsx(EmbeddedBlock, { context: context, ...block, className: classNameBlock }, `block_${i}`));
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=GroupBlocksItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupBlocksItem.js","sourceRoot":"","sources":["../../../src/components/GroupBlock/GroupBlocksItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAIxC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAKhE,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAmB,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,EAAE;IAChF,OAAO,CACL,cAAK,SAAS,EAAE,oCAAoC,YACjD,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAC/D,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAA2B,EAAE,EAAE,CAAC,CAAC,KAAoB,EAAE,CAAS,EAAE,EAAE;IAC9F,MAAM,IAAI,GAAG,KAAK,EAAE,SAAS,CAAC;IAC9B,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,qBAAqB,CAAC,EAAE;QAC7C,OAAO,IAAI,CAAC;KACb;IACD,MAAM,cAAc,GAAG,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACrD,MAAM,aAAa,GAAa,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC5D,OAAO,CACL,KAAC,aAAa,IAAoB,OAAO,EAAE,OAAO,KAAM,KAAK,EAAE,SAAS,EAAE,cAAc,IAApE,SAAS,CAAC,EAAE,CAA4D,CAC7F,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterBlocksByTag.js","sourceRoot":"","sources":["../../../src/components/GroupBlock/filterBlocksByTag.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAuB,EAAE,GAAY,EAAE,EAAE;IACzE,OAAO,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AAC7E,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
|
|
2
|
+
import type { GroupBlockDef } from './BlocksTypeProps';
|
|
3
|
+
declare type EmbeddableBlocksProps = {
|
|
4
|
+
groupBlocks?: GroupBlockDef[];
|
|
5
|
+
context: ContentPageContext;
|
|
6
|
+
className?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const renderBlock: ({ context, className }: EmbeddableBlocksProps) => (block: GroupBlockDef, i: number) => any;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { EmbeddableGroupBlocks } from './EmbeddableGroupBlocks.js';
|
|
3
|
+
import { style2className } from '../../utils/style2className.js';
|
|
4
|
+
export const renderBlock = ({ context, className }) => (block, i) => {
|
|
5
|
+
const type = block?.blockType;
|
|
6
|
+
if (!type || !(type in EmbeddableGroupBlocks)) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const classNameBlock = style2className(block?.style);
|
|
10
|
+
const EmbeddedBlock = EmbeddableGroupBlocks[type];
|
|
11
|
+
return (_jsx("div", { className: className, children: _jsx(EmbeddedBlock, { context: context, ...block, className: classNameBlock }) }, `block_${i}`));
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=renderBlocksTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderBlocksTypes.js","sourceRoot":"","sources":["../../../src/components/GroupBlock/renderBlocksTypes.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAQ9D,MAAM,CAAC,MAAM,WAAW,GACtB,CAAC,EAAE,OAAO,EAAE,SAAS,EAAyB,EAAE,EAAE,CAClD,CAAC,KAAoB,EAAE,CAAS,EAAE,EAAE;IAClC,MAAM,IAAI,GAAG,KAAK,EAAE,SAAS,CAAC;IAC9B,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,qBAAqB,CAAC,EAAE;QAC7C,OAAO,IAAI,CAAC;KACb;IACD,MAAM,cAAc,GAAG,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACrD,MAAM,aAAa,GAAa,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC5D,OAAO,CACL,cAAK,SAAS,EAAE,SAAS,YACvB,KAAC,aAAa,IAAC,OAAO,EAAE,OAAO,KAAM,KAAK,EAAE,SAAS,EAAE,cAAc,GAAI,IAD3C,SAAS,CAAC,EAAE,CAEtC,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -13,7 +13,10 @@ export interface BlockItemCommonProps {
|
|
|
13
13
|
* @title Отображать в раскрытом виде
|
|
14
14
|
*/
|
|
15
15
|
isExpanded?: boolean;
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* @title Блоки
|
|
18
|
+
* @maxItems 10
|
|
19
|
+
*/
|
|
17
20
|
blocks?: BlockDef[];
|
|
18
21
|
columns?: ColumnsCount;
|
|
19
22
|
}
|
|
@@ -25,7 +28,6 @@ export interface OtherProductsContent {
|
|
|
25
28
|
title?: string;
|
|
26
29
|
/**
|
|
27
30
|
* @title Список
|
|
28
|
-
* @maxItems 10
|
|
29
31
|
*/
|
|
30
32
|
blockItems?: BlockItemCommonProps[];
|
|
31
33
|
colorPalette?: ColorPalette;
|
|
@@ -13,7 +13,7 @@ const productSlideStyleMap = {
|
|
|
13
13
|
primary: 'bg-white text-primary-text',
|
|
14
14
|
secondary: 'bg-primary-main text-white',
|
|
15
15
|
};
|
|
16
|
-
export const ProductGalleryGreen = JSX(({ className = '', context, slides = [], version = 'primary',
|
|
16
|
+
export const ProductGalleryGreen = JSX(({ className = '', context, slides = [], version = 'primary', anchor = null }) => {
|
|
17
17
|
const galleryNav = slides.map((s) => s.nav);
|
|
18
18
|
const galleryBlocks = slides.map((s) => s.productBlock);
|
|
19
19
|
const [activeSlideIndex, setActiveSlideIndex] = context.useState(0);
|
|
@@ -24,19 +24,18 @@ export const ProductGalleryGreen = JSX(({ className = '', context, slides = [],
|
|
|
24
24
|
activeSlideIndex,
|
|
25
25
|
onClick: () => setActiveSlideIndex(i),
|
|
26
26
|
version,
|
|
27
|
-
duration,
|
|
28
27
|
})) })] }));
|
|
29
28
|
});
|
|
30
29
|
function renderProductBlock(block, i, context) {
|
|
31
30
|
const { version } = block;
|
|
32
31
|
const additionalClass = version ? productBlockStyleMap[version].title : '';
|
|
33
|
-
return (_jsx("section", { className: "box-border relative flex grow-0 shrink-0 basis-full", role: "listitem", children: _jsx("div", { className: "flex grow", children: _jsx(ProductBlockInner, { className: `pl-[50px]
|
|
32
|
+
return (_jsx("section", { className: "box-border relative flex grow-0 shrink-0 basis-full", role: "listitem", children: _jsx("div", { className: "flex grow", children: _jsx(ProductBlockInner, { className: `pl-[50px] z-[1] ${additionalClass}`, context: context, textBlockClassName: "mb-[154px]", ...block }) }) }, String(i)));
|
|
34
33
|
}
|
|
35
|
-
function renderNavButton({ slide, i, activeSlideIndex, onClick, version
|
|
34
|
+
function renderNavButton({ slide, i, activeSlideIndex, onClick, version }) {
|
|
36
35
|
const isActiveBtn = i === activeSlideIndex;
|
|
37
36
|
const btnClassName = isActiveBtn
|
|
38
|
-
? 'bg-white shadow-dark-blue/42 h-[102px] w-[354px] min-w-[354px]
|
|
39
|
-
: `min-w-[277px] px-0 pt-4 pb-[23px] hover:py-[26px] hover:py-[26px] ease-in duration-300
|
|
37
|
+
? 'bg-white shadow-dark-blue/42 h-[102px] w-[354px] min-w-[354px] p-0 border-none'
|
|
38
|
+
: `min-w-[277px] px-0 pt-4 pb-[23px] hover:py-[26px] hover:py-[26px] ease-in duration-300 bg-white/10
|
|
40
39
|
${productSlideStyleMap[version]}`;
|
|
41
40
|
const btnTitleClassName = isActiveBtn
|
|
42
41
|
? 'text-primary-text text-title-2xs'
|
|
@@ -44,10 +43,9 @@ function renderNavButton({ slide, i, activeSlideIndex, onClick, version, duratio
|
|
|
44
43
|
const btnDescClassName = isActiveBtn
|
|
45
44
|
? 'text-secondary-text text-m-title-xs mt-2.5'
|
|
46
45
|
: `text-m-md mt-1.5 ${productBlockStyleMap[version].text}`;
|
|
47
|
-
const additionalBorder = version === 'secondary' ? 'border-white/50' : '';
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
${
|
|
51
|
-
`, children: [_jsxs("div", { className: "border-0 px-6", children: [_jsx("div", { className: `font-medium ${btnTitleClassName}`, children: slide?.title }), _jsx("div", { className: `text-secondary-text ${btnDescClassName}`, children: slide.description })] }), _jsx("div", { className: `absolute bottom-0 left-0 w-full h-[3px] bg-primary-main -translate-x-full ${progressBarClassName}`, style: { animationDuration: `${duration}s`, animationFillMode: 'forwards' } })] }, String(i)));
|
|
46
|
+
const additionalBorder = version === 'secondary' ? 'border-white/50' : 'border-black/50';
|
|
47
|
+
return (_jsx("button", { type: "button", onClick: onClick, "aria-label": slide?.title, className: `box-border font-sans relative overflow-hidden border-[1px] border-white/50 cursor-pointer text-left mx-1 grow basis-0
|
|
48
|
+
${btnClassName} ${additionalBorder}
|
|
49
|
+
`, children: _jsxs("div", { className: "border-0 px-6", children: [_jsx("div", { className: `font-medium ${btnTitleClassName}`, children: slide?.title }), _jsx("div", { className: `text-secondary-text ${btnDescClassName}`, children: slide.description })] }) }, String(i)));
|
|
52
50
|
}
|
|
53
51
|
//# sourceMappingURL=ProductGalleryGreen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductGalleryGreen.js","sourceRoot":"","sources":["../../../src/components/ProductGalleryGreen/ProductGalleryGreen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAIxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAUtE,MAAM,2BAA2B,GAAiC;IAChE,OAAO,EAAE,4BAA4B;IACrC,SAAS,EAAE,4BAA4B;CACxC,CAAC;AAEF,MAAM,oBAAoB,GAAoC;IAC5D,OAAO,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE,IAAI,EAAE,qBAAqB,EAAE;IACtE,SAAS,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE;CAC1D,CAAC;AAEF,MAAM,oBAAoB,GAAiC;IACzD,OAAO,EAAE,4BAA4B;IACrC,SAAS,EAAE,4BAA4B;CACxC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CACpC,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,EAAE,EAAE,OAAO,GAAG,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"ProductGalleryGreen.js","sourceRoot":"","sources":["../../../src/components/ProductGalleryGreen/ProductGalleryGreen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAIxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAUtE,MAAM,2BAA2B,GAAiC;IAChE,OAAO,EAAE,4BAA4B;IACrC,SAAS,EAAE,4BAA4B;CACxC,CAAC;AAEF,MAAM,oBAAoB,GAAoC;IAC5D,OAAO,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE,IAAI,EAAE,qBAAqB,EAAE;IACtE,SAAS,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE;CAC1D,CAAC;AAEF,MAAM,oBAAoB,GAAiC;IACzD,OAAO,EAAE,4BAA4B;IACrC,SAAS,EAAE,4BAA4B;CACxC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CACpC,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,EAAE,EAAE,OAAO,GAAG,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,EAAE,EAAE;IAC/E,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IACxD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEpE,OAAO,CACL,mBACE,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,iEAAiE,SAAS;UACnF,2BAA2B,CAAC,OAAO,CAAC,EAAE,aAExC,cACE,SAAS,EAAC,0BAA0B,EACpC,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,gBAAgB,MAAM,EAAE,EAC3D,IAAI,EAAC,MAAM,YAEV,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,GAC3E,EAEN,cAAK,SAAS,EAAC,yEAAyE,YACrF,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAC3B,eAAe,CAAC;oBACd,KAAK;oBACL,CAAC;oBACD,gBAAgB;oBAChB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC;oBACrC,OAAO;iBACR,CAAC,CACH,GACG,IACE,CACX,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,SAAS,kBAAkB,CAAC,KAA+B,EAAE,CAAS,EAAE,OAAO;IAC7E,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC1B,MAAM,eAAe,GAAG,OAAO,CAAC,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAE3E,OAAO,CACL,kBAEE,SAAS,EAAC,qDAAqD,EAC/D,IAAI,EAAC,UAAU,YAEf,cAAK,SAAS,EAAC,WAAW,YACxB,KAAC,iBAAiB,IAChB,SAAS,EAAE,mBAAmB,eAAe,EAAE,EAC/C,OAAO,EAAE,OAAO,EAChB,kBAAkB,EAAC,YAAY,KAC3B,KAAK,GACT,GACE,IAXD,MAAM,CAAC,CAAC,CAAC,CAYN,CACX,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,EAAE;IACvE,MAAM,WAAW,GAAG,CAAC,KAAK,gBAAgB,CAAC;IAE3C,MAAM,YAAY,GAAG,WAAW;QAC9B,CAAC,CAAC,gFAAgF;QAClF,CAAC,CAAC;QACE,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC;IACtC,MAAM,iBAAiB,GAAG,WAAW;QACnC,CAAC,CAAC,kCAAkC;QACpC,CAAC,CAAC,aAAa,oBAAoB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC;IACvD,MAAM,gBAAgB,GAAG,WAAW;QAClC,CAAC,CAAC,4CAA4C;QAC9C,CAAC,CAAC,oBAAoB,oBAAoB,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAE7D,MAAM,gBAAgB,GAAG,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAEzF,OAAO,CACL,iBACE,IAAI,EAAC,QAAQ,EAEb,OAAO,EAAE,OAAO,gBACJ,KAAK,EAAE,KAAK,EACxB,SAAS,EAAE;UACP,YAAY,IAAI,gBAAgB;OACnC,YAED,eAAK,SAAS,EAAC,eAAe,aAC5B,cAAK,SAAS,EAAE,eAAe,iBAAiB,EAAE,YAAG,KAAK,EAAE,KAAK,GAAO,EACxE,cAAK,SAAS,EAAE,uBAAuB,gBAAgB,EAAE,YAAG,KAAK,CAAC,WAAW,GAAO,IAChF,IAVD,MAAM,CAAC,CAAC,CAAC,CAWP,CACV,CAAC;AACJ,CAAC"}
|
package/mobile/lib/types.d.ts
CHANGED
|
@@ -37,10 +37,15 @@ export interface ContentPageMeta {
|
|
|
37
37
|
twitter?: Record<string, string>;
|
|
38
38
|
jsonLd?: string;
|
|
39
39
|
}
|
|
40
|
+
export interface CustomPageTemplate {
|
|
41
|
+
content?: Record<string, any>;
|
|
42
|
+
type?: string;
|
|
43
|
+
}
|
|
40
44
|
export interface ContentPageDef extends ContentPageMeta {
|
|
41
45
|
style?: string[];
|
|
42
46
|
blocks?: BlockDef[];
|
|
43
47
|
slots?: SlotsMap;
|
|
48
|
+
customPageTmpl?: CustomPageTemplate;
|
|
44
49
|
likeControl?: boolean;
|
|
45
50
|
colorPalette?: ColorPalette;
|
|
46
51
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function style2className(style: string[] | undefined | null): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style2className.js","sourceRoot":"","sources":["../../src/utils/style2className.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe,CAAC,KAAkC;IAChE,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -5,6 +5,7 @@ import type { ExchangeRateTileContent } from './ExchangeRateTile/ExchangeRateTil
|
|
|
5
5
|
import type { FooterContent } from './Footer/FooterContent';
|
|
6
6
|
import type { GalleryContent } from './Gallery/GalleryContent';
|
|
7
7
|
import type { GracePeriodContent } from './GracePeriod/GracePeriodContent';
|
|
8
|
+
import type { GroupBlockContent } from './GroupBlock/GroupBlockContent';
|
|
8
9
|
import type { HeaderContent } from './Header/HeaderContent';
|
|
9
10
|
import type { LinkDocsContent } from './LinkDocs/LinkDocsContent';
|
|
10
11
|
import type { LinkListContent } from './LinkList/LinkListContent';
|
|
@@ -48,4 +49,5 @@ export type BlockContent =
|
|
|
48
49
|
| TextBlockContent
|
|
49
50
|
| TileContent
|
|
50
51
|
| NavigationContent
|
|
51
|
-
| LinkListContent
|
|
52
|
+
| LinkListContent
|
|
53
|
+
| GroupBlockContent;
|
|
@@ -2,6 +2,7 @@ import { JSX, PropsWithChildren } from '@redneckz/uni-jsx';
|
|
|
2
2
|
import type { BlockDef, ContentPageDef, UniBlockProps } from '../../types';
|
|
3
3
|
import { changeHashOnScroll } from '../../utils/changeHashOnScroll';
|
|
4
4
|
import { isSSR } from '../../utils/isSSR';
|
|
5
|
+
import { style2className } from '../../utils/style2className';
|
|
5
6
|
import type { BlockContent } from '../BlockContent';
|
|
6
7
|
import { LikeControl } from '../LikeControl/LikeControl';
|
|
7
8
|
import { Placeholder } from '../Placeholder/Placeholder';
|
|
@@ -128,7 +129,3 @@ function renderBlock(
|
|
|
128
129
|
`block-${i}`,
|
|
129
130
|
);
|
|
130
131
|
}
|
|
131
|
-
|
|
132
|
-
function style2className(style: string[] | undefined | null): string {
|
|
133
|
-
return style ? style.join(' ') : '';
|
|
134
|
-
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { ContentPageDef, CustomPageTemplate, UniBlockProps } from '../../types';
|
|
3
|
+
import { style2className } from '../../utils/style2className';
|
|
4
|
+
import { ContentPageContext } from './ContentPageContext';
|
|
5
|
+
|
|
6
|
+
interface PageDecoratorProps<VNode> {
|
|
7
|
+
pageClassName: string;
|
|
8
|
+
pageTemplate: CustomPageTemplate;
|
|
9
|
+
render: (props: { pageClassName: string; pageTemplate: CustomPageTemplate }) => VNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type PageDecorator<VNode = any> = (
|
|
13
|
+
props: PageDecoratorProps<VNode>,
|
|
14
|
+
index?: number | string,
|
|
15
|
+
) => any;
|
|
16
|
+
|
|
17
|
+
export interface PageTemplate {
|
|
18
|
+
name: string;
|
|
19
|
+
template: any;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type PageTemplatesRegistry = Record<string, PageTemplate>;
|
|
23
|
+
|
|
24
|
+
export interface CustomContentPageProps extends UniBlockProps {
|
|
25
|
+
pageTemplatesRegistry: PageTemplatesRegistry;
|
|
26
|
+
data: ContentPageDef;
|
|
27
|
+
pageDecorator?: PageDecorator;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface RenderPageFunc {
|
|
31
|
+
pageTemplate: CustomPageTemplate;
|
|
32
|
+
pageClassName: string;
|
|
33
|
+
pageDecorator: PageDecorator;
|
|
34
|
+
pageTemplatesRegistry: PageTemplatesRegistry;
|
|
35
|
+
context: ContentPageContext;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const defaultPageDecorator: PageDecorator = ({ pageClassName, pageTemplate, render }) =>
|
|
39
|
+
render({ pageClassName, pageTemplate });
|
|
40
|
+
|
|
41
|
+
export const CustomContentPage = JSX<CustomContentPageProps>(
|
|
42
|
+
({
|
|
43
|
+
className = '',
|
|
44
|
+
context,
|
|
45
|
+
pageTemplatesRegistry,
|
|
46
|
+
data: { style: pageStyle, customPageTmpl: pageTemplate },
|
|
47
|
+
pageDecorator = defaultPageDecorator,
|
|
48
|
+
}) => {
|
|
49
|
+
return pageTemplate
|
|
50
|
+
? renderPage({
|
|
51
|
+
pageTemplate,
|
|
52
|
+
pageClassName: `${style2className(pageStyle)} ${className}`,
|
|
53
|
+
pageDecorator,
|
|
54
|
+
pageTemplatesRegistry,
|
|
55
|
+
context,
|
|
56
|
+
})
|
|
57
|
+
: null;
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
function renderPage({
|
|
62
|
+
pageTemplate,
|
|
63
|
+
pageClassName,
|
|
64
|
+
pageDecorator,
|
|
65
|
+
pageTemplatesRegistry,
|
|
66
|
+
context,
|
|
67
|
+
}: RenderPageFunc) {
|
|
68
|
+
const { type } = pageTemplate;
|
|
69
|
+
if (!(type && type in pageTemplatesRegistry) || !pageTemplatesRegistry[type].template) {
|
|
70
|
+
throw new Error(`No page template with "${type}" is registered`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const { template: PageComponent } = pageTemplatesRegistry[type];
|
|
74
|
+
return pageDecorator({
|
|
75
|
+
pageClassName,
|
|
76
|
+
pageTemplate,
|
|
77
|
+
render: (props) => {
|
|
78
|
+
const { content } = props.pageTemplate;
|
|
79
|
+
return <PageComponent className={props.pageClassName} context={context} {...content} />;
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ProductBlockContent } from '../../components/ProductBlock/ProductBlockContent';
|
|
2
|
+
import type { ProductTileContent } from '../../components/ProductTile/ProductTileContent';
|
|
3
|
+
import { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
|
|
4
|
+
|
|
5
|
+
export interface ActiveHandler {
|
|
6
|
+
context: ContentPageContext;
|
|
7
|
+
blocks?: GroupBlockDef[];
|
|
8
|
+
initialState?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface GroupBlockCommonProps {
|
|
12
|
+
/** @title Стиль */
|
|
13
|
+
style?: string[];
|
|
14
|
+
/** @title Теги */
|
|
15
|
+
tags?: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @title Продуктовый блок
|
|
20
|
+
* @default {"blockType": "ProductBlock"}
|
|
21
|
+
*/
|
|
22
|
+
export type ProductBlockDef = ProductBlockContent &
|
|
23
|
+
GroupBlockCommonProps & { blockType: 'ProductBlock' };
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @title Продуктовая плитка
|
|
27
|
+
* @default {"blockType": "ProductTile"}
|
|
28
|
+
*/
|
|
29
|
+
export type ProductTileDef = ProductTileContent &
|
|
30
|
+
GroupBlockCommonProps & { blockType: 'ProductTile' };
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @title Выберите блок
|
|
34
|
+
*/
|
|
35
|
+
export type EmptyOption = null;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @title Содержимое блока
|
|
39
|
+
*/
|
|
40
|
+
export type GroupBlockDef = EmptyOption | ProductBlockDef | ProductTileDef;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tabs": [
|
|
3
|
+
{ "title": "Еще программы", "index": 0 },
|
|
4
|
+
{ "title": "Страхование жизни", "index": 1, "tag": "tag1" },
|
|
5
|
+
{ "title": "Страхование здоровья", "index": 2, "tag": "tag2" }
|
|
6
|
+
],
|
|
7
|
+
"blocks": [
|
|
8
|
+
{
|
|
9
|
+
"blockType": "ProductBlock",
|
|
10
|
+
"title": "Продуктовый блок",
|
|
11
|
+
"description": "Описание текстового блока",
|
|
12
|
+
"tags":["tag2"]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"blockType": "ProductTile",
|
|
16
|
+
"title": "Продуктовая плитка",
|
|
17
|
+
"description": "Описание текстового блока",
|
|
18
|
+
"tags":["tag1"]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"blockType": "ProductBlock",
|
|
22
|
+
"title": "Продуктовый блок",
|
|
23
|
+
"description": "Описание текстового блока",
|
|
24
|
+
"tags":["tag2"]
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { UniBlockProps } from '../../types';
|
|
3
|
+
import type { GroupBlockContent, GroupBlockTab } from './GroupBlockContent';
|
|
4
|
+
import { GroupBlockTabs } from './GroupBlockTabs';
|
|
5
|
+
import { GroupBlocksItem } from './GroupBlocksItem';
|
|
6
|
+
import { filterBlocksByTag } from './filterBlocksByTag';
|
|
7
|
+
|
|
8
|
+
export interface TabsItemProps extends GroupBlockTab {
|
|
9
|
+
count?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface GroupBlockProps extends GroupBlockContent, UniBlockProps {
|
|
13
|
+
tabs?: TabsItemProps[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const GroupBlock = JSX<GroupBlockProps>(
|
|
17
|
+
({ className = '', tabs, context, anchor = null, groupBlocks = [] }) => {
|
|
18
|
+
const [currentTag, setCurrentTag] = context.useState(tabs?.[0]?.tag);
|
|
19
|
+
|
|
20
|
+
const filteredBlocks = filterBlocksByTag(groupBlocks, currentTag);
|
|
21
|
+
|
|
22
|
+
const tabsNewMap = tabs?.map((tab) => {
|
|
23
|
+
const count = tab.tag
|
|
24
|
+
? groupBlocks.filter((block) => block?.tags?.includes(`${tab.tag}`)).length
|
|
25
|
+
: groupBlocks.length;
|
|
26
|
+
|
|
27
|
+
return { ...tab, count };
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<section id={anchor} className={`box-border gap-1 h-12 ${className}`}>
|
|
32
|
+
{tabsNewMap?.length ? (
|
|
33
|
+
<GroupBlockTabs currentTag={currentTag} onTabClick={setCurrentTag} tabs={tabsNewMap} />
|
|
34
|
+
) : null}
|
|
35
|
+
{groupBlocks.length ? (
|
|
36
|
+
<div className="list-none">
|
|
37
|
+
<GroupBlocksItem context={context} groupBlocks={filteredBlocks} />
|
|
38
|
+
</div>
|
|
39
|
+
) : null}
|
|
40
|
+
</section>
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { GroupBlockDef } from './BlocksTypeProps';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @title Таб
|
|
5
|
+
*/
|
|
6
|
+
export interface GroupBlockTab {
|
|
7
|
+
/** @title Название */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** @title Tег */
|
|
10
|
+
tag?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @title Блок-группировки
|
|
15
|
+
*/
|
|
16
|
+
export interface GroupBlockContent {
|
|
17
|
+
/** @title Блоки */
|
|
18
|
+
groupBlocks?: GroupBlockDef[];
|
|
19
|
+
/** @title Табы */
|
|
20
|
+
tabs?: GroupBlockTab[];
|
|
21
|
+
/** @title Показывать счетчик блоков во вкладках */
|
|
22
|
+
isShowCounter?: boolean;
|
|
23
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { TabsItemProps } from './GroupBlock';
|
|
3
|
+
|
|
4
|
+
export type TabClickHandler = (tag) => void;
|
|
5
|
+
|
|
6
|
+
export interface GroupBlockTabsProps {
|
|
7
|
+
onTabClick: TabClickHandler;
|
|
8
|
+
currentTag?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
tabs?: TabsItemProps[];
|
|
11
|
+
isShowCounter?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const GroupBlockTabs = JSX<GroupBlockTabsProps>((props) => {
|
|
15
|
+
const { tabs, currentTag, onTabClick, className = '', isShowCounter = true } = props;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className={`mb-2 box-border flex gap-x-1 h-12 ${className}`} role="tablist">
|
|
19
|
+
{tabs?.map(renderTab(onTabClick, isShowCounter, currentTag))}
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const badgeStyle = 'w-[22px] h-[22px] rounded-full text-m-sm';
|
|
25
|
+
|
|
26
|
+
const renderTab =
|
|
27
|
+
(onTabClick: TabClickHandler, isShowCounter: boolean, currentTag?: string) =>
|
|
28
|
+
(tab: TabsItemProps, i: number) => {
|
|
29
|
+
const isActive = currentTag === tab.tag;
|
|
30
|
+
const tabBg = isActive ? 'bg-primary-main' : 'group bg-white';
|
|
31
|
+
const tabText = isActive ? 'text-white' : 'text-secondary-text group-hover:text-primary-main';
|
|
32
|
+
const counterBlockStyle = `${badgeStyle}
|
|
33
|
+
${isActive ? 'bg-white/30 text-white' : 'bg-secondary-text/10 text-secondary-text'}`;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
key={String(i)}
|
|
38
|
+
className={`flex h-full w-full flex-1 cursor-pointer mr-2 last:mr-0 box-content ${tabBg}`}
|
|
39
|
+
role="tab"
|
|
40
|
+
onClick={() => onTabClick(tab.tag)}
|
|
41
|
+
aria-selected={String(isActive)}
|
|
42
|
+
tag={tab?.tag}
|
|
43
|
+
>
|
|
44
|
+
<div className="flex flex-1 items-center justify-center">
|
|
45
|
+
{tab?.title ? <h3 className={`mr-8 ${tabText}`}>{tab?.title}</h3> : null}
|
|
46
|
+
{isShowCounter ? (
|
|
47
|
+
<div className={`flex items-center justify-center ${counterBlockStyle}`}>
|
|
48
|
+
<span>{tab.count}</span>
|
|
49
|
+
</div>
|
|
50
|
+
) : null}
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { JSXBlock } from '../../components/ContentPage/ContentPage';
|
|
3
|
+
import type { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
|
|
4
|
+
import type { UniBlockProps } from '../../types';
|
|
5
|
+
import { style2className } from '../../utils/style2className';
|
|
6
|
+
import type { GroupBlockDef } from './BlocksTypeProps';
|
|
7
|
+
import { EmbeddableGroupBlocks } from './EmbeddableGroupBlocks';
|
|
8
|
+
import { GroupBlockContent } from './GroupBlockContent';
|
|
9
|
+
|
|
10
|
+
export interface GroupBlocksProps extends GroupBlockContent, UniBlockProps {}
|
|
11
|
+
|
|
12
|
+
export const GroupBlocksItem = JSX<GroupBlocksProps>(({ groupBlocks, context }) => {
|
|
13
|
+
return (
|
|
14
|
+
<div className={'grid grid-cols-12 gap-2 box-border'}>
|
|
15
|
+
{groupBlocks?.length ? groupBlocks.map(renderBlock(context)) : null}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const renderBlock = (context: ContentPageContext) => (block: GroupBlockDef, i: number) => {
|
|
21
|
+
const type = block?.blockType;
|
|
22
|
+
if (!type || !(type in EmbeddableGroupBlocks)) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const classNameBlock = style2className(block?.style);
|
|
26
|
+
const EmbeddedBlock: JSXBlock = EmbeddableGroupBlocks[type];
|
|
27
|
+
return (
|
|
28
|
+
<EmbeddedBlock key={`block_${i}`} context={context} {...block} className={classNameBlock} />
|
|
29
|
+
);
|
|
30
|
+
};
|