@lowdefy/blocks-antd 4.0.0-alpha.9 → 4.0.0-rc.1
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 +2 -3
- package/dist/blocks/Affix/style.less +1 -1
- package/dist/blocks/Alert/Alert.js +10 -12
- package/dist/blocks/Alert/style.less +1 -1
- package/dist/blocks/AutoComplete/AutoComplete.js +17 -39
- package/dist/blocks/AutoComplete/schema.json +5 -46
- package/dist/blocks/AutoComplete/style.less +1 -1
- package/dist/blocks/Avatar/Avatar.js +4 -6
- package/dist/blocks/Avatar/style.less +1 -1
- package/dist/blocks/Badge/Badge.js +2 -3
- package/dist/blocks/Badge/style.less +1 -1
- package/dist/blocks/Breadcrumb/Breadcrumb.js +13 -16
- package/dist/blocks/Breadcrumb/style.less +1 -1
- package/dist/blocks/Button/Button.js +6 -7
- package/dist/blocks/Button/style.less +1 -1
- package/dist/blocks/ButtonSelector/ButtonSelector.js +6 -7
- package/dist/blocks/ButtonSelector/style.less +1 -1
- package/dist/blocks/Card/Card.js +4 -6
- package/dist/blocks/Card/style.less +1 -1
- package/dist/blocks/CheckboxSelector/CheckboxSelector.js +6 -7
- package/dist/blocks/CheckboxSelector/style.less +1 -1
- package/dist/blocks/CheckboxSwitch/CheckboxSwitch.js +5 -5
- package/dist/blocks/CheckboxSwitch/style.less +1 -1
- package/dist/blocks/Collapse/Collapse.js +11 -15
- package/dist/blocks/Collapse/style.less +1 -1
- package/dist/blocks/Comment/Comment.js +3 -3
- package/dist/blocks/Comment/style.less +1 -1
- package/dist/blocks/ConfirmModal/ConfirmModal.js +3 -3
- package/dist/blocks/ConfirmModal/style.less +1 -1
- package/dist/blocks/Content/Content.js +2 -3
- package/dist/blocks/Content/style.less +1 -1
- package/dist/blocks/ControlledList/ControlledList.js +5 -5
- package/dist/blocks/ControlledList/style.less +1 -1
- package/dist/blocks/DateRangeSelector/DateRangeSelector.js +11 -14
- package/dist/blocks/DateRangeSelector/style.less +1 -1
- package/dist/blocks/DateSelector/DateSelector.js +7 -7
- package/dist/blocks/DateSelector/style.less +1 -1
- package/dist/blocks/DateTimeSelector/DateTimeSelector.js +10 -8
- package/dist/blocks/DateTimeSelector/style.less +1 -1
- package/dist/blocks/Descriptions/Descriptions.js +13 -15
- package/dist/blocks/Descriptions/style.less +1 -1
- package/dist/blocks/Divider/Divider.js +2 -3
- package/dist/blocks/Divider/style.less +1 -1
- package/dist/blocks/Drawer/Drawer.js +5 -7
- package/dist/blocks/Drawer/style.less +1 -1
- package/dist/blocks/Footer/Footer.js +2 -3
- package/dist/blocks/Footer/style.less +1 -1
- package/dist/blocks/Header/Header.js +3 -4
- package/dist/blocks/Header/style.less +1 -1
- package/dist/blocks/Label/Label.js +23 -27
- package/dist/blocks/Label/getLabelCol.js +1 -1
- package/dist/blocks/Label/getWrapperCol.js +1 -1
- package/dist/blocks/Label/labelLogic.js +15 -15
- package/dist/blocks/Label/style.less +5 -1
- package/dist/blocks/Layout/Layout.js +2 -3
- package/dist/blocks/Layout/style.less +1 -1
- package/dist/blocks/Menu/Menu.js +49 -57
- package/dist/blocks/Menu/style.less +1 -1
- package/dist/blocks/Message/Message.js +4 -5
- package/dist/blocks/Message/style.less +1 -1
- package/dist/blocks/MobileMenu/MobileMenu.js +7 -9
- package/dist/blocks/MobileMenu/style.less +1 -1
- package/dist/blocks/Modal/Modal.js +11 -14
- package/dist/blocks/Modal/style.less +1 -1
- package/dist/blocks/MonthSelector/MonthSelector.js +7 -7
- package/dist/blocks/MonthSelector/style.less +1 -1
- package/dist/blocks/MultipleSelector/MultipleSelector.js +9 -11
- package/dist/blocks/MultipleSelector/style.less +1 -1
- package/dist/blocks/Notification/Notification.js +5 -7
- package/dist/blocks/Notification/style.less +1 -1
- package/dist/blocks/NumberInput/NumberInput.js +6 -4
- package/dist/blocks/NumberInput/schema.json +7 -0
- package/dist/blocks/NumberInput/style.less +1 -1
- package/dist/blocks/PageHCF/PageHCF.js +2 -3
- package/dist/blocks/PageHCF/style.less +1 -1
- package/dist/blocks/PageHCSF/PageHCSF.js +2 -3
- package/dist/blocks/PageHCSF/style.less +1 -1
- package/dist/blocks/PageHSCF/PageHSCF.js +2 -3
- package/dist/blocks/PageHSCF/style.less +1 -1
- package/dist/blocks/PageHeaderMenu/PageHeaderMenu.js +47 -35
- package/dist/blocks/PageHeaderMenu/schema.json +5 -5
- package/dist/blocks/PageHeaderMenu/style.less +1 -1
- package/dist/blocks/PageSHCF/PageSHCF.js +2 -3
- package/dist/blocks/PageSHCF/style.less +1 -1
- package/dist/blocks/PageSiderMenu/PageSiderMenu.js +45 -43
- package/dist/blocks/PageSiderMenu/schema.json +5 -5
- package/dist/blocks/PageSiderMenu/style.less +1 -1
- package/dist/blocks/Pagination/Pagination.js +4 -5
- package/dist/blocks/Pagination/style.less +1 -1
- package/dist/blocks/Paragraph/Paragraph.js +3 -4
- package/dist/blocks/Paragraph/style.less +2 -1
- package/dist/blocks/ParagraphInput/ParagraphInput.js +5 -5
- package/dist/blocks/ParagraphInput/style.less +1 -1
- package/dist/blocks/PasswordInput/PasswordInput.js +7 -6
- package/dist/blocks/PasswordInput/style.less +1 -1
- package/dist/blocks/Progress/Progress.js +2 -3
- package/dist/blocks/Progress/style.less +1 -1
- package/dist/blocks/RadioSelector/RadioSelector.js +9 -10
- package/dist/blocks/RadioSelector/style.less +1 -1
- package/dist/blocks/RatingSlider/RatingSlider.js +11 -13
- package/dist/blocks/RatingSlider/style.less +1 -1
- package/dist/blocks/Result/Result.js +2 -3
- package/dist/blocks/Result/style.less +1 -1
- package/dist/blocks/Selector/Selector.js +9 -11
- package/dist/blocks/Selector/style.less +1 -1
- package/dist/blocks/Sider/Sider.js +5 -7
- package/dist/blocks/Sider/style.less +1 -1
- package/dist/blocks/Statistic/Statistic.js +2 -3
- package/dist/blocks/Statistic/style.less +1 -1
- package/dist/blocks/Switch/Switch.js +5 -5
- package/dist/blocks/Switch/style.less +1 -1
- package/dist/blocks/Tabs/Tabs.js +11 -16
- package/dist/blocks/Tabs/style.less +1 -1
- package/dist/blocks/TextArea/TextArea.js +6 -6
- package/dist/blocks/TextArea/style.less +1 -1
- package/dist/blocks/TextInput/TextInput.js +9 -8
- package/dist/blocks/TextInput/style.less +1 -1
- package/dist/blocks/TimelineList/TimelineList.js +10 -10
- package/dist/blocks/TimelineList/style.less +1 -1
- package/dist/blocks/Title/Title.js +5 -5
- package/dist/blocks/Title/style.less +2 -1
- package/dist/blocks/TitleInput/TitleInput.js +6 -6
- package/dist/blocks/TitleInput/style.less +1 -1
- package/dist/blocks/Tooltip/Tooltip.js +2 -3
- package/dist/blocks/Tooltip/style.less +1 -1
- package/dist/blocks/WeekSelector/WeekSelector.js +7 -7
- package/dist/blocks/WeekSelector/style.less +1 -1
- package/dist/blocks.js +1 -1
- package/dist/color.js +1 -1
- package/dist/disabledDate.js +4 -7
- package/dist/getUniqueValues.js +1 -1
- package/dist/getValueIndex.js +1 -1
- package/dist/style.less +1 -1
- package/dist/types.js +1 -1
- package/dist/useRunAfterUpdate.js +1 -1
- package/dist/validationExamples.js +2 -2
- package/package.json +28 -29
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -14,12 +14,6 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ // Derived from https://github.com/ant-design/ant-design/blob/master/components/form/FormItemLabel.tsx
|
|
16
16
|
// MIT Copyright (c) 2015-present Ant UED, https://xtech.antfin.com/ - 2020-09-08
|
|
17
|
-
import React from 'react';
|
|
18
|
-
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
|
|
19
|
-
import { Col, Row } from 'antd';
|
|
20
|
-
import classNames from 'classnames';
|
|
21
|
-
import CSSMotion from 'rc-motion';
|
|
22
|
-
import labelLogic from './labelLogic.js';
|
|
23
17
|
function _extends() {
|
|
24
18
|
_extends = Object.assign || function(target) {
|
|
25
19
|
for(var i = 1; i < arguments.length; i++){
|
|
@@ -34,13 +28,19 @@ function _extends() {
|
|
|
34
28
|
};
|
|
35
29
|
return _extends.apply(this, arguments);
|
|
36
30
|
}
|
|
31
|
+
import React from 'react';
|
|
32
|
+
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
|
|
33
|
+
import { Col, Row } from 'antd';
|
|
34
|
+
import classNames from 'classnames';
|
|
35
|
+
import CSSMotion from 'rc-motion';
|
|
36
|
+
import labelLogic from './labelLogic.js';
|
|
37
37
|
const validationKeyMap = {
|
|
38
38
|
error: 'errors',
|
|
39
39
|
warning: 'warnings'
|
|
40
40
|
};
|
|
41
41
|
let iconMap;
|
|
42
|
-
const Label = ({ blockId , components: { Icon } , content , methods , properties , required , validation
|
|
43
|
-
const { extraClassName , feedbackClassName , label , labelClassName , labelCol , labelColClassName , rowClassName , showExtra , showFeedback , wrapperCol
|
|
42
|
+
const Label = ({ blockId , components: { Icon } , content , methods , properties , required , validation })=>{
|
|
43
|
+
const { extraClassName , feedbackClassName , iconClassName , label , labelClassName , labelCol , labelColClassName , rowClassName , showExtra , showFeedback , wrapperCol } = labelLogic({
|
|
44
44
|
blockId,
|
|
45
45
|
content,
|
|
46
46
|
methods,
|
|
@@ -52,16 +52,13 @@ const Label = ({ blockId , components: { Icon } , content , methods , propertie
|
|
|
52
52
|
iconMap = {
|
|
53
53
|
error: ()=>/*#__PURE__*/ React.createElement(Icon, {
|
|
54
54
|
properties: "AiFillCloseCircle"
|
|
55
|
-
})
|
|
56
|
-
,
|
|
55
|
+
}),
|
|
57
56
|
success: ()=>/*#__PURE__*/ React.createElement(Icon, {
|
|
58
57
|
properties: "AiFillCheckCircle"
|
|
59
|
-
})
|
|
60
|
-
,
|
|
58
|
+
}),
|
|
61
59
|
validating: ()=>/*#__PURE__*/ React.createElement(Icon, {
|
|
62
60
|
properties: "AiOutlineLoading"
|
|
63
|
-
})
|
|
64
|
-
,
|
|
61
|
+
}),
|
|
65
62
|
warning: ()=>/*#__PURE__*/ React.createElement(Icon, {
|
|
66
63
|
properties: "AiFillExclamationCircle"
|
|
67
64
|
})
|
|
@@ -69,9 +66,9 @@ const Label = ({ blockId , components: { Icon } , content , methods , propertie
|
|
|
69
66
|
}
|
|
70
67
|
const IconNode = validation.status && iconMap[validation.status];
|
|
71
68
|
const icon = validation.status && IconNode ? /*#__PURE__*/ React.createElement("span", {
|
|
72
|
-
className:
|
|
69
|
+
className: iconClassName
|
|
73
70
|
}, /*#__PURE__*/ React.createElement(IconNode, null)) : null;
|
|
74
|
-
return
|
|
71
|
+
return /*#__PURE__*/ React.createElement(Row, {
|
|
75
72
|
id: blockId,
|
|
76
73
|
className: rowClassName
|
|
77
74
|
}, label && /*#__PURE__*/ React.createElement(Col, _extends({}, labelCol, {
|
|
@@ -89,20 +86,19 @@ const Label = ({ blockId , components: { Icon } , content , methods , propertie
|
|
|
89
86
|
className: "ant-form-item-control-input"
|
|
90
87
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
91
88
|
className: "ant-form-item-control-input-content"
|
|
92
|
-
}, content.content && content.content()), icon), /*#__PURE__*/ React.createElement(CSSMotion, {
|
|
93
|
-
visible: showFeedback,
|
|
89
|
+
}, content.content && content.content()), icon), (showFeedback || showExtra) && /*#__PURE__*/ React.createElement(CSSMotion, {
|
|
90
|
+
visible: showFeedback || showExtra,
|
|
94
91
|
motionName: "show-help",
|
|
95
92
|
motionAppear: true,
|
|
96
93
|
removeOnLeave: true
|
|
97
94
|
}, ({ className: motionClassName })=>/*#__PURE__*/ React.createElement("div", {
|
|
98
|
-
className: classNames(
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
})))));
|
|
95
|
+
className: classNames(extraClassName, motionClassName)
|
|
96
|
+
}, showFeedback ? /*#__PURE__*/ React.createElement("div", {
|
|
97
|
+
className: classNames(feedbackClassName)
|
|
98
|
+
}, validation[validationKeyMap[validation.status]] && validation[validationKeyMap[validation.status]].length > 0 && validation[validationKeyMap[validation.status]][0]) : renderHtml({
|
|
99
|
+
html: properties.extra,
|
|
100
|
+
methods
|
|
101
|
+
})))));
|
|
106
102
|
};
|
|
107
103
|
Label.defaultProps = blockDefaultProps;
|
|
108
104
|
Label.meta = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -19,7 +19,7 @@ import getLabelCol from './getLabelCol.js';
|
|
|
19
19
|
const labelLogic = ({ blockId , content , methods , properties ={} , required =false , validation ={
|
|
20
20
|
messages: [],
|
|
21
21
|
status: null
|
|
22
|
-
}
|
|
22
|
+
} })=>{
|
|
23
23
|
const wrapperCol = getWrapperCol(properties, properties.inline);
|
|
24
24
|
const labelCol = getLabelCol(properties, properties.inline);
|
|
25
25
|
// render label priority order: content.label area -> properties.title -> blockId and do not render an empty label
|
|
@@ -32,12 +32,6 @@ const labelLogic = ({ blockId , content , methods , properties ={} , required =f
|
|
|
32
32
|
const rowClassName = classNames({
|
|
33
33
|
[`ant-form-item`]: true,
|
|
34
34
|
[`ant-form-item-with-help`]: false,
|
|
35
|
-
// Status
|
|
36
|
-
[`ant-form-item-has-feedback`]: validation.status && properties.hasFeedback !== false,
|
|
37
|
-
[`ant-form-item-has-success`]: validation.status === 'success',
|
|
38
|
-
[`ant-form-item-has-warning`]: validation.status === 'warning',
|
|
39
|
-
[`ant-form-item-has-error`]: validation.status === 'error',
|
|
40
|
-
[`ant-form-item-is-validating`]: validation.status === 'validating',
|
|
41
35
|
[methods.makeCssClass({
|
|
42
36
|
flexWrap: properties.inline && 'inherit',
|
|
43
37
|
marginBottom: 0
|
|
@@ -58,9 +52,9 @@ const labelLogic = ({ blockId , content , methods , properties ={} , required =f
|
|
|
58
52
|
[methods.makeCssClass([
|
|
59
53
|
{
|
|
60
54
|
height: 'fit-content !important',
|
|
61
|
-
minHeight: properties.size === 'large' ? 40 : properties.size === 'small' ? 24 : 32
|
|
55
|
+
minHeight: properties.inline && (properties.size === 'large' ? 40 : properties.size === 'small' ? 24 : 32)
|
|
62
56
|
},
|
|
63
|
-
properties.style
|
|
57
|
+
properties.style
|
|
64
58
|
])]: true
|
|
65
59
|
});
|
|
66
60
|
const extraClassName = classNames({
|
|
@@ -70,13 +64,10 @@ const labelLogic = ({ blockId , content , methods , properties ={} , required =f
|
|
|
70
64
|
{
|
|
71
65
|
marginTop: properties.size === 'small' ? -4 : 0
|
|
72
66
|
},
|
|
73
|
-
properties.extraStyle
|
|
67
|
+
properties.extraStyle
|
|
74
68
|
])]: true
|
|
75
69
|
});
|
|
76
70
|
const feedbackClassName = classNames({
|
|
77
|
-
'ant-form-item-explain': true,
|
|
78
|
-
'ant-form-item-extra': true,
|
|
79
|
-
[`ant-form-item-explain-feedback`]: validation.status && properties.hasFeedback !== false,
|
|
80
71
|
[`ant-form-item-explain-success`]: validation.status === 'success',
|
|
81
72
|
[`ant-form-item-explain-warning`]: validation.status === 'warning',
|
|
82
73
|
[`ant-form-item-explain-error`]: validation.status === 'error',
|
|
@@ -85,14 +76,23 @@ const labelLogic = ({ blockId , content , methods , properties ={} , required =f
|
|
|
85
76
|
{
|
|
86
77
|
marginTop: properties.size === 'small' ? -4 : 0
|
|
87
78
|
},
|
|
88
|
-
properties.feedbackStyle
|
|
79
|
+
properties.feedbackStyle
|
|
89
80
|
])]: true
|
|
90
81
|
});
|
|
82
|
+
const iconClassName = classNames({
|
|
83
|
+
'ant-form-item-feedback-icon': true,
|
|
84
|
+
[`ant-form-item-feedback-icon-success`]: validation.status === 'success',
|
|
85
|
+
[`ant-form-item-feedback-icon-warning`]: validation.status === 'warning',
|
|
86
|
+
[`ant-form-item-feedback-icon-error`]: validation.status === 'error',
|
|
87
|
+
[`ant-form-item-feedback-icon-validating`]: validation.status === 'validating',
|
|
88
|
+
'ldf-feedback-icon': true
|
|
89
|
+
});
|
|
91
90
|
const showExtra = !!properties.extra && (!validation.status || validation.status === 'success');
|
|
92
91
|
const showFeedback = validation.status === 'warning' || validation.status === 'error';
|
|
93
92
|
return {
|
|
94
93
|
extraClassName,
|
|
95
94
|
feedbackClassName,
|
|
95
|
+
iconClassName,
|
|
96
96
|
label: !properties.disabled && label,
|
|
97
97
|
labelClassName,
|
|
98
98
|
labelCol,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -28,3 +28,7 @@
|
|
|
28
28
|
.ant-input-affix-wrapper {
|
|
29
29
|
height: 100% !important;
|
|
30
30
|
}
|
|
31
|
+
|
|
32
|
+
.ldf-feedback-icon {
|
|
33
|
+
margin-left: @margin-xss;
|
|
34
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -18,8 +18,7 @@ import { Layout } from 'antd';
|
|
|
18
18
|
const LayoutBlock = ({ blockId , content , properties , methods })=>/*#__PURE__*/ React.createElement(Layout, {
|
|
19
19
|
id: blockId,
|
|
20
20
|
className: methods.makeCssClass(properties.style)
|
|
21
|
-
}, content.content && content.content())
|
|
22
|
-
;
|
|
21
|
+
}, content.content && content.content());
|
|
23
22
|
LayoutBlock.defaultProps = blockDefaultProps;
|
|
24
23
|
LayoutBlock.meta = {
|
|
25
24
|
category: 'container',
|
package/dist/blocks/Menu/Menu.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,11 +12,7 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
17
|
-
import { Menu } from 'antd';
|
|
18
|
-
import { type, get } from '@lowdefy/helpers';
|
|
19
|
-
function _extends() {
|
|
15
|
+
*/ function _extends() {
|
|
20
16
|
_extends = Object.assign || function(target) {
|
|
21
17
|
for(var i = 1; i < arguments.length; i++){
|
|
22
18
|
var source = arguments[i];
|
|
@@ -30,16 +26,18 @@ function _extends() {
|
|
|
30
26
|
};
|
|
31
27
|
return _extends.apply(this, arguments);
|
|
32
28
|
}
|
|
29
|
+
import React from 'react';
|
|
30
|
+
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
31
|
+
import { Menu } from 'antd';
|
|
32
|
+
import { type, get } from '@lowdefy/helpers';
|
|
33
33
|
const getDefaultMenu = (menus, menuId = 'default', links)=>{
|
|
34
34
|
if (type.isArray(links)) return links;
|
|
35
35
|
if (!type.isArray(menus)) return [];
|
|
36
|
-
const menu = menus.find((item)=>item.menuId === menuId
|
|
37
|
-
|
|
38
|
-
return menu.links || [];
|
|
36
|
+
const menu = menus.find((item)=>item.menuId === menuId) ?? menus[0] ?? {};
|
|
37
|
+
return menu.links ?? [];
|
|
39
38
|
};
|
|
40
|
-
const getTitle = ({ id , properties , pageId , url })=>properties && properties.title
|
|
41
|
-
|
|
42
|
-
const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , methods , pageId , properties , rename , })=>{
|
|
39
|
+
const getTitle = ({ id , properties , pageId , url })=>(properties && properties.title) ?? pageId ?? url ?? id;
|
|
40
|
+
const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , methods , pageId , properties , rename })=>{
|
|
43
41
|
const styles = {
|
|
44
42
|
lineHeight: '64px',
|
|
45
43
|
width: '100%',
|
|
@@ -51,8 +49,8 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
51
49
|
exProps.inlineIndent = properties.inlineIndent;
|
|
52
50
|
}
|
|
53
51
|
const menu = getDefaultMenu(menus, properties.menuId, properties.links);
|
|
54
|
-
const theme = properties.theme
|
|
55
|
-
return
|
|
52
|
+
const theme = properties.theme ?? 'dark';
|
|
53
|
+
return /*#__PURE__*/ React.createElement(Menu, _extends({
|
|
56
54
|
id: blockId,
|
|
57
55
|
expandIcon: properties.expandIcon && /*#__PURE__*/ React.createElement(Icon, {
|
|
58
56
|
blockId: `${blockId}_expandIcon`,
|
|
@@ -67,18 +65,14 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
67
65
|
styles,
|
|
68
66
|
properties.style
|
|
69
67
|
]),
|
|
70
|
-
defaultOpenKeys: properties.defaultOpenKeys
|
|
71
|
-
(menu.find((
|
|
72
|
-
) : [
|
|
68
|
+
defaultOpenKeys: properties.defaultOpenKeys ?? (properties.mode === 'inline' && properties.collapsed !== true && [
|
|
69
|
+
(menu.find((link)=>(link.links || []).map((subLink)=>subLink.links ? subLink.links.map((subSubLink)=>subSubLink.pageId) : [
|
|
73
70
|
subLink.pageId
|
|
74
|
-
]
|
|
75
|
-
).flat().some((link)=>(properties.selectedKeys || [
|
|
71
|
+
]).flat().some((link)=>(properties.selectedKeys ?? [
|
|
76
72
|
pageId
|
|
77
|
-
]).indexOf(link) !== -1
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
] || [],
|
|
81
|
-
selectedKeys: properties.selectedKeys || [
|
|
73
|
+
]).indexOf(link) !== -1)) ?? {}).id
|
|
74
|
+
]) ?? [],
|
|
75
|
+
selectedKeys: properties.selectedKeys ?? [
|
|
82
76
|
pageId
|
|
83
77
|
],
|
|
84
78
|
subMenuCloseDelay: properties.subMenuCloseDelay,
|
|
@@ -90,8 +84,7 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
90
84
|
event: {
|
|
91
85
|
key: item.key
|
|
92
86
|
}
|
|
93
|
-
})
|
|
94
|
-
,
|
|
87
|
+
}),
|
|
95
88
|
onClick: (item)=>methods.triggerEvent({
|
|
96
89
|
name: get(rename, 'events.onClick', {
|
|
97
90
|
default: 'onClick'
|
|
@@ -99,8 +92,7 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
99
92
|
event: {
|
|
100
93
|
key: item.key
|
|
101
94
|
}
|
|
102
|
-
})
|
|
103
|
-
,
|
|
95
|
+
}),
|
|
104
96
|
onOpenChange: (openKeys)=>methods.triggerEvent({
|
|
105
97
|
name: get(rename, 'events.onToggleMenuGroup', {
|
|
106
98
|
default: 'onToggleMenuGroup'
|
|
@@ -112,18 +104,18 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
112
104
|
}, exProps), menu.map((link, i)=>{
|
|
113
105
|
switch(link.type){
|
|
114
106
|
case 'MenuDivider':
|
|
115
|
-
return
|
|
116
|
-
key:
|
|
107
|
+
return /*#__PURE__*/ React.createElement(Menu.Divider, {
|
|
108
|
+
key: link.id,
|
|
117
109
|
className: methods.makeCssClass([
|
|
118
110
|
link.style
|
|
119
111
|
]),
|
|
120
112
|
dashed: link.properties && link.properties.dashed
|
|
121
|
-
})
|
|
113
|
+
});
|
|
122
114
|
case 'MenuGroup':
|
|
123
|
-
return
|
|
124
|
-
key:
|
|
115
|
+
return /*#__PURE__*/ React.createElement(Menu.SubMenu, {
|
|
116
|
+
key: link.pageId ?? link.id,
|
|
125
117
|
title: /*#__PURE__*/ React.createElement(Link, _extends({
|
|
126
|
-
id: link.pageId
|
|
118
|
+
id: link.pageId ?? link.id ?? i,
|
|
127
119
|
className: methods.makeCssClass(link.style, true)
|
|
128
120
|
}, link), getTitle(link)),
|
|
129
121
|
icon: link.properties && link.properties.icon && /*#__PURE__*/ React.createElement(Icon, {
|
|
@@ -136,32 +128,32 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
136
128
|
}).map((subLink, j)=>{
|
|
137
129
|
switch(subLink.type){
|
|
138
130
|
case 'MenuDivider':
|
|
139
|
-
return
|
|
140
|
-
key:
|
|
131
|
+
return /*#__PURE__*/ React.createElement(Menu.Divider, {
|
|
132
|
+
key: subLink.id ?? j,
|
|
141
133
|
className: methods.makeCssClass([
|
|
142
134
|
subLink.style
|
|
143
135
|
]),
|
|
144
136
|
dashed: subLink.properties && subLink.properties.dashed
|
|
145
|
-
})
|
|
137
|
+
});
|
|
146
138
|
case 'MenuGroup':
|
|
147
|
-
return
|
|
148
|
-
key:
|
|
139
|
+
return /*#__PURE__*/ React.createElement(Menu.ItemGroup, {
|
|
140
|
+
key: subLink.pageId ?? subLink.id,
|
|
149
141
|
title: /*#__PURE__*/ React.createElement(Link, _extends({
|
|
150
|
-
id: subLink.pageId
|
|
142
|
+
id: subLink.pageId ?? subLink.id ?? j,
|
|
151
143
|
className: methods.makeCssClass(subLink.style, true)
|
|
152
144
|
}, subLink), getTitle(subLink))
|
|
153
145
|
}, subLink.links.map((subLinkGroup, k)=>{
|
|
154
146
|
if (subLinkGroup.type === 'MenuDivider') {
|
|
155
|
-
return
|
|
147
|
+
return /*#__PURE__*/ React.createElement(Menu.Divider, {
|
|
156
148
|
key: `${subLink.id}_${k}`,
|
|
157
149
|
className: methods.makeCssClass([
|
|
158
150
|
subLink.style
|
|
159
151
|
]),
|
|
160
152
|
dashed: subLink.properties && subLink.properties.dashed
|
|
161
|
-
})
|
|
153
|
+
});
|
|
162
154
|
}
|
|
163
|
-
return
|
|
164
|
-
key:
|
|
155
|
+
return /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
156
|
+
key: subLinkGroup.pageId ?? subLinkGroup.id,
|
|
165
157
|
danger: get(subLinkGroup, 'properties.danger'),
|
|
166
158
|
icon: subLinkGroup.properties && subLinkGroup.properties.icon && /*#__PURE__*/ React.createElement(Icon, {
|
|
167
159
|
blockId: `${subLinkGroup.id}_icon`,
|
|
@@ -169,14 +161,14 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
169
161
|
properties: subLinkGroup.properties.icon
|
|
170
162
|
})
|
|
171
163
|
}, /*#__PURE__*/ React.createElement(Link, _extends({
|
|
172
|
-
id: subLinkGroup.pageId
|
|
164
|
+
id: subLinkGroup.pageId ?? subLinkGroup.id ?? k,
|
|
173
165
|
className: methods.makeCssClass(subLinkGroup.style, true)
|
|
174
|
-
}, subLinkGroup), getTitle(subLinkGroup)))
|
|
175
|
-
}))
|
|
166
|
+
}, subLinkGroup), getTitle(subLinkGroup)));
|
|
167
|
+
}));
|
|
176
168
|
case 'MenuLink':
|
|
177
169
|
default:
|
|
178
|
-
return
|
|
179
|
-
key:
|
|
170
|
+
return /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
171
|
+
key: subLink.pageId ?? subLink.id,
|
|
180
172
|
danger: get(subLink, 'properties.danger'),
|
|
181
173
|
icon: subLink.properties && subLink.properties.icon && /*#__PURE__*/ React.createElement(Icon, {
|
|
182
174
|
blockId: `${subLink.id}_icon`,
|
|
@@ -184,15 +176,15 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
184
176
|
properties: subLink.properties.icon
|
|
185
177
|
})
|
|
186
178
|
}, /*#__PURE__*/ React.createElement(Link, _extends({
|
|
187
|
-
id: subLink.pageId
|
|
179
|
+
id: subLink.pageId ?? subLink.id ?? j,
|
|
188
180
|
className: methods.makeCssClass(subLink.style, true)
|
|
189
|
-
}, subLink), getTitle(subLink)))
|
|
181
|
+
}, subLink), getTitle(subLink)));
|
|
190
182
|
}
|
|
191
|
-
}))
|
|
183
|
+
}));
|
|
192
184
|
case 'MenuLink':
|
|
193
185
|
default:
|
|
194
|
-
return
|
|
195
|
-
key:
|
|
186
|
+
return /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
187
|
+
key: link.pageId ?? link.id,
|
|
196
188
|
danger: get(link, 'properties.danger'),
|
|
197
189
|
icon: link.properties && link.properties.icon && /*#__PURE__*/ React.createElement(Icon, {
|
|
198
190
|
blockId: `${link.id}_icon`,
|
|
@@ -200,11 +192,11 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
200
192
|
properties: link.properties.icon
|
|
201
193
|
})
|
|
202
194
|
}, /*#__PURE__*/ React.createElement(Link, _extends({
|
|
203
|
-
id: link.pageId
|
|
195
|
+
id: link.pageId ?? link.id ?? i,
|
|
204
196
|
className: methods.makeCssClass(link.style, true)
|
|
205
|
-
}, link), getTitle(link)))
|
|
197
|
+
}, link), getTitle(link)));
|
|
206
198
|
}
|
|
207
|
-
}))
|
|
199
|
+
}));
|
|
208
200
|
};
|
|
209
201
|
MenuComp.defaultProps = blockDefaultProps;
|
|
210
202
|
MenuComp.meta = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -28,8 +28,7 @@ const MessageBlock = ({ blockId , components: { Icon } , events , methods , pro
|
|
|
28
28
|
duration: type.isNone(args.duration) ? properties.duration : args.duration,
|
|
29
29
|
onClose: ()=>methods.triggerEvent({
|
|
30
30
|
name: 'onClose'
|
|
31
|
-
})
|
|
32
|
-
,
|
|
31
|
+
}),
|
|
33
32
|
icon: (args.icon || properties.icon) && /*#__PURE__*/ React.createElement(Icon, {
|
|
34
33
|
blockId: `${blockId}_icon`,
|
|
35
34
|
events: events,
|
|
@@ -39,9 +38,9 @@ const MessageBlock = ({ blockId , components: { Icon } , events , methods , pro
|
|
|
39
38
|
});
|
|
40
39
|
});
|
|
41
40
|
});
|
|
42
|
-
return
|
|
41
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
43
42
|
id: blockId
|
|
44
|
-
})
|
|
43
|
+
});
|
|
45
44
|
};
|
|
46
45
|
MessageBlock.defaultProps = blockDefaultProps;
|
|
47
46
|
MessageBlock.meta = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -18,7 +18,7 @@ import { mergeObjects, get } from '@lowdefy/helpers';
|
|
|
18
18
|
import Button from '../Button/Button.js';
|
|
19
19
|
import Drawer from '../Drawer/Drawer.js';
|
|
20
20
|
import Menu from '../Menu/Menu.js';
|
|
21
|
-
const MobileMenu = ({ basePath , blockId , components , events , methods , menus , pageId , properties , rename
|
|
21
|
+
const MobileMenu = ({ basePath , blockId , components , events , methods , menus , pageId , properties , rename })=>{
|
|
22
22
|
const [openState, setOpen] = useState(false);
|
|
23
23
|
useEffect(()=>{
|
|
24
24
|
methods.registerMethod(get(rename, 'methods.toggleOpen', {
|
|
@@ -38,7 +38,7 @@ const MobileMenu = ({ basePath , blockId , components , events , methods , menus
|
|
|
38
38
|
setOpen(open);
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
|
-
return
|
|
41
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
42
42
|
id: blockId
|
|
43
43
|
}, /*#__PURE__*/ React.createElement(Button, {
|
|
44
44
|
blockId: `${blockId}_button`,
|
|
@@ -55,8 +55,7 @@ const MobileMenu = ({ basePath , blockId , components , events , methods , menus
|
|
|
55
55
|
methods: methods,
|
|
56
56
|
onClick: ()=>methods[get(rename, 'methods.toggleOpen', {
|
|
57
57
|
default: 'toggleOpen'
|
|
58
|
-
})]()
|
|
59
|
-
,
|
|
58
|
+
})](),
|
|
60
59
|
rename: {
|
|
61
60
|
events: {
|
|
62
61
|
onClick: 'onToggleDrawer'
|
|
@@ -71,7 +70,7 @@ const MobileMenu = ({ basePath , blockId , components , events , methods , menus
|
|
|
71
70
|
padding: '3.1em 0 0 0'
|
|
72
71
|
}
|
|
73
72
|
},
|
|
74
|
-
properties.drawer
|
|
73
|
+
properties.drawer
|
|
75
74
|
]),
|
|
76
75
|
rename: {
|
|
77
76
|
events: {
|
|
@@ -85,8 +84,7 @@ const MobileMenu = ({ basePath , blockId , components , events , methods , menus
|
|
|
85
84
|
methods: methods,
|
|
86
85
|
onClose: ()=>methods[get(rename, 'methods.toggleOpen', {
|
|
87
86
|
default: 'toggleOpen'
|
|
88
|
-
})]()
|
|
89
|
-
,
|
|
87
|
+
})](),
|
|
90
88
|
content: {
|
|
91
89
|
content: ()=>/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Menu, {
|
|
92
90
|
basePath: basePath,
|
|
@@ -114,7 +112,7 @@ const MobileMenu = ({ basePath , blockId , components , events , methods , menus
|
|
|
114
112
|
}
|
|
115
113
|
}))
|
|
116
114
|
}
|
|
117
|
-
}))
|
|
115
|
+
}));
|
|
118
116
|
};
|
|
119
117
|
MobileMenu.defaultProps = blockDefaultProps;
|
|
120
118
|
MobileMenu.meta = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,11 +12,7 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
|
|
17
|
-
import { get } from '@lowdefy/helpers';
|
|
18
|
-
import { Modal } from 'antd';
|
|
19
|
-
function _extends() {
|
|
15
|
+
*/ function _extends() {
|
|
20
16
|
_extends = Object.assign || function(target) {
|
|
21
17
|
for(var i = 1; i < arguments.length; i++){
|
|
22
18
|
var source = arguments[i];
|
|
@@ -30,6 +26,10 @@ function _extends() {
|
|
|
30
26
|
};
|
|
31
27
|
return _extends.apply(this, arguments);
|
|
32
28
|
}
|
|
29
|
+
import React, { useState, useEffect } from 'react';
|
|
30
|
+
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
|
|
31
|
+
import { get } from '@lowdefy/helpers';
|
|
32
|
+
import { Modal } from 'antd';
|
|
33
33
|
const triggerSetOpen = ({ methods , setOpen , state })=>{
|
|
34
34
|
if (!state) {
|
|
35
35
|
methods.triggerEvent({
|
|
@@ -50,14 +50,12 @@ const ModalBlock = ({ blockId , content , events , methods , properties })=>{
|
|
|
50
50
|
state: !openState,
|
|
51
51
|
setOpen,
|
|
52
52
|
methods
|
|
53
|
-
})
|
|
54
|
-
);
|
|
53
|
+
}));
|
|
55
54
|
methods.registerMethod('setOpen', ({ open })=>triggerSetOpen({
|
|
56
55
|
state: !!open,
|
|
57
56
|
setOpen,
|
|
58
57
|
methods
|
|
59
|
-
})
|
|
60
|
-
);
|
|
58
|
+
}));
|
|
61
59
|
});
|
|
62
60
|
const extraProps = {};
|
|
63
61
|
if (content.footer) {
|
|
@@ -66,14 +64,13 @@ const ModalBlock = ({ blockId , content , events , methods , properties })=>{
|
|
|
66
64
|
if (properties.footer === false) {
|
|
67
65
|
extraProps.footer = null;
|
|
68
66
|
}
|
|
69
|
-
return
|
|
67
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
70
68
|
id: blockId
|
|
71
69
|
}, /*#__PURE__*/ React.createElement(Modal, _extends({
|
|
72
70
|
id: `${blockId}_modal`,
|
|
73
71
|
afterClose: ()=>methods.triggerEvent({
|
|
74
72
|
name: 'afterClose'
|
|
75
|
-
})
|
|
76
|
-
,
|
|
73
|
+
}),
|
|
77
74
|
bodyStyle: methods.makeCssClass(properties.bodyStyle, true),
|
|
78
75
|
cancelButtonProps: properties.cancelButtonProps,
|
|
79
76
|
cancelText: properties.cancelText || 'Cancel',
|
|
@@ -120,7 +117,7 @@ const ModalBlock = ({ blockId , content , events , methods , properties })=>{
|
|
|
120
117
|
});
|
|
121
118
|
}
|
|
122
119
|
}
|
|
123
|
-
}, extraProps), content.content && content.content()))
|
|
120
|
+
}, extraProps), content.content && content.content()));
|
|
124
121
|
};
|
|
125
122
|
ModalBlock.defaultProps = blockDefaultProps;
|
|
126
123
|
ModalBlock.meta = {
|