@lowdefy/blocks-antd 4.0.0-rc.9 → 4.0.0
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 -2
- package/dist/blocks/Affix/style.less +1 -1
- package/dist/blocks/Alert/Alert.js +7 -20
- package/dist/blocks/Alert/style.less +1 -1
- package/dist/blocks/AutoComplete/AutoComplete.js +18 -3
- package/dist/blocks/AutoComplete/schema.json +12 -0
- package/dist/blocks/AutoComplete/style.less +1 -1
- package/dist/blocks/Avatar/Avatar.js +2 -2
- package/dist/blocks/Avatar/style.less +1 -1
- package/dist/blocks/Badge/Badge.js +2 -2
- package/dist/blocks/Badge/style.less +1 -1
- package/dist/blocks/Breadcrumb/Breadcrumb.js +7 -20
- package/dist/blocks/Breadcrumb/style.less +1 -1
- package/dist/blocks/Button/Button.js +2 -2
- package/dist/blocks/Button/style.less +1 -1
- package/dist/blocks/ButtonSelector/ButtonSelector.js +2 -2
- package/dist/blocks/ButtonSelector/style.less +1 -1
- package/dist/blocks/Card/Card.js +3 -2
- package/dist/blocks/Card/style.less +1 -1
- package/dist/blocks/Carousel/Carousel.js +9 -22
- package/dist/blocks/Carousel/style.less +1 -1
- package/dist/blocks/CheckboxSelector/CheckboxSelector.js +2 -2
- package/dist/blocks/CheckboxSelector/style.less +1 -1
- package/dist/blocks/CheckboxSwitch/CheckboxSwitch.js +2 -2
- package/dist/blocks/CheckboxSwitch/style.less +1 -1
- package/dist/blocks/Collapse/Collapse.js +8 -21
- package/dist/blocks/Collapse/style.less +1 -1
- package/dist/blocks/Comment/Comment.js +2 -2
- package/dist/blocks/Comment/style.less +1 -1
- package/dist/blocks/ConfirmModal/ConfirmModal.js +9 -9
- package/dist/blocks/ConfirmModal/style.less +1 -1
- package/dist/blocks/Content/Content.js +2 -2
- package/dist/blocks/Content/style.less +1 -1
- package/dist/blocks/ControlledList/ControlledList.js +6 -6
- package/dist/blocks/ControlledList/style.less +1 -1
- package/dist/blocks/DateRangeSelector/DateRangeSelector.js +9 -9
- package/dist/blocks/DateRangeSelector/style.less +1 -1
- package/dist/blocks/DateSelector/DateSelector.js +5 -5
- package/dist/blocks/DateSelector/style.less +1 -1
- package/dist/blocks/DateTimeSelector/DateTimeSelector.js +19 -17
- package/dist/blocks/DateTimeSelector/style.less +1 -1
- package/dist/blocks/Descriptions/Descriptions.js +3 -3
- package/dist/blocks/Descriptions/style.less +1 -1
- package/dist/blocks/Divider/Divider.js +2 -2
- package/dist/blocks/Divider/style.less +1 -1
- package/dist/blocks/Drawer/Drawer.js +4 -4
- package/dist/blocks/Drawer/style.less +1 -1
- package/dist/blocks/Footer/Footer.js +2 -2
- package/dist/blocks/Footer/style.less +1 -1
- package/dist/blocks/Header/Header.js +2 -2
- package/dist/blocks/Header/style.less +1 -1
- package/dist/blocks/Label/Label.js +10 -22
- package/dist/blocks/Label/getLabelCol.js +1 -1
- package/dist/blocks/Label/getWrapperCol.js +7 -7
- package/dist/blocks/Label/labelLogic.js +18 -18
- package/dist/blocks/Label/style.less +1 -1
- package/dist/blocks/Layout/Layout.js +2 -2
- package/dist/blocks/Layout/style.less +1 -1
- package/dist/blocks/Menu/Menu.js +35 -43
- package/dist/blocks/Menu/style.less +1 -1
- package/dist/blocks/Message/Message.js +6 -6
- package/dist/blocks/Message/style.less +1 -1
- package/dist/blocks/MobileMenu/MobileMenu.js +5 -5
- package/dist/blocks/MobileMenu/style.less +1 -1
- package/dist/blocks/Modal/Modal.js +12 -25
- package/dist/blocks/Modal/style.less +1 -1
- package/dist/blocks/MonthSelector/MonthSelector.js +5 -5
- package/dist/blocks/MonthSelector/style.less +1 -1
- package/dist/blocks/MultipleSelector/MultipleSelector.js +42 -5
- package/dist/blocks/MultipleSelector/schema.json +43 -0
- package/dist/blocks/MultipleSelector/style.less +2 -1
- package/dist/blocks/Notification/Notification.js +2 -2
- package/dist/blocks/Notification/style.less +1 -1
- package/dist/blocks/NumberInput/NumberInput.js +12 -2
- package/dist/blocks/NumberInput/schema.json +9 -1
- package/dist/blocks/NumberInput/style.less +1 -1
- package/dist/blocks/PageHeaderMenu/PageHeaderMenu.js +2 -2
- package/dist/blocks/PageHeaderMenu/style.less +1 -1
- package/dist/blocks/PageSiderMenu/PageSiderMenu.js +3 -3
- package/dist/blocks/PageSiderMenu/style.less +1 -1
- package/dist/blocks/Pagination/Pagination.js +4 -4
- package/dist/blocks/Pagination/style.less +1 -1
- package/dist/blocks/Paragraph/Paragraph.js +3 -2
- package/dist/blocks/Paragraph/schema.json +4 -0
- package/dist/blocks/Paragraph/style.less +1 -1
- package/dist/blocks/ParagraphInput/ParagraphInput.js +2 -2
- package/dist/blocks/ParagraphInput/style.less +1 -1
- package/dist/blocks/PasswordInput/PasswordInput.js +12 -2
- package/dist/blocks/PasswordInput/schema.json +8 -0
- package/dist/blocks/PasswordInput/style.less +1 -1
- package/dist/blocks/PhoneNumberInput/PhoneNumberInput.js +26 -6
- package/dist/blocks/PhoneNumberInput/schema.json +8 -0
- package/dist/blocks/PhoneNumberInput/style.less +1 -1
- package/dist/blocks/Progress/Progress.js +2 -2
- package/dist/blocks/Progress/style.less +1 -1
- package/dist/blocks/RadioSelector/RadioSelector.js +2 -2
- package/dist/blocks/RadioSelector/style.less +1 -1
- package/dist/blocks/RatingSlider/RatingSlider.js +9 -9
- package/dist/blocks/RatingSlider/style.less +1 -1
- package/dist/blocks/Result/Result.js +2 -2
- package/dist/blocks/Result/style.less +1 -1
- package/dist/blocks/Selector/Selector.js +17 -2
- package/dist/blocks/Selector/schema.json +12 -0
- package/dist/blocks/Selector/style.less +1 -1
- package/dist/blocks/Sider/Sider.js +5 -5
- package/dist/blocks/Sider/style.less +1 -1
- package/dist/blocks/Slider/Slider.js +76 -0
- package/dist/blocks/Slider/style.less +18 -0
- package/dist/blocks/Statistic/Statistic.js +11 -5
- package/dist/blocks/Statistic/style.less +1 -1
- package/dist/blocks/Switch/Switch.js +2 -2
- package/dist/blocks/Switch/style.less +1 -1
- package/dist/blocks/Tabs/Tabs.js +55 -53
- package/dist/blocks/Tabs/schema.json +1 -5
- package/dist/blocks/Tabs/style.less +1 -1
- package/dist/blocks/Tag/Tag.js +57 -0
- package/dist/blocks/Tag/schema.json +45 -0
- package/dist/blocks/Tag/style.less +17 -0
- package/dist/blocks/TextArea/TextArea.js +12 -2
- package/dist/blocks/TextArea/schema.json +8 -0
- package/dist/blocks/TextArea/style.less +1 -1
- package/dist/blocks/TextInput/TextInput.js +13 -3
- package/dist/blocks/TextInput/schema.json +8 -0
- package/dist/blocks/TextInput/style.less +1 -1
- package/dist/blocks/TimelineList/TimelineList.js +12 -25
- package/dist/blocks/TimelineList/style.less +1 -1
- package/dist/blocks/Title/Title.js +2 -2
- package/dist/blocks/Title/style.less +1 -1
- package/dist/blocks/TitleInput/TitleInput.js +2 -2
- package/dist/blocks/TitleInput/style.less +1 -1
- package/dist/blocks/Tooltip/Tooltip.js +3 -3
- package/dist/blocks/Tooltip/style.less +1 -1
- package/dist/blocks/WeekSelector/WeekSelector.js +5 -5
- package/dist/blocks/WeekSelector/style.less +1 -1
- package/dist/blocks.js +3 -1
- 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/types.js +3 -3
- package/dist/useRunAfterUpdate.js +1 -1
- package/dist/validationExamples.js +1 -1
- package/package.json +21 -23
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 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.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/ import React from 'react';
|
|
16
16
|
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
17
17
|
import { Layout } from 'antd';
|
|
18
|
-
const LayoutBlock = ({ blockId
|
|
18
|
+
const LayoutBlock = ({ blockId, content, properties, methods })=>/*#__PURE__*/ React.createElement(Layout, {
|
|
19
19
|
id: blockId,
|
|
20
20
|
className: methods.makeCssClass(properties.style)
|
|
21
21
|
}, content.content && content.content());
|
package/dist/blocks/Menu/Menu.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 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,21 +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
|
-
_extends = Object.assign || function(target) {
|
|
17
|
-
for(var i = 1; i < arguments.length; i++){
|
|
18
|
-
var source = arguments[i];
|
|
19
|
-
for(var key in source){
|
|
20
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
21
|
-
target[key] = source[key];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return target;
|
|
26
|
-
};
|
|
27
|
-
return _extends.apply(this, arguments);
|
|
28
|
-
}
|
|
29
|
-
import React from 'react';
|
|
15
|
+
*/ import React from 'react';
|
|
30
16
|
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
31
17
|
import { Menu } from 'antd';
|
|
32
18
|
import { type, get } from '@lowdefy/helpers';
|
|
@@ -36,8 +22,8 @@ const getDefaultMenu = (menus, menuId = 'default', links)=>{
|
|
|
36
22
|
const menu = menus.find((item)=>item.menuId === menuId) ?? menus[0] ?? {};
|
|
37
23
|
return menu.links ?? [];
|
|
38
24
|
};
|
|
39
|
-
const getTitle = ({ id
|
|
40
|
-
const MenuComp = ({ blockId
|
|
25
|
+
const getTitle = ({ id, properties, pageId, url })=>properties?.title ?? pageId ?? url ?? id;
|
|
26
|
+
const MenuComp = ({ blockId, components: { Icon, Link }, events, menus, methods, pageId, properties, rename })=>{
|
|
41
27
|
const styles = {
|
|
42
28
|
lineHeight: '64px',
|
|
43
29
|
width: '100%',
|
|
@@ -50,7 +36,7 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
50
36
|
}
|
|
51
37
|
const menu = getDefaultMenu(menus, properties.menuId, properties.links);
|
|
52
38
|
const theme = properties.theme ?? 'dark';
|
|
53
|
-
return /*#__PURE__*/ React.createElement(Menu,
|
|
39
|
+
return /*#__PURE__*/ React.createElement(Menu, {
|
|
54
40
|
id: blockId,
|
|
55
41
|
expandIcon: properties.expandIcon && /*#__PURE__*/ React.createElement(Icon, {
|
|
56
42
|
blockId: `${blockId}_expandIcon`,
|
|
@@ -100,8 +86,9 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
100
86
|
event: {
|
|
101
87
|
openKeys
|
|
102
88
|
}
|
|
103
|
-
})
|
|
104
|
-
|
|
89
|
+
}),
|
|
90
|
+
...exProps
|
|
91
|
+
}, menu.map((link, i)=>{
|
|
105
92
|
switch(link.type){
|
|
106
93
|
case 'MenuDivider':
|
|
107
94
|
return /*#__PURE__*/ React.createElement(Menu.Divider, {
|
|
@@ -109,16 +96,17 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
109
96
|
className: methods.makeCssClass([
|
|
110
97
|
link.style
|
|
111
98
|
]),
|
|
112
|
-
dashed: link.properties
|
|
99
|
+
dashed: link.properties?.dashed
|
|
113
100
|
});
|
|
114
101
|
case 'MenuGroup':
|
|
115
102
|
return /*#__PURE__*/ React.createElement(Menu.SubMenu, {
|
|
116
103
|
key: link.pageId ?? link.id,
|
|
117
|
-
title: /*#__PURE__*/ React.createElement(Link,
|
|
104
|
+
title: /*#__PURE__*/ React.createElement(Link, {
|
|
118
105
|
id: link.pageId ?? link.id ?? i,
|
|
119
|
-
className: methods.makeCssClass(link.style, true)
|
|
120
|
-
|
|
121
|
-
|
|
106
|
+
className: methods.makeCssClass(link.style, true),
|
|
107
|
+
...link
|
|
108
|
+
}, getTitle(link)),
|
|
109
|
+
icon: link.properties?.icon && /*#__PURE__*/ React.createElement(Icon, {
|
|
122
110
|
blockId: `${link.id}_icon`,
|
|
123
111
|
events: events,
|
|
124
112
|
properties: link.properties.icon
|
|
@@ -133,15 +121,16 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
133
121
|
className: methods.makeCssClass([
|
|
134
122
|
subLink.style
|
|
135
123
|
]),
|
|
136
|
-
dashed: subLink.properties
|
|
124
|
+
dashed: subLink.properties?.dashed
|
|
137
125
|
});
|
|
138
126
|
case 'MenuGroup':
|
|
139
127
|
return /*#__PURE__*/ React.createElement(Menu.ItemGroup, {
|
|
140
128
|
key: subLink.pageId ?? subLink.id,
|
|
141
|
-
title: /*#__PURE__*/ React.createElement(Link,
|
|
129
|
+
title: /*#__PURE__*/ React.createElement(Link, {
|
|
142
130
|
id: subLink.pageId ?? subLink.id ?? j,
|
|
143
|
-
className: methods.makeCssClass(subLink.style, true)
|
|
144
|
-
|
|
131
|
+
className: methods.makeCssClass(subLink.style, true),
|
|
132
|
+
...subLink
|
|
133
|
+
}, getTitle(subLink))
|
|
145
134
|
}, subLink.links.map((subLinkGroup, k)=>{
|
|
146
135
|
if (subLinkGroup.type === 'MenuDivider') {
|
|
147
136
|
return /*#__PURE__*/ React.createElement(Menu.Divider, {
|
|
@@ -149,36 +138,38 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
149
138
|
className: methods.makeCssClass([
|
|
150
139
|
subLink.style
|
|
151
140
|
]),
|
|
152
|
-
dashed: subLink.properties
|
|
141
|
+
dashed: subLink.properties?.dashed
|
|
153
142
|
});
|
|
154
143
|
}
|
|
155
144
|
return /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
156
145
|
key: subLinkGroup.pageId ?? subLinkGroup.id,
|
|
157
146
|
danger: get(subLinkGroup, 'properties.danger'),
|
|
158
|
-
icon: subLinkGroup.properties
|
|
147
|
+
icon: subLinkGroup.properties?.icon && /*#__PURE__*/ React.createElement(Icon, {
|
|
159
148
|
blockId: `${subLinkGroup.id}_icon`,
|
|
160
149
|
events: events,
|
|
161
150
|
properties: subLinkGroup.properties.icon
|
|
162
151
|
})
|
|
163
|
-
}, /*#__PURE__*/ React.createElement(Link,
|
|
152
|
+
}, /*#__PURE__*/ React.createElement(Link, {
|
|
164
153
|
id: subLinkGroup.pageId ?? subLinkGroup.id ?? k,
|
|
165
|
-
className: methods.makeCssClass(subLinkGroup.style, true)
|
|
166
|
-
|
|
154
|
+
className: methods.makeCssClass(subLinkGroup.style, true),
|
|
155
|
+
...subLinkGroup
|
|
156
|
+
}, getTitle(subLinkGroup)));
|
|
167
157
|
}));
|
|
168
158
|
case 'MenuLink':
|
|
169
159
|
default:
|
|
170
160
|
return /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
171
161
|
key: subLink.pageId ?? subLink.id,
|
|
172
162
|
danger: get(subLink, 'properties.danger'),
|
|
173
|
-
icon: subLink.properties
|
|
163
|
+
icon: subLink.properties?.icon && /*#__PURE__*/ React.createElement(Icon, {
|
|
174
164
|
blockId: `${subLink.id}_icon`,
|
|
175
165
|
events: events,
|
|
176
166
|
properties: subLink.properties.icon
|
|
177
167
|
})
|
|
178
|
-
}, /*#__PURE__*/ React.createElement(Link,
|
|
168
|
+
}, /*#__PURE__*/ React.createElement(Link, {
|
|
179
169
|
id: subLink.pageId ?? subLink.id ?? j,
|
|
180
|
-
className: methods.makeCssClass(subLink.style, true)
|
|
181
|
-
|
|
170
|
+
className: methods.makeCssClass(subLink.style, true),
|
|
171
|
+
...subLink
|
|
172
|
+
}, getTitle(subLink)));
|
|
182
173
|
}
|
|
183
174
|
}));
|
|
184
175
|
case 'MenuLink':
|
|
@@ -186,15 +177,16 @@ const MenuComp = ({ blockId , components: { Icon , Link } , events , menus , me
|
|
|
186
177
|
return /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
187
178
|
key: link.pageId ?? link.id,
|
|
188
179
|
danger: get(link, 'properties.danger'),
|
|
189
|
-
icon: link.properties
|
|
180
|
+
icon: link.properties?.icon && /*#__PURE__*/ React.createElement(Icon, {
|
|
190
181
|
blockId: `${link.id}_icon`,
|
|
191
182
|
events: events,
|
|
192
183
|
properties: link.properties.icon
|
|
193
184
|
})
|
|
194
|
-
}, /*#__PURE__*/ React.createElement(Link,
|
|
185
|
+
}, /*#__PURE__*/ React.createElement(Link, {
|
|
195
186
|
id: link.pageId ?? link.id ?? i,
|
|
196
|
-
className: methods.makeCssClass(link.style, true)
|
|
197
|
-
|
|
187
|
+
className: methods.makeCssClass(link.style, true),
|
|
188
|
+
...link
|
|
189
|
+
}, getTitle(link)));
|
|
198
190
|
}
|
|
199
191
|
}));
|
|
200
192
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 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.
|
|
@@ -16,23 +16,23 @@
|
|
|
16
16
|
import { message } from 'antd';
|
|
17
17
|
import { type } from '@lowdefy/helpers';
|
|
18
18
|
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
|
|
19
|
-
const MessageBlock = ({ blockId
|
|
19
|
+
const MessageBlock = ({ blockId, components: { Icon }, events, methods, properties })=>{
|
|
20
20
|
useEffect(()=>{
|
|
21
21
|
methods.registerMethod('open', (args = {})=>{
|
|
22
|
-
return message[args.status
|
|
22
|
+
return message[args.status ?? properties.status ?? 'success']({
|
|
23
23
|
id: `${blockId}_message`,
|
|
24
24
|
content: renderHtml({
|
|
25
|
-
html: args.content
|
|
25
|
+
html: args.content ?? properties.content ?? blockId,
|
|
26
26
|
methods
|
|
27
27
|
}),
|
|
28
28
|
duration: type.isNone(args.duration) ? properties.duration : args.duration,
|
|
29
29
|
onClose: ()=>methods.triggerEvent({
|
|
30
30
|
name: 'onClose'
|
|
31
31
|
}),
|
|
32
|
-
icon: (args.icon
|
|
32
|
+
icon: (args.icon ?? properties.icon) && /*#__PURE__*/ React.createElement(Icon, {
|
|
33
33
|
blockId: `${blockId}_icon`,
|
|
34
34
|
events: events,
|
|
35
|
-
properties: args.icon
|
|
35
|
+
properties: args.icon ?? properties.icon
|
|
36
36
|
}),
|
|
37
37
|
className: methods.makeCssClass(properties.messageStyle)
|
|
38
38
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 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
|
|
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', {
|
|
@@ -31,7 +31,7 @@ const MobileMenu = ({ basePath , blockId , components , events , methods , menus
|
|
|
31
31
|
});
|
|
32
32
|
methods.registerMethod(get(rename, 'methods.setOpen', {
|
|
33
33
|
default: 'setOpen'
|
|
34
|
-
}), ({ open
|
|
34
|
+
}), ({ open })=>{
|
|
35
35
|
methods._setOpen({
|
|
36
36
|
open
|
|
37
37
|
});
|
|
@@ -86,7 +86,7 @@ const MobileMenu = ({ basePath , blockId , components , events , methods , menus
|
|
|
86
86
|
default: 'toggleOpen'
|
|
87
87
|
})](),
|
|
88
88
|
content: {
|
|
89
|
-
content: ()=>/*#__PURE__*/ React.createElement(
|
|
89
|
+
content: ()=>/*#__PURE__*/ React.createElement(Menu, {
|
|
90
90
|
basePath: basePath,
|
|
91
91
|
components: components,
|
|
92
92
|
blockId: `${blockId}_menu`,
|
|
@@ -110,7 +110,7 @@ const MobileMenu = ({ basePath , blockId , components , events , methods , menus
|
|
|
110
110
|
onSelect: 'onMenuItemSelect'
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
})
|
|
113
|
+
})
|
|
114
114
|
}
|
|
115
115
|
}));
|
|
116
116
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 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,25 +12,11 @@
|
|
|
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
|
-
_extends = Object.assign || function(target) {
|
|
17
|
-
for(var i = 1; i < arguments.length; i++){
|
|
18
|
-
var source = arguments[i];
|
|
19
|
-
for(var key in source){
|
|
20
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
21
|
-
target[key] = source[key];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return target;
|
|
26
|
-
};
|
|
27
|
-
return _extends.apply(this, arguments);
|
|
28
|
-
}
|
|
29
|
-
import React, { useState, useEffect } from 'react';
|
|
15
|
+
*/ import React, { useState, useEffect } from 'react';
|
|
30
16
|
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
|
|
31
17
|
import { get } from '@lowdefy/helpers';
|
|
32
18
|
import { Modal } from 'antd';
|
|
33
|
-
const triggerSetOpen = ({ methods
|
|
19
|
+
const triggerSetOpen = ({ methods, setOpen, state })=>{
|
|
34
20
|
if (!state) {
|
|
35
21
|
methods.triggerEvent({
|
|
36
22
|
name: 'onClose'
|
|
@@ -43,7 +29,7 @@ const triggerSetOpen = ({ methods , setOpen , state })=>{
|
|
|
43
29
|
}
|
|
44
30
|
setOpen(state);
|
|
45
31
|
};
|
|
46
|
-
const ModalBlock = ({ blockId
|
|
32
|
+
const ModalBlock = ({ blockId, content, events, methods, properties })=>{
|
|
47
33
|
const [openState, setOpen] = useState(false);
|
|
48
34
|
useEffect(()=>{
|
|
49
35
|
methods.registerMethod('toggleOpen', ()=>triggerSetOpen({
|
|
@@ -51,7 +37,7 @@ const ModalBlock = ({ blockId , content , events , methods , properties })=>{
|
|
|
51
37
|
setOpen,
|
|
52
38
|
methods
|
|
53
39
|
}));
|
|
54
|
-
methods.registerMethod('setOpen', ({ open
|
|
40
|
+
methods.registerMethod('setOpen', ({ open })=>triggerSetOpen({
|
|
55
41
|
state: !!open,
|
|
56
42
|
setOpen,
|
|
57
43
|
methods
|
|
@@ -66,14 +52,14 @@ const ModalBlock = ({ blockId , content , events , methods , properties })=>{
|
|
|
66
52
|
}
|
|
67
53
|
return /*#__PURE__*/ React.createElement("div", {
|
|
68
54
|
id: blockId
|
|
69
|
-
}, /*#__PURE__*/ React.createElement(Modal,
|
|
55
|
+
}, /*#__PURE__*/ React.createElement(Modal, {
|
|
70
56
|
id: `${blockId}_modal`,
|
|
71
57
|
afterClose: ()=>methods.triggerEvent({
|
|
72
58
|
name: 'afterClose'
|
|
73
59
|
}),
|
|
74
60
|
bodyStyle: methods.makeCssClass(properties.bodyStyle, true),
|
|
75
61
|
cancelButtonProps: properties.cancelButtonProps,
|
|
76
|
-
cancelText: properties.cancelText
|
|
62
|
+
cancelText: properties.cancelText ?? 'Cancel',
|
|
77
63
|
centered: !!properties.centered,
|
|
78
64
|
closable: properties.closable !== undefined ? properties.closable : true,
|
|
79
65
|
confirmLoading: get(events, 'onOk.loading'),
|
|
@@ -81,8 +67,8 @@ const ModalBlock = ({ blockId , content , events , methods , properties })=>{
|
|
|
81
67
|
maskClosable: properties.maskClosable !== undefined ? properties.maskClosable : true,
|
|
82
68
|
maskStyle: methods.makeCssClass(properties.maskStyle, true),
|
|
83
69
|
okButtonProps: properties.okButtonProps,
|
|
84
|
-
okText: properties.okText
|
|
85
|
-
okType: properties.okButtonType
|
|
70
|
+
okText: properties.okText ?? 'Ok',
|
|
71
|
+
okType: properties.okButtonType ?? 'primary',
|
|
86
72
|
title: renderHtml({
|
|
87
73
|
html: properties.title,
|
|
88
74
|
methods
|
|
@@ -116,8 +102,9 @@ const ModalBlock = ({ blockId , content , events , methods , properties })=>{
|
|
|
116
102
|
methods
|
|
117
103
|
});
|
|
118
104
|
}
|
|
119
|
-
}
|
|
120
|
-
|
|
105
|
+
},
|
|
106
|
+
...extraProps
|
|
107
|
+
}, content.content && content.content()));
|
|
121
108
|
};
|
|
122
109
|
ModalBlock.defaultProps = blockDefaultProps;
|
|
123
110
|
ModalBlock.meta = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 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.
|
|
@@ -20,7 +20,7 @@ import { type } from '@lowdefy/helpers';
|
|
|
20
20
|
import Label from '../Label/Label.js';
|
|
21
21
|
import disabledDate from '../../disabledDate.js';
|
|
22
22
|
const MonthPicker = DatePicker.MonthPicker;
|
|
23
|
-
const MonthSelector = ({ blockId
|
|
23
|
+
const MonthSelector = ({ blockId, components: { Icon }, events, loading, methods, properties, required, validation, value })=>{
|
|
24
24
|
return /*#__PURE__*/ React.createElement(Label, {
|
|
25
25
|
blockId: blockId,
|
|
26
26
|
components: {
|
|
@@ -54,16 +54,16 @@ const MonthSelector = ({ blockId , components: { Icon } , events , loading , me
|
|
|
54
54
|
]),
|
|
55
55
|
disabled: properties.disabled || loading,
|
|
56
56
|
disabledDate: disabledDate(properties.disabledDates),
|
|
57
|
-
format: properties.format
|
|
57
|
+
format: properties.format ?? 'YYYY-MM',
|
|
58
58
|
getPopupContainer: ()=>document.getElementById(`${blockId}_popup`),
|
|
59
|
-
placeholder: properties.placeholder
|
|
59
|
+
placeholder: properties.placeholder ?? 'Select Month',
|
|
60
60
|
size: properties.size,
|
|
61
61
|
status: validation.status,
|
|
62
62
|
value: type.isDate(value) ? moment.utc(value).startOf('month') : null,
|
|
63
63
|
suffixIcon: /*#__PURE__*/ React.createElement(Icon, {
|
|
64
64
|
blockId: `${blockId}_suffixIcon`,
|
|
65
65
|
events: events,
|
|
66
|
-
properties: properties.suffixIcon
|
|
66
|
+
properties: properties.suffixIcon ?? 'AiOutlineCalendar'
|
|
67
67
|
}),
|
|
68
68
|
onChange: (newVal)=>{
|
|
69
69
|
methods.setValue(!newVal ? null : moment.utc(newVal.add(newVal.utcOffset(), 'minutes')).startOf('month').toDate());
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 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,10 +19,28 @@ import { Select } from 'antd';
|
|
|
19
19
|
import getUniqueValues from '../../getUniqueValues.js';
|
|
20
20
|
import getValueIndex from '../../getValueIndex.js';
|
|
21
21
|
import Label from '../Label/Label.js';
|
|
22
|
+
import Tag from '../Tag/Tag.js';
|
|
22
23
|
const Option = Select.Option;
|
|
23
|
-
const
|
|
24
|
+
const tagRender = (props, option, methods, components)=>{
|
|
25
|
+
const { label, closable, onClose } = props;
|
|
26
|
+
return /*#__PURE__*/ React.createElement(Tag, {
|
|
27
|
+
components: components,
|
|
28
|
+
methods: methods,
|
|
29
|
+
onClose: onClose,
|
|
30
|
+
properties: {
|
|
31
|
+
title: label ?? '',
|
|
32
|
+
...option?.tag ?? {},
|
|
33
|
+
closable,
|
|
34
|
+
style: {
|
|
35
|
+
marginRight: 3,
|
|
36
|
+
...option?.tag?.style ?? {}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const MultipleSelector = ({ blockId, components: { Icon }, events, loading, methods, properties, required, validation, value })=>{
|
|
24
42
|
const [fetchState, setFetch] = useState(false);
|
|
25
|
-
const uniqueValueOptions = getUniqueValues(properties.options
|
|
43
|
+
const uniqueValueOptions = getUniqueValues(properties.options ?? []);
|
|
26
44
|
return /*#__PURE__*/ React.createElement(Label, {
|
|
27
45
|
blockId: blockId,
|
|
28
46
|
components: {
|
|
@@ -56,8 +74,12 @@ const MultipleSelector = ({ blockId , components: { Icon } , events , loading ,
|
|
|
56
74
|
disabled: properties.disabled || loading,
|
|
57
75
|
getPopupContainer: ()=>document.getElementById(`${blockId}_popup`),
|
|
58
76
|
mode: "multiple",
|
|
77
|
+
tagRender: properties.renderTags && ((props)=>tagRender(props, uniqueValueOptions[props.value], methods, {
|
|
78
|
+
Icon
|
|
79
|
+
})),
|
|
80
|
+
maxTagCount: properties.maxTagCount,
|
|
59
81
|
notFoundContent: fetchState ? 'Loading' : 'Not found',
|
|
60
|
-
placeholder: get(properties, 'placeholder', {
|
|
82
|
+
placeholder: loading ? 'Loading...' : get(properties, 'placeholder', {
|
|
61
83
|
default: 'Select items'
|
|
62
84
|
}),
|
|
63
85
|
showArrow: get(properties, 'showArrow', {
|
|
@@ -65,7 +87,7 @@ const MultipleSelector = ({ blockId , components: { Icon } , events , loading ,
|
|
|
65
87
|
}),
|
|
66
88
|
size: properties.size,
|
|
67
89
|
status: validation.status,
|
|
68
|
-
value: getValueIndex(value, uniqueValueOptions, true),
|
|
90
|
+
value: loading ? [] : getValueIndex(value, uniqueValueOptions, true),
|
|
69
91
|
suffixIcon: properties.suffixIcon && /*#__PURE__*/ React.createElement(Icon, {
|
|
70
92
|
blockId: `${blockId}_suffixIcon`,
|
|
71
93
|
events: events,
|
|
@@ -92,6 +114,21 @@ const MultipleSelector = ({ blockId , components: { Icon } , events , loading ,
|
|
|
92
114
|
name: 'onChange'
|
|
93
115
|
});
|
|
94
116
|
},
|
|
117
|
+
onBlur: ()=>{
|
|
118
|
+
methods.triggerEvent({
|
|
119
|
+
name: 'onBlur'
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
onFocus: ()=>{
|
|
123
|
+
methods.triggerEvent({
|
|
124
|
+
name: 'onFocus'
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
onClear: ()=>{
|
|
128
|
+
methods.triggerEvent({
|
|
129
|
+
name: 'onClear'
|
|
130
|
+
});
|
|
131
|
+
},
|
|
95
132
|
onSearch: async (value)=>{
|
|
96
133
|
setFetch(true);
|
|
97
134
|
const result = await methods.triggerEvent({
|
|
@@ -178,12 +178,39 @@
|
|
|
178
178
|
"docs": {
|
|
179
179
|
"displayType": "yaml"
|
|
180
180
|
}
|
|
181
|
+
},
|
|
182
|
+
"tag": {
|
|
183
|
+
"type": "object",
|
|
184
|
+
"properties": {
|
|
185
|
+
"color": {
|
|
186
|
+
"type": "string",
|
|
187
|
+
"description": "Color of the Tag. Preset options are success, processing, error, warning, default, blue, cyan, geekblue, gold, green, lime, magenta, orange, purple, red, volcano, or alternatively any hex color.",
|
|
188
|
+
"docs": {
|
|
189
|
+
"displayType": "color"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"title": {
|
|
193
|
+
"type": "string",
|
|
194
|
+
"description": "Content title of tag - supports html."
|
|
195
|
+
},
|
|
196
|
+
"icon": {
|
|
197
|
+
"type": ["string", "object"],
|
|
198
|
+
"description": "Name of an Ant Design Icon or properties of an Icon block to customize alert icon.",
|
|
199
|
+
"docs": {
|
|
200
|
+
"displayType": "icon"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
181
204
|
}
|
|
182
205
|
}
|
|
183
206
|
}
|
|
184
207
|
}
|
|
185
208
|
]
|
|
186
209
|
},
|
|
210
|
+
"maxTagCount": {
|
|
211
|
+
"type": "number",
|
|
212
|
+
"description": "Max tag count to show."
|
|
213
|
+
},
|
|
187
214
|
"placeholder": {
|
|
188
215
|
"type": "string",
|
|
189
216
|
"default": "Select item",
|
|
@@ -219,6 +246,10 @@
|
|
|
219
246
|
"title": {
|
|
220
247
|
"type": "string",
|
|
221
248
|
"description": "Multiple selector label title - supports html."
|
|
249
|
+
},
|
|
250
|
+
"renderTags": {
|
|
251
|
+
"type": "boolean",
|
|
252
|
+
"description": "When true, the selected option labels are rendered as tags in the selector input. This field must be true to render option tag values."
|
|
222
253
|
}
|
|
223
254
|
}
|
|
224
255
|
},
|
|
@@ -230,6 +261,18 @@
|
|
|
230
261
|
"type": "array",
|
|
231
262
|
"description": "Trigger actions when selection is changed."
|
|
232
263
|
},
|
|
264
|
+
"onBlur": {
|
|
265
|
+
"type": "array",
|
|
266
|
+
"description": "Trigger action event occurs when selector loses focus."
|
|
267
|
+
},
|
|
268
|
+
"onFocus": {
|
|
269
|
+
"type": "array",
|
|
270
|
+
"description": "Trigger action when selector gets focus."
|
|
271
|
+
},
|
|
272
|
+
"onClear": {
|
|
273
|
+
"type": "array",
|
|
274
|
+
"description": "Trigger action when selector gets cleared."
|
|
275
|
+
},
|
|
233
276
|
"onSearch": {
|
|
234
277
|
"type": "array",
|
|
235
278
|
"description": "Trigger actions when input is changed. 'value' is passed to the _event operator to be used in actions such as search queries."
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 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.
|
|
@@ -15,4 +15,5 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
@import 'antd/lib/select/style/index.less';
|
|
18
|
+
@import 'antd/lib/tag/style/index.less';
|
|
18
19
|
@import '../Label/style.less';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 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.
|
|
@@ -17,7 +17,7 @@ import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
|
|
|
17
17
|
import { notification } from 'antd';
|
|
18
18
|
import { type } from '@lowdefy/helpers';
|
|
19
19
|
import Button from '../Button/Button.js';
|
|
20
|
-
const NotificationBlock = ({ blockId
|
|
20
|
+
const NotificationBlock = ({ blockId, components: { Icon }, events, methods, properties })=>{
|
|
21
21
|
useEffect(()=>{
|
|
22
22
|
methods.registerMethod('open', (args = {})=>{
|
|
23
23
|
notification[args.status || properties.status || 'success']({
|