@redneckz/wildless-cms-uni-blocks 0.3.58 → 0.3.59
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 +29 -14
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/components/Header/Header.js +2 -2
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/Header/HeaderContent.d.ts +6 -0
- package/dist/components/Header/HeaderSubMenu.js +7 -4
- package/dist/components/Header/HeaderSubMenu.js.map +1 -1
- package/dist/components/ProductTile/ProductTile.js +14 -2
- package/dist/components/ProductTile/ProductTile.js.map +1 -1
- package/dist/components/ProductTile/ProductTileContent.d.ts +2 -0
- package/dist/components/Tile/Tile.js +1 -1
- package/dist/components/Tile/Tile.js.map +1 -1
- package/dist/types.d.ts +0 -5
- package/dist/ui-kit/Button/Button.js +2 -2
- package/dist/ui-kit/Button/Button.js.map +1 -1
- package/dist/ui-kit/Button/ButtonInner.js +2 -2
- package/dist/ui-kit/Button/ButtonInner.js.map +1 -1
- package/dist/ui-kit/Button/ButtonProps.d.ts +2 -0
- package/dist/ui-kit/Button/ButtonSection.js +1 -1
- package/dist/ui-kit/Button/ButtonSection.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/Header/Header.fixture.d.ts +1 -0
- package/lib/components/Header/Header.js +2 -2
- package/lib/components/Header/Header.js.map +1 -1
- package/lib/components/Header/HeaderContent.d.ts +6 -0
- package/lib/components/Header/HeaderSubMenu.js +7 -4
- package/lib/components/Header/HeaderSubMenu.js.map +1 -1
- package/lib/components/ProductTile/ProductTile.fixture.d.ts +1 -0
- package/lib/components/ProductTile/ProductTile.js +14 -2
- package/lib/components/ProductTile/ProductTile.js.map +1 -1
- package/lib/components/ProductTile/ProductTileContent.d.ts +2 -0
- package/lib/components/Tile/Tile.js +1 -1
- package/lib/components/Tile/Tile.js.map +1 -1
- package/lib/types.d.ts +0 -5
- package/lib/ui-kit/Button/Button.js +2 -2
- package/lib/ui-kit/Button/Button.js.map +1 -1
- package/lib/ui-kit/Button/ButtonInner.js +2 -2
- package/lib/ui-kit/Button/ButtonInner.js.map +1 -1
- package/lib/ui-kit/Button/ButtonProps.d.ts +2 -0
- package/lib/ui-kit/Button/ButtonSection.js +1 -1
- package/lib/ui-kit/Button/ButtonSection.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +3 -3
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/components/Header/HeaderContent.d.ts +6 -0
- package/mobile/dist/components/Header/HeaderSubMenu.js +7 -4
- package/mobile/dist/components/Header/HeaderSubMenu.js.map +1 -1
- package/mobile/dist/components/ProductTile/ProductTile.js +14 -2
- package/mobile/dist/components/ProductTile/ProductTile.js.map +1 -1
- package/mobile/dist/components/ProductTile/ProductTileContent.d.ts +2 -0
- package/mobile/dist/components/Tile/Tile.js +1 -1
- package/mobile/dist/components/Tile/Tile.js.map +1 -1
- package/mobile/dist/types.d.ts +0 -5
- package/mobile/dist/ui-kit/Button/ButtonInner.js +2 -2
- package/mobile/dist/ui-kit/Button/ButtonInner.js.map +1 -1
- package/mobile/dist/ui-kit/Button/ButtonProps.d.ts +2 -0
- package/mobile/dist/ui-kit/Button/ButtonSection.js +1 -1
- package/mobile/dist/ui-kit/Button/ButtonSection.js.map +1 -1
- package/mobile/lib/components/Header/HeaderContent.d.ts +6 -0
- package/mobile/lib/components/Header/HeaderSubMenu.js +7 -4
- package/mobile/lib/components/Header/HeaderSubMenu.js.map +1 -1
- package/mobile/lib/components/ProductTile/ProductTile.js +14 -2
- package/mobile/lib/components/ProductTile/ProductTile.js.map +1 -1
- package/mobile/lib/components/ProductTile/ProductTileContent.d.ts +2 -0
- package/mobile/lib/components/Tile/Tile.js +1 -1
- package/mobile/lib/components/Tile/Tile.js.map +1 -1
- package/mobile/lib/types.d.ts +0 -5
- package/mobile/lib/ui-kit/Button/ButtonInner.js +2 -2
- package/mobile/lib/ui-kit/Button/ButtonInner.js.map +1 -1
- package/mobile/lib/ui-kit/Button/ButtonProps.d.ts +2 -0
- package/mobile/lib/ui-kit/Button/ButtonSection.js +1 -1
- package/mobile/lib/ui-kit/Button/ButtonSection.js.map +1 -1
- package/mobile/src/components/Header/HeaderContent.ts +6 -0
- package/mobile/src/components/Header/HeaderSubMenu.tsx +10 -5
- package/mobile/src/components/ProductTile/ProductTile.tsx +30 -13
- package/mobile/src/components/ProductTile/ProductTileContent.ts +2 -0
- package/mobile/src/components/Tile/Tile.tsx +5 -1
- package/mobile/src/types.ts +0 -6
- package/mobile/src/ui-kit/Button/ButtonInner.tsx +2 -1
- package/mobile/src/ui-kit/Button/ButtonProps.ts +2 -0
- package/mobile/src/ui-kit/Button/ButtonSection.tsx +1 -1
- package/package.json +1 -1
- package/src/components/Header/Header.fixture.tsx +1 -0
- package/src/components/Header/Header.tsx +4 -1
- package/src/components/Header/HeaderContent.ts +6 -0
- package/src/components/Header/HeaderSubMenu.tsx +10 -5
- package/src/components/ProductTile/ProductTile.fixture.tsx +50 -5
- package/src/components/ProductTile/ProductTile.tsx +30 -13
- package/src/components/ProductTile/ProductTileContent.ts +2 -0
- package/src/components/Tile/Tile.tsx +5 -1
- package/src/types.ts +0 -6
- package/src/ui-kit/Button/Button.fixture.tsx +12 -0
- package/src/ui-kit/Button/Button.tsx +8 -2
- package/src/ui-kit/Button/ButtonInner.tsx +2 -1
- package/src/ui-kit/Button/ButtonProps.ts +2 -0
- package/src/ui-kit/Button/ButtonSection.tsx +1 -1
- package/dist/components/ContentPage/CustomContentPage.d.ts +0 -30
- package/dist/components/ContentPage/CustomContentPage.js +0 -33
- package/dist/components/ContentPage/CustomContentPage.js.map +0 -1
- package/lib/components/ContentPage/CustomContentPage.d.ts +0 -30
- package/lib/components/ContentPage/CustomContentPage.js +0 -31
- package/lib/components/ContentPage/CustomContentPage.js.map +0 -1
- package/mobile/dist/components/ContentPage/CustomContentPage.d.ts +0 -30
- package/mobile/dist/components/ContentPage/CustomContentPage.js +0 -33
- package/mobile/dist/components/ContentPage/CustomContentPage.js.map +0 -1
- package/mobile/lib/components/ContentPage/CustomContentPage.d.ts +0 -30
- package/mobile/lib/components/ContentPage/CustomContentPage.js +0 -31
- package/mobile/lib/components/ContentPage/CustomContentPage.js.map +0 -1
- package/mobile/src/components/ContentPage/CustomContentPage.tsx +0 -82
- package/src/components/ContentPage/CustomContentPage.tsx +0 -82
|
@@ -17,6 +17,12 @@ const letterWithMoney: Picture = {
|
|
|
17
17
|
format: 'webp',
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
const letterWithPhone: Picture = {
|
|
21
|
+
src: 'letter-with-phone.png',
|
|
22
|
+
alt: 'Пенсионный кредит в РСХБ',
|
|
23
|
+
format: 'webp',
|
|
24
|
+
};
|
|
25
|
+
|
|
20
26
|
const building: Picture = {
|
|
21
27
|
src: 'building.png',
|
|
22
28
|
alt: 'Кредит под залог недвижимости в РСХБ',
|
|
@@ -38,6 +44,13 @@ const benefits = [
|
|
|
38
44
|
},
|
|
39
45
|
];
|
|
40
46
|
|
|
47
|
+
const benefits2 = [
|
|
48
|
+
{
|
|
49
|
+
label: '1 год',
|
|
50
|
+
description: 'срок программы',
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
|
|
41
54
|
const buttons: ButtonProps[] = [
|
|
42
55
|
{
|
|
43
56
|
text: 'Подробнее',
|
|
@@ -46,7 +59,22 @@ const buttons: ButtonProps[] = [
|
|
|
46
59
|
},
|
|
47
60
|
];
|
|
48
61
|
|
|
49
|
-
const
|
|
62
|
+
const buttons2: ButtonProps[] = [
|
|
63
|
+
{
|
|
64
|
+
href: 'https://rshb.ru',
|
|
65
|
+
text: 'Подробнее',
|
|
66
|
+
target: '_blank',
|
|
67
|
+
version: 'secondary',
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
const buttons3: ButtonProps[] = [
|
|
72
|
+
{
|
|
73
|
+
href: 'https://rshb.ru',
|
|
74
|
+
text: 'Оформить',
|
|
75
|
+
target: '_blank',
|
|
76
|
+
version: 'primary',
|
|
77
|
+
},
|
|
50
78
|
{
|
|
51
79
|
href: 'https://rshb.ru',
|
|
52
80
|
text: 'Подробнее',
|
|
@@ -68,7 +96,7 @@ export const PRODUCT_PENSION_TILE: ProductTileContent = {
|
|
|
68
96
|
headingType: 'h3',
|
|
69
97
|
description: 'Для людей в возрасте до 75 лет',
|
|
70
98
|
benefits,
|
|
71
|
-
buttons:
|
|
99
|
+
buttons: buttons2,
|
|
72
100
|
};
|
|
73
101
|
|
|
74
102
|
export default {
|
|
@@ -86,7 +114,7 @@ export default {
|
|
|
86
114
|
headingType="h3"
|
|
87
115
|
description={'Потребительский кредит на любые цели, без залога и поручительства'}
|
|
88
116
|
benefits={benefits}
|
|
89
|
-
buttons={
|
|
117
|
+
buttons={buttons2}
|
|
90
118
|
image={letterWithMoney}
|
|
91
119
|
/>
|
|
92
120
|
</div>
|
|
@@ -100,7 +128,7 @@ export default {
|
|
|
100
128
|
headingType="h3"
|
|
101
129
|
description={'Без переоформления залогой недвижимости на банк'}
|
|
102
130
|
benefits={benefits}
|
|
103
|
-
buttons={
|
|
131
|
+
buttons={buttons2}
|
|
104
132
|
image={building}
|
|
105
133
|
/>
|
|
106
134
|
</div>
|
|
@@ -114,7 +142,24 @@ export default {
|
|
|
114
142
|
headingType="h3"
|
|
115
143
|
description={'Для людей в возрасте до 75 лет'}
|
|
116
144
|
benefits={benefits}
|
|
117
|
-
buttons={
|
|
145
|
+
buttons={buttons2}
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
),
|
|
149
|
+
'with-add-desc': (
|
|
150
|
+
<div className="container grid grid-cols-12">
|
|
151
|
+
<ProductTile
|
|
152
|
+
context={context}
|
|
153
|
+
className="col-span-6"
|
|
154
|
+
title="Ипотечное страхование"
|
|
155
|
+
headingType="h3"
|
|
156
|
+
description={'Финансовая защита заемщиков в случае непредвиденных обстоятельств'}
|
|
157
|
+
additionalDescription={
|
|
158
|
+
'Страховая сумма и страховой взнос зависит от остатка задолженности по ипотеке'
|
|
159
|
+
}
|
|
160
|
+
benefits={benefits2}
|
|
161
|
+
buttons={buttons3}
|
|
162
|
+
image={letterWithPhone}
|
|
118
163
|
/>
|
|
119
164
|
</div>
|
|
120
165
|
),
|
|
@@ -8,7 +8,7 @@ import { Img } from '../../ui-kit/Img/Img';
|
|
|
8
8
|
import { BaseTile } from '../BaseTile/BaseTile';
|
|
9
9
|
import { getTileMinHeight } from '../BaseTile/getTileMinHeight';
|
|
10
10
|
import { getTileRightPadding } from '../BaseTile/getTileRightPadding';
|
|
11
|
-
import type {
|
|
11
|
+
import type { TextBenefit } from '../BenefitsBlock/BenefitsBlockContent';
|
|
12
12
|
import type { ProductTileContent } from './ProductTileContent';
|
|
13
13
|
|
|
14
14
|
export interface ProductTileProps extends ProductTileContent, UniBlockProps {}
|
|
@@ -25,6 +25,7 @@ export const ProductTile = JSX<ProductTileProps>(
|
|
|
25
25
|
title,
|
|
26
26
|
headingType = 'h3',
|
|
27
27
|
description,
|
|
28
|
+
additionalDescription,
|
|
28
29
|
benefits,
|
|
29
30
|
buttons,
|
|
30
31
|
image,
|
|
@@ -60,23 +61,31 @@ export const ProductTile = JSX<ProductTileProps>(
|
|
|
60
61
|
{description ? (
|
|
61
62
|
<Description className="mt-4 max-w-[600px]" description={description} />
|
|
62
63
|
) : null}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<div className="pt-1">
|
|
69
|
-
{benefits.map((_, i) => renderBenefitDescription(_, i, version))}
|
|
70
|
-
</div>
|
|
71
|
-
) : null}
|
|
72
|
-
</div>
|
|
64
|
+
{renderBenefits(benefits, version)}
|
|
65
|
+
|
|
66
|
+
{additionalDescription
|
|
67
|
+
? renderAdditionalDescription(additionalDescription, version)
|
|
68
|
+
: null}
|
|
73
69
|
</BaseTile>
|
|
74
70
|
</section>
|
|
75
71
|
);
|
|
76
72
|
},
|
|
77
73
|
);
|
|
78
74
|
|
|
79
|
-
function
|
|
75
|
+
function renderBenefits(benefits: TextBenefit[] = [], version: BlockVersion) {
|
|
76
|
+
return (
|
|
77
|
+
<div className="flex mt-5 mb-1">
|
|
78
|
+
{benefits.length ? <div className="mr-8">{benefits.map(renderBenefitLabel)}</div> : null}
|
|
79
|
+
{benefits.length ? (
|
|
80
|
+
<div className="pt-1">
|
|
81
|
+
{benefits.map((_, i) => renderBenefitDescription(_, i, version))}
|
|
82
|
+
</div>
|
|
83
|
+
) : null}
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function renderBenefitLabel(benefit: TextBenefit, i: number) {
|
|
80
89
|
return (
|
|
81
90
|
<div key={String(i)} className={`text-xl font-medium ${i ? 'mt-2.5' : ''}`}>
|
|
82
91
|
{benefit.label}
|
|
@@ -84,7 +93,7 @@ function renderBenefitLabel(benefit: Benefit, i: number) {
|
|
|
84
93
|
);
|
|
85
94
|
}
|
|
86
95
|
|
|
87
|
-
function renderBenefitDescription(benefit:
|
|
96
|
+
function renderBenefitDescription(benefit: TextBenefit, i: number, version = 'primary') {
|
|
88
97
|
const labelStyleMap: Record<BlockVersion, string> = {
|
|
89
98
|
primary: 'text-secondary-text',
|
|
90
99
|
secondary: 'text-white',
|
|
@@ -95,3 +104,11 @@ function renderBenefitDescription(benefit: Benefit, i: number, version = 'primar
|
|
|
95
104
|
</div>
|
|
96
105
|
);
|
|
97
106
|
}
|
|
107
|
+
|
|
108
|
+
function renderAdditionalDescription(additionalDescription: string, version = 'primary') {
|
|
109
|
+
const descStyleMap: Record<BlockVersion, string> = {
|
|
110
|
+
primary: 'text-secondary-text',
|
|
111
|
+
secondary: 'text-white',
|
|
112
|
+
};
|
|
113
|
+
return <div className={`text-sm mt-2.5 ${descStyleMap[version]}`}>{additionalDescription}</div>;
|
|
114
|
+
}
|
|
@@ -59,7 +59,11 @@ export const Tile = JSX<TileProps>((props) => {
|
|
|
59
59
|
}
|
|
60
60
|
buttons={
|
|
61
61
|
buttons?.length ? (
|
|
62
|
-
<ButtonSection
|
|
62
|
+
<ButtonSection
|
|
63
|
+
context={context}
|
|
64
|
+
buttons={buttons.map((button) => ({ ...button, className: 'w-[158px]' }))}
|
|
65
|
+
className="flex mt-9 gap-3"
|
|
66
|
+
/>
|
|
63
67
|
) : null
|
|
64
68
|
}
|
|
65
69
|
image={image?.src && <Img className="mt-auto ml-7" image={image} />}
|
package/src/types.ts
CHANGED
|
@@ -44,16 +44,10 @@ export interface ContentPageMeta {
|
|
|
44
44
|
jsonLd?: string;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export interface CustomPageTemplate {
|
|
48
|
-
content?: Record<string, any>;
|
|
49
|
-
type?: string;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
47
|
export interface ContentPageDef extends ContentPageMeta {
|
|
53
48
|
style?: string[];
|
|
54
49
|
blocks?: BlockDef[];
|
|
55
50
|
slots?: SlotsMap;
|
|
56
|
-
customPageTmpl?: CustomPageTemplate;
|
|
57
51
|
likeControl?: boolean;
|
|
58
52
|
colorPalette?: ColorPalette;
|
|
59
53
|
}
|
|
@@ -84,6 +84,18 @@ export default {
|
|
|
84
84
|
text="App Store"
|
|
85
85
|
version="secondary"
|
|
86
86
|
/>
|
|
87
|
+
|
|
88
|
+
<Button
|
|
89
|
+
href="https://www.rshb.ru/"
|
|
90
|
+
target="_blank"
|
|
91
|
+
appendRight={
|
|
92
|
+
<div>
|
|
93
|
+
<Img image={{ icon: 'TelegramIcon' }} width="20" height="16" asSVG />
|
|
94
|
+
</div>
|
|
95
|
+
}
|
|
96
|
+
text="Мы в Telegram"
|
|
97
|
+
version="primary"
|
|
98
|
+
/>
|
|
87
99
|
</div>
|
|
88
100
|
</div>
|
|
89
101
|
<div>
|
|
@@ -21,10 +21,16 @@ const buttonStyle = 'text-center font-sans select-none';
|
|
|
21
21
|
export interface ButtonCommonProps extends ButtonProps, ButtonWithIconProps {}
|
|
22
22
|
|
|
23
23
|
export const Button = JSX<ButtonCommonProps>((props) => {
|
|
24
|
-
const { text, aboveText, appendLeft, children, disabled, rounded, ...rest } = props;
|
|
24
|
+
const { text, aboveText, appendLeft, appendRight, children, disabled, rounded, ...rest } = props;
|
|
25
25
|
|
|
26
26
|
const buttonInner = children ?? (
|
|
27
|
-
<ButtonInner
|
|
27
|
+
<ButtonInner
|
|
28
|
+
text={text}
|
|
29
|
+
aboveText={aboveText}
|
|
30
|
+
appendLeft={appendLeft}
|
|
31
|
+
appendRight={appendRight}
|
|
32
|
+
rounded={rounded}
|
|
33
|
+
/>
|
|
28
34
|
);
|
|
29
35
|
|
|
30
36
|
return disabled ? (
|
|
@@ -7,7 +7,7 @@ interface ButtonInnerProps extends ButtonWithIconProps {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export const ButtonInner = JSX<ButtonInnerProps>((props) => {
|
|
10
|
-
const { text, aboveText, appendLeft } = props;
|
|
10
|
+
const { text, aboveText, appendLeft, appendRight } = props;
|
|
11
11
|
return (
|
|
12
12
|
<div className={getButtonStyle(props)}>
|
|
13
13
|
{appendLeft ? appendLeft : null}
|
|
@@ -17,6 +17,7 @@ export const ButtonInner = JSX<ButtonInnerProps>((props) => {
|
|
|
17
17
|
<div className="text-button text-left">{text}</div>
|
|
18
18
|
</div>
|
|
19
19
|
) : null}
|
|
20
|
+
{appendRight ? appendRight : null}
|
|
20
21
|
</div>
|
|
21
22
|
);
|
|
22
23
|
});
|
|
@@ -11,7 +11,7 @@ export const ButtonSection = JSX<ButtonSectionProps>(({ context, className = '',
|
|
|
11
11
|
const { handlerDecorator } = context;
|
|
12
12
|
const router = context.useRouter();
|
|
13
13
|
return buttons?.length ? (
|
|
14
|
-
<div className={
|
|
14
|
+
<div className={className}>
|
|
15
15
|
{buttons.map((button, index) =>
|
|
16
16
|
renderButton(useLink({ router, handlerDecorator }, button), index),
|
|
17
17
|
)}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ContentPageDef, CustomPageTemplate, UniBlockProps } from '../../types';
|
|
2
|
-
import { ContentPageContext } from './ContentPageContext';
|
|
3
|
-
interface PageDecoratorProps<VNode> {
|
|
4
|
-
pageClassName: string;
|
|
5
|
-
pageTemplate: CustomPageTemplate;
|
|
6
|
-
render: (props: {
|
|
7
|
-
pageClassName: string;
|
|
8
|
-
pageTemplate: CustomPageTemplate;
|
|
9
|
-
}) => VNode;
|
|
10
|
-
}
|
|
11
|
-
export declare type PageDecorator<VNode = any> = (props: PageDecoratorProps<VNode>, index?: number | string) => any;
|
|
12
|
-
export interface PageTemplate {
|
|
13
|
-
name: string;
|
|
14
|
-
template: any;
|
|
15
|
-
}
|
|
16
|
-
export declare type PageTemplatesRegistry = Record<string, PageTemplate>;
|
|
17
|
-
export interface CustomContentPageProps extends UniBlockProps {
|
|
18
|
-
pageTemplatesRegistry: PageTemplatesRegistry;
|
|
19
|
-
data: ContentPageDef;
|
|
20
|
-
pageDecorator?: PageDecorator;
|
|
21
|
-
}
|
|
22
|
-
export interface RenderPageFunc {
|
|
23
|
-
pageTemplate: CustomPageTemplate;
|
|
24
|
-
pageClassName: string;
|
|
25
|
-
pageDecorator: PageDecorator;
|
|
26
|
-
pageTemplatesRegistry: PageTemplatesRegistry;
|
|
27
|
-
context: ContentPageContext;
|
|
28
|
-
}
|
|
29
|
-
export declare const CustomContentPage: (props: import("@redneckz/uni-jsx").PropsWithChildren<CustomContentPageProps, any>, context?: any) => any;
|
|
30
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.CustomContentPage = void 0;
|
|
3
|
-
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
-
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
-
const style2className_1 = require("../../utils/style2className");
|
|
6
|
-
const defaultPageDecorator = ({ pageClassName, pageTemplate, render }) => render({ pageClassName, pageTemplate });
|
|
7
|
-
exports.CustomContentPage = (0, uni_jsx_1.JSX)(({ className = '', context, pageTemplatesRegistry, data: { style: pageStyle, customPageTmpl: pageTemplate }, pageDecorator = defaultPageDecorator, }) => {
|
|
8
|
-
return pageTemplate
|
|
9
|
-
? renderPage({
|
|
10
|
-
pageTemplate,
|
|
11
|
-
pageClassName: `${(0, style2className_1.style2className)(pageStyle)} ${className}`,
|
|
12
|
-
pageDecorator,
|
|
13
|
-
pageTemplatesRegistry,
|
|
14
|
-
context,
|
|
15
|
-
})
|
|
16
|
-
: null;
|
|
17
|
-
});
|
|
18
|
-
function renderPage({ pageTemplate, pageClassName, pageDecorator, pageTemplatesRegistry, context, }) {
|
|
19
|
-
const { type } = pageTemplate;
|
|
20
|
-
if (!(type && type in pageTemplatesRegistry) || !pageTemplatesRegistry[type].template) {
|
|
21
|
-
throw new Error(`No page template with "${type}" is registered`);
|
|
22
|
-
}
|
|
23
|
-
const { template: PageComponent } = pageTemplatesRegistry[type];
|
|
24
|
-
return pageDecorator({
|
|
25
|
-
pageClassName,
|
|
26
|
-
pageTemplate,
|
|
27
|
-
render: (props) => {
|
|
28
|
-
const { content } = props.pageTemplate;
|
|
29
|
-
return (0, jsx_runtime_1.jsx)(PageComponent, { className: props.pageClassName, context: context, ...content });
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=CustomContentPage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CustomContentPage.js","sourceRoot":"","sources":["../../../src/components/ContentPage/CustomContentPage.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,iEAA8D;AAmC9D,MAAM,oBAAoB,GAAkB,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,CACtF,MAAM,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,CAAC;AAE7B,QAAA,iBAAiB,GAAG,IAAA,aAAG,EAClC,CAAC,EACC,SAAS,GAAG,EAAE,EACd,OAAO,EACP,qBAAqB,EACrB,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,EACxD,aAAa,GAAG,oBAAoB,GACrC,EAAE,EAAE;IACH,OAAO,YAAY;QACjB,CAAC,CAAC,UAAU,CAAC;YACT,YAAY;YACZ,aAAa,EAAE,GAAG,IAAA,iCAAe,EAAC,SAAS,CAAC,IAAI,SAAS,EAAE;YAC3D,aAAa;YACb,qBAAqB;YACrB,OAAO;SACR,CAAC;QACJ,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CACF,CAAC;AAEF,SAAS,UAAU,CAAC,EAClB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,OAAO,GACQ;IACf,MAAM,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC;IAC9B,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,qBAAqB,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QACrF,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,iBAAiB,CAAC,CAAC;KAClE;IAED,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAChE,OAAO,aAAa,CAAC;QACnB,aAAa;QACb,YAAY;QACZ,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,YAAY,CAAC;YACvC,OAAO,uBAAC,aAAa,IAAC,SAAS,EAAE,KAAK,CAAC,aAAa,EAAE,OAAO,EAAE,OAAO,KAAM,OAAO,GAAI,CAAC;QAC1F,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ContentPageDef, CustomPageTemplate, UniBlockProps } from '../../types';
|
|
2
|
-
import { ContentPageContext } from './ContentPageContext';
|
|
3
|
-
interface PageDecoratorProps<VNode> {
|
|
4
|
-
pageClassName: string;
|
|
5
|
-
pageTemplate: CustomPageTemplate;
|
|
6
|
-
render: (props: {
|
|
7
|
-
pageClassName: string;
|
|
8
|
-
pageTemplate: CustomPageTemplate;
|
|
9
|
-
}) => VNode;
|
|
10
|
-
}
|
|
11
|
-
export declare type PageDecorator<VNode = any> = (props: PageDecoratorProps<VNode>, index?: number | string) => any;
|
|
12
|
-
export interface PageTemplate {
|
|
13
|
-
name: string;
|
|
14
|
-
template: any;
|
|
15
|
-
}
|
|
16
|
-
export declare type PageTemplatesRegistry = Record<string, PageTemplate>;
|
|
17
|
-
export interface CustomContentPageProps extends UniBlockProps {
|
|
18
|
-
pageTemplatesRegistry: PageTemplatesRegistry;
|
|
19
|
-
data: ContentPageDef;
|
|
20
|
-
pageDecorator?: PageDecorator;
|
|
21
|
-
}
|
|
22
|
-
export interface RenderPageFunc {
|
|
23
|
-
pageTemplate: CustomPageTemplate;
|
|
24
|
-
pageClassName: string;
|
|
25
|
-
pageDecorator: PageDecorator;
|
|
26
|
-
pageTemplatesRegistry: PageTemplatesRegistry;
|
|
27
|
-
context: ContentPageContext;
|
|
28
|
-
}
|
|
29
|
-
export declare const CustomContentPage: (props: import("@redneckz/uni-jsx").PropsWithChildren<CustomContentPageProps, any>, context?: any) => any;
|
|
30
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
const defaultPageDecorator = ({ pageClassName, pageTemplate, render }) => render({ pageClassName, pageTemplate });
|
|
5
|
-
export const CustomContentPage = JSX(({ className = '', context, pageTemplatesRegistry, data: { style: pageStyle, customPageTmpl: pageTemplate }, pageDecorator = defaultPageDecorator, }) => {
|
|
6
|
-
return pageTemplate
|
|
7
|
-
? renderPage({
|
|
8
|
-
pageTemplate,
|
|
9
|
-
pageClassName: `${style2className(pageStyle)} ${className}`,
|
|
10
|
-
pageDecorator,
|
|
11
|
-
pageTemplatesRegistry,
|
|
12
|
-
context,
|
|
13
|
-
})
|
|
14
|
-
: null;
|
|
15
|
-
});
|
|
16
|
-
function renderPage({ pageTemplate, pageClassName, pageDecorator, pageTemplatesRegistry, context, }) {
|
|
17
|
-
const { type } = pageTemplate;
|
|
18
|
-
if (!(type && type in pageTemplatesRegistry) || !pageTemplatesRegistry[type].template) {
|
|
19
|
-
throw new Error(`No page template with "${type}" is registered`);
|
|
20
|
-
}
|
|
21
|
-
const { template: PageComponent } = pageTemplatesRegistry[type];
|
|
22
|
-
return pageDecorator({
|
|
23
|
-
pageClassName,
|
|
24
|
-
pageTemplate,
|
|
25
|
-
render: (props) => {
|
|
26
|
-
const { content } = props.pageTemplate;
|
|
27
|
-
return _jsx(PageComponent, { className: props.pageClassName, context: context, ...content });
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=CustomContentPage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CustomContentPage.js","sourceRoot":"","sources":["../../../src/components/ContentPage/CustomContentPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAmC9D,MAAM,oBAAoB,GAAkB,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,CACtF,MAAM,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAClC,CAAC,EACC,SAAS,GAAG,EAAE,EACd,OAAO,EACP,qBAAqB,EACrB,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,EACxD,aAAa,GAAG,oBAAoB,GACrC,EAAE,EAAE;IACH,OAAO,YAAY;QACjB,CAAC,CAAC,UAAU,CAAC;YACT,YAAY;YACZ,aAAa,EAAE,GAAG,eAAe,CAAC,SAAS,CAAC,IAAI,SAAS,EAAE;YAC3D,aAAa;YACb,qBAAqB;YACrB,OAAO;SACR,CAAC;QACJ,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CACF,CAAC;AAEF,SAAS,UAAU,CAAC,EAClB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,OAAO,GACQ;IACf,MAAM,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC;IAC9B,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,qBAAqB,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QACrF,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,iBAAiB,CAAC,CAAC;KAClE;IAED,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAChE,OAAO,aAAa,CAAC;QACnB,aAAa;QACb,YAAY;QACZ,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,YAAY,CAAC;YACvC,OAAO,KAAC,aAAa,IAAC,SAAS,EAAE,KAAK,CAAC,aAAa,EAAE,OAAO,EAAE,OAAO,KAAM,OAAO,GAAI,CAAC;QAC1F,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ContentPageDef, CustomPageTemplate, UniBlockProps } from '../../types';
|
|
2
|
-
import { ContentPageContext } from './ContentPageContext';
|
|
3
|
-
interface PageDecoratorProps<VNode> {
|
|
4
|
-
pageClassName: string;
|
|
5
|
-
pageTemplate: CustomPageTemplate;
|
|
6
|
-
render: (props: {
|
|
7
|
-
pageClassName: string;
|
|
8
|
-
pageTemplate: CustomPageTemplate;
|
|
9
|
-
}) => VNode;
|
|
10
|
-
}
|
|
11
|
-
export declare type PageDecorator<VNode = any> = (props: PageDecoratorProps<VNode>, index?: number | string) => any;
|
|
12
|
-
export interface PageTemplate {
|
|
13
|
-
name: string;
|
|
14
|
-
template: any;
|
|
15
|
-
}
|
|
16
|
-
export declare type PageTemplatesRegistry = Record<string, PageTemplate>;
|
|
17
|
-
export interface CustomContentPageProps extends UniBlockProps {
|
|
18
|
-
pageTemplatesRegistry: PageTemplatesRegistry;
|
|
19
|
-
data: ContentPageDef;
|
|
20
|
-
pageDecorator?: PageDecorator;
|
|
21
|
-
}
|
|
22
|
-
export interface RenderPageFunc {
|
|
23
|
-
pageTemplate: CustomPageTemplate;
|
|
24
|
-
pageClassName: string;
|
|
25
|
-
pageDecorator: PageDecorator;
|
|
26
|
-
pageTemplatesRegistry: PageTemplatesRegistry;
|
|
27
|
-
context: ContentPageContext;
|
|
28
|
-
}
|
|
29
|
-
export declare const CustomContentPage: (props: import("@redneckz/uni-jsx").PropsWithChildren<CustomContentPageProps, any>, context?: any) => any;
|
|
30
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.CustomContentPage = void 0;
|
|
3
|
-
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
-
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
-
const style2className_1 = require("../../utils/style2className");
|
|
6
|
-
const defaultPageDecorator = ({ pageClassName, pageTemplate, render }) => render({ pageClassName, pageTemplate });
|
|
7
|
-
exports.CustomContentPage = (0, uni_jsx_1.JSX)(({ className = '', context, pageTemplatesRegistry, data: { style: pageStyle, customPageTmpl: pageTemplate }, pageDecorator = defaultPageDecorator, }) => {
|
|
8
|
-
return pageTemplate
|
|
9
|
-
? renderPage({
|
|
10
|
-
pageTemplate,
|
|
11
|
-
pageClassName: `${(0, style2className_1.style2className)(pageStyle)} ${className}`,
|
|
12
|
-
pageDecorator,
|
|
13
|
-
pageTemplatesRegistry,
|
|
14
|
-
context,
|
|
15
|
-
})
|
|
16
|
-
: null;
|
|
17
|
-
});
|
|
18
|
-
function renderPage({ pageTemplate, pageClassName, pageDecorator, pageTemplatesRegistry, context, }) {
|
|
19
|
-
const { type } = pageTemplate;
|
|
20
|
-
if (!(type && type in pageTemplatesRegistry) || !pageTemplatesRegistry[type].template) {
|
|
21
|
-
throw new Error(`No page template with "${type}" is registered`);
|
|
22
|
-
}
|
|
23
|
-
const { template: PageComponent } = pageTemplatesRegistry[type];
|
|
24
|
-
return pageDecorator({
|
|
25
|
-
pageClassName,
|
|
26
|
-
pageTemplate,
|
|
27
|
-
render: (props) => {
|
|
28
|
-
const { content } = props.pageTemplate;
|
|
29
|
-
return (0, jsx_runtime_1.jsx)(PageComponent, { className: props.pageClassName, context: context, ...content });
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=CustomContentPage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CustomContentPage.js","sourceRoot":"","sources":["../../../src/components/ContentPage/CustomContentPage.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,iEAA8D;AAmC9D,MAAM,oBAAoB,GAAkB,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,CACtF,MAAM,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,CAAC;AAE7B,QAAA,iBAAiB,GAAG,IAAA,aAAG,EAClC,CAAC,EACC,SAAS,GAAG,EAAE,EACd,OAAO,EACP,qBAAqB,EACrB,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,EACxD,aAAa,GAAG,oBAAoB,GACrC,EAAE,EAAE;IACH,OAAO,YAAY;QACjB,CAAC,CAAC,UAAU,CAAC;YACT,YAAY;YACZ,aAAa,EAAE,GAAG,IAAA,iCAAe,EAAC,SAAS,CAAC,IAAI,SAAS,EAAE;YAC3D,aAAa;YACb,qBAAqB;YACrB,OAAO;SACR,CAAC;QACJ,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CACF,CAAC;AAEF,SAAS,UAAU,CAAC,EAClB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,OAAO,GACQ;IACf,MAAM,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC;IAC9B,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,qBAAqB,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QACrF,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,iBAAiB,CAAC,CAAC;KAClE;IAED,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAChE,OAAO,aAAa,CAAC;QACnB,aAAa;QACb,YAAY;QACZ,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,YAAY,CAAC;YACvC,OAAO,uBAAC,aAAa,IAAC,SAAS,EAAE,KAAK,CAAC,aAAa,EAAE,OAAO,EAAE,OAAO,KAAM,OAAO,GAAI,CAAC;QAC1F,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ContentPageDef, CustomPageTemplate, UniBlockProps } from '../../types';
|
|
2
|
-
import { ContentPageContext } from './ContentPageContext';
|
|
3
|
-
interface PageDecoratorProps<VNode> {
|
|
4
|
-
pageClassName: string;
|
|
5
|
-
pageTemplate: CustomPageTemplate;
|
|
6
|
-
render: (props: {
|
|
7
|
-
pageClassName: string;
|
|
8
|
-
pageTemplate: CustomPageTemplate;
|
|
9
|
-
}) => VNode;
|
|
10
|
-
}
|
|
11
|
-
export declare type PageDecorator<VNode = any> = (props: PageDecoratorProps<VNode>, index?: number | string) => any;
|
|
12
|
-
export interface PageTemplate {
|
|
13
|
-
name: string;
|
|
14
|
-
template: any;
|
|
15
|
-
}
|
|
16
|
-
export declare type PageTemplatesRegistry = Record<string, PageTemplate>;
|
|
17
|
-
export interface CustomContentPageProps extends UniBlockProps {
|
|
18
|
-
pageTemplatesRegistry: PageTemplatesRegistry;
|
|
19
|
-
data: ContentPageDef;
|
|
20
|
-
pageDecorator?: PageDecorator;
|
|
21
|
-
}
|
|
22
|
-
export interface RenderPageFunc {
|
|
23
|
-
pageTemplate: CustomPageTemplate;
|
|
24
|
-
pageClassName: string;
|
|
25
|
-
pageDecorator: PageDecorator;
|
|
26
|
-
pageTemplatesRegistry: PageTemplatesRegistry;
|
|
27
|
-
context: ContentPageContext;
|
|
28
|
-
}
|
|
29
|
-
export declare const CustomContentPage: (props: import("@redneckz/uni-jsx").PropsWithChildren<CustomContentPageProps, any>, context?: any) => any;
|
|
30
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
const defaultPageDecorator = ({ pageClassName, pageTemplate, render }) => render({ pageClassName, pageTemplate });
|
|
5
|
-
export const CustomContentPage = JSX(({ className = '', context, pageTemplatesRegistry, data: { style: pageStyle, customPageTmpl: pageTemplate }, pageDecorator = defaultPageDecorator, }) => {
|
|
6
|
-
return pageTemplate
|
|
7
|
-
? renderPage({
|
|
8
|
-
pageTemplate,
|
|
9
|
-
pageClassName: `${style2className(pageStyle)} ${className}`,
|
|
10
|
-
pageDecorator,
|
|
11
|
-
pageTemplatesRegistry,
|
|
12
|
-
context,
|
|
13
|
-
})
|
|
14
|
-
: null;
|
|
15
|
-
});
|
|
16
|
-
function renderPage({ pageTemplate, pageClassName, pageDecorator, pageTemplatesRegistry, context, }) {
|
|
17
|
-
const { type } = pageTemplate;
|
|
18
|
-
if (!(type && type in pageTemplatesRegistry) || !pageTemplatesRegistry[type].template) {
|
|
19
|
-
throw new Error(`No page template with "${type}" is registered`);
|
|
20
|
-
}
|
|
21
|
-
const { template: PageComponent } = pageTemplatesRegistry[type];
|
|
22
|
-
return pageDecorator({
|
|
23
|
-
pageClassName,
|
|
24
|
-
pageTemplate,
|
|
25
|
-
render: (props) => {
|
|
26
|
-
const { content } = props.pageTemplate;
|
|
27
|
-
return _jsx(PageComponent, { className: props.pageClassName, context: context, ...content });
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=CustomContentPage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CustomContentPage.js","sourceRoot":"","sources":["../../../src/components/ContentPage/CustomContentPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAmC9D,MAAM,oBAAoB,GAAkB,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,CACtF,MAAM,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAClC,CAAC,EACC,SAAS,GAAG,EAAE,EACd,OAAO,EACP,qBAAqB,EACrB,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,EACxD,aAAa,GAAG,oBAAoB,GACrC,EAAE,EAAE;IACH,OAAO,YAAY;QACjB,CAAC,CAAC,UAAU,CAAC;YACT,YAAY;YACZ,aAAa,EAAE,GAAG,eAAe,CAAC,SAAS,CAAC,IAAI,SAAS,EAAE;YAC3D,aAAa;YACb,qBAAqB;YACrB,OAAO;SACR,CAAC;QACJ,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CACF,CAAC;AAEF,SAAS,UAAU,CAAC,EAClB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,OAAO,GACQ;IACf,MAAM,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC;IAC9B,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,qBAAqB,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QACrF,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,iBAAiB,CAAC,CAAC;KAClE;IAED,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAChE,OAAO,aAAa,CAAC;QACnB,aAAa;QACb,YAAY;QACZ,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,YAAY,CAAC;YACvC,OAAO,KAAC,aAAa,IAAC,SAAS,EAAE,KAAK,CAAC,aAAa,EAAE,OAAO,EAAE,OAAO,KAAM,OAAO,GAAI,CAAC;QAC1F,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,82 +0,0 @@
|
|
|
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
|
-
}
|