@lowdefy/blocks-antd 4.0.0-alpha.1 → 4.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/Affix/Affix.js +11 -6
- package/dist/blocks/Affix/style.less +1 -1
- package/dist/blocks/Alert/Alert.js +28 -10
- package/dist/blocks/Alert/style.less +1 -1
- package/dist/blocks/AutoComplete/AutoComplete.js +41 -34
- package/dist/blocks/AutoComplete/style.less +1 -1
- package/dist/blocks/Avatar/Avatar.js +12 -7
- package/dist/blocks/Avatar/schema.json +1 -1
- package/dist/blocks/Avatar/style.less +1 -1
- package/dist/blocks/Badge/Badge.js +12 -7
- package/dist/blocks/Badge/schema.json +1 -1
- package/dist/blocks/Badge/style.less +1 -1
- package/dist/blocks/Breadcrumb/Breadcrumb.js +56 -64
- package/dist/blocks/Breadcrumb/schema.json +1 -1
- package/dist/blocks/Breadcrumb/style.less +1 -1
- package/dist/blocks/Button/Button.js +22 -13
- package/dist/blocks/Button/schema.json +1 -1
- package/dist/blocks/Button/style.less +1 -1
- package/dist/blocks/ButtonSelector/ButtonSelector.js +36 -29
- package/dist/blocks/ButtonSelector/style.less +1 -1
- package/dist/blocks/Card/Card.js +11 -6
- package/dist/blocks/Card/style.less +1 -1
- package/dist/blocks/CheckboxSelector/CheckboxSelector.js +40 -34
- package/dist/blocks/CheckboxSelector/style.less +1 -1
- package/dist/blocks/CheckboxSwitch/CheckboxSwitch.js +21 -15
- package/dist/blocks/CheckboxSwitch/style.less +1 -1
- package/dist/blocks/Collapse/Collapse.js +38 -21
- package/dist/blocks/Collapse/schema.json +1 -1
- package/dist/blocks/Collapse/style.less +1 -1
- package/dist/blocks/Comment/Comment.js +13 -9
- package/dist/blocks/Comment/style.less +1 -1
- package/dist/blocks/ConfirmModal/ConfirmModal.js +28 -10
- package/dist/blocks/ConfirmModal/schema.json +1 -1
- package/dist/blocks/ConfirmModal/style.less +1 -1
- package/dist/blocks/Content/Content.js +11 -6
- package/dist/blocks/Content/style.less +1 -1
- package/dist/blocks/ControlledList/ControlledList.js +61 -63
- package/dist/blocks/ControlledList/style.less +1 -1
- package/dist/blocks/DateRangeSelector/DateRangeSelector.js +55 -50
- package/dist/blocks/DateRangeSelector/schema.json +2 -2
- package/dist/blocks/DateRangeSelector/style.less +1 -1
- package/dist/blocks/DateSelector/DateSelector.js +49 -44
- package/dist/blocks/DateSelector/schema.json +2 -2
- package/dist/blocks/DateSelector/style.less +1 -1
- package/dist/blocks/DateTimeSelector/DateTimeSelector.js +56 -51
- package/dist/blocks/DateTimeSelector/schema.json +2 -2
- package/dist/blocks/DateTimeSelector/style.less +1 -1
- package/dist/blocks/Descriptions/Descriptions.js +42 -38
- package/dist/blocks/Descriptions/style.less +1 -1
- package/dist/blocks/Divider/Divider.js +14 -9
- package/dist/blocks/Divider/style.less +1 -1
- package/dist/blocks/Drawer/Drawer.js +11 -6
- package/dist/blocks/Drawer/style.less +1 -1
- package/dist/blocks/Footer/Footer.js +11 -6
- package/dist/blocks/Footer/style.less +1 -1
- package/dist/blocks/Header/Header.js +11 -9
- package/dist/blocks/Header/schema.json +0 -4
- package/dist/blocks/Header/style.less +1 -1
- package/dist/blocks/Label/Label.js +70 -67
- package/dist/blocks/Label/getLabelCol.js +1 -1
- package/dist/blocks/Label/getWrapperCol.js +1 -1
- package/dist/blocks/Label/labelLogic.js +2 -3
- package/dist/blocks/Label/style.less +1 -1
- package/dist/blocks/Layout/Layout.js +11 -6
- package/dist/blocks/Layout/style.less +1 -1
- package/dist/blocks/Menu/Menu.js +123 -218
- package/dist/blocks/Menu/schema.json +1 -15
- package/dist/blocks/Menu/style.less +1 -1
- package/dist/blocks/Message/Message.js +11 -6
- package/dist/blocks/Message/schema.json +1 -1
- package/dist/blocks/Message/style.less +1 -1
- package/dist/blocks/MobileMenu/MobileMenu.js +85 -85
- package/dist/blocks/MobileMenu/schema.json +1 -15
- package/dist/blocks/MobileMenu/style.less +1 -1
- package/dist/blocks/Modal/Modal.js +76 -60
- package/dist/blocks/Modal/style.less +1 -1
- package/dist/blocks/MonthSelector/MonthSelector.js +47 -42
- package/dist/blocks/MonthSelector/schema.json +2 -2
- package/dist/blocks/MonthSelector/style.less +1 -1
- package/dist/blocks/MultipleSelector/MultipleSelector.js +104 -99
- package/dist/blocks/MultipleSelector/schema.json +6 -6
- package/dist/blocks/MultipleSelector/style.less +1 -1
- package/dist/blocks/Notification/Notification.js +13 -8
- package/dist/blocks/Notification/schema.json +2 -2
- package/dist/blocks/Notification/style.less +1 -1
- package/dist/blocks/NumberInput/NumberInput.js +14 -6
- package/dist/blocks/NumberInput/style.less +1 -1
- package/dist/blocks/PageHCF/PageHCF.js +34 -34
- package/dist/blocks/PageHCF/schema.json +0 -29
- package/dist/blocks/PageHCF/style.less +1 -1
- package/dist/blocks/PageHCSF/PageHCSF.js +61 -66
- package/dist/blocks/PageHCSF/schema.json +0 -30
- package/dist/blocks/PageHCSF/style.less +1 -1
- package/dist/blocks/PageHSCF/PageHSCF.js +61 -66
- package/dist/blocks/PageHSCF/schema.json +0 -30
- package/dist/blocks/PageHSCF/style.less +1 -1
- package/dist/blocks/PageHeaderMenu/PageHeaderMenu.js +151 -167
- package/dist/blocks/PageHeaderMenu/schema.json +1 -24
- package/dist/blocks/PageHeaderMenu/style.less +1 -1
- package/dist/blocks/PageSHCF/PageSHCF.js +60 -65
- package/dist/blocks/PageSHCF/schema.json +0 -30
- package/dist/blocks/PageSHCF/style.less +1 -1
- package/dist/blocks/PageSiderMenu/PageSiderMenu.js +258 -285
- package/dist/blocks/PageSiderMenu/schema.json +1 -31
- package/dist/blocks/PageSiderMenu/style.less +1 -1
- package/dist/blocks/Pagination/Pagination.js +17 -5
- package/dist/blocks/Pagination/style.less +1 -1
- package/dist/blocks/Paragraph/Paragraph.js +21 -14
- package/dist/blocks/Paragraph/style.less +1 -1
- package/dist/blocks/ParagraphInput/ParagraphInput.js +22 -14
- package/dist/blocks/ParagraphInput/style.less +1 -1
- package/dist/blocks/PasswordInput/PasswordInput.js +14 -6
- package/dist/blocks/PasswordInput/style.less +1 -1
- package/dist/blocks/Progress/Progress.js +9 -3
- package/dist/blocks/Progress/style.less +1 -1
- package/dist/blocks/RadioSelector/RadioSelector.js +40 -34
- package/dist/blocks/RadioSelector/style.less +1 -1
- package/dist/blocks/RatingSlider/RatingSlider.js +127 -126
- package/dist/blocks/RatingSlider/schema.json +4 -4
- package/dist/blocks/RatingSlider/style.less +1 -1
- package/dist/blocks/Result/Result.js +13 -8
- package/dist/blocks/Result/schema.json +1 -1
- package/dist/blocks/Result/style.less +1 -1
- package/dist/blocks/Selector/Selector.js +96 -91
- package/dist/blocks/Selector/schema.json +4 -4
- package/dist/blocks/Selector/style.less +1 -1
- package/dist/blocks/Sider/Sider.js +12 -9
- package/dist/blocks/Sider/schema.json +0 -7
- package/dist/blocks/Sider/style.less +1 -1
- package/dist/blocks/Statistic/Statistic.js +11 -5
- package/dist/blocks/Statistic/schema.json +2 -2
- package/dist/blocks/Statistic/style.less +1 -1
- package/dist/blocks/Switch/Switch.js +22 -19
- package/dist/blocks/Switch/schema.json +4 -4
- package/dist/blocks/Switch/style.less +1 -1
- package/dist/blocks/Tabs/Tabs.js +36 -24
- package/dist/blocks/Tabs/schema.json +1 -1
- package/dist/blocks/Tabs/style.less +1 -1
- package/dist/blocks/TextArea/TextArea.js +14 -6
- package/dist/blocks/TextArea/style.less +1 -1
- package/dist/blocks/TextInput/TextInput.js +16 -8
- package/dist/blocks/TextInput/schema.json +2 -2
- package/dist/blocks/TextInput/style.less +1 -1
- package/dist/blocks/TimelineList/TimelineList.js +56 -40
- package/dist/blocks/TimelineList/schema.json +4 -1
- package/dist/blocks/TimelineList/style.less +1 -1
- package/dist/blocks/Title/Title.js +21 -14
- package/dist/blocks/Title/style.less +1 -1
- package/dist/blocks/TitleInput/TitleInput.js +22 -14
- package/dist/blocks/TitleInput/style.less +1 -1
- package/dist/blocks/Tooltip/Tooltip.js +11 -9
- package/dist/blocks/Tooltip/style.less +1 -1
- package/dist/blocks/WeekSelector/WeekSelector.js +47 -42
- package/dist/blocks/WeekSelector/schema.json +2 -2
- package/dist/blocks/WeekSelector/style.less +1 -1
- package/dist/blocks.js +74 -0
- package/dist/color.js +1 -1
- package/dist/disabledDate.js +2 -3
- package/dist/getUniqueValues.js +1 -1
- package/dist/getValueIndex.js +1 -1
- package/dist/style.less +1 -1
- package/dist/{blocks/Alert/index.js → types.js} +16 -19
- package/dist/useRunAfterUpdate.js +1 -1
- package/dist/validationExamples.js +1 -1
- package/package.json +27 -23
- package/dist/blocks/Affix/index.js +0 -26
- package/dist/blocks/AutoComplete/index.js +0 -33
- package/dist/blocks/Avatar/index.js +0 -28
- package/dist/blocks/Badge/index.js +0 -26
- package/dist/blocks/Breadcrumb/index.js +0 -31
- package/dist/blocks/Button/index.js +0 -28
- package/dist/blocks/ButtonSelector/index.js +0 -33
- package/dist/blocks/Card/index.js +0 -31
- package/dist/blocks/CheckboxSelector/index.js +0 -33
- package/dist/blocks/CheckboxSwitch/index.js +0 -36
- package/dist/blocks/Collapse/index.js +0 -31
- package/dist/blocks/Comment/index.js +0 -28
- package/dist/blocks/ConfirmModal/index.js +0 -59
- package/dist/blocks/Content/index.js +0 -26
- package/dist/blocks/ControlledList/index.js +0 -36
- package/dist/blocks/DateRangeSelector/index.js +0 -33
- package/dist/blocks/DateSelector/index.js +0 -33
- package/dist/blocks/DateTimeSelector/index.js +0 -33
- package/dist/blocks/Descriptions/index.js +0 -31
- package/dist/blocks/Divider/index.js +0 -31
- package/dist/blocks/Drawer/index.js +0 -41
- package/dist/blocks/Footer/index.js +0 -26
- package/dist/blocks/Header/index.js +0 -26
- package/dist/blocks/Label/index.js +0 -32
- package/dist/blocks/Layout/index.js +0 -31
- package/dist/blocks/Menu/index.js +0 -26
- package/dist/blocks/Message/index.js +0 -53
- package/dist/blocks/MobileMenu/index.js +0 -41
- package/dist/blocks/Modal/index.js +0 -41
- package/dist/blocks/MonthSelector/index.js +0 -33
- package/dist/blocks/MultipleSelector/index.js +0 -33
- package/dist/blocks/Notification/index.js +0 -59
- package/dist/blocks/NumberInput/index.js +0 -33
- package/dist/blocks/PageHCF/index.js +0 -31
- package/dist/blocks/PageHCSF/index.js +0 -46
- package/dist/blocks/PageHSCF/index.js +0 -46
- package/dist/blocks/PageHeaderMenu/index.js +0 -46
- package/dist/blocks/PageSHCF/index.js +0 -46
- package/dist/blocks/PageSiderMenu/index.js +0 -57
- package/dist/blocks/Pagination/index.js +0 -37
- package/dist/blocks/Paragraph/index.js +0 -28
- package/dist/blocks/ParagraphInput/index.js +0 -36
- package/dist/blocks/PasswordInput/index.js +0 -33
- package/dist/blocks/Progress/index.js +0 -31
- package/dist/blocks/RadioSelector/index.js +0 -33
- package/dist/blocks/RatingSlider/index.js +0 -33
- package/dist/blocks/Result/index.js +0 -31
- package/dist/blocks/S3UploadButton/S3UploadButton.js +0 -171
- package/dist/blocks/S3UploadButton/index.js +0 -29
- package/dist/blocks/S3UploadButton/schema.json +0 -83
- package/dist/blocks/S3UploadButton/style.less +0 -18
- package/dist/blocks/Selector/index.js +0 -33
- package/dist/blocks/Sider/index.js +0 -41
- package/dist/blocks/Statistic/index.js +0 -31
- package/dist/blocks/Switch/index.js +0 -33
- package/dist/blocks/Tabs/index.js +0 -31
- package/dist/blocks/TextArea/index.js +0 -33
- package/dist/blocks/TextInput/index.js +0 -33
- package/dist/blocks/TimelineList/index.js +0 -31
- package/dist/blocks/Title/index.js +0 -31
- package/dist/blocks/TitleInput/index.js +0 -39
- package/dist/blocks/Tooltip/index.js +0 -31
- package/dist/blocks/WeekSelector/index.js +0 -33
- package/dist/index.js +0 -152
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
/*
|
|
3
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
4
3
|
|
|
5
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
you may not use this file except in compliance with the License.
|
|
@@ -21,15 +20,13 @@ import classNames from 'classnames';
|
|
|
21
20
|
import CheckboxSelector from '../CheckboxSelector/CheckboxSelector.js';
|
|
22
21
|
import Label from '../Label/Label.js';
|
|
23
22
|
const includeMarks = (minMax, minMin, step = 1)=>{
|
|
24
|
-
const marks = {
|
|
25
|
-
};
|
|
23
|
+
const marks = {};
|
|
26
24
|
marks[minMin] = {
|
|
27
25
|
style: {
|
|
28
26
|
marginTop: 2,
|
|
29
27
|
fontSize: 12
|
|
30
28
|
},
|
|
31
|
-
label: /*#__PURE__*/
|
|
32
|
-
})
|
|
29
|
+
label: /*#__PURE__*/ React.createElement("span", null)
|
|
33
30
|
};
|
|
34
31
|
// round to fix floating point error
|
|
35
32
|
for(let k = minMax[0]; k <= minMax[1]; k = parseFloat((k + step).toPrecision(8))){
|
|
@@ -38,9 +35,7 @@ const includeMarks = (minMax, minMin, step = 1)=>{
|
|
|
38
35
|
marginTop: 2,
|
|
39
36
|
fontSize: 12
|
|
40
37
|
},
|
|
41
|
-
label: /*#__PURE__*/
|
|
42
|
-
children: k
|
|
43
|
-
})
|
|
38
|
+
label: /*#__PURE__*/ React.createElement("strong", null, k)
|
|
44
39
|
};
|
|
45
40
|
}
|
|
46
41
|
return marks;
|
|
@@ -92,14 +87,13 @@ const RatingSlider = ({ blockId , components: { Icon , Link } , events , loadin
|
|
|
92
87
|
// round to fix floating point error
|
|
93
88
|
const minMin = parseFloat((minMax[0] - (properties.step || 1)).toPrecision(8));
|
|
94
89
|
const validationColor = validation.status === 'error' ? '#ff4d4f' : validation.status === 'warning' ? '#faad14' : null;
|
|
95
|
-
return(/*#__PURE__*/
|
|
90
|
+
return(/*#__PURE__*/ React.createElement(Label, {
|
|
96
91
|
blockId: blockId,
|
|
97
92
|
components: {
|
|
98
93
|
Icon,
|
|
99
94
|
Link
|
|
100
95
|
},
|
|
101
96
|
events: events,
|
|
102
|
-
loading: loading,
|
|
103
97
|
methods: methods,
|
|
104
98
|
properties: {
|
|
105
99
|
title: properties.title,
|
|
@@ -109,133 +103,140 @@ const RatingSlider = ({ blockId , components: { Icon , Link } , events , loadin
|
|
|
109
103
|
required: required,
|
|
110
104
|
validation: validation,
|
|
111
105
|
content: {
|
|
112
|
-
content: ()=>/*#__PURE__*/
|
|
106
|
+
content: ()=>/*#__PURE__*/ React.createElement("div", {
|
|
113
107
|
className: methods.makeCssClass([
|
|
114
108
|
styles.content,
|
|
115
109
|
{
|
|
116
110
|
paddingRight: validation.status && 30
|
|
117
111
|
},
|
|
118
|
-
])
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
112
|
+
])
|
|
113
|
+
}, !required && !properties.disableNotApplicable && /*#__PURE__*/ React.createElement(CheckboxSelector, {
|
|
114
|
+
blockId: `${blockId}_checkbox_selector`,
|
|
115
|
+
components: {
|
|
116
|
+
Icon,
|
|
117
|
+
Link
|
|
118
|
+
},
|
|
119
|
+
properties: mergeObjects([
|
|
120
|
+
{
|
|
121
|
+
label: {
|
|
122
|
+
disabled: true
|
|
125
123
|
},
|
|
126
|
-
|
|
124
|
+
options: [
|
|
127
125
|
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
options: [
|
|
132
|
-
{
|
|
133
|
-
value: true,
|
|
134
|
-
label: properties.notApplicableLabel || 'N/A'
|
|
135
|
-
}
|
|
136
|
-
],
|
|
137
|
-
color: properties.color
|
|
138
|
-
},
|
|
139
|
-
properties.CheckboxInput,
|
|
140
|
-
{
|
|
141
|
-
style: styles.checkbox
|
|
142
|
-
},
|
|
143
|
-
]),
|
|
144
|
-
methods: {
|
|
145
|
-
...methods,
|
|
146
|
-
setValue: (val)=>{
|
|
147
|
-
if (val[0] === true) {
|
|
148
|
-
unCheck(true);
|
|
149
|
-
methods.setValue(properties.notApplicableLabel || 'N/A');
|
|
150
|
-
} else {
|
|
151
|
-
unCheck(false);
|
|
152
|
-
}
|
|
126
|
+
value: true,
|
|
127
|
+
label: properties.notApplicableLabel || 'N/A'
|
|
153
128
|
}
|
|
129
|
+
],
|
|
130
|
+
color: properties.color,
|
|
131
|
+
disabled: properties.disabled || loading
|
|
132
|
+
},
|
|
133
|
+
properties.CheckboxInput,
|
|
134
|
+
{
|
|
135
|
+
style: styles.checkbox
|
|
136
|
+
},
|
|
137
|
+
]),
|
|
138
|
+
methods: {
|
|
139
|
+
...methods,
|
|
140
|
+
setValue: (val)=>{
|
|
141
|
+
if (val[0] === true) {
|
|
142
|
+
unCheck(true);
|
|
143
|
+
methods.setValue(properties.notApplicableLabel || 'N/A');
|
|
144
|
+
} else {
|
|
145
|
+
unCheck(false);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
value: [
|
|
150
|
+
check
|
|
151
|
+
]
|
|
152
|
+
}), !properties.disableIcons && /*#__PURE__*/ React.createElement(Icon, {
|
|
153
|
+
blockId: `${blockId}_iconMin`,
|
|
154
|
+
events: events,
|
|
155
|
+
properties: mergeObjects([
|
|
156
|
+
{
|
|
157
|
+
name: 'AiOutlineFrown',
|
|
158
|
+
style: styles.iconLeft,
|
|
159
|
+
color: properties.color
|
|
160
|
+
},
|
|
161
|
+
propertiesIconMin,
|
|
162
|
+
])
|
|
163
|
+
}), /*#__PURE__*/ React.createElement(Slider, {
|
|
164
|
+
id: `${blockId}_input`,
|
|
165
|
+
components: {
|
|
166
|
+
Icon,
|
|
167
|
+
Link
|
|
168
|
+
},
|
|
169
|
+
events: events,
|
|
170
|
+
className: classNames(methods.makeCssClass([
|
|
171
|
+
properties.color && {
|
|
172
|
+
'& > div.ant-slider-track': {
|
|
173
|
+
backgroundColor: `${properties.color} !important`
|
|
154
174
|
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
]
|
|
158
|
-
}),
|
|
159
|
-
!properties.disableIcons && /*#__PURE__*/ _jsx(Icon, {
|
|
160
|
-
blockId: `${blockId}_iconMin`,
|
|
161
|
-
events: events,
|
|
162
|
-
properties: mergeObjects([
|
|
163
|
-
{
|
|
164
|
-
name: 'FrownOutlined',
|
|
165
|
-
style: styles.iconLeft,
|
|
166
|
-
color: properties.color
|
|
167
|
-
},
|
|
168
|
-
propertiesIconMin,
|
|
169
|
-
])
|
|
170
|
-
}),
|
|
171
|
-
/*#__PURE__*/ _jsx(Slider, {
|
|
172
|
-
id: `${blockId}_input`,
|
|
173
|
-
components: {
|
|
174
|
-
Icon,
|
|
175
|
-
Link
|
|
176
|
-
},
|
|
177
|
-
events: events,
|
|
178
|
-
className: classNames(methods.makeCssClass([
|
|
179
|
-
properties.color && {
|
|
180
|
-
'& > div.ant-slider-track': {
|
|
181
|
-
backgroundColor: `${properties.color} !important`
|
|
182
|
-
},
|
|
183
|
-
'& > div.ant-slider-handle': {
|
|
184
|
-
borderColor: `${properties.color} !important`
|
|
185
|
-
},
|
|
186
|
-
'& > div.ant-slider-step > span.ant-slider-dot-active': {
|
|
187
|
-
borderColor: `${properties.color} !important`
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
validationColor && {
|
|
191
|
-
'& > div.ant-slider-rail': {
|
|
192
|
-
backgroundColor: `${validationColor} !important`
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
]), methods.makeCssClass(styles.slider), methods.makeCssClass(properties.inputStyle)),
|
|
196
|
-
autoFocus: properties.autoFocus,
|
|
197
|
-
disabled: properties.disabled || check === true && !properties.disableNotApplicable,
|
|
198
|
-
dots: get(properties, 'showDots', {
|
|
199
|
-
default: true
|
|
200
|
-
}),
|
|
201
|
-
tooltipVisible: value === null || properties.tooltipVisible === 'never' ? false : properties.tooltipVisible === 'always' ? true : undefined,
|
|
202
|
-
tipFormatter: (val)=>`${val}`
|
|
203
|
-
,
|
|
204
|
-
marks: properties.marks || (get(properties, 'showMarks', {
|
|
205
|
-
default: true
|
|
206
|
-
}) ? includeMarks(minMax, minMin, properties.step || 1) : undefined),
|
|
207
|
-
min: minMin,
|
|
208
|
-
max: minMax[1],
|
|
209
|
-
range: false,
|
|
210
|
-
step: properties.step || 1,
|
|
211
|
-
onChange: (val)=>{
|
|
212
|
-
if (val === minMin) {
|
|
213
|
-
methods.setValue(null);
|
|
214
|
-
} else {
|
|
215
|
-
methods.setValue(val);
|
|
216
|
-
}
|
|
217
|
-
methods.triggerEvent({
|
|
218
|
-
name: 'onChange'
|
|
219
|
-
});
|
|
175
|
+
'& > div.ant-slider-handle': {
|
|
176
|
+
borderColor: `${properties.color} !important`
|
|
220
177
|
},
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
{
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
178
|
+
'& > div.ant-slider-step > span.ant-slider-dot-active': {
|
|
179
|
+
borderColor: `${properties.color} !important`
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
validationColor && {
|
|
183
|
+
'& > div.ant-slider-rail': {
|
|
184
|
+
backgroundColor: `${validationColor} !important`
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
]), methods.makeCssClass(styles.slider), methods.makeCssClass(properties.inputStyle)),
|
|
188
|
+
autoFocus: properties.autoFocus,
|
|
189
|
+
disabled: properties.disabled || check === true && !properties.disableNotApplicable || loading,
|
|
190
|
+
dots: get(properties, 'showDots', {
|
|
191
|
+
default: true
|
|
192
|
+
}),
|
|
193
|
+
tooltipVisible: value === null || properties.tooltipVisible === 'never' ? false : properties.tooltipVisible === 'always' ? true : undefined,
|
|
194
|
+
tipFormatter: (val)=>`${val}`
|
|
195
|
+
,
|
|
196
|
+
marks: properties.marks || (get(properties, 'showMarks', {
|
|
197
|
+
default: true
|
|
198
|
+
}) ? includeMarks(minMax, minMin, properties.step || 1) : undefined),
|
|
199
|
+
min: minMin,
|
|
200
|
+
max: minMax[1],
|
|
201
|
+
range: false,
|
|
202
|
+
step: properties.step || 1,
|
|
203
|
+
onChange: (val)=>{
|
|
204
|
+
if (val === minMin) {
|
|
205
|
+
methods.setValue(null);
|
|
206
|
+
} else {
|
|
207
|
+
methods.setValue(val);
|
|
208
|
+
}
|
|
209
|
+
methods.triggerEvent({
|
|
210
|
+
name: 'onChange'
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
value: value === null ? minMin : value
|
|
214
|
+
}), !properties.disableIcons && /*#__PURE__*/ React.createElement(Icon, {
|
|
215
|
+
blockId: `${blockId}_iconMax`,
|
|
216
|
+
events: events,
|
|
217
|
+
properties: mergeObjects([
|
|
218
|
+
{
|
|
219
|
+
name: 'AiOutlineSmile',
|
|
220
|
+
style: styles.iconRight,
|
|
221
|
+
color: properties.color
|
|
222
|
+
},
|
|
223
|
+
propertiesIconMax,
|
|
224
|
+
])
|
|
225
|
+
}))
|
|
237
226
|
}
|
|
238
227
|
}));
|
|
239
228
|
};
|
|
240
229
|
RatingSlider.defaultProps = blockDefaultProps;
|
|
230
|
+
RatingSlider.meta = {
|
|
231
|
+
valueType: 'any',
|
|
232
|
+
category: 'input',
|
|
233
|
+
icons: [
|
|
234
|
+
...Label.meta.icons,
|
|
235
|
+
'AiOutlineFrown',
|
|
236
|
+
'AiOutlineSmile'
|
|
237
|
+
],
|
|
238
|
+
styles: [
|
|
239
|
+
'blocks/RatingSlider/style.less'
|
|
240
|
+
]
|
|
241
|
+
};
|
|
241
242
|
export default RatingSlider;
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
},
|
|
34
34
|
"minIcon": {
|
|
35
35
|
"type": ["string", "object"],
|
|
36
|
-
"default": "
|
|
37
|
-
"description": "Name of an
|
|
36
|
+
"default": "AiOutlineFrown",
|
|
37
|
+
"description": "Name of an React-Icon (See <a href='https://react-icons.github.io/react-icons/'>all icons</a>) or properties of an Icon block to customize the icon to the left of the minimum side of the slider.",
|
|
38
38
|
"docs": {
|
|
39
39
|
"displayType": "icon"
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"maxIcon": {
|
|
43
43
|
"type": ["string", "object"],
|
|
44
|
-
"default": "
|
|
45
|
-
"description": "Name of an
|
|
44
|
+
"default": "AiOutlineSmile",
|
|
45
|
+
"description": "Name of an React-Icon (See <a href='https://react-icons.github.io/react-icons/'>all icons</a>) or properties of an Icon block to customize the icon to the right of the maximum side of the slider.",
|
|
46
46
|
"docs": {
|
|
47
47
|
"displayType": "icon"
|
|
48
48
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
/*
|
|
3
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
4
3
|
|
|
5
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
you may not use this file except in compliance with the License.
|
|
@@ -16,7 +15,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
16
15
|
*/ import React from 'react';
|
|
17
16
|
import { Result } from 'antd';
|
|
18
17
|
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
|
|
19
|
-
const ResultBlock = ({ blockId , components: { Icon } , events , content , methods , properties })=>/*#__PURE__*/
|
|
18
|
+
const ResultBlock = ({ blockId , components: { Icon } , events , content , methods , properties })=>/*#__PURE__*/ React.createElement(Result, {
|
|
20
19
|
id: blockId,
|
|
21
20
|
title: renderHtml({
|
|
22
21
|
html: properties.title,
|
|
@@ -27,18 +26,24 @@ const ResultBlock = ({ blockId , components: { Icon } , events , content , meth
|
|
|
27
26
|
methods
|
|
28
27
|
}),
|
|
29
28
|
status: properties.status,
|
|
30
|
-
icon: properties.icon && /*#__PURE__*/
|
|
29
|
+
icon: properties.icon && /*#__PURE__*/ React.createElement(Icon, {
|
|
31
30
|
blockId: `${blockId}_icon`,
|
|
32
31
|
events: events,
|
|
33
32
|
properties: properties.icon
|
|
34
33
|
}),
|
|
35
34
|
extra: content.extra && content.extra({
|
|
36
35
|
justifyContent: 'center'
|
|
37
|
-
}),
|
|
38
|
-
children: content.content && content.content({
|
|
39
|
-
justifyContent: 'center'
|
|
40
36
|
})
|
|
41
|
-
}
|
|
37
|
+
}, content.content && content.content({
|
|
38
|
+
justifyContent: 'center'
|
|
39
|
+
}))
|
|
42
40
|
;
|
|
43
41
|
ResultBlock.defaultProps = blockDefaultProps;
|
|
42
|
+
ResultBlock.meta = {
|
|
43
|
+
category: 'container',
|
|
44
|
+
icons: [],
|
|
45
|
+
styles: [
|
|
46
|
+
'blocks/Result/style.less'
|
|
47
|
+
]
|
|
48
|
+
};
|
|
44
49
|
export default ResultBlock;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"properties": {
|
|
7
7
|
"icon": {
|
|
8
8
|
"type": ["string", "object"],
|
|
9
|
-
"description": "Name of an
|
|
9
|
+
"description": "Name of an React-Icon (See <a href='https://react-icons.github.io/react-icons/'>all icons</a>) or properties of an Icon block to customize icon to use as result image.",
|
|
10
10
|
"docs": {
|
|
11
11
|
"displayType": "icon"
|
|
12
12
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
/*
|
|
3
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
4
3
|
|
|
5
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
you may not use this file except in compliance with the License.
|
|
@@ -24,7 +23,7 @@ const Option = Select.Option;
|
|
|
24
23
|
const Selector = ({ blockId , components: { Icon , Link } , events , loading , methods , properties , required , validation , value: value1 , })=>{
|
|
25
24
|
const [fetchState, setFetch] = useState(false);
|
|
26
25
|
const uniqueValueOptions = getUniqueValues(properties.options || []);
|
|
27
|
-
return(/*#__PURE__*/
|
|
26
|
+
return(/*#__PURE__*/ React.createElement(Label, {
|
|
28
27
|
blockId: blockId,
|
|
29
28
|
components: {
|
|
30
29
|
Icon,
|
|
@@ -38,100 +37,106 @@ const Selector = ({ blockId , components: { Icon , Link } , events , loading ,
|
|
|
38
37
|
},
|
|
39
38
|
validation: validation,
|
|
40
39
|
required: required,
|
|
41
|
-
loading: loading,
|
|
42
40
|
content: {
|
|
43
|
-
content: ()=>/*#__PURE__*/
|
|
41
|
+
content: ()=>/*#__PURE__*/ React.createElement("div", {
|
|
44
42
|
className: methods.makeCssClass({
|
|
45
43
|
width: '100%'
|
|
44
|
+
})
|
|
45
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
46
|
+
id: `${blockId}_popup`
|
|
47
|
+
}), /*#__PURE__*/ React.createElement(Select, {
|
|
48
|
+
id: `${blockId}_input`,
|
|
49
|
+
bordered: properties.bordered,
|
|
50
|
+
className: methods.makeCssClass([
|
|
51
|
+
{
|
|
52
|
+
width: '100%'
|
|
53
|
+
},
|
|
54
|
+
properties.inputStyle
|
|
55
|
+
]),
|
|
56
|
+
mode: "single",
|
|
57
|
+
autoFocus: properties.autoFocus,
|
|
58
|
+
getPopupContainer: ()=>document.getElementById(`${blockId}_popup`)
|
|
59
|
+
,
|
|
60
|
+
disabled: properties.disabled || loading,
|
|
61
|
+
placeholder: get(properties, 'placeholder', {
|
|
62
|
+
default: 'Select item'
|
|
46
63
|
}),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
})
|
|
112
|
-
}, i) : /*#__PURE__*/ _jsx(Option, {
|
|
113
|
-
className: methods.makeCssClass([
|
|
114
|
-
properties.optionsStyle,
|
|
115
|
-
opt.style
|
|
116
|
-
]),
|
|
117
|
-
disabled: opt.disabled,
|
|
118
|
-
filterstring: opt.filterString,
|
|
119
|
-
id: `${blockId}_${i}`,
|
|
120
|
-
value: `${i}`,
|
|
121
|
-
children: type.isNone(opt.label) ? renderHtml({
|
|
122
|
-
html: `${opt.value}`,
|
|
123
|
-
methods
|
|
124
|
-
}) : renderHtml({
|
|
125
|
-
html: opt.label,
|
|
126
|
-
methods
|
|
127
|
-
})
|
|
128
|
-
}, i)
|
|
129
|
-
)
|
|
130
|
-
})
|
|
131
|
-
]
|
|
132
|
-
})
|
|
64
|
+
suffixIcon: properties.suffixIcon && /*#__PURE__*/ React.createElement(Icon, {
|
|
65
|
+
blockId: `${blockId}_suffixIcon`,
|
|
66
|
+
events: events,
|
|
67
|
+
properties: properties.suffixIcon
|
|
68
|
+
}),
|
|
69
|
+
clearIcon: properties.clearIcon && /*#__PURE__*/ React.createElement(Icon, {
|
|
70
|
+
blockId: `${blockId}_clearIcon`,
|
|
71
|
+
events: events,
|
|
72
|
+
properties: properties.clearIcon
|
|
73
|
+
}),
|
|
74
|
+
showArrow: properties.showArrow,
|
|
75
|
+
allowClear: properties.allowClear !== false,
|
|
76
|
+
showSearch: get(properties, 'showSearch', {
|
|
77
|
+
default: true
|
|
78
|
+
}),
|
|
79
|
+
size: properties.size,
|
|
80
|
+
filterOption: (input, option)=>(option.filterstring || option.children.props.html || '').toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
81
|
+
,
|
|
82
|
+
notFoundContent: fetchState ? 'Loading' : 'Not found',
|
|
83
|
+
onChange: (newVal)=>{
|
|
84
|
+
methods.setValue(type.isPrimitive(uniqueValueOptions[newVal]) ? uniqueValueOptions[newVal] : uniqueValueOptions[newVal].value);
|
|
85
|
+
methods.triggerEvent({
|
|
86
|
+
name: 'onChange'
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
onSearch: async (value)=>{
|
|
90
|
+
setFetch(true);
|
|
91
|
+
const result = await methods.triggerEvent({
|
|
92
|
+
name: 'onSearch',
|
|
93
|
+
event: {
|
|
94
|
+
value
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
if (!result.bounced) {
|
|
98
|
+
setFetch(false);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
value: getValueIndex(value1, uniqueValueOptions)
|
|
102
|
+
}, uniqueValueOptions.map((opt, i)=>type.isPrimitive(opt) ? /*#__PURE__*/ React.createElement(Option, {
|
|
103
|
+
className: methods.makeCssClass(properties.optionsStyle),
|
|
104
|
+
id: `${blockId}_${i}`,
|
|
105
|
+
key: i,
|
|
106
|
+
value: `${i}`
|
|
107
|
+
}, renderHtml({
|
|
108
|
+
html: `${opt}`,
|
|
109
|
+
methods
|
|
110
|
+
})) : /*#__PURE__*/ React.createElement(Option, {
|
|
111
|
+
className: methods.makeCssClass([
|
|
112
|
+
properties.optionsStyle,
|
|
113
|
+
opt.style
|
|
114
|
+
]),
|
|
115
|
+
disabled: opt.disabled,
|
|
116
|
+
filterstring: opt.filterString,
|
|
117
|
+
id: `${blockId}_${i}`,
|
|
118
|
+
key: i,
|
|
119
|
+
value: `${i}`
|
|
120
|
+
}, type.isNone(opt.label) ? renderHtml({
|
|
121
|
+
html: `${opt.value}`,
|
|
122
|
+
methods
|
|
123
|
+
}) : renderHtml({
|
|
124
|
+
html: opt.label,
|
|
125
|
+
methods
|
|
126
|
+
}))
|
|
127
|
+
)))
|
|
133
128
|
}
|
|
134
129
|
}));
|
|
135
130
|
};
|
|
136
131
|
Selector.defaultProps = blockDefaultProps;
|
|
132
|
+
Selector.meta = {
|
|
133
|
+
valueType: 'any',
|
|
134
|
+
category: 'input',
|
|
135
|
+
icons: [
|
|
136
|
+
...Label.meta.icons
|
|
137
|
+
],
|
|
138
|
+
styles: [
|
|
139
|
+
'blocks/Selector/style.less'
|
|
140
|
+
]
|
|
141
|
+
};
|
|
137
142
|
export default Selector;
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"clearIcon": {
|
|
23
23
|
"type": ["string", "object"],
|
|
24
|
-
"default": "
|
|
25
|
-
"description": "Name of an
|
|
24
|
+
"default": "AiOutlineCloseCircle",
|
|
25
|
+
"description": "Name of an React-Icon (See <a href='https://react-icons.github.io/react-icons/'>all icons</a>) or properties of an Icon block to customize icon at far right position of the selector, shown when user is given option to clear input.",
|
|
26
26
|
"docs": {
|
|
27
27
|
"displayType": "icon"
|
|
28
28
|
}
|
|
@@ -207,8 +207,8 @@
|
|
|
207
207
|
},
|
|
208
208
|
"suffixIcon": {
|
|
209
209
|
"type": ["string", "object"],
|
|
210
|
-
"default": "
|
|
211
|
-
"description": "Name of an
|
|
210
|
+
"default": "AiOutlineDown",
|
|
211
|
+
"description": "Name of an React-Icon (See <a href='https://react-icons.github.io/react-icons/'>all icons</a>) or properties of an Icon block to customize icon at the drop-down position of the selector.",
|
|
212
212
|
"docs": {
|
|
213
213
|
"displayType": "icon"
|
|
214
214
|
}
|