@lowdefy/blocks-antd 4.0.0-rc.8 → 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.
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
17
17
|
import { InputNumber } from 'antd';
|
|
18
18
|
import Label from '../Label/Label.js';
|
|
19
|
-
const NumberInput = ({ blockId
|
|
19
|
+
const NumberInput = ({ blockId, events, components, loading, methods, properties, required, validation, value })=>{
|
|
20
20
|
return /*#__PURE__*/ React.createElement(Label, {
|
|
21
21
|
blockId: blockId,
|
|
22
22
|
components: components,
|
|
@@ -64,6 +64,16 @@ const NumberInput = ({ blockId , events , components , loading , methods , prope
|
|
|
64
64
|
name: 'onPressEnter'
|
|
65
65
|
});
|
|
66
66
|
},
|
|
67
|
+
onBlur: ()=>{
|
|
68
|
+
methods.triggerEvent({
|
|
69
|
+
name: 'onBlur'
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
onFocus: ()=>{
|
|
73
|
+
methods.triggerEvent({
|
|
74
|
+
name: 'onFocus'
|
|
75
|
+
});
|
|
76
|
+
},
|
|
67
77
|
value: value
|
|
68
78
|
})
|
|
69
79
|
}
|
|
@@ -151,9 +151,17 @@
|
|
|
151
151
|
"type": "object",
|
|
152
152
|
"additionalProperties": false,
|
|
153
153
|
"properties": {
|
|
154
|
+
"onBlur": {
|
|
155
|
+
"type": "array",
|
|
156
|
+
"description": "Trigger action event occurs when number input loses focus."
|
|
157
|
+
},
|
|
154
158
|
"onChange": {
|
|
155
159
|
"type": "array",
|
|
156
|
-
"description": "Trigger
|
|
160
|
+
"description": "Trigger action when number input is changed."
|
|
161
|
+
},
|
|
162
|
+
"onFocus": {
|
|
163
|
+
"type": "array",
|
|
164
|
+
"description": "Trigger action when number input gets focus."
|
|
157
165
|
},
|
|
158
166
|
"onPressEnter": {
|
|
159
167
|
"type": "array",
|
|
@@ -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.
|
|
@@ -22,7 +22,7 @@ import Header from '../Header/Header.js';
|
|
|
22
22
|
import Layout from '../Layout/Layout.js';
|
|
23
23
|
import Menu from '../Menu/Menu.js';
|
|
24
24
|
import MobileMenu from '../MobileMenu/MobileMenu.js';
|
|
25
|
-
const PageHeaderMenu = ({ basePath
|
|
25
|
+
const PageHeaderMenu = ({ basePath, blockId, components: { Icon, Link }, content, events, menus, methods, pageId, properties })=>{
|
|
26
26
|
const styles = {
|
|
27
27
|
layout: {
|
|
28
28
|
minHeight: '100vh'
|
|
@@ -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.
|
|
@@ -25,7 +25,7 @@ import Layout from '../Layout/Layout.js';
|
|
|
25
25
|
import Menu from '../Menu/Menu.js';
|
|
26
26
|
import MobileMenu from '../MobileMenu/MobileMenu.js';
|
|
27
27
|
import Sider from '../Sider/Sider.js';
|
|
28
|
-
const PageSiderMenu = ({ basePath
|
|
28
|
+
const PageSiderMenu = ({ basePath, blockId, components: { Icon, Link }, events, content, menus, methods, pageId, properties })=>{
|
|
29
29
|
const [openSiderState, setSiderOpen] = useState(!properties.sider?.initialCollapsed);
|
|
30
30
|
useEffect(()=>{
|
|
31
31
|
methods.registerMethod('toggleSiderOpen', ()=>{
|
|
@@ -34,7 +34,7 @@ const PageSiderMenu = ({ basePath , blockId , components: { Icon , Link } , eve
|
|
|
34
34
|
});
|
|
35
35
|
setSiderOpen(!openSiderState);
|
|
36
36
|
});
|
|
37
|
-
methods.registerMethod('setSiderOpen', ({ open
|
|
37
|
+
methods.registerMethod('setSiderOpen', ({ open })=>{
|
|
38
38
|
methods._toggleSiderOpen({
|
|
39
39
|
open
|
|
40
40
|
});
|
|
@@ -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,7 +16,7 @@
|
|
|
16
16
|
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
17
17
|
import { Pagination } from 'antd';
|
|
18
18
|
import { type } from '@lowdefy/helpers';
|
|
19
|
-
const getPageSize = ({ properties
|
|
19
|
+
const getPageSize = ({ properties, value })=>{
|
|
20
20
|
if (type.isObject(value) && type.isNumber(value.pageSize)) {
|
|
21
21
|
return value.pageSize;
|
|
22
22
|
}
|
|
@@ -25,7 +25,7 @@ const getPageSize = ({ properties , value })=>{
|
|
|
25
25
|
}
|
|
26
26
|
return 10;
|
|
27
27
|
};
|
|
28
|
-
const createChangeHandler = ({ eventName
|
|
28
|
+
const createChangeHandler = ({ eventName, methods })=>(current, pageSize)=>{
|
|
29
29
|
methods.setValue({
|
|
30
30
|
current,
|
|
31
31
|
pageSize,
|
|
@@ -40,7 +40,7 @@ const createChangeHandler = ({ eventName , methods })=>(current, pageSize)=>{
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
|
-
const PaginationBlock = ({ blockId
|
|
43
|
+
const PaginationBlock = ({ blockId, loading, methods, properties, value })=>{
|
|
44
44
|
const showTotal = type.isFunction(properties.showTotal) ? properties.showTotal : (total, range)=>{
|
|
45
45
|
if (type.isString(properties.showTotal)) {
|
|
46
46
|
return properties.showTotal;
|
|
@@ -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 { type } from '@lowdefy/helpers';
|
|
18
18
|
import { Typography } from 'antd';
|
|
19
19
|
const Paragraph = Typography.Paragraph;
|
|
20
|
-
const ParagraphBlock = ({ blockId
|
|
20
|
+
const ParagraphBlock = ({ blockId, components: { Icon }, events, methods, properties })=>/*#__PURE__*/ React.createElement(Paragraph, {
|
|
21
21
|
id: blockId,
|
|
22
22
|
className: methods.makeCssClass(properties.style),
|
|
23
23
|
code: properties.code,
|
|
@@ -89,6 +89,7 @@ const ParagraphBlock = ({ blockId , components: { Icon } , events , methods , p
|
|
|
89
89
|
underline: properties.underline
|
|
90
90
|
}, renderHtml({
|
|
91
91
|
html: properties.content,
|
|
92
|
+
events,
|
|
92
93
|
methods
|
|
93
94
|
}));
|
|
94
95
|
ParagraphBlock.defaultProps = blockDefaultProps;
|
|
@@ -125,6 +125,10 @@
|
|
|
125
125
|
"onCopy": {
|
|
126
126
|
"type": "array",
|
|
127
127
|
"description": "Trigger action when copy text is clicked."
|
|
128
|
+
},
|
|
129
|
+
"onTextSelection": {
|
|
130
|
+
"type": "array",
|
|
131
|
+
"description": "Trigger action when text is selected and pass selected text to the event object."
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
}
|
|
@@ -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 { Typography } from 'antd';
|
|
|
17
17
|
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
18
18
|
import { type } from '@lowdefy/helpers';
|
|
19
19
|
const Paragraph = Typography.Paragraph;
|
|
20
|
-
const ParagraphInput = ({ blockId
|
|
20
|
+
const ParagraphInput = ({ blockId, components: { Icon }, events, loading, methods, properties, value })=>{
|
|
21
21
|
const [editing, setEdit] = useState(false);
|
|
22
22
|
const editableEvents = {
|
|
23
23
|
onStart: ()=>{
|
|
@@ -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 { Input } from 'antd';
|
|
|
17
17
|
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
18
18
|
import Label from '../Label/Label.js';
|
|
19
19
|
import useRunAfterUpdate from '../../useRunAfterUpdate.js';
|
|
20
|
-
const PasswordInput = ({ blockId
|
|
20
|
+
const PasswordInput = ({ blockId, components, events, loading, methods, properties, required, validation, value })=>{
|
|
21
21
|
return /*#__PURE__*/ React.createElement(Label, {
|
|
22
22
|
blockId: blockId,
|
|
23
23
|
components: components,
|
|
@@ -54,6 +54,16 @@ const PasswordInput = ({ blockId , components , events , loading , methods , pro
|
|
|
54
54
|
name: 'onPressEnter'
|
|
55
55
|
});
|
|
56
56
|
},
|
|
57
|
+
onFocus: ()=>{
|
|
58
|
+
methods.triggerEvent({
|
|
59
|
+
name: 'onFocus'
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
onBlur: ()=>{
|
|
63
|
+
methods.triggerEvent({
|
|
64
|
+
name: 'onBlur'
|
|
65
|
+
});
|
|
66
|
+
},
|
|
57
67
|
placeholder: properties.placeholder,
|
|
58
68
|
value: value,
|
|
59
69
|
size: properties.size,
|
|
@@ -110,10 +110,18 @@
|
|
|
110
110
|
"type": "object",
|
|
111
111
|
"additionalProperties": false,
|
|
112
112
|
"properties": {
|
|
113
|
+
"onBlur": {
|
|
114
|
+
"type": "array",
|
|
115
|
+
"description": "Trigger action event occurs when text input loses focus."
|
|
116
|
+
},
|
|
113
117
|
"onChange": {
|
|
114
118
|
"type": "array",
|
|
115
119
|
"description": "Trigger action when text input is changed."
|
|
116
120
|
},
|
|
121
|
+
"onFocus": {
|
|
122
|
+
"type": "array",
|
|
123
|
+
"description": "Trigger action when text input gets focus."
|
|
124
|
+
},
|
|
117
125
|
"onPressEnter": {
|
|
118
126
|
"type": "array",
|
|
119
127
|
"description": "Trigger action when enter is pressed while text input is focused."
|
|
@@ -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,13 +20,13 @@ import Label from '../Label/Label.js';
|
|
|
20
20
|
import getValueIndex from '../../getValueIndex.js';
|
|
21
21
|
import getUniqueValues from '../../getUniqueValues.js';
|
|
22
22
|
const Option = Select.Option;
|
|
23
|
-
function getAllowedRegions({ allowedRegions
|
|
23
|
+
function getAllowedRegions({ allowedRegions, regions }) {
|
|
24
24
|
if (!allowedRegions || allowedRegions.length === 0) {
|
|
25
25
|
return regions;
|
|
26
26
|
}
|
|
27
27
|
return regions.filter((region)=>allowedRegions.includes(region.code));
|
|
28
28
|
}
|
|
29
|
-
function getDefaultRegion({ allowedRegions
|
|
29
|
+
function getDefaultRegion({ allowedRegions, defaultRegion, uniqueValueOptions }) {
|
|
30
30
|
if (!defaultRegion) {
|
|
31
31
|
return getValueIndex(allowedRegions[0], uniqueValueOptions);
|
|
32
32
|
}
|
|
@@ -36,7 +36,7 @@ function getDefaultRegion({ allowedRegions , defaultRegion , uniqueValueOptions
|
|
|
36
36
|
}
|
|
37
37
|
return getValueIndex(allowedRegions[index], uniqueValueOptions);
|
|
38
38
|
}
|
|
39
|
-
function AddOnSelect({ blockId
|
|
39
|
+
function AddOnSelect({ blockId, defaultValue, loading, methods, properties, uniqueValueOptions, value }) {
|
|
40
40
|
return /*#__PURE__*/ React.createElement(Select, {
|
|
41
41
|
id: `${blockId}_select_input`,
|
|
42
42
|
bordered: properties.bordered,
|
|
@@ -68,6 +68,16 @@ function AddOnSelect({ blockId , defaultValue , loading , methods , properties ,
|
|
|
68
68
|
name: 'onChange'
|
|
69
69
|
});
|
|
70
70
|
},
|
|
71
|
+
onBlur: ()=>{
|
|
72
|
+
methods.triggerEvent({
|
|
73
|
+
name: 'onBlur'
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
onFocus: ()=>{
|
|
77
|
+
methods.triggerEvent({
|
|
78
|
+
name: 'onFocus'
|
|
79
|
+
});
|
|
80
|
+
},
|
|
71
81
|
optionFilterProp: "filterString",
|
|
72
82
|
optionLabelProp: "label",
|
|
73
83
|
placeholder: 'Select item',
|
|
@@ -89,7 +99,7 @@ function AddOnSelect({ blockId , defaultValue , loading , methods , properties ,
|
|
|
89
99
|
}, displayLabel);
|
|
90
100
|
}));
|
|
91
101
|
}
|
|
92
|
-
const PhoneNumberInput = ({ blockId
|
|
102
|
+
const PhoneNumberInput = ({ blockId, components: { Icon, Link }, events, loading, methods, properties, required, validation, value })=>{
|
|
93
103
|
const allowedRegions = getAllowedRegions({
|
|
94
104
|
allowedRegions: properties.allowedRegions,
|
|
95
105
|
regions
|
|
@@ -151,7 +161,7 @@ const PhoneNumberInput = ({ blockId , components: { Icon , Link } , events , lo
|
|
|
151
161
|
status: validation.status,
|
|
152
162
|
value: value?.input,
|
|
153
163
|
onChange: (event)=>{
|
|
154
|
-
|
|
164
|
+
let input = event.target.value;
|
|
155
165
|
if (properties.replaceInput) {
|
|
156
166
|
const regex = new RegExp(properties.replaceInput.pattern, properties.replaceInput.flags ?? 'gm');
|
|
157
167
|
input = input.replace(regex, properties.replaceInput.replacement ?? '');
|
|
@@ -175,6 +185,16 @@ const PhoneNumberInput = ({ blockId , components: { Icon , Link } , events , lo
|
|
|
175
185
|
name: 'onPressEnter'
|
|
176
186
|
});
|
|
177
187
|
},
|
|
188
|
+
onBlur: ()=>{
|
|
189
|
+
methods.triggerEvent({
|
|
190
|
+
name: 'onBlur'
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
onFocus: ()=>{
|
|
194
|
+
methods.triggerEvent({
|
|
195
|
+
name: 'onFocus'
|
|
196
|
+
});
|
|
197
|
+
},
|
|
178
198
|
prefix: properties.prefix || properties.prefixIcon && /*#__PURE__*/ React.createElement(Icon, {
|
|
179
199
|
blockId: `${blockId}_prefixIcon`,
|
|
180
200
|
events: events,
|
|
@@ -199,6 +199,14 @@
|
|
|
199
199
|
"type": "array",
|
|
200
200
|
"description": "Trigger action when the number is changed."
|
|
201
201
|
},
|
|
202
|
+
"onBlur": {
|
|
203
|
+
"type": "array",
|
|
204
|
+
"description": "Trigger action event occurs when input loses focus."
|
|
205
|
+
},
|
|
206
|
+
"onFocus": {
|
|
207
|
+
"type": "array",
|
|
208
|
+
"description": "Trigger action when input gets focus."
|
|
209
|
+
},
|
|
202
210
|
"onPressEnter": {
|
|
203
211
|
"type": "array",
|
|
204
212
|
"description": "Trigger action when enter is pressed while text input is focused."
|
|
@@ -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 { Progress } from 'antd';
|
|
17
17
|
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
18
|
-
const ProgressBlock = ({ blockId
|
|
18
|
+
const ProgressBlock = ({ blockId, properties })=>/*#__PURE__*/ React.createElement(Progress, {
|
|
19
19
|
gapDegree: properties.gapDegree,
|
|
20
20
|
gapPosition: properties.gapPosition,
|
|
21
21
|
id: blockId,
|
|
@@ -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 Label from '../Label/Label.js';
|
|
|
20
20
|
import getValueIndex from '../../getValueIndex.js';
|
|
21
21
|
import getUniqueValues from '../../getUniqueValues.js';
|
|
22
22
|
const RadioGroup = Radio.Group;
|
|
23
|
-
const RadioSelector = ({ blockId
|
|
23
|
+
const RadioSelector = ({ blockId, components, events, loading, properties, required, validation, value, methods })=>{
|
|
24
24
|
const uniqueValueOptions = getUniqueValues(properties.options || []);
|
|
25
25
|
return /*#__PURE__*/ React.createElement(Label, {
|
|
26
26
|
blockId: blockId,
|
|
@@ -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.
|
|
@@ -63,7 +63,7 @@ const styles = {
|
|
|
63
63
|
flexDirection: 'row'
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
-
const RatingSlider = ({ blockId
|
|
66
|
+
const RatingSlider = ({ blockId, components: { Icon, Link }, events, loading, methods, properties, required, validation, value })=>{
|
|
67
67
|
const [check, unCheck] = useState(false);
|
|
68
68
|
let propertiesIconMin = serializer.copy(properties.minIcon);
|
|
69
69
|
if (type.isString(propertiesIconMin)) {
|
|
@@ -81,10 +81,10 @@ const RatingSlider = ({ blockId , components: { Icon , Link } , events , loadin
|
|
|
81
81
|
get(properties, 'max', {
|
|
82
82
|
default: 10
|
|
83
83
|
}),
|
|
84
|
-
properties.min
|
|
84
|
+
properties.min ?? 0
|
|
85
85
|
].sort((a, b)=>a - b);
|
|
86
86
|
// round to fix floating point error
|
|
87
|
-
const minMin = parseFloat((minMax[0] - (properties.step
|
|
87
|
+
const minMin = parseFloat((minMax[0] - (properties.step ?? 1)).toPrecision(8));
|
|
88
88
|
const validationColor = validation.status === 'error' ? '#ff4d4f' : validation.status === 'warning' ? '#faad14' : null;
|
|
89
89
|
return /*#__PURE__*/ React.createElement(Label, {
|
|
90
90
|
blockId: blockId,
|
|
@@ -123,7 +123,7 @@ const RatingSlider = ({ blockId , components: { Icon , Link } , events , loadin
|
|
|
123
123
|
options: [
|
|
124
124
|
{
|
|
125
125
|
value: true,
|
|
126
|
-
label: properties.notApplicableLabel
|
|
126
|
+
label: properties.notApplicableLabel ?? 'N/A'
|
|
127
127
|
}
|
|
128
128
|
],
|
|
129
129
|
color: properties.color,
|
|
@@ -139,7 +139,7 @@ const RatingSlider = ({ blockId , components: { Icon , Link } , events , loadin
|
|
|
139
139
|
setValue: (val)=>{
|
|
140
140
|
if (val[0] === true) {
|
|
141
141
|
unCheck(true);
|
|
142
|
-
methods.setValue(properties.notApplicableLabel
|
|
142
|
+
methods.setValue(properties.notApplicableLabel ?? 'N/A');
|
|
143
143
|
} else {
|
|
144
144
|
unCheck(false);
|
|
145
145
|
}
|
|
@@ -191,13 +191,13 @@ const RatingSlider = ({ blockId , components: { Icon , Link } , events , loadin
|
|
|
191
191
|
}),
|
|
192
192
|
tooltipVisible: value === null || properties.tooltipVisible === 'never' ? false : properties.tooltipVisible === 'always' ? true : undefined,
|
|
193
193
|
tipFormatter: (val)=>`${val}`,
|
|
194
|
-
marks: properties.marks
|
|
194
|
+
marks: properties.marks ?? (get(properties, 'showMarks', {
|
|
195
195
|
default: true
|
|
196
|
-
}) ? includeMarks(minMax, minMin, properties.step
|
|
196
|
+
}) ? includeMarks(minMax, minMin, properties.step ?? 1) : undefined),
|
|
197
197
|
min: minMin,
|
|
198
198
|
max: minMax[1],
|
|
199
199
|
range: false,
|
|
200
|
-
step: properties.step
|
|
200
|
+
step: properties.step ?? 1,
|
|
201
201
|
onChange: (val)=>{
|
|
202
202
|
if (val === minMin) {
|
|
203
203
|
methods.setValue(null);
|
|
@@ -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 { Result } from 'antd';
|
|
17
17
|
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
|
|
18
|
-
const ResultBlock = ({ blockId
|
|
18
|
+
const ResultBlock = ({ blockId, components: { Icon }, events, content, methods, properties })=>/*#__PURE__*/ React.createElement(Result, {
|
|
19
19
|
id: blockId,
|
|
20
20
|
title: renderHtml({
|
|
21
21
|
html: properties.title,
|
|
@@ -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 Label from '../Label/Label.js';
|
|
|
20
20
|
import getValueIndex from '../../getValueIndex.js';
|
|
21
21
|
import getUniqueValues from '../../getUniqueValues.js';
|
|
22
22
|
const Option = Select.Option;
|
|
23
|
-
const Selector = ({ blockId
|
|
23
|
+
const Selector = ({ blockId, components: { Icon, Link }, events, loading, methods, properties, required, validation, value })=>{
|
|
24
24
|
const [fetchState, setFetch] = useState(false);
|
|
25
25
|
const uniqueValueOptions = getUniqueValues(properties.options || []);
|
|
26
26
|
return /*#__PURE__*/ React.createElement(Label, {
|
|
@@ -85,6 +85,21 @@ const Selector = ({ blockId , components: { Icon , Link } , events , loading ,
|
|
|
85
85
|
name: 'onChange'
|
|
86
86
|
});
|
|
87
87
|
},
|
|
88
|
+
onBlur: ()=>{
|
|
89
|
+
methods.triggerEvent({
|
|
90
|
+
name: 'onBlur'
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
onFocus: ()=>{
|
|
94
|
+
methods.triggerEvent({
|
|
95
|
+
name: 'onFocus'
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
onClear: ()=>{
|
|
99
|
+
methods.triggerEvent({
|
|
100
|
+
name: 'onClear'
|
|
101
|
+
});
|
|
102
|
+
},
|
|
88
103
|
onSearch: async (value)=>{
|
|
89
104
|
setFetch(true);
|
|
90
105
|
const result = await methods.triggerEvent({
|
|
@@ -223,10 +223,22 @@
|
|
|
223
223
|
"type": "object",
|
|
224
224
|
"additionalProperties": false,
|
|
225
225
|
"properties": {
|
|
226
|
+
"onBlur": {
|
|
227
|
+
"type": "array",
|
|
228
|
+
"description": "Trigger action event occurs when selector loses focus."
|
|
229
|
+
},
|
|
226
230
|
"onChange": {
|
|
227
231
|
"type": "array",
|
|
228
232
|
"description": "Trigger action when selection is changed."
|
|
229
233
|
},
|
|
234
|
+
"onFocus": {
|
|
235
|
+
"type": "array",
|
|
236
|
+
"description": "Trigger action when selector gets focus."
|
|
237
|
+
},
|
|
238
|
+
"onClear": {
|
|
239
|
+
"type": "array",
|
|
240
|
+
"description": "Trigger action when selector is cleared."
|
|
241
|
+
},
|
|
230
242
|
"onSearch": {
|
|
231
243
|
"type": "array",
|
|
232
244
|
"description": "Trigger actions when input is changed. 'value' is passed to the _event operator to be used in actions such as search queries."
|