@lowdefy/blocks-antd 4.0.0-alpha.1 → 4.0.0-alpha.12
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/dist/blocks/Affix/Affix.js +11 -6
- package/dist/blocks/Affix/style.less +1 -1
- package/dist/blocks/Alert/Alert.js +28 -10
- package/dist/blocks/Alert/style.less +1 -1
- package/dist/blocks/AutoComplete/AutoComplete.js +41 -34
- package/dist/blocks/AutoComplete/style.less +1 -1
- package/dist/blocks/Avatar/Avatar.js +12 -7
- package/dist/blocks/Avatar/schema.json +1 -1
- package/dist/blocks/Avatar/style.less +1 -1
- package/dist/blocks/Badge/Badge.js +12 -7
- package/dist/blocks/Badge/schema.json +1 -1
- package/dist/blocks/Badge/style.less +1 -1
- package/dist/blocks/Breadcrumb/Breadcrumb.js +56 -64
- package/dist/blocks/Breadcrumb/schema.json +1 -1
- package/dist/blocks/Breadcrumb/style.less +1 -1
- package/dist/blocks/Button/Button.js +22 -13
- package/dist/blocks/Button/schema.json +1 -1
- package/dist/blocks/Button/style.less +1 -1
- package/dist/blocks/ButtonSelector/ButtonSelector.js +36 -29
- package/dist/blocks/ButtonSelector/style.less +1 -1
- package/dist/blocks/Card/Card.js +11 -6
- package/dist/blocks/Card/style.less +1 -1
- package/dist/blocks/CheckboxSelector/CheckboxSelector.js +40 -34
- package/dist/blocks/CheckboxSelector/style.less +1 -1
- package/dist/blocks/CheckboxSwitch/CheckboxSwitch.js +21 -15
- package/dist/blocks/CheckboxSwitch/style.less +1 -1
- package/dist/blocks/Collapse/Collapse.js +38 -21
- package/dist/blocks/Collapse/schema.json +1 -1
- package/dist/blocks/Collapse/style.less +1 -1
- package/dist/blocks/Comment/Comment.js +13 -9
- package/dist/blocks/Comment/style.less +1 -1
- package/dist/blocks/ConfirmModal/ConfirmModal.js +28 -10
- package/dist/blocks/ConfirmModal/schema.json +1 -1
- package/dist/blocks/ConfirmModal/style.less +1 -1
- package/dist/blocks/Content/Content.js +11 -6
- package/dist/blocks/Content/style.less +1 -1
- package/dist/blocks/ControlledList/ControlledList.js +61 -63
- package/dist/blocks/ControlledList/style.less +1 -1
- package/dist/blocks/DateRangeSelector/DateRangeSelector.js +55 -50
- package/dist/blocks/DateRangeSelector/schema.json +2 -2
- package/dist/blocks/DateRangeSelector/style.less +1 -1
- package/dist/blocks/DateSelector/DateSelector.js +49 -44
- package/dist/blocks/DateSelector/schema.json +2 -2
- package/dist/blocks/DateSelector/style.less +1 -1
- package/dist/blocks/DateTimeSelector/DateTimeSelector.js +56 -51
- package/dist/blocks/DateTimeSelector/schema.json +2 -2
- package/dist/blocks/DateTimeSelector/style.less +1 -1
- package/dist/blocks/Descriptions/Descriptions.js +42 -38
- package/dist/blocks/Descriptions/style.less +1 -1
- package/dist/blocks/Divider/Divider.js +14 -9
- package/dist/blocks/Divider/style.less +1 -1
- package/dist/blocks/Drawer/Drawer.js +11 -6
- package/dist/blocks/Drawer/style.less +1 -1
- package/dist/blocks/Footer/Footer.js +11 -6
- package/dist/blocks/Footer/style.less +1 -1
- package/dist/blocks/Header/Header.js +11 -9
- package/dist/blocks/Header/schema.json +0 -4
- package/dist/blocks/Header/style.less +1 -1
- package/dist/blocks/Label/Label.js +70 -67
- package/dist/blocks/Label/getLabelCol.js +1 -1
- package/dist/blocks/Label/getWrapperCol.js +1 -1
- package/dist/blocks/Label/labelLogic.js +2 -3
- package/dist/blocks/Label/style.less +1 -1
- package/dist/blocks/Layout/Layout.js +11 -6
- package/dist/blocks/Layout/style.less +1 -1
- package/dist/blocks/Menu/Menu.js +123 -218
- package/dist/blocks/Menu/schema.json +1 -15
- package/dist/blocks/Menu/style.less +1 -1
- package/dist/blocks/Message/Message.js +11 -6
- package/dist/blocks/Message/schema.json +1 -1
- package/dist/blocks/Message/style.less +1 -1
- package/dist/blocks/MobileMenu/MobileMenu.js +85 -85
- package/dist/blocks/MobileMenu/schema.json +1 -15
- package/dist/blocks/MobileMenu/style.less +1 -1
- package/dist/blocks/Modal/Modal.js +76 -60
- package/dist/blocks/Modal/style.less +1 -1
- package/dist/blocks/MonthSelector/MonthSelector.js +47 -42
- package/dist/blocks/MonthSelector/schema.json +2 -2
- package/dist/blocks/MonthSelector/style.less +1 -1
- package/dist/blocks/MultipleSelector/MultipleSelector.js +104 -99
- package/dist/blocks/MultipleSelector/schema.json +6 -6
- package/dist/blocks/MultipleSelector/style.less +1 -1
- package/dist/blocks/Notification/Notification.js +13 -8
- package/dist/blocks/Notification/schema.json +2 -2
- package/dist/blocks/Notification/style.less +1 -1
- package/dist/blocks/NumberInput/NumberInput.js +14 -6
- package/dist/blocks/NumberInput/style.less +1 -1
- package/dist/blocks/PageHCF/PageHCF.js +34 -34
- package/dist/blocks/PageHCF/schema.json +0 -29
- package/dist/blocks/PageHCF/style.less +1 -1
- package/dist/blocks/PageHCSF/PageHCSF.js +61 -66
- package/dist/blocks/PageHCSF/schema.json +0 -30
- package/dist/blocks/PageHCSF/style.less +1 -1
- package/dist/blocks/PageHSCF/PageHSCF.js +61 -66
- package/dist/blocks/PageHSCF/schema.json +0 -30
- package/dist/blocks/PageHSCF/style.less +1 -1
- package/dist/blocks/PageHeaderMenu/PageHeaderMenu.js +151 -167
- package/dist/blocks/PageHeaderMenu/schema.json +1 -24
- package/dist/blocks/PageHeaderMenu/style.less +1 -1
- package/dist/blocks/PageSHCF/PageSHCF.js +60 -65
- package/dist/blocks/PageSHCF/schema.json +0 -30
- package/dist/blocks/PageSHCF/style.less +1 -1
- package/dist/blocks/PageSiderMenu/PageSiderMenu.js +258 -285
- package/dist/blocks/PageSiderMenu/schema.json +1 -31
- package/dist/blocks/PageSiderMenu/style.less +1 -1
- package/dist/blocks/Pagination/Pagination.js +17 -5
- package/dist/blocks/Pagination/style.less +1 -1
- package/dist/blocks/Paragraph/Paragraph.js +21 -14
- package/dist/blocks/Paragraph/style.less +1 -1
- package/dist/blocks/ParagraphInput/ParagraphInput.js +22 -14
- package/dist/blocks/ParagraphInput/style.less +1 -1
- package/dist/blocks/PasswordInput/PasswordInput.js +14 -6
- package/dist/blocks/PasswordInput/style.less +1 -1
- package/dist/blocks/Progress/Progress.js +9 -3
- package/dist/blocks/Progress/style.less +1 -1
- package/dist/blocks/RadioSelector/RadioSelector.js +40 -34
- package/dist/blocks/RadioSelector/style.less +1 -1
- package/dist/blocks/RatingSlider/RatingSlider.js +127 -126
- package/dist/blocks/RatingSlider/schema.json +4 -4
- package/dist/blocks/RatingSlider/style.less +1 -1
- package/dist/blocks/Result/Result.js +13 -8
- package/dist/blocks/Result/schema.json +1 -1
- package/dist/blocks/Result/style.less +1 -1
- package/dist/blocks/Selector/Selector.js +96 -91
- package/dist/blocks/Selector/schema.json +4 -4
- package/dist/blocks/Selector/style.less +1 -1
- package/dist/blocks/Sider/Sider.js +12 -9
- package/dist/blocks/Sider/schema.json +0 -7
- package/dist/blocks/Sider/style.less +1 -1
- package/dist/blocks/Statistic/Statistic.js +11 -5
- package/dist/blocks/Statistic/schema.json +2 -2
- package/dist/blocks/Statistic/style.less +1 -1
- package/dist/blocks/Switch/Switch.js +22 -19
- package/dist/blocks/Switch/schema.json +4 -4
- package/dist/blocks/Switch/style.less +1 -1
- package/dist/blocks/Tabs/Tabs.js +36 -24
- package/dist/blocks/Tabs/schema.json +1 -1
- package/dist/blocks/Tabs/style.less +1 -1
- package/dist/blocks/TextArea/TextArea.js +14 -6
- package/dist/blocks/TextArea/style.less +1 -1
- package/dist/blocks/TextInput/TextInput.js +16 -8
- package/dist/blocks/TextInput/schema.json +2 -2
- package/dist/blocks/TextInput/style.less +1 -1
- package/dist/blocks/TimelineList/TimelineList.js +56 -40
- package/dist/blocks/TimelineList/schema.json +4 -1
- package/dist/blocks/TimelineList/style.less +1 -1
- package/dist/blocks/Title/Title.js +21 -14
- package/dist/blocks/Title/style.less +1 -1
- package/dist/blocks/TitleInput/TitleInput.js +22 -14
- package/dist/blocks/TitleInput/style.less +1 -1
- package/dist/blocks/Tooltip/Tooltip.js +11 -9
- package/dist/blocks/Tooltip/style.less +1 -1
- package/dist/blocks/WeekSelector/WeekSelector.js +47 -42
- package/dist/blocks/WeekSelector/schema.json +2 -2
- package/dist/blocks/WeekSelector/style.less +1 -1
- package/dist/blocks.js +74 -0
- package/dist/color.js +1 -1
- package/dist/disabledDate.js +2 -3
- package/dist/getUniqueValues.js +1 -1
- package/dist/getValueIndex.js +1 -1
- package/dist/style.less +1 -1
- package/dist/{blocks/Alert/index.js → types.js} +16 -19
- package/dist/useRunAfterUpdate.js +1 -1
- package/dist/validationExamples.js +1 -1
- package/package.json +27 -23
- package/dist/blocks/Affix/index.js +0 -26
- package/dist/blocks/AutoComplete/index.js +0 -33
- package/dist/blocks/Avatar/index.js +0 -28
- package/dist/blocks/Badge/index.js +0 -26
- package/dist/blocks/Breadcrumb/index.js +0 -31
- package/dist/blocks/Button/index.js +0 -28
- package/dist/blocks/ButtonSelector/index.js +0 -33
- package/dist/blocks/Card/index.js +0 -31
- package/dist/blocks/CheckboxSelector/index.js +0 -33
- package/dist/blocks/CheckboxSwitch/index.js +0 -36
- package/dist/blocks/Collapse/index.js +0 -31
- package/dist/blocks/Comment/index.js +0 -28
- package/dist/blocks/ConfirmModal/index.js +0 -59
- package/dist/blocks/Content/index.js +0 -26
- package/dist/blocks/ControlledList/index.js +0 -36
- package/dist/blocks/DateRangeSelector/index.js +0 -33
- package/dist/blocks/DateSelector/index.js +0 -33
- package/dist/blocks/DateTimeSelector/index.js +0 -33
- package/dist/blocks/Descriptions/index.js +0 -31
- package/dist/blocks/Divider/index.js +0 -31
- package/dist/blocks/Drawer/index.js +0 -41
- package/dist/blocks/Footer/index.js +0 -26
- package/dist/blocks/Header/index.js +0 -26
- package/dist/blocks/Label/index.js +0 -32
- package/dist/blocks/Layout/index.js +0 -31
- package/dist/blocks/Menu/index.js +0 -26
- package/dist/blocks/Message/index.js +0 -53
- package/dist/blocks/MobileMenu/index.js +0 -41
- package/dist/blocks/Modal/index.js +0 -41
- package/dist/blocks/MonthSelector/index.js +0 -33
- package/dist/blocks/MultipleSelector/index.js +0 -33
- package/dist/blocks/Notification/index.js +0 -59
- package/dist/blocks/NumberInput/index.js +0 -33
- package/dist/blocks/PageHCF/index.js +0 -31
- package/dist/blocks/PageHCSF/index.js +0 -46
- package/dist/blocks/PageHSCF/index.js +0 -46
- package/dist/blocks/PageHeaderMenu/index.js +0 -46
- package/dist/blocks/PageSHCF/index.js +0 -46
- package/dist/blocks/PageSiderMenu/index.js +0 -57
- package/dist/blocks/Pagination/index.js +0 -37
- package/dist/blocks/Paragraph/index.js +0 -28
- package/dist/blocks/ParagraphInput/index.js +0 -36
- package/dist/blocks/PasswordInput/index.js +0 -33
- package/dist/blocks/Progress/index.js +0 -31
- package/dist/blocks/RadioSelector/index.js +0 -33
- package/dist/blocks/RatingSlider/index.js +0 -33
- package/dist/blocks/Result/index.js +0 -31
- package/dist/blocks/S3UploadButton/S3UploadButton.js +0 -171
- package/dist/blocks/S3UploadButton/index.js +0 -29
- package/dist/blocks/S3UploadButton/schema.json +0 -83
- package/dist/blocks/S3UploadButton/style.less +0 -18
- package/dist/blocks/Selector/index.js +0 -33
- package/dist/blocks/Sider/index.js +0 -41
- package/dist/blocks/Statistic/index.js +0 -31
- package/dist/blocks/Switch/index.js +0 -33
- package/dist/blocks/Tabs/index.js +0 -31
- package/dist/blocks/TextArea/index.js +0 -33
- package/dist/blocks/TextInput/index.js +0 -33
- package/dist/blocks/TimelineList/index.js +0 -31
- package/dist/blocks/Title/index.js +0 -31
- package/dist/blocks/TitleInput/index.js +0 -39
- package/dist/blocks/Tooltip/index.js +0 -31
- package/dist/blocks/WeekSelector/index.js +0 -33
- package/dist/index.js +0 -152
package/dist/blocks/Menu/Menu.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
/*
|
|
3
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
4
3
|
|
|
5
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
you may not use this file except in compliance with the License.
|
|
@@ -17,85 +16,45 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
17
16
|
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
18
17
|
import { Menu } from 'antd';
|
|
19
18
|
import { type, get } from '@lowdefy/helpers';
|
|
20
|
-
|
|
19
|
+
function _extends() {
|
|
20
|
+
_extends = Object.assign || function(target) {
|
|
21
|
+
for(var i = 1; i < arguments.length; i++){
|
|
22
|
+
var source = arguments[i];
|
|
23
|
+
for(var key in source){
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
25
|
+
target[key] = source[key];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return target;
|
|
30
|
+
};
|
|
31
|
+
return _extends.apply(this, arguments);
|
|
32
|
+
}
|
|
21
33
|
const getDefaultMenu = (menus, menuId = 'default', links)=>{
|
|
22
34
|
if (type.isArray(links)) return links;
|
|
23
35
|
if (!type.isArray(menus)) return [];
|
|
24
36
|
const menu = menus.find((item)=>item.menuId === menuId
|
|
25
|
-
) || menus[0] || {
|
|
26
|
-
};
|
|
37
|
+
) || menus[0] || {};
|
|
27
38
|
return menu.links || [];
|
|
28
39
|
};
|
|
29
|
-
const getTitle = (id, properties,
|
|
40
|
+
const getTitle = ({ id , properties , pageId , url })=>properties && properties.title || pageId || url || id
|
|
30
41
|
;
|
|
31
|
-
const
|
|
32
|
-
if (type.isString(pageId)) {
|
|
33
|
-
return(/*#__PURE__*/ _jsx(Link, {
|
|
34
|
-
href: `${basePath}/${pageId}`,
|
|
35
|
-
className: makeCssClass([
|
|
36
|
-
linkStyle
|
|
37
|
-
]),
|
|
38
|
-
children: getTitle(id, properties, pageId)
|
|
39
|
-
}));
|
|
40
|
-
}
|
|
41
|
-
if (url) {
|
|
42
|
-
return(/*#__PURE__*/ _jsx(Link, {
|
|
43
|
-
href: url,
|
|
44
|
-
className: makeCssClass([
|
|
45
|
-
linkStyle
|
|
46
|
-
]),
|
|
47
|
-
children: getTitle(id, properties, url)
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
return(/*#__PURE__*/ _jsx("span", {
|
|
51
|
-
className: makeCssClass([
|
|
52
|
-
linkStyle
|
|
53
|
-
]),
|
|
54
|
-
children: getTitle(id, properties)
|
|
55
|
-
}));
|
|
56
|
-
};
|
|
57
|
-
const getNestedColors = (menuColor, background)=>{
|
|
58
|
-
const fontColor = color(menuColor, 6);
|
|
59
|
-
const bgColor = color(menuColor, 3);
|
|
60
|
-
return {
|
|
61
|
-
backgroundColor: background && `${bgColor} !important`,
|
|
62
|
-
color: `${fontColor} !important`,
|
|
63
|
-
'& > *': {
|
|
64
|
-
color: `${fontColor} !important`
|
|
65
|
-
},
|
|
66
|
-
'& > * > *': {
|
|
67
|
-
color: `${fontColor} !important`
|
|
68
|
-
},
|
|
69
|
-
borderColor: `${fontColor} !important`,
|
|
70
|
-
'&:after': {
|
|
71
|
-
borderColor: `${fontColor} !important`
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
const MenuComp = ({ basePath , blockId , components: { Icon , Link } , events , menus , methods , pageId , properties , rename , })=>{
|
|
42
|
+
const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , methods , pageId , properties , rename , })=>{
|
|
76
43
|
const styles = {
|
|
77
44
|
lineHeight: '64px',
|
|
45
|
+
width: '100%',
|
|
78
46
|
display: properties.mode === 'horizontal' && 'inline-block'
|
|
79
47
|
};
|
|
80
|
-
const exProps = {
|
|
81
|
-
};
|
|
48
|
+
const exProps = {};
|
|
82
49
|
if (properties.mode === 'inline') {
|
|
83
50
|
exProps.collapsed = properties.collapsed;
|
|
84
51
|
exProps.inlineIndent = properties.inlineIndent;
|
|
85
52
|
}
|
|
86
53
|
const menu = getDefaultMenu(menus, properties.menuId, properties.links);
|
|
87
54
|
const theme = properties.theme || 'dark';
|
|
88
|
-
|
|
89
|
-
const nestedColorsBg = getNestedColors(properties.selectedColor, true);
|
|
90
|
-
const bgColorDarker = {
|
|
91
|
-
backgroundColor: properties.backgroundColor && `${color(properties.backgroundColor, 7)} !important`
|
|
92
|
-
};
|
|
93
|
-
const bgColor = {
|
|
94
|
-
backgroundColor: properties.backgroundColor && `${properties.backgroundColor} !important`
|
|
95
|
-
};
|
|
96
|
-
return(/*#__PURE__*/ _jsx(Menu, {
|
|
55
|
+
return(/*#__PURE__*/ React.createElement(Menu, _extends({
|
|
97
56
|
id: blockId,
|
|
98
|
-
expandIcon: properties.expandIcon && /*#__PURE__*/
|
|
57
|
+
expandIcon: properties.expandIcon && /*#__PURE__*/ React.createElement(Icon, {
|
|
99
58
|
blockId: `${blockId}_expandIcon`,
|
|
100
59
|
events: events,
|
|
101
60
|
properties: properties.expandIcon
|
|
@@ -106,22 +65,7 @@ const MenuComp = ({ basePath , blockId , components: { Icon , Link } , events ,
|
|
|
106
65
|
theme: theme,
|
|
107
66
|
className: methods.makeCssClass([
|
|
108
67
|
styles,
|
|
109
|
-
properties.
|
|
110
|
-
properties.selectedColor && theme === 'dark' && {
|
|
111
|
-
'& > li.ant-menu-item-selected': nestedColorsBg,
|
|
112
|
-
'& > li.ant-menu-submenu > ul > li.ant-menu-item-selected': nestedColorsBg,
|
|
113
|
-
'& > li.ant-menu-submenu > ul > li.ant-menu-item-group > ul > li.ant-menu-item-selected': nestedColorsBg
|
|
114
|
-
},
|
|
115
|
-
properties.selectedColor && theme === 'light' && {
|
|
116
|
-
'& > li.ant-menu-item-selected': nestedColorsBg,
|
|
117
|
-
'& > li.ant-menu-submenu-selected': nestedColors,
|
|
118
|
-
'& > li.ant-menu-item:hover': nestedColors,
|
|
119
|
-
'& > li.ant-menu-submenu:hover': nestedColors,
|
|
120
|
-
'& > li.ant-menu-submenu > ul > li.ant-menu-item:hover': nestedColors,
|
|
121
|
-
'& > li.ant-menu-submenu > ul > li.ant-menu-item-selected': nestedColorsBg,
|
|
122
|
-
'& > li.ant-menu-submenu > ul > li.ant-menu-item-group > ul > li.ant-menu-item-selected': nestedColorsBg
|
|
123
|
-
},
|
|
124
|
-
properties.style,
|
|
68
|
+
properties.style
|
|
125
69
|
]),
|
|
126
70
|
defaultOpenKeys: properties.defaultOpenKeys || properties.mode === 'inline' && properties.collapsed !== true && [
|
|
127
71
|
(menu.find((link1)=>(link1.links || []).map((subLink)=>subLink.links ? subLink.links.map((subSubLink)=>subSubLink.pageId
|
|
@@ -132,8 +76,7 @@ const MenuComp = ({ basePath , blockId , components: { Icon , Link } , events ,
|
|
|
132
76
|
pageId
|
|
133
77
|
]).indexOf(link) !== -1
|
|
134
78
|
)
|
|
135
|
-
) || {
|
|
136
|
-
}).id,
|
|
79
|
+
) || {}).id,
|
|
137
80
|
] || [],
|
|
138
81
|
selectedKeys: properties.selectedKeys || [
|
|
139
82
|
pageId
|
|
@@ -166,147 +109,109 @@ const MenuComp = ({ basePath , blockId , components: { Icon , Link } , events ,
|
|
|
166
109
|
openKeys
|
|
167
110
|
}
|
|
168
111
|
})
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
children: get(link, 'links', {
|
|
215
|
-
default: []
|
|
216
|
-
}).map((subLink, j)=>{
|
|
217
|
-
switch(subLink.type){
|
|
218
|
-
case 'MenuDivider':
|
|
219
|
-
return(/*#__PURE__*/ _jsx(Menu.Divider, {
|
|
112
|
+
}, exProps), menu.map((link, i)=>{
|
|
113
|
+
switch(link.type){
|
|
114
|
+
case 'MenuDivider':
|
|
115
|
+
return(/*#__PURE__*/ React.createElement(Menu.Divider, {
|
|
116
|
+
key: `${link.id}_${i}`,
|
|
117
|
+
className: methods.makeCssClass([
|
|
118
|
+
link.style
|
|
119
|
+
]),
|
|
120
|
+
dashed: link.properties && link.properties.dashed
|
|
121
|
+
}));
|
|
122
|
+
case 'MenuGroup':
|
|
123
|
+
return(/*#__PURE__*/ React.createElement(Menu.SubMenu, {
|
|
124
|
+
key: `${link.pageId || link.id}_${i}`,
|
|
125
|
+
title: /*#__PURE__*/ React.createElement(Link, _extends({
|
|
126
|
+
id: link.pageId || link.id || i,
|
|
127
|
+
className: methods.makeCssClass(link.style, true)
|
|
128
|
+
}, link), getTitle(link)),
|
|
129
|
+
icon: link.properties && link.properties.icon && /*#__PURE__*/ React.createElement(Icon, {
|
|
130
|
+
blockId: `${link.id}_icon`,
|
|
131
|
+
events: events,
|
|
132
|
+
properties: link.properties.icon
|
|
133
|
+
})
|
|
134
|
+
}, get(link, 'links', {
|
|
135
|
+
default: []
|
|
136
|
+
}).map((subLink, j)=>{
|
|
137
|
+
switch(subLink.type){
|
|
138
|
+
case 'MenuDivider':
|
|
139
|
+
return(/*#__PURE__*/ React.createElement(Menu.Divider, {
|
|
140
|
+
key: `${subLink.id || i}_${j}`,
|
|
141
|
+
className: methods.makeCssClass([
|
|
142
|
+
subLink.style
|
|
143
|
+
]),
|
|
144
|
+
dashed: subLink.properties && subLink.properties.dashed
|
|
145
|
+
}));
|
|
146
|
+
case 'MenuGroup':
|
|
147
|
+
return(/*#__PURE__*/ React.createElement(Menu.ItemGroup, {
|
|
148
|
+
key: `${subLink.pageId || subLink.id}_${j}`,
|
|
149
|
+
title: /*#__PURE__*/ React.createElement(Link, _extends({
|
|
150
|
+
id: subLink.pageId || subLink.id || j,
|
|
151
|
+
className: methods.makeCssClass(subLink.style, true)
|
|
152
|
+
}, subLink), getTitle(subLink))
|
|
153
|
+
}, subLink.links.map((subLinkGroup, k)=>{
|
|
154
|
+
if (subLinkGroup.type === 'MenuDivider') {
|
|
155
|
+
return(/*#__PURE__*/ React.createElement(Menu.Divider, {
|
|
156
|
+
key: `${subLink.id}_${k}`,
|
|
220
157
|
className: methods.makeCssClass([
|
|
221
158
|
subLink.style
|
|
222
159
|
]),
|
|
223
160
|
dashed: subLink.properties && subLink.properties.dashed
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
properties: subLink.properties.icon
|
|
272
|
-
}),
|
|
273
|
-
children: /*#__PURE__*/ _jsx(MenuTitle, {
|
|
274
|
-
basePath: basePath,
|
|
275
|
-
Link: Link,
|
|
276
|
-
linkStyle: methods.makeCssClass(subLink.style, true),
|
|
277
|
-
id: subLink.id,
|
|
278
|
-
makeCssClass: methods.makeCssClass,
|
|
279
|
-
pageId: subLink.pageId,
|
|
280
|
-
properties: subLink.properties,
|
|
281
|
-
url: subLink.url
|
|
282
|
-
})
|
|
283
|
-
}, `${subLink.pageId || subLink.id}_${j}`));
|
|
284
|
-
}
|
|
285
|
-
})
|
|
286
|
-
}, `${link.pageId || link.id}_${i}`));
|
|
287
|
-
case 'MenuLink':
|
|
288
|
-
default:
|
|
289
|
-
return(/*#__PURE__*/ _jsx(Menu.Item, {
|
|
290
|
-
danger: get(link, 'properties.danger'),
|
|
291
|
-
icon: link.properties && link.properties.icon && /*#__PURE__*/ _jsx(Icon, {
|
|
292
|
-
blockId: `${link.id}_icon`,
|
|
293
|
-
events: events,
|
|
294
|
-
properties: link.properties.icon
|
|
295
|
-
}),
|
|
296
|
-
children: /*#__PURE__*/ _jsx(MenuTitle, {
|
|
297
|
-
basePath: basePath,
|
|
298
|
-
Link: Link,
|
|
299
|
-
linkStyle: methods.makeCssClass(link.style, true),
|
|
300
|
-
id: link.id,
|
|
301
|
-
makeCssClass: methods.makeCssClass,
|
|
302
|
-
pageId: link.pageId,
|
|
303
|
-
properties: link.properties,
|
|
304
|
-
url: link.url
|
|
305
|
-
})
|
|
306
|
-
}, `${link.pageId || link.id}_${i}`));
|
|
307
|
-
}
|
|
308
|
-
})
|
|
309
|
-
}));
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
return(/*#__PURE__*/ React.createElement(Menu.Item, {
|
|
164
|
+
key: `${subLinkGroup.pageId || subLinkGroup.id}_${k}`,
|
|
165
|
+
danger: get(subLinkGroup, 'properties.danger'),
|
|
166
|
+
icon: subLinkGroup.properties && subLinkGroup.properties.icon && /*#__PURE__*/ React.createElement(Icon, {
|
|
167
|
+
blockId: `${subLinkGroup.id}_icon`,
|
|
168
|
+
events: events,
|
|
169
|
+
properties: subLinkGroup.properties.icon
|
|
170
|
+
})
|
|
171
|
+
}, /*#__PURE__*/ React.createElement(Link, _extends({
|
|
172
|
+
id: subLinkGroup.pageId || subLinkGroup.id || k,
|
|
173
|
+
className: methods.makeCssClass(subLinkGroup.style, true)
|
|
174
|
+
}, subLinkGroup), getTitle(subLinkGroup))));
|
|
175
|
+
})));
|
|
176
|
+
case 'MenuLink':
|
|
177
|
+
default:
|
|
178
|
+
return(/*#__PURE__*/ React.createElement(Menu.Item, {
|
|
179
|
+
key: `${subLink.pageId || subLink.id}_${j}`,
|
|
180
|
+
danger: get(subLink, 'properties.danger'),
|
|
181
|
+
icon: subLink.properties && subLink.properties.icon && /*#__PURE__*/ React.createElement(Icon, {
|
|
182
|
+
blockId: `${subLink.id}_icon`,
|
|
183
|
+
events: events,
|
|
184
|
+
properties: subLink.properties.icon
|
|
185
|
+
})
|
|
186
|
+
}, /*#__PURE__*/ React.createElement(Link, _extends({
|
|
187
|
+
id: subLink.pageId || subLink.id || j,
|
|
188
|
+
className: methods.makeCssClass(subLink.style, true)
|
|
189
|
+
}, subLink), getTitle(subLink))));
|
|
190
|
+
}
|
|
191
|
+
})));
|
|
192
|
+
case 'MenuLink':
|
|
193
|
+
default:
|
|
194
|
+
return(/*#__PURE__*/ React.createElement(Menu.Item, {
|
|
195
|
+
key: `${link.pageId || link.id}_${i}`,
|
|
196
|
+
danger: get(link, 'properties.danger'),
|
|
197
|
+
icon: link.properties && link.properties.icon && /*#__PURE__*/ React.createElement(Icon, {
|
|
198
|
+
blockId: `${link.id}_icon`,
|
|
199
|
+
events: events,
|
|
200
|
+
properties: link.properties.icon
|
|
201
|
+
})
|
|
202
|
+
}, /*#__PURE__*/ React.createElement(Link, _extends({
|
|
203
|
+
id: link.pageId || link.id || i,
|
|
204
|
+
className: methods.makeCssClass(link.style, true)
|
|
205
|
+
}, link), getTitle(link))));
|
|
206
|
+
}
|
|
207
|
+
})));
|
|
310
208
|
};
|
|
311
209
|
MenuComp.defaultProps = blockDefaultProps;
|
|
210
|
+
MenuComp.meta = {
|
|
211
|
+
category: 'display',
|
|
212
|
+
icons: [],
|
|
213
|
+
styles: [
|
|
214
|
+
'blocks/Menu/style.less'
|
|
215
|
+
]
|
|
216
|
+
};
|
|
312
217
|
export default MenuComp;
|
|
@@ -4,13 +4,6 @@
|
|
|
4
4
|
"type": "object",
|
|
5
5
|
"additionalProperties": false,
|
|
6
6
|
"properties": {
|
|
7
|
-
"backgroundColor": {
|
|
8
|
-
"type": "string",
|
|
9
|
-
"description": "Menu background color.",
|
|
10
|
-
"docs": {
|
|
11
|
-
"displayType": "color"
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
7
|
"expandIcon": {
|
|
15
8
|
"type": ["string", "object"],
|
|
16
9
|
"description": "Menu expand icon.",
|
|
@@ -18,13 +11,6 @@
|
|
|
18
11
|
"displayType": "icon"
|
|
19
12
|
}
|
|
20
13
|
},
|
|
21
|
-
"selectedColor": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"description": "Menu primary selected color.",
|
|
24
|
-
"docs": {
|
|
25
|
-
"displayType": "color"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
14
|
"menuId": {
|
|
29
15
|
"type": "string",
|
|
30
16
|
"description": "App menu id used to get menu links."
|
|
@@ -107,7 +93,7 @@
|
|
|
107
93
|
},
|
|
108
94
|
"icon": {
|
|
109
95
|
"type": ["string", "object"],
|
|
110
|
-
"description": "Name of an
|
|
96
|
+
"description": "Name of an React-Icon (See <a href='https://react-icons.github.io/react-icons/'>all icons</a>) or properties of an Icon block to customize icon on menu item.",
|
|
111
97
|
"docs": {
|
|
112
98
|
"displayType": "icon"
|
|
113
99
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
/*
|
|
3
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
4
3
|
|
|
5
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
you may not use this file except in compliance with the License.
|
|
@@ -19,8 +18,7 @@ import { type } from '@lowdefy/helpers';
|
|
|
19
18
|
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
|
|
20
19
|
const MessageBlock = ({ blockId , components: { Icon } , events , methods , properties })=>{
|
|
21
20
|
useEffect(()=>{
|
|
22
|
-
methods.registerMethod('open', (args = {
|
|
23
|
-
})=>{
|
|
21
|
+
methods.registerMethod('open', (args = {})=>{
|
|
24
22
|
return message[args.status || properties.status || 'success']({
|
|
25
23
|
id: `${blockId}_message`,
|
|
26
24
|
content: renderHtml({
|
|
@@ -32,7 +30,7 @@ const MessageBlock = ({ blockId , components: { Icon } , events , methods , pro
|
|
|
32
30
|
name: 'onClose'
|
|
33
31
|
})
|
|
34
32
|
,
|
|
35
|
-
icon: (args.icon || properties.icon) && /*#__PURE__*/
|
|
33
|
+
icon: (args.icon || properties.icon) && /*#__PURE__*/ React.createElement(Icon, {
|
|
36
34
|
blockId: `${blockId}_icon`,
|
|
37
35
|
events: events,
|
|
38
36
|
properties: args.icon || properties.icon
|
|
@@ -41,9 +39,16 @@ const MessageBlock = ({ blockId , components: { Icon } , events , methods , pro
|
|
|
41
39
|
});
|
|
42
40
|
});
|
|
43
41
|
});
|
|
44
|
-
return(/*#__PURE__*/
|
|
42
|
+
return(/*#__PURE__*/ React.createElement("div", {
|
|
45
43
|
id: blockId
|
|
46
44
|
}));
|
|
47
45
|
};
|
|
48
46
|
MessageBlock.defaultProps = blockDefaultProps;
|
|
47
|
+
MessageBlock.meta = {
|
|
48
|
+
category: 'display',
|
|
49
|
+
icons: [],
|
|
50
|
+
styles: [
|
|
51
|
+
'blocks/Message/style.less'
|
|
52
|
+
]
|
|
53
|
+
};
|
|
49
54
|
export default MessageBlock;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"icon": {
|
|
17
17
|
"type": ["string", "object"],
|
|
18
|
-
"description": "Name of an
|
|
18
|
+
"description": "Name of an React-Icon (See <a href='https://react-icons.github.io/react-icons/'>all icons</a>) or properties of an Icon block to customize message icon.",
|
|
19
19
|
"docs": {
|
|
20
20
|
"displayType": "icon"
|
|
21
21
|
}
|