@redneckz/wildless-cms-uni-blocks 0.6.15 → 0.6.16
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/bin/migration-scripts/0.6.16.js +90 -0
- package/bin/utils.js +2 -0
- package/bundle/bundle.umd.js +14 -5
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/components/ContentPage/renderContentPageHead.js +7 -7
- package/dist/components/ContentPage/renderContentPageHead.js.map +1 -1
- package/dist/ui-kit/Foldable/DefaultFoldButton.js +13 -4
- package/dist/ui-kit/Foldable/DefaultFoldButton.js.map +1 -1
- package/lib/components/ContentPage/renderContentPageHead.js +7 -7
- package/lib/components/ContentPage/renderContentPageHead.js.map +1 -1
- package/lib/ui-kit/Foldable/DefaultFoldButton.js +13 -4
- package/lib/ui-kit/Foldable/DefaultFoldButton.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +1 -1
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/components/ContentPage/renderContentPageHead.js +7 -7
- package/mobile/dist/components/ContentPage/renderContentPageHead.js.map +1 -1
- package/mobile/dist/ui-kit/Foldable/DefaultFoldButton.js +13 -4
- package/mobile/dist/ui-kit/Foldable/DefaultFoldButton.js.map +1 -1
- package/mobile/lib/components/ContentPage/renderContentPageHead.js +7 -7
- package/mobile/lib/components/ContentPage/renderContentPageHead.js.map +1 -1
- package/mobile/lib/ui-kit/Foldable/DefaultFoldButton.js +13 -4
- package/mobile/lib/ui-kit/Foldable/DefaultFoldButton.js.map +1 -1
- package/mobile/src/components/ContentPage/renderContentPageHead.tsx +11 -7
- package/mobile/src/ui-kit/Foldable/DefaultFoldButton.tsx +32 -23
- package/package.json +1 -1
- package/src/components/ContentPage/renderContentPageHead.tsx +11 -7
- package/src/ui-kit/Foldable/DefaultFoldButton.tsx +32 -23
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsonCopy } from '../utils.js';
|
|
2
|
+
|
|
3
|
+
export const description = 'v0.6.16';
|
|
4
|
+
|
|
5
|
+
const replaceToContent = (obj, prop) => {
|
|
6
|
+
if (!obj.hasOwnProperty('content')) {
|
|
7
|
+
Object.assign(obj, { content: {} });
|
|
8
|
+
}
|
|
9
|
+
if (obj.hasOwnProperty(prop) && prop) {
|
|
10
|
+
Object.assign(obj.content, { [prop]: obj[prop] });
|
|
11
|
+
Reflect.deleteProperty(obj, prop);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default (unitPath, content) => {
|
|
16
|
+
if (!content?.blocks) {
|
|
17
|
+
return content;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
for (const block of content.blocks) {
|
|
21
|
+
adjustOtherProducts(block);
|
|
22
|
+
adjustAccordion(block);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return { ...content };
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const adjustAccordionItems = (accordionItems) =>
|
|
29
|
+
accordionItems.map((item) => {
|
|
30
|
+
item.type = 'AccordionItem';
|
|
31
|
+
item.content = {};
|
|
32
|
+
replaceToContent(item, 'label');
|
|
33
|
+
replaceToContent(item, 'labelIcon');
|
|
34
|
+
replaceToContent(item, 'bordered');
|
|
35
|
+
|
|
36
|
+
if (!item?.blocks) {
|
|
37
|
+
return item;
|
|
38
|
+
}
|
|
39
|
+
item.blocks = item.blocks.map((_) => {
|
|
40
|
+
if (_?.blockListType) {
|
|
41
|
+
const { blockListType = '', style, ...rest } = _;
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
content: { ...rest },
|
|
45
|
+
type: blockListType,
|
|
46
|
+
style,
|
|
47
|
+
};
|
|
48
|
+
} else {
|
|
49
|
+
return _;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return item;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
function adjustAccordion(block) {
|
|
56
|
+
if (block.type !== 'Accordion' || !block.content || !block.content?.accordionItems) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const content = block.content;
|
|
60
|
+
content.blocks = adjustAccordionItems(content.accordionItems);
|
|
61
|
+
Reflect.deleteProperty(content, 'accordionItems');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const adjustOtherProductsItems = (blockItems) => {
|
|
65
|
+
return blockItems.map((item) => {
|
|
66
|
+
item.type = 'OtherProductsItem';
|
|
67
|
+
replaceToContent(item, 'label');
|
|
68
|
+
if (!item?.blocks) {
|
|
69
|
+
return item;
|
|
70
|
+
}
|
|
71
|
+
item.blocks = item.blocks.map((_) => {
|
|
72
|
+
const { blockListType, style, ...rest } = _;
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
content: { ...rest },
|
|
76
|
+
type: blockListType,
|
|
77
|
+
style,
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
return item;
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
function adjustOtherProducts(block) {
|
|
84
|
+
if (block.type !== 'OtherProducts' || !block.content || !block.content.blockItems) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const content = block.content;
|
|
88
|
+
block.blocks = adjustOtherProductsItems(content.blockItems);
|
|
89
|
+
Reflect.deleteProperty(content, 'blockItems');
|
|
90
|
+
}
|
package/bin/utils.js
CHANGED
package/bundle/bundle.umd.js
CHANGED
|
@@ -2498,10 +2498,19 @@
|
|
|
2498
2498
|
return content || defaultContent;
|
|
2499
2499
|
}
|
|
2500
2500
|
|
|
2501
|
-
const DefaultFoldButton = JSX(({ className, label, icon, dataTheme = '', onClick }) =>
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2501
|
+
const DefaultFoldButton = JSX(({ className = '', label, icon, dataTheme = '', onClick }) => {
|
|
2502
|
+
const STATE_STYLE = 'hover:bg-primary-hover focus:border-primary-text active:bg-primary-active outline-none';
|
|
2503
|
+
const DIMENSIONS_STYLE = 'flex justify-center w-full px-0 py-5 mb-[1px]';
|
|
2504
|
+
return (jsxs("button", { className: [
|
|
2505
|
+
'border border-transparent bg-primary-main font-sans text-white cursor-pointer',
|
|
2506
|
+
STATE_STYLE,
|
|
2507
|
+
DIMENSIONS_STYLE,
|
|
2508
|
+
className,
|
|
2509
|
+
].join(' '), "data-theme": dataTheme, onClick: onClick, children: [jsx("span", { className: "text-h4 pr-3", children: label }), icon ? (jsx(ImgInner, { image: {
|
|
2510
|
+
icon,
|
|
2511
|
+
iconVersion: 'white',
|
|
2512
|
+
}, className: "flex-shrink-0 my-auto", width: "20", height: "20", asSVG: true })) : null] }));
|
|
2513
|
+
});
|
|
2505
2514
|
const renderDefaultFoldButton = ({ isUnfolded, onToggle }) => {
|
|
2506
2515
|
const labels = ['Развернуть', 'Скрыть'];
|
|
2507
2516
|
const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
|
|
@@ -3416,7 +3425,7 @@
|
|
|
3416
3425
|
return (jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: jsx(LikeControl, { className: "rounded-tl-lg sticky bottom-0 pointer-events-auto", context: context }, "LikeControl") }));
|
|
3417
3426
|
}
|
|
3418
3427
|
|
|
3419
|
-
const packageVersion = "0.6.
|
|
3428
|
+
const packageVersion = "0.6.16";
|
|
3420
3429
|
|
|
3421
3430
|
exports.Blocks = Blocks;
|
|
3422
3431
|
exports.ContentPage = ContentPage;
|