@redneckz/wildless-cms-uni-blocks 0.9.10 → 0.9.11
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 +15 -11
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/Filtration/FiltrationContent.d.ts +18 -8
- package/dist/components/Filtration/Filtration.js +1 -1
- package/dist/components/Filtration/Filtration.js.map +1 -1
- package/dist/components/Filtration/FiltrationContent.d.ts +18 -8
- package/dist/components/Filtration/FiltrationInner.js +9 -5
- package/dist/components/Filtration/FiltrationInner.js.map +1 -1
- package/dist/components/Filtration/renderFormItem.js +6 -5
- package/dist/components/Filtration/renderFormItem.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/Filtration/Filtration.js +1 -1
- package/lib/components/Filtration/Filtration.js.map +1 -1
- package/lib/components/Filtration/FiltrationContent.d.ts +18 -8
- package/lib/components/Filtration/FiltrationInner.js +9 -5
- package/lib/components/Filtration/FiltrationInner.js.map +1 -1
- package/lib/components/Filtration/renderFormItem.js +6 -5
- package/lib/components/Filtration/renderFormItem.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +1 -1
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/Filtration/FiltrationContent.d.ts +18 -8
- package/mobile/dist/components/Filtration/Filtration.js +1 -1
- package/mobile/dist/components/Filtration/Filtration.js.map +1 -1
- package/mobile/dist/components/Filtration/FiltrationContent.d.ts +18 -8
- package/mobile/dist/components/Filtration/FiltrationInner.js +9 -5
- package/mobile/dist/components/Filtration/FiltrationInner.js.map +1 -1
- package/mobile/dist/components/Filtration/renderFormItem.js +6 -5
- package/mobile/dist/components/Filtration/renderFormItem.js.map +1 -1
- package/mobile/lib/components/Filtration/Filtration.js +1 -1
- package/mobile/lib/components/Filtration/Filtration.js.map +1 -1
- package/mobile/lib/components/Filtration/FiltrationContent.d.ts +18 -8
- package/mobile/lib/components/Filtration/FiltrationInner.js +9 -5
- package/mobile/lib/components/Filtration/FiltrationInner.js.map +1 -1
- package/mobile/lib/components/Filtration/renderFormItem.js +6 -5
- package/mobile/lib/components/Filtration/renderFormItem.js.map +1 -1
- package/mobile/src/components/Filtration/Filtration.example.json +39 -19
- package/mobile/src/components/Filtration/Filtration.tsx +3 -8
- package/mobile/src/components/Filtration/FiltrationContent.ts +19 -8
- package/mobile/src/components/Filtration/FiltrationInner.tsx +31 -12
- package/mobile/src/components/Filtration/renderFormItem.tsx +20 -20
- package/mobile/src/components/RichTextBlock/RichTextBlock.example.json +1 -1
- package/package.json +1 -1
- package/src/components/Filtration/Filtration.example.json +39 -19
- package/src/components/Filtration/Filtration.fixture.tsx +36 -20
- package/src/components/Filtration/Filtration.tsx +3 -8
- package/src/components/Filtration/FiltrationContent.ts +19 -8
- package/src/components/Filtration/FiltrationInner.tsx +31 -12
- package/src/components/Filtration/renderFormItem.tsx +20 -20
- package/src/components/RichTextBlock/RichTextBlock.example.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ButtonVersion } from '../../model/ButtonVersion';
|
|
2
|
+
import type { DescriptionProps, TitleProps } from '../../model/HeadlineType';
|
|
2
3
|
/**
|
|
3
4
|
* @title Заголовок
|
|
4
5
|
*/
|
|
@@ -28,6 +29,7 @@ export declare type StringArray = {
|
|
|
28
29
|
* @hidden
|
|
29
30
|
*/
|
|
30
31
|
type?: 'array';
|
|
32
|
+
/** @title */
|
|
31
33
|
items?: {
|
|
32
34
|
/**
|
|
33
35
|
* @default string
|
|
@@ -40,13 +42,13 @@ export declare type StringArray = {
|
|
|
40
42
|
};
|
|
41
43
|
export declare type FiltrationSchema = {
|
|
42
44
|
/** @title Тип недвижимости */
|
|
43
|
-
propertyType?:
|
|
45
|
+
propertyType?: StringArray;
|
|
44
46
|
/** @title Этап строительства */
|
|
45
|
-
stage?:
|
|
47
|
+
stage?: StringArray;
|
|
46
48
|
/** @title Категории */
|
|
47
|
-
categories?:
|
|
49
|
+
categories?: StringArray;
|
|
48
50
|
/** @title Дополнительно */
|
|
49
|
-
extraOptions?:
|
|
51
|
+
extraOptions?: StringArray;
|
|
50
52
|
};
|
|
51
53
|
/**
|
|
52
54
|
* @title Кнопка сброса
|
|
@@ -59,13 +61,22 @@ export declare type ResetButton = {
|
|
|
59
61
|
/**
|
|
60
62
|
* @title Цвет кнопки
|
|
61
63
|
*/
|
|
62
|
-
|
|
64
|
+
version: ButtonVersion;
|
|
63
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* @title Плитка "Не найдено"
|
|
68
|
+
*/
|
|
69
|
+
export declare type NotFound = TitleProps & DescriptionProps;
|
|
64
70
|
export interface FiltrationInnerContent {
|
|
65
|
-
/** @title Название кнопки */
|
|
71
|
+
/** @title Название сворачивающейся кнопки */
|
|
66
72
|
label?: string;
|
|
67
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* @title Количество отображаемых предметов
|
|
75
|
+
* @minimum 1
|
|
76
|
+
*/
|
|
68
77
|
topItemsCount?: number;
|
|
78
|
+
resetButton?: ResetButton;
|
|
79
|
+
notFound?: NotFound;
|
|
69
80
|
}
|
|
70
81
|
/**
|
|
71
82
|
* @title Фильтрация
|
|
@@ -73,6 +84,5 @@ export interface FiltrationInnerContent {
|
|
|
73
84
|
export interface FiltrationContent extends FiltrationInnerContent {
|
|
74
85
|
/** @title Параметры фильтрации */
|
|
75
86
|
filtrationSchema?: FiltrationSchema;
|
|
76
|
-
resetButton?: ResetButton;
|
|
77
87
|
}
|
|
78
88
|
export {};
|
|
@@ -4,18 +4,22 @@ import { renderBlocksList } from '../../BlockRenderer/renderBlockList.js';
|
|
|
4
4
|
import { DefaultFoldButton } from '../../ui-kit/Foldable/DefaultFoldButton.js';
|
|
5
5
|
import { Foldable } from '../../ui-kit/Foldable/Foldable.js';
|
|
6
6
|
import { FoldableSection } from '../../ui-kit/Foldable/FoldableSection.js';
|
|
7
|
+
import { Paragraph } from '../../ui-kit/Paragraph/Paragraph.js';
|
|
8
|
+
import { Text } from '../../ui-kit/Text/Text.js';
|
|
7
9
|
import { style } from '../../utils/style.js';
|
|
8
|
-
import { ErrorBlock } from '../ErrorBlock/ErrorBlock.js';
|
|
9
10
|
import { checkShouldRenderBlock } from './checkShouldRenderBlock.js';
|
|
10
11
|
const ICONS = ['ArrowDownIcon', 'ArrowUpIcon'];
|
|
11
12
|
const resultsGridStyle = 'grid grid-cols-12 gap-1 border-box';
|
|
12
|
-
export const FiltrationInner = JSX(({ label = '', filtrationState = {}, topItemsCount = 0, block, ...rest }) => {
|
|
13
|
+
export const FiltrationInner = JSX(({ label = '', filtrationState = {}, topItemsCount = 0, block, notFound, ...rest }) => {
|
|
13
14
|
const blocksToRender = block?.blocks?.filter((b) => checkShouldRenderBlock(filtrationState, b.content || {})) || [];
|
|
14
15
|
const [visibleBlocks, hiddenBlocks] = topItemsCount > 0
|
|
15
16
|
? [blocksToRender.slice(0, topItemsCount), blocksToRender.slice(topItemsCount)]
|
|
16
17
|
: [blocksToRender, []];
|
|
17
|
-
return (_jsxs("div", { children: [_jsx("div", { className: style(blocksToRender.length ? 'hidden' : ''), children:
|
|
18
|
-
return (_jsx(FoldableSection, { className: resultsGridStyle, isUnfolded: isUnfolded, children: renderBlocksList(hiddenBlocks, { ...rest.options, parent: block }) }));
|
|
19
|
-
}, renderFoldButton: ({ isUnfolded, onToggle }) => (_jsx(DefaultFoldButton, { className: style(
|
|
18
|
+
return (_jsxs("div", { children: [_jsx("div", { className: style(blocksToRender.length ? 'hidden' : 'block'), children: notFound ? renderNotFound(notFound) : null }), _jsxs("div", { className: style(blocksToRender.length ? '' : 'hidden'), children: [_jsx("div", { className: style('mb-1', resultsGridStyle), children: renderBlocksList(visibleBlocks, { ...rest.options, parent: block }) }), _jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => {
|
|
19
|
+
return (_jsx(FoldableSection, { className: style(resultsGridStyle, isUnfolded ? 'mb-1' : ''), isUnfolded: isUnfolded, children: renderBlocksList(hiddenBlocks, { ...rest.options, parent: block }) }));
|
|
20
|
+
}, renderFoldButton: ({ isUnfolded, onToggle }) => (_jsx(DefaultFoldButton, { className: style(topItemsCount < 1 ? 'hidden' : ''), disabled: !hiddenBlocks?.length, label: label, icon: ICONS[Number(isUnfolded)], dataTheme: rest.options?.page?.colorPalette, onClick: onToggle })) })] })] }));
|
|
20
21
|
});
|
|
22
|
+
function renderNotFound({ title, description }) {
|
|
23
|
+
return (_jsxs("div", { className: "bg-white py-20", children: [title ? (_jsx("div", { className: "mb-2", children: _jsx(Paragraph, { align: "text-center", children: _jsx(Text, { size: "text-h4", children: title }) }) })) : null, description ? (_jsx(Paragraph, { size: "text-xl", font: "font-light", align: "text-center", children: description })) : null] }));
|
|
24
|
+
}
|
|
21
25
|
//# sourceMappingURL=FiltrationInner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FiltrationInner.js","sourceRoot":"","sources":["../../../src/components/Filtration/FiltrationInner.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAGvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"FiltrationInner.js","sourceRoot":"","sources":["../../../src/components/Filtration/FiltrationInner.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAGvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OA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AS,IAAC,KAAK,EAAC,aAAa,YAC5B,KAAC,IAAI,IAAC,IAAI,EAAC,SAAS,YAAE,KAAK,GAAQ,GACzB,GACR,CACP,CAAC,CAAC,CAAC,IAAI,EACP,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,IAAC,IAAI,EAAC,SAAS,EAAC,IAAI,EAAC,YAAY,EAAC,KAAK,EAAC,aAAa,YAC5D,WAAW,GACF,CACb,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -5,14 +5,15 @@ export const renderFormItem = (filtrationSchema, register) => (key) => {
|
|
|
5
5
|
const item = filtrationSchema[key];
|
|
6
6
|
const type = item?.type;
|
|
7
7
|
switch (type) {
|
|
8
|
-
case '
|
|
9
|
-
return
|
|
8
|
+
case 'array':
|
|
9
|
+
return renderCheckboxes(key, register)(item);
|
|
10
10
|
default:
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
const
|
|
15
|
-
const options = item?.enum?.map((e, i) => ({ value: e, title: item?.enumNames?.[i] || '' })) ||
|
|
16
|
-
|
|
14
|
+
const renderCheckboxes = (key, register) => (item) => {
|
|
15
|
+
const options = item?.items?.enum?.map((e, i) => ({ value: e, title: item?.items?.enumNames?.[i] || '' })) ||
|
|
16
|
+
[];
|
|
17
|
+
return (_jsxs("div", { children: [item?.title ? (_jsx("div", { className: "mb-4", children: _jsx(Text, { size: "text-m", font: "font-light", color: "text-secondary-text", children: item.title }) })) : null, _jsx(SlideCheckboxGroup, { items: options, multiple: true, ...register(key) })] }, key));
|
|
17
18
|
};
|
|
18
19
|
//# sourceMappingURL=renderFormItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderFormItem.js","sourceRoot":"","sources":["../../../src/components/Filtration/renderFormItem.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,IAAI,E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0BACG,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CACb,cAAK,SAAS,EAAC,MAAM,YACnB,KAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,YAAY,EAAC,KAAK,EAAC,qBAAqB,YAC9D,IAAI,CAAC,KAAK,GACN,GACH,CACP,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,kBAAkB,IAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,WAAK,QAAQ,CAAC,GAAG,CAAC,GAAI,KAR1D,GAAG,CASP,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -3,35 +3,55 @@
|
|
|
3
3
|
"filtrationSchema": {
|
|
4
4
|
"propertyType": {
|
|
5
5
|
"title": "Тип недвижимости",
|
|
6
|
-
"type": "
|
|
7
|
-
"
|
|
8
|
-
|
|
6
|
+
"type": "array",
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"enum": ["flat", "apartment", "house", "storeRoom", "parkingSpace"],
|
|
10
|
+
"enumNames": ["Квартира", "Апартаменты", "Жилой дом", "Кладовая", "Машино-место"]
|
|
11
|
+
}
|
|
9
12
|
},
|
|
10
13
|
"stage": {
|
|
11
14
|
"title": "Этап строительства",
|
|
12
|
-
"type": "
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
+
"type": "array",
|
|
16
|
+
"items": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"enum": ["built", "inProgress"],
|
|
19
|
+
"enumNames": ["Готовое жильё", "Строящиеся"]
|
|
20
|
+
}
|
|
15
21
|
},
|
|
16
22
|
"categories": {
|
|
17
23
|
"title": "Категории",
|
|
18
|
-
"type": "
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
"type": "array",
|
|
25
|
+
"items": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"enum": ["salaryClient", "IT", "youngFamily", "military", "medicalWorker", "scientist"],
|
|
28
|
+
"enumNames": [
|
|
29
|
+
"Зарплатный клиент",
|
|
30
|
+
"IT-специалист",
|
|
31
|
+
"Молодая семья",
|
|
32
|
+
"Военнослужащий",
|
|
33
|
+
"Медицинский работник",
|
|
34
|
+
"Научный сотрудник"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
28
37
|
},
|
|
29
38
|
"extraOptions": {
|
|
30
39
|
"title": "Дополнительно",
|
|
31
|
-
"type": "
|
|
32
|
-
"
|
|
33
|
-
|
|
40
|
+
"type": "array",
|
|
41
|
+
"items": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"enum": ["preferentialMortgage", "children"],
|
|
44
|
+
"enumNames": ["Льготная ипотека", "Дети"]
|
|
45
|
+
}
|
|
34
46
|
}
|
|
47
|
+
},
|
|
48
|
+
"resetButton": {
|
|
49
|
+
"text": "Очистить фильтры",
|
|
50
|
+
"version": "secondary"
|
|
51
|
+
},
|
|
52
|
+
"notFound": {
|
|
53
|
+
"title": "Нет подходящей ипотечной программы",
|
|
54
|
+
"description": "Попробуйте очистить фильтры"
|
|
35
55
|
}
|
|
36
56
|
}
|
|
37
57
|
}
|
|
@@ -15,19 +15,14 @@ export const Filtration: JSXBlock<FiltrationProps> = JSX<FiltrationProps>(
|
|
|
15
15
|
const { formState, register, resetForm } = useForm();
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
|
-
<BlockWrapper className={style(
|
|
19
|
-
<form className="flex justify-between">
|
|
18
|
+
<BlockWrapper className={style(className)} version="transparent" {...rest}>
|
|
19
|
+
<form className="flex justify-between bg-white p-9 mb-1">
|
|
20
20
|
<div className="flex gap-11">
|
|
21
21
|
{Object.keys(filtrationSchema).map(renderFormItem(filtrationSchema, register))}
|
|
22
22
|
</div>
|
|
23
23
|
{resetButton ? (
|
|
24
24
|
<div>
|
|
25
|
-
<Button
|
|
26
|
-
className="w-72"
|
|
27
|
-
text={resetButton.text}
|
|
28
|
-
version={resetButton.buttonVersion}
|
|
29
|
-
onClick={resetForm}
|
|
30
|
-
/>
|
|
25
|
+
<Button className="w-72" onClick={resetForm} {...resetButton} />
|
|
31
26
|
</div>
|
|
32
27
|
) : null}
|
|
33
28
|
</form>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ButtonVersion } from '../../model/ButtonVersion';
|
|
2
|
+
import type { DescriptionProps, TitleProps } from '../../model/HeadlineType';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @title Заголовок
|
|
@@ -33,6 +34,7 @@ export type StringArray = {
|
|
|
33
34
|
* @hidden
|
|
34
35
|
*/
|
|
35
36
|
type?: 'array';
|
|
37
|
+
/** @title */
|
|
36
38
|
items?: {
|
|
37
39
|
/**
|
|
38
40
|
* @default string
|
|
@@ -47,13 +49,13 @@ export type StringArray = {
|
|
|
47
49
|
// TODO: Make customizable to implement arbitrary filtration blocks
|
|
48
50
|
export type FiltrationSchema = {
|
|
49
51
|
/** @title Тип недвижимости */
|
|
50
|
-
propertyType?:
|
|
52
|
+
propertyType?: StringArray;
|
|
51
53
|
/** @title Этап строительства */
|
|
52
|
-
stage?:
|
|
54
|
+
stage?: StringArray;
|
|
53
55
|
/** @title Категории */
|
|
54
|
-
categories?:
|
|
56
|
+
categories?: StringArray;
|
|
55
57
|
/** @title Дополнительно */
|
|
56
|
-
extraOptions?:
|
|
58
|
+
extraOptions?: StringArray;
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
/**
|
|
@@ -67,14 +69,24 @@ export type ResetButton = {
|
|
|
67
69
|
/**
|
|
68
70
|
* @title Цвет кнопки
|
|
69
71
|
*/
|
|
70
|
-
|
|
72
|
+
version: ButtonVersion;
|
|
71
73
|
};
|
|
72
74
|
|
|
75
|
+
/**
|
|
76
|
+
* @title Плитка "Не найдено"
|
|
77
|
+
*/
|
|
78
|
+
export type NotFound = TitleProps & DescriptionProps;
|
|
79
|
+
|
|
73
80
|
export interface FiltrationInnerContent {
|
|
74
|
-
/** @title Название кнопки */
|
|
81
|
+
/** @title Название сворачивающейся кнопки */
|
|
75
82
|
label?: string;
|
|
76
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* @title Количество отображаемых предметов
|
|
85
|
+
* @minimum 1
|
|
86
|
+
*/
|
|
77
87
|
topItemsCount?: number;
|
|
88
|
+
resetButton?: ResetButton;
|
|
89
|
+
notFound?: NotFound;
|
|
78
90
|
}
|
|
79
91
|
|
|
80
92
|
/**
|
|
@@ -83,5 +95,4 @@ export interface FiltrationInnerContent {
|
|
|
83
95
|
export interface FiltrationContent extends FiltrationInnerContent {
|
|
84
96
|
/** @title Параметры фильтрации */
|
|
85
97
|
filtrationSchema?: FiltrationSchema;
|
|
86
|
-
resetButton?: ResetButton;
|
|
87
98
|
}
|
|
@@ -5,10 +5,11 @@ import type { UniBlockProps } from '../../model/JSXBlock';
|
|
|
5
5
|
import { DefaultFoldButton } from '../../ui-kit/Foldable/DefaultFoldButton';
|
|
6
6
|
import { Foldable } from '../../ui-kit/Foldable/Foldable';
|
|
7
7
|
import { FoldableSection } from '../../ui-kit/Foldable/FoldableSection';
|
|
8
|
+
import { Paragraph } from '../../ui-kit/Paragraph/Paragraph';
|
|
9
|
+
import { Text } from '../../ui-kit/Text/Text';
|
|
8
10
|
import { style } from '../../utils/style';
|
|
9
|
-
import { ErrorBlock } from '../ErrorBlock/ErrorBlock';
|
|
10
11
|
import { checkShouldRenderBlock } from './checkShouldRenderBlock';
|
|
11
|
-
import type { FiltrationInnerContent } from './FiltrationContent';
|
|
12
|
+
import type { FiltrationInnerContent, NotFound } from './FiltrationContent';
|
|
12
13
|
|
|
13
14
|
const ICONS: IconName[] = ['ArrowDownIcon', 'ArrowUpIcon'];
|
|
14
15
|
|
|
@@ -19,7 +20,7 @@ interface FiltrationInnerProps extends FiltrationInnerContent, UniBlockProps {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export const FiltrationInner = JSX<FiltrationInnerProps>(
|
|
22
|
-
({ label = '', filtrationState = {}, topItemsCount = 0, block, ...rest }) => {
|
|
23
|
+
({ label = '', filtrationState = {}, topItemsCount = 0, block, notFound, ...rest }) => {
|
|
23
24
|
const blocksToRender =
|
|
24
25
|
block?.blocks?.filter((b) => checkShouldRenderBlock(filtrationState, b.content || {})) || [];
|
|
25
26
|
|
|
@@ -30,28 +31,27 @@ export const FiltrationInner = JSX<FiltrationInnerProps>(
|
|
|
30
31
|
|
|
31
32
|
return (
|
|
32
33
|
<div>
|
|
33
|
-
<div className={style(blocksToRender.length ? 'hidden' : '')}>
|
|
34
|
-
|
|
35
|
-
error={{ errorContentType: 'Image' }}
|
|
36
|
-
title="Нет подходящей ипотечной программы"
|
|
37
|
-
subtitle="Попробуйте очистить фильтры"
|
|
38
|
-
/>
|
|
34
|
+
<div className={style(blocksToRender.length ? 'hidden' : 'block')}>
|
|
35
|
+
{notFound ? renderNotFound(notFound) : null}
|
|
39
36
|
</div>
|
|
40
37
|
<div className={style(blocksToRender.length ? '' : 'hidden')}>
|
|
41
|
-
<div className={resultsGridStyle}>
|
|
38
|
+
<div className={style('mb-1', resultsGridStyle)}>
|
|
42
39
|
{renderBlocksList(visibleBlocks, { ...rest.options, parent: block })}
|
|
43
40
|
</div>
|
|
44
41
|
<Foldable
|
|
45
42
|
renderFoldableSection={({ isUnfolded }) => {
|
|
46
43
|
return (
|
|
47
|
-
<FoldableSection
|
|
44
|
+
<FoldableSection
|
|
45
|
+
className={style(resultsGridStyle, isUnfolded ? 'mb-1' : '')}
|
|
46
|
+
isUnfolded={isUnfolded}
|
|
47
|
+
>
|
|
48
48
|
{renderBlocksList(hiddenBlocks, { ...rest.options, parent: block })}
|
|
49
49
|
</FoldableSection>
|
|
50
50
|
);
|
|
51
51
|
}}
|
|
52
52
|
renderFoldButton={({ isUnfolded, onToggle }) => (
|
|
53
53
|
<DefaultFoldButton
|
|
54
|
-
className={style(
|
|
54
|
+
className={style(topItemsCount < 1 ? 'hidden' : '')}
|
|
55
55
|
disabled={!hiddenBlocks?.length}
|
|
56
56
|
label={label}
|
|
57
57
|
icon={ICONS[Number(isUnfolded)]}
|
|
@@ -65,3 +65,22 @@ export const FiltrationInner = JSX<FiltrationInnerProps>(
|
|
|
65
65
|
);
|
|
66
66
|
},
|
|
67
67
|
);
|
|
68
|
+
|
|
69
|
+
function renderNotFound({ title, description }: NotFound) {
|
|
70
|
+
return (
|
|
71
|
+
<div className="bg-white py-20">
|
|
72
|
+
{title ? (
|
|
73
|
+
<div className="mb-2">
|
|
74
|
+
<Paragraph align="text-center">
|
|
75
|
+
<Text size="text-h4">{title}</Text>
|
|
76
|
+
</Paragraph>
|
|
77
|
+
</div>
|
|
78
|
+
) : null}
|
|
79
|
+
{description ? (
|
|
80
|
+
<Paragraph size="text-xl" font="font-light" align="text-center">
|
|
81
|
+
{description}
|
|
82
|
+
</Paragraph>
|
|
83
|
+
) : null}
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FormElementRegisterer } from '../../hooks/useForm';
|
|
2
2
|
import { SlideCheckboxGroup } from '../../ui-kit/SlideCheckboxGroup/SlideCheckboxGroup';
|
|
3
3
|
import { Text } from '../../ui-kit/Text/Text';
|
|
4
|
-
import type { FiltrationSchema,
|
|
4
|
+
import type { FiltrationSchema, StringArray } from './FiltrationContent';
|
|
5
5
|
|
|
6
6
|
export const renderFormItem =
|
|
7
7
|
(filtrationSchema: FiltrationSchema, register: FormElementRegisterer) => (key: string) => {
|
|
@@ -9,28 +9,28 @@ export const renderFormItem =
|
|
|
9
9
|
const type = item?.type;
|
|
10
10
|
|
|
11
11
|
switch (type) {
|
|
12
|
-
case '
|
|
13
|
-
return
|
|
12
|
+
case 'array':
|
|
13
|
+
return renderCheckboxes(key, register)(item);
|
|
14
14
|
default:
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
const renderCheckboxes = (key: string, register: FormElementRegisterer) => (item?: StringArray) => {
|
|
20
|
+
const options =
|
|
21
|
+
item?.items?.enum?.map((e, i) => ({ value: e, title: item?.items?.enumNames?.[i] || '' })) ||
|
|
22
|
+
[];
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
return (
|
|
25
|
+
<div key={key}>
|
|
26
|
+
{item?.title ? (
|
|
27
|
+
<div className="mb-4">
|
|
28
|
+
<Text size="text-m" font="font-light" color="text-secondary-text">
|
|
29
|
+
{item.title}
|
|
30
|
+
</Text>
|
|
31
|
+
</div>
|
|
32
|
+
) : null}
|
|
33
|
+
<SlideCheckboxGroup items={options} multiple {...register(key)} />
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"content": {
|
|
3
|
-
"__html": "<
|
|
3
|
+
"__html": "<h1>Заголовок 1</h1>\n<h2>Заголовок 2</h2>\n<h3>Заголовок 3</h3>\n<h4>Заголовок 4</h4>\n<h5>Заголовок 5</h5>\n<h6>Заголовок 6</h6>\n<p>Параграф, в котором много текста и даже <a href=\"#\">ссылка</a></p>\n<p><strong>Жирный текст</strong>, <em>Наклонный текст</em></p>\n<ul>\n <li>Список с точками</li>\n <li>Список с точками</li>\n</ul>\n<ol>\n <li>Нумерованный список</li>\n <li>Нумерованный список</li>\n</ol>\n"
|
|
4
4
|
}
|
|
5
5
|
}
|
package/package.json
CHANGED
|
@@ -3,35 +3,55 @@
|
|
|
3
3
|
"filtrationSchema": {
|
|
4
4
|
"propertyType": {
|
|
5
5
|
"title": "Тип недвижимости",
|
|
6
|
-
"type": "
|
|
7
|
-
"
|
|
8
|
-
|
|
6
|
+
"type": "array",
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"enum": ["flat", "apartment", "house", "storeRoom", "parkingSpace"],
|
|
10
|
+
"enumNames": ["Квартира", "Апартаменты", "Жилой дом", "Кладовая", "Машино-место"]
|
|
11
|
+
}
|
|
9
12
|
},
|
|
10
13
|
"stage": {
|
|
11
14
|
"title": "Этап строительства",
|
|
12
|
-
"type": "
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
+
"type": "array",
|
|
16
|
+
"items": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"enum": ["built", "inProgress"],
|
|
19
|
+
"enumNames": ["Готовое жильё", "Строящиеся"]
|
|
20
|
+
}
|
|
15
21
|
},
|
|
16
22
|
"categories": {
|
|
17
23
|
"title": "Категории",
|
|
18
|
-
"type": "
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
"type": "array",
|
|
25
|
+
"items": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"enum": ["salaryClient", "IT", "youngFamily", "military", "medicalWorker", "scientist"],
|
|
28
|
+
"enumNames": [
|
|
29
|
+
"Зарплатный клиент",
|
|
30
|
+
"IT-специалист",
|
|
31
|
+
"Молодая семья",
|
|
32
|
+
"Военнослужащий",
|
|
33
|
+
"Медицинский работник",
|
|
34
|
+
"Научный сотрудник"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
28
37
|
},
|
|
29
38
|
"extraOptions": {
|
|
30
39
|
"title": "Дополнительно",
|
|
31
|
-
"type": "
|
|
32
|
-
"
|
|
33
|
-
|
|
40
|
+
"type": "array",
|
|
41
|
+
"items": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"enum": ["preferentialMortgage", "children"],
|
|
44
|
+
"enumNames": ["Льготная ипотека", "Дети"]
|
|
45
|
+
}
|
|
34
46
|
}
|
|
47
|
+
},
|
|
48
|
+
"resetButton": {
|
|
49
|
+
"text": "Очистить фильтры",
|
|
50
|
+
"version": "secondary"
|
|
51
|
+
},
|
|
52
|
+
"notFound": {
|
|
53
|
+
"title": "Нет подходящей ипотечной программы",
|
|
54
|
+
"description": "Попробуйте очистить фильтры"
|
|
35
55
|
}
|
|
36
56
|
}
|
|
37
57
|
}
|
|
@@ -49,34 +49,46 @@ const generateBlock = (...presets: any[]) => ({
|
|
|
49
49
|
const SCHEMA: FiltrationContent['filtrationSchema'] = {
|
|
50
50
|
propertyType: {
|
|
51
51
|
title: 'Тип недвижимости',
|
|
52
|
-
type: '
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
type: 'array',
|
|
53
|
+
items: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
enum: ['flat', 'apartment', 'house', 'storeRoom', 'parkingSpace'],
|
|
56
|
+
enumNames: ['Квартира', 'Апартаменты', 'Жилой дом', 'Кладовая', 'Машино-место'],
|
|
57
|
+
},
|
|
55
58
|
},
|
|
56
59
|
stage: {
|
|
57
60
|
title: 'Этап строительства',
|
|
58
|
-
type: '
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
type: 'array',
|
|
62
|
+
items: {
|
|
63
|
+
type: 'string',
|
|
64
|
+
enum: ['built', 'inProgress'],
|
|
65
|
+
enumNames: ['Готовое жильё', 'Строящиеся'],
|
|
66
|
+
},
|
|
61
67
|
},
|
|
62
68
|
categories: {
|
|
63
69
|
title: 'Категории',
|
|
64
|
-
type: '
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
'
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
type: 'array',
|
|
71
|
+
items: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
enum: ['salaryClient', 'IT', 'youngFamily', 'military', 'medicalWorker', 'scientist'],
|
|
74
|
+
enumNames: [
|
|
75
|
+
'Зарплатный клиент',
|
|
76
|
+
'IT-специалист',
|
|
77
|
+
'Молодая семья',
|
|
78
|
+
'Военнослужащий',
|
|
79
|
+
'Медицинский работник',
|
|
80
|
+
'Научный сотрудник',
|
|
81
|
+
],
|
|
82
|
+
},
|
|
74
83
|
},
|
|
75
84
|
extraOptions: {
|
|
76
85
|
title: 'Дополнительно',
|
|
77
|
-
type: '
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
type: 'array',
|
|
87
|
+
items: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
enum: ['preferentialMortgage', 'children'],
|
|
90
|
+
enumNames: ['Льготная ипотека', 'Дети'],
|
|
91
|
+
},
|
|
80
92
|
},
|
|
81
93
|
};
|
|
82
94
|
|
|
@@ -92,7 +104,11 @@ export default {
|
|
|
92
104
|
label="Другие ипотечные программы"
|
|
93
105
|
filtrationSchema={SCHEMA}
|
|
94
106
|
topItemsCount={2}
|
|
95
|
-
resetButton={{ text: 'Очистить фильтры',
|
|
107
|
+
resetButton={{ text: 'Очистить фильтры', version: 'secondary' }}
|
|
108
|
+
notFound={{
|
|
109
|
+
title: 'Нет подходящей ипотечной программы',
|
|
110
|
+
description: 'Попробуйте очистить фильтры',
|
|
111
|
+
}}
|
|
96
112
|
block={{
|
|
97
113
|
type: 'Filtration',
|
|
98
114
|
blocks: [
|