@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.
|
|
@@ -17,7 +17,7 @@ import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
|
17
17
|
import { get } from '@lowdefy/helpers';
|
|
18
18
|
import { Layout } from 'antd';
|
|
19
19
|
const Sider = Layout.Sider;
|
|
20
|
-
const triggerSetOpen = async ({ state
|
|
20
|
+
const triggerSetOpen = async ({ state, setOpen, methods, rename })=>{
|
|
21
21
|
if (!state) {
|
|
22
22
|
await methods.triggerEvent({
|
|
23
23
|
name: get(rename, 'events.onClose', {
|
|
@@ -34,12 +34,12 @@ const triggerSetOpen = async ({ state , setOpen , methods , rename })=>{
|
|
|
34
34
|
}
|
|
35
35
|
setOpen(state);
|
|
36
36
|
};
|
|
37
|
-
const SiderBlock = ({ blockId
|
|
37
|
+
const SiderBlock = ({ blockId, properties, content, methods, rename })=>{
|
|
38
38
|
const [openState, setOpen] = useState(!properties.initialCollapsed);
|
|
39
39
|
useEffect(()=>{
|
|
40
40
|
methods.registerMethod(get(rename, 'methods.toggleOpen', {
|
|
41
41
|
default: 'toggleOpen'
|
|
42
|
-
}),
|
|
42
|
+
}), ()=>triggerSetOpen({
|
|
43
43
|
state: !openState,
|
|
44
44
|
setOpen,
|
|
45
45
|
methods,
|
|
@@ -47,7 +47,7 @@ const SiderBlock = ({ blockId , properties , content , methods , rename })=>{
|
|
|
47
47
|
}));
|
|
48
48
|
methods.registerMethod(get(rename, 'methods.setOpen', {
|
|
49
49
|
default: 'setOpen'
|
|
50
|
-
}),
|
|
50
|
+
}), ({ open })=>triggerSetOpen({
|
|
51
51
|
state: !!open,
|
|
52
52
|
setOpen,
|
|
53
53
|
methods,
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import React from 'react';
|
|
16
|
+
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
17
|
+
import { Slider } from 'antd';
|
|
18
|
+
import classNames from 'classnames';
|
|
19
|
+
import Label from '../Label/Label.js';
|
|
20
|
+
const SliderBlock = ({ blockId, components: { Icon, Link }, events, loading, methods, properties, required, validation, value })=>{
|
|
21
|
+
return /*#__PURE__*/ React.createElement(Label, {
|
|
22
|
+
blockId: blockId,
|
|
23
|
+
components: {
|
|
24
|
+
Icon,
|
|
25
|
+
Link
|
|
26
|
+
},
|
|
27
|
+
events: events,
|
|
28
|
+
methods: methods,
|
|
29
|
+
properties: {
|
|
30
|
+
title: properties.title,
|
|
31
|
+
size: properties.size,
|
|
32
|
+
...properties.label
|
|
33
|
+
},
|
|
34
|
+
required: required,
|
|
35
|
+
validation: validation,
|
|
36
|
+
content: {
|
|
37
|
+
content: ()=>/*#__PURE__*/ React.createElement(Slider, {
|
|
38
|
+
id: `${blockId}_input`,
|
|
39
|
+
className: classNames(methods.makeCssClass(properties.inputStyle)),
|
|
40
|
+
disabled: properties.disabled || loading,
|
|
41
|
+
dots: properties.dots,
|
|
42
|
+
handleStyle: properties.handleStyle,
|
|
43
|
+
included: properties.included,
|
|
44
|
+
marks: properties.marks,
|
|
45
|
+
max: properties.max,
|
|
46
|
+
min: properties.min,
|
|
47
|
+
railStyle: properties.railStyle,
|
|
48
|
+
range: properties.range,
|
|
49
|
+
reverse: properties.reverse,
|
|
50
|
+
step: properties.step,
|
|
51
|
+
tooltip: properties.tooltip,
|
|
52
|
+
trackStyle: properties.trackStyle,
|
|
53
|
+
vertical: properties.vertical,
|
|
54
|
+
onChange: (val)=>{
|
|
55
|
+
methods.setValue(val);
|
|
56
|
+
methods.triggerEvent({
|
|
57
|
+
name: 'onChange'
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
value: value
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
SliderBlock.defaultProps = blockDefaultProps;
|
|
66
|
+
SliderBlock.meta = {
|
|
67
|
+
valueType: 'any',
|
|
68
|
+
category: 'input',
|
|
69
|
+
icons: [
|
|
70
|
+
...Label.meta.icons
|
|
71
|
+
],
|
|
72
|
+
styles: [
|
|
73
|
+
'blocks/Slider/style.less'
|
|
74
|
+
]
|
|
75
|
+
};
|
|
76
|
+
export default SliderBlock;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
@import 'antd/lib/slider/style/index.less';
|
|
18
|
+
@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.
|
|
@@ -16,9 +16,13 @@
|
|
|
16
16
|
import { Statistic } from 'antd';
|
|
17
17
|
import { type } from '@lowdefy/helpers';
|
|
18
18
|
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
|
|
19
|
-
const StatisticBlock = ({ blockId
|
|
19
|
+
const StatisticBlock = ({ blockId, components: { Icon }, events, properties, methods })=>{
|
|
20
|
+
const additionalProps = {};
|
|
21
|
+
if (properties.decimalSeparator) {
|
|
22
|
+
additionalProps.decimalSeparator = properties.decimalSeparator;
|
|
23
|
+
}
|
|
24
|
+
return /*#__PURE__*/ React.createElement(Statistic, {
|
|
20
25
|
className: methods.makeCssClass(properties.style),
|
|
21
|
-
decimalSeparator: properties.decimalSeparator,
|
|
22
26
|
groupSeparator: properties.groupSeparator,
|
|
23
27
|
id: blockId,
|
|
24
28
|
loading: properties.loading,
|
|
@@ -33,13 +37,15 @@ const StatisticBlock = ({ blockId , components: { Icon } , events , properties
|
|
|
33
37
|
blockId: `${blockId}_prefixIcon`,
|
|
34
38
|
events: events,
|
|
35
39
|
properties: properties.prefixIcon
|
|
36
|
-
}) : properties.prefix
|
|
40
|
+
}) : properties.prefix ?? '',
|
|
37
41
|
suffix: properties.suffixIcon ? /*#__PURE__*/ React.createElement(Icon, {
|
|
38
42
|
blockId: `${blockId}_suffixIcon`,
|
|
39
43
|
events: events,
|
|
40
44
|
properties: properties.suffixIcon
|
|
41
|
-
}) : properties.suffix
|
|
45
|
+
}) : properties.suffix ?? '',
|
|
46
|
+
...additionalProps
|
|
42
47
|
});
|
|
48
|
+
};
|
|
43
49
|
StatisticBlock.defaultProps = blockDefaultProps;
|
|
44
50
|
StatisticBlock.meta = {
|
|
45
51
|
category: 'display',
|
|
@@ -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 { Switch } from 'antd';
|
|
|
17
17
|
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
18
18
|
import { type, serializer } from '@lowdefy/helpers';
|
|
19
19
|
import Label from '../Label/Label.js';
|
|
20
|
-
const SwitchBlock = ({ blockId
|
|
20
|
+
const SwitchBlock = ({ blockId, components: { Icon, Link }, events, loading, methods, properties, required, validation, value })=>{
|
|
21
21
|
let propertiesIconChecked = serializer.copy(properties.checkedIcon);
|
|
22
22
|
if (type.isString(propertiesIconChecked)) {
|
|
23
23
|
propertiesIconChecked = {
|
package/dist/blocks/Tabs/Tabs.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,24 +12,10 @@
|
|
|
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
|
-
|
|
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';
|
|
30
|
-
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
15
|
+
*/ import React, { useState, useEffect } from 'react';
|
|
16
|
+
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
|
|
31
17
|
import { Tabs } from 'antd';
|
|
32
|
-
const getTabs = ({ content
|
|
18
|
+
const getTabs = ({ content, properties })=>{
|
|
33
19
|
let tabs = properties.tabs;
|
|
34
20
|
if (!tabs) {
|
|
35
21
|
tabs = Object.keys(content).sort().map((key)=>({
|
|
@@ -40,62 +26,78 @@ const getTabs = ({ content , properties })=>{
|
|
|
40
26
|
// remove extraAreaKey key area from tabs
|
|
41
27
|
return tabs.filter((tab)=>tab.key !== properties.extraAreaKey);
|
|
42
28
|
};
|
|
43
|
-
const
|
|
44
|
-
const additionalProps = {};
|
|
45
|
-
if (properties.activeKey) {
|
|
46
|
-
additionalProps.activeKey = properties.activeKey;
|
|
47
|
-
}
|
|
48
|
-
if (properties.extraAreaKey) {
|
|
49
|
-
additionalProps.tabBarExtraContent = content[properties.extraAreaKey] && content[properties.extraAreaKey]();
|
|
50
|
-
}
|
|
51
|
-
return additionalProps;
|
|
52
|
-
};
|
|
53
|
-
const TabsBlock = ({ blockId , components: { Icon } , events , content , methods , properties })=>{
|
|
29
|
+
const TabsBlock = ({ blockId, components: { Icon }, events, content, methods, properties })=>{
|
|
54
30
|
const tabs = getTabs({
|
|
55
31
|
content,
|
|
56
32
|
properties
|
|
57
33
|
});
|
|
58
|
-
const additionalProps =
|
|
59
|
-
|
|
60
|
-
properties
|
|
34
|
+
const additionalProps = {};
|
|
35
|
+
if (properties.extraAreaKey) {
|
|
36
|
+
additionalProps.tabBarExtraContent = content[properties.extraAreaKey] && content[properties.extraAreaKey]();
|
|
37
|
+
}
|
|
38
|
+
const [key, setKey] = useState(properties.defaultActiveKey ?? tabs[0].key);
|
|
39
|
+
useEffect(()=>{
|
|
40
|
+
methods.registerMethod('setActiveKey', ({ activeKey })=>{
|
|
41
|
+
if (activeKey !== key) {
|
|
42
|
+
setKey(activeKey);
|
|
43
|
+
methods.triggerEvent({
|
|
44
|
+
name: 'onChange',
|
|
45
|
+
event: {
|
|
46
|
+
activeKey
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
61
51
|
});
|
|
62
|
-
return /*#__PURE__*/ React.createElement(Tabs,
|
|
52
|
+
return /*#__PURE__*/ React.createElement(Tabs, {
|
|
53
|
+
activeKey: key,
|
|
63
54
|
animated: properties.animated !== undefined ? properties.animated : true,
|
|
64
|
-
defaultActiveKey: properties.defaultActiveKey || tabs[0].key,
|
|
65
55
|
id: blockId,
|
|
66
|
-
onChange: (activeKey)=>
|
|
56
|
+
onChange: (activeKey)=>{
|
|
57
|
+
setKey(activeKey);
|
|
58
|
+
methods.triggerEvent({
|
|
67
59
|
name: 'onChange',
|
|
68
60
|
event: {
|
|
69
61
|
activeKey
|
|
70
62
|
}
|
|
71
|
-
})
|
|
72
|
-
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
size: properties.size ?? 'default',
|
|
73
66
|
tabBarStyle: methods.makeCssClass(properties.tabBarStyle, true),
|
|
74
|
-
tabPosition: properties.tabPosition
|
|
75
|
-
type: properties.tabType
|
|
76
|
-
onTabScroll: ({ direction
|
|
67
|
+
tabPosition: properties.tabPosition ?? 'top',
|
|
68
|
+
type: properties.tabType ?? 'line',
|
|
69
|
+
onTabScroll: ({ direction })=>methods.triggerEvent({
|
|
77
70
|
name: 'onTabScroll',
|
|
78
71
|
event: {
|
|
79
72
|
direction
|
|
80
73
|
}
|
|
81
74
|
}),
|
|
82
|
-
onTabClick: (key)=>
|
|
75
|
+
onTabClick: (key)=>{
|
|
76
|
+
methods.triggerEvent({
|
|
83
77
|
name: 'onTabClick',
|
|
84
78
|
event: {
|
|
85
79
|
key
|
|
86
80
|
}
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
items: tabs.map((tab)=>({
|
|
84
|
+
id: `${blockId}_${tab.key}`,
|
|
85
|
+
key: tab.key,
|
|
86
|
+
disabled: tab.disabled,
|
|
87
|
+
label: /*#__PURE__*/ React.createElement("span", {
|
|
88
|
+
className: methods.makeCssClass(tab.titleStyle)
|
|
89
|
+
}, tab.icon && /*#__PURE__*/ React.createElement(Icon, {
|
|
90
|
+
blockId: `${blockId}_icon`,
|
|
91
|
+
events: events,
|
|
92
|
+
properties: tab.icon
|
|
93
|
+
}), tab.title ? renderHtml({
|
|
94
|
+
html: tab.title,
|
|
95
|
+
methods
|
|
96
|
+
}) : tab.key),
|
|
97
|
+
children: content[tab.key] && content[tab.key]()
|
|
98
|
+
})),
|
|
99
|
+
...additionalProps
|
|
100
|
+
});
|
|
99
101
|
};
|
|
100
102
|
TabsBlock.defaultProps = blockDefaultProps;
|
|
101
103
|
TabsBlock.meta = {
|
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
"type": "object",
|
|
5
5
|
"additionalProperties": false,
|
|
6
6
|
"properties": {
|
|
7
|
-
"activeKey": {
|
|
8
|
-
"type": "string",
|
|
9
|
-
"description": "Current TabPane's key."
|
|
10
|
-
},
|
|
11
7
|
"animated": {
|
|
12
8
|
"type": "boolean",
|
|
13
9
|
"default": true,
|
|
@@ -43,7 +39,7 @@
|
|
|
43
39
|
"properties": {
|
|
44
40
|
"title": {
|
|
45
41
|
"type": "string",
|
|
46
|
-
"description": "Title of the tab."
|
|
42
|
+
"description": "Title of the tab - supports html."
|
|
47
43
|
},
|
|
48
44
|
"key": {
|
|
49
45
|
"type": "string",
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import React from 'react';
|
|
16
|
+
import { Tag } from 'antd';
|
|
17
|
+
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
|
|
18
|
+
import { type } from '@lowdefy/helpers';
|
|
19
|
+
const TagBlock = ({ blockId, components: { Icon }, events, methods, onClick, onClose, properties })=>{
|
|
20
|
+
const additionalProps = {};
|
|
21
|
+
if (properties.icon) {
|
|
22
|
+
additionalProps.icon = /*#__PURE__*/ React.createElement(Icon, {
|
|
23
|
+
blockId: `${blockId}_icon`,
|
|
24
|
+
events: events,
|
|
25
|
+
properties: properties.icon
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (onClick || events.onClick) {
|
|
29
|
+
additionalProps.onClick = onClick || (()=>methods.triggerEvent({
|
|
30
|
+
name: 'onClick'
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
if (onClose || events.onClose) {
|
|
34
|
+
additionalProps.onClose = onClose || (()=>methods.triggerEvent({
|
|
35
|
+
name: 'onClose'
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
return /*#__PURE__*/ React.createElement(Tag, {
|
|
39
|
+
id: blockId,
|
|
40
|
+
closable: properties.closable,
|
|
41
|
+
color: properties.color,
|
|
42
|
+
className: methods.makeCssClass(properties.style),
|
|
43
|
+
...additionalProps
|
|
44
|
+
}, type.isString(properties.title) ? renderHtml({
|
|
45
|
+
html: properties.title,
|
|
46
|
+
methods
|
|
47
|
+
}) : properties.title ?? blockId);
|
|
48
|
+
};
|
|
49
|
+
TagBlock.defaultProps = blockDefaultProps;
|
|
50
|
+
TagBlock.meta = {
|
|
51
|
+
category: 'display',
|
|
52
|
+
icons: [],
|
|
53
|
+
styles: [
|
|
54
|
+
'blocks/Tag/style.less'
|
|
55
|
+
]
|
|
56
|
+
};
|
|
57
|
+
export default TagBlock;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"properties": {
|
|
3
|
+
"type": "object",
|
|
4
|
+
"additionalProperties": false,
|
|
5
|
+
"properties": {
|
|
6
|
+
"closable": {
|
|
7
|
+
"type": "boolean",
|
|
8
|
+
"default": false,
|
|
9
|
+
"description": "Allow tag to be closed."
|
|
10
|
+
},
|
|
11
|
+
"color": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"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.",
|
|
14
|
+
"docs": {
|
|
15
|
+
"displayType": "color"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"title": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Content title of tag - supports html."
|
|
21
|
+
},
|
|
22
|
+
"icon": {
|
|
23
|
+
"type": ["string", "object"],
|
|
24
|
+
"description": "Name of an Ant Design Icon or properties of an Icon block to customize alert icon.",
|
|
25
|
+
"docs": {
|
|
26
|
+
"displayType": "icon"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"events": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"additionalProperties": false,
|
|
34
|
+
"properties": {
|
|
35
|
+
"onClick": {
|
|
36
|
+
"type": "array",
|
|
37
|
+
"description": "Called when Tag is clicked."
|
|
38
|
+
},
|
|
39
|
+
"onClose": {
|
|
40
|
+
"type": "array",
|
|
41
|
+
"description": "Called when Tag close icon is clicked."
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
@import 'antd/lib/tag/style/index.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.
|
|
@@ -19,7 +19,7 @@ import { Input } from 'antd';
|
|
|
19
19
|
import Label from '../Label/Label.js';
|
|
20
20
|
import useRunAfterUpdate from '../../useRunAfterUpdate.js';
|
|
21
21
|
const TextAreaComp = Input.TextArea;
|
|
22
|
-
const TextAreaBlock = ({ blockId
|
|
22
|
+
const TextAreaBlock = ({ blockId, components, events, loading, properties, required, validation, value, methods })=>{
|
|
23
23
|
return /*#__PURE__*/ React.createElement(Label, {
|
|
24
24
|
blockId: blockId,
|
|
25
25
|
components: components,
|
|
@@ -63,6 +63,16 @@ const TextAreaBlock = ({ blockId , components , events , loading , properties ,
|
|
|
63
63
|
event.target.setSelectionRange(cStart, cEnd);
|
|
64
64
|
});
|
|
65
65
|
},
|
|
66
|
+
onFocus: ()=>{
|
|
67
|
+
methods.triggerEvent({
|
|
68
|
+
name: 'onFocus'
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
onBlur: ()=>{
|
|
72
|
+
methods.triggerEvent({
|
|
73
|
+
name: 'onBlur'
|
|
74
|
+
});
|
|
75
|
+
},
|
|
66
76
|
onPressEnter: ()=>{
|
|
67
77
|
methods.triggerEvent({
|
|
68
78
|
name: 'onPressEnter'
|
|
@@ -151,10 +151,18 @@
|
|
|
151
151
|
"type": "object",
|
|
152
152
|
"additionalProperties": false,
|
|
153
153
|
"properties": {
|
|
154
|
+
"onBlur": {
|
|
155
|
+
"type": "array",
|
|
156
|
+
"description": "Trigger action event occurs when text input loses focus."
|
|
157
|
+
},
|
|
154
158
|
"onChange": {
|
|
155
159
|
"type": "array",
|
|
156
160
|
"description": "Trigger action when text input is changed."
|
|
157
161
|
},
|
|
162
|
+
"onFocus": {
|
|
163
|
+
"type": "array",
|
|
164
|
+
"description": "Trigger action when text input gets focus."
|
|
165
|
+
},
|
|
158
166
|
"onPressEnter": {
|
|
159
167
|
"type": "array",
|
|
160
168
|
"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.
|
|
@@ -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 TextInput = ({ blockId
|
|
20
|
+
const TextInput = ({ blockId, components: { Icon, Link }, events, loading, methods, properties, required, validation, value })=>{
|
|
21
21
|
return /*#__PURE__*/ React.createElement(Label, {
|
|
22
22
|
blockId: blockId,
|
|
23
23
|
components: {
|
|
@@ -48,7 +48,7 @@ const TextInput = ({ blockId , components: { Icon , Link } , events , loading ,
|
|
|
48
48
|
status: validation.status,
|
|
49
49
|
value: value,
|
|
50
50
|
onChange: (event)=>{
|
|
51
|
-
|
|
51
|
+
let input = event.target.value;
|
|
52
52
|
if (properties.replaceInput) {
|
|
53
53
|
const regex = new RegExp(properties.replaceInput.pattern, properties.replaceInput.flags ?? 'gm');
|
|
54
54
|
input = input.replace(regex, properties.replaceInput.replacement ?? '');
|
|
@@ -68,6 +68,16 @@ const TextInput = ({ blockId , components: { Icon , Link } , events , loading ,
|
|
|
68
68
|
name: 'onPressEnter'
|
|
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
|
prefix: properties.prefix || properties.prefixIcon && /*#__PURE__*/ React.createElement(Icon, {
|
|
72
82
|
blockId: `${blockId}_prefixIcon`,
|
|
73
83
|
events: events,
|
|
@@ -157,10 +157,18 @@
|
|
|
157
157
|
"type": "object",
|
|
158
158
|
"additionalProperties": false,
|
|
159
159
|
"properties": {
|
|
160
|
+
"onBlur": {
|
|
161
|
+
"type": "array",
|
|
162
|
+
"description": "Trigger action event occurs when text input loses focus."
|
|
163
|
+
},
|
|
160
164
|
"onChange": {
|
|
161
165
|
"type": "array",
|
|
162
166
|
"description": "Trigger action when text input is changed."
|
|
163
167
|
},
|
|
168
|
+
"onFocus": {
|
|
169
|
+
"type": "array",
|
|
170
|
+
"description": "Trigger action when text input gets focus."
|
|
171
|
+
},
|
|
164
172
|
"onPressEnter": {
|
|
165
173
|
"type": "array",
|
|
166
174
|
"description": "Trigger action when enter is pressed while text input is focused."
|