@lowdefy/blocks-antd 4.0.0-alpha.26 → 4.0.0-alpha.29

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.
Files changed (193) hide show
  1. package/package.json +9 -10
  2. package/dist/blocks/Affix/Affix.js +0 -43
  3. package/dist/blocks/Affix/schema.json +0 -34
  4. package/dist/blocks/Affix/style.less +0 -17
  5. package/dist/blocks/Alert/Alert.js +0 -78
  6. package/dist/blocks/Alert/schema.json +0 -62
  7. package/dist/blocks/Alert/style.less +0 -17
  8. package/dist/blocks/AutoComplete/AutoComplete.js +0 -86
  9. package/dist/blocks/AutoComplete/schema.json +0 -148
  10. package/dist/blocks/AutoComplete/style.less +0 -17
  11. package/dist/blocks/Avatar/Avatar.js +0 -49
  12. package/dist/blocks/Avatar/schema.json +0 -71
  13. package/dist/blocks/Avatar/style.less +0 -17
  14. package/dist/blocks/Badge/Badge.js +0 -44
  15. package/dist/blocks/Badge/schema.json +0 -70
  16. package/dist/blocks/Badge/style.less +0 -17
  17. package/dist/blocks/Breadcrumb/Breadcrumb.js +0 -79
  18. package/dist/blocks/Breadcrumb/schema.json +0 -78
  19. package/dist/blocks/Breadcrumb/style.less +0 -17
  20. package/dist/blocks/Button/Button.js +0 -77
  21. package/dist/blocks/Button/schema.json +0 -91
  22. package/dist/blocks/Button/style.less +0 -17
  23. package/dist/blocks/ButtonSelector/ButtonSelector.js +0 -91
  24. package/dist/blocks/ButtonSelector/schema.json +0 -188
  25. package/dist/blocks/ButtonSelector/style.less +0 -18
  26. package/dist/blocks/Card/Card.js +0 -50
  27. package/dist/blocks/Card/schema.json +0 -58
  28. package/dist/blocks/Card/style.less +0 -17
  29. package/dist/blocks/CheckboxSelector/CheckboxSelector.js +0 -97
  30. package/dist/blocks/CheckboxSelector/schema.json +0 -193
  31. package/dist/blocks/CheckboxSelector/style.less +0 -19
  32. package/dist/blocks/CheckboxSwitch/CheckboxSwitch.js +0 -74
  33. package/dist/blocks/CheckboxSwitch/schema.json +0 -105
  34. package/dist/blocks/CheckboxSwitch/style.less +0 -19
  35. package/dist/blocks/Collapse/Collapse.js +0 -89
  36. package/dist/blocks/Collapse/schema.json +0 -90
  37. package/dist/blocks/Collapse/style.less +0 -17
  38. package/dist/blocks/Comment/Comment.js +0 -56
  39. package/dist/blocks/Comment/schema.json +0 -39
  40. package/dist/blocks/Comment/style.less +0 -18
  41. package/dist/blocks/ConfirmModal/ConfirmModal.js +0 -96
  42. package/dist/blocks/ConfirmModal/schema.json +0 -122
  43. package/dist/blocks/ConfirmModal/style.less +0 -17
  44. package/dist/blocks/Content/Content.js +0 -31
  45. package/dist/blocks/Content/schema.json +0 -16
  46. package/dist/blocks/Content/style.less +0 -17
  47. package/dist/blocks/ControlledList/ControlledList.js +0 -137
  48. package/dist/blocks/ControlledList/schema.json +0 -68
  49. package/dist/blocks/ControlledList/style.less +0 -19
  50. package/dist/blocks/DateRangeSelector/DateRangeSelector.js +0 -102
  51. package/dist/blocks/DateRangeSelector/schema.json +0 -221
  52. package/dist/blocks/DateRangeSelector/style.less +0 -18
  53. package/dist/blocks/DateSelector/DateSelector.js +0 -90
  54. package/dist/blocks/DateSelector/schema.json +0 -183
  55. package/dist/blocks/DateSelector/style.less +0 -18
  56. package/dist/blocks/DateTimeSelector/DateTimeSelector.js +0 -98
  57. package/dist/blocks/DateTimeSelector/schema.json +0 -215
  58. package/dist/blocks/DateTimeSelector/style.less +0 -18
  59. package/dist/blocks/Descriptions/Descriptions.js +0 -83
  60. package/dist/blocks/Descriptions/schema.json +0 -186
  61. package/dist/blocks/Descriptions/style.less +0 -17
  62. package/dist/blocks/Divider/Divider.js +0 -37
  63. package/dist/blocks/Divider/schema.json +0 -35
  64. package/dist/blocks/Divider/style.less +0 -17
  65. package/dist/blocks/Drawer/Drawer.js +0 -104
  66. package/dist/blocks/Drawer/schema.json +0 -113
  67. package/dist/blocks/Drawer/style.less +0 -17
  68. package/dist/blocks/Footer/Footer.js +0 -36
  69. package/dist/blocks/Footer/schema.json +0 -16
  70. package/dist/blocks/Footer/style.less +0 -17
  71. package/dist/blocks/Header/Header.js +0 -36
  72. package/dist/blocks/Header/schema.json +0 -22
  73. package/dist/blocks/Header/style.less +0 -17
  74. package/dist/blocks/Label/Label.js +0 -116
  75. package/dist/blocks/Label/getLabelCol.js +0 -55
  76. package/dist/blocks/Label/getWrapperCol.js +0 -69
  77. package/dist/blocks/Label/labelLogic.js +0 -106
  78. package/dist/blocks/Label/schema.json +0 -62
  79. package/dist/blocks/Label/style.less +0 -34
  80. package/dist/blocks/Layout/Layout.js +0 -30
  81. package/dist/blocks/Layout/schema.json +0 -16
  82. package/dist/blocks/Layout/style.less +0 -17
  83. package/dist/blocks/Menu/Menu.js +0 -209
  84. package/dist/blocks/Menu/schema.json +0 -236
  85. package/dist/blocks/Menu/style.less +0 -17
  86. package/dist/blocks/Message/Message.js +0 -53
  87. package/dist/blocks/Message/schema.json +0 -48
  88. package/dist/blocks/Message/style.less +0 -17
  89. package/dist/blocks/MobileMenu/MobileMenu.js +0 -128
  90. package/dist/blocks/MobileMenu/schema.json +0 -236
  91. package/dist/blocks/MobileMenu/style.less +0 -19
  92. package/dist/blocks/Modal/Modal.js +0 -130
  93. package/dist/blocks/Modal/schema.json +0 -118
  94. package/dist/blocks/Modal/style.less +0 -17
  95. package/dist/blocks/MonthSelector/MonthSelector.js +0 -90
  96. package/dist/blocks/MonthSelector/schema.json +0 -183
  97. package/dist/blocks/MonthSelector/style.less +0 -18
  98. package/dist/blocks/MultipleSelector/MultipleSelector.js +0 -146
  99. package/dist/blocks/MultipleSelector/schema.json +0 -239
  100. package/dist/blocks/MultipleSelector/style.less +0 -18
  101. package/dist/blocks/Notification/Notification.js +0 -77
  102. package/dist/blocks/Notification/schema.json +0 -85
  103. package/dist/blocks/Notification/style.less +0 -18
  104. package/dist/blocks/NumberInput/NumberInput.js +0 -82
  105. package/dist/blocks/NumberInput/schema.json +0 -157
  106. package/dist/blocks/NumberInput/style.less +0 -18
  107. package/dist/blocks/PageHCF/PageHCF.js +0 -70
  108. package/dist/blocks/PageHCF/schema.json +0 -64
  109. package/dist/blocks/PageHCF/style.less +0 -20
  110. package/dist/blocks/PageHCSF/PageHCSF.js +0 -98
  111. package/dist/blocks/PageHCSF/schema.json +0 -148
  112. package/dist/blocks/PageHCSF/style.less +0 -21
  113. package/dist/blocks/PageHSCF/PageHSCF.js +0 -98
  114. package/dist/blocks/PageHSCF/schema.json +0 -147
  115. package/dist/blocks/PageHSCF/style.less +0 -21
  116. package/dist/blocks/PageHeaderMenu/PageHeaderMenu.js +0 -290
  117. package/dist/blocks/PageHeaderMenu/schema.json +0 -215
  118. package/dist/blocks/PageHeaderMenu/style.less +0 -23
  119. package/dist/blocks/PageSHCF/PageSHCF.js +0 -98
  120. package/dist/blocks/PageSHCF/schema.json +0 -148
  121. package/dist/blocks/PageSHCF/style.less +0 -21
  122. package/dist/blocks/PageSiderMenu/PageSiderMenu.js +0 -406
  123. package/dist/blocks/PageSiderMenu/schema.json +0 -283
  124. package/dist/blocks/PageSiderMenu/style.less +0 -26
  125. package/dist/blocks/Pagination/Pagination.js +0 -98
  126. package/dist/blocks/Pagination/schema.json +0 -75
  127. package/dist/blocks/Pagination/style.less +0 -17
  128. package/dist/blocks/Paragraph/Paragraph.js +0 -102
  129. package/dist/blocks/Paragraph/schema.json +0 -131
  130. package/dist/blocks/Paragraph/style.less +0 -17
  131. package/dist/blocks/ParagraphInput/ParagraphInput.js +0 -125
  132. package/dist/blocks/ParagraphInput/schema.json +0 -162
  133. package/dist/blocks/ParagraphInput/style.less +0 -17
  134. package/dist/blocks/PasswordInput/PasswordInput.js +0 -78
  135. package/dist/blocks/PasswordInput/schema.json +0 -123
  136. package/dist/blocks/PasswordInput/style.less +0 -18
  137. package/dist/blocks/Progress/Progress.js +0 -42
  138. package/dist/blocks/Progress/schema.json +0 -76
  139. package/dist/blocks/Progress/style.less +0 -17
  140. package/dist/blocks/RadioSelector/RadioSelector.js +0 -96
  141. package/dist/blocks/RadioSelector/schema.json +0 -190
  142. package/dist/blocks/RadioSelector/style.less +0 -19
  143. package/dist/blocks/RatingSlider/RatingSlider.js +0 -240
  144. package/dist/blocks/RatingSlider/schema.json +0 -169
  145. package/dist/blocks/RatingSlider/style.less +0 -19
  146. package/dist/blocks/Result/Result.js +0 -48
  147. package/dist/blocks/Result/schema.json +0 -30
  148. package/dist/blocks/Result/style.less +0 -17
  149. package/dist/blocks/Selector/Selector.js +0 -140
  150. package/dist/blocks/Selector/schema.json +0 -236
  151. package/dist/blocks/Selector/style.less +0 -18
  152. package/dist/blocks/Sider/Sider.js +0 -85
  153. package/dist/blocks/Sider/schema.json +0 -71
  154. package/dist/blocks/Sider/style.less +0 -17
  155. package/dist/blocks/Statistic/Statistic.js +0 -51
  156. package/dist/blocks/Statistic/schema.json +0 -74
  157. package/dist/blocks/Statistic/style.less +0 -17
  158. package/dist/blocks/Switch/Switch.js +0 -101
  159. package/dist/blocks/Switch/schema.json +0 -136
  160. package/dist/blocks/Switch/style.less +0 -18
  161. package/dist/blocks/Tabs/Tabs.js +0 -108
  162. package/dist/blocks/Tabs/schema.json +0 -97
  163. package/dist/blocks/Tabs/style.less +0 -17
  164. package/dist/blocks/TextArea/TextArea.js +0 -87
  165. package/dist/blocks/TextArea/schema.json +0 -164
  166. package/dist/blocks/TextArea/style.less +0 -18
  167. package/dist/blocks/TextInput/TextInput.js +0 -92
  168. package/dist/blocks/TextInput/schema.json +0 -149
  169. package/dist/blocks/TextInput/style.less +0 -18
  170. package/dist/blocks/TimelineList/TimelineList.js +0 -102
  171. package/dist/blocks/TimelineList/schema.json +0 -65
  172. package/dist/blocks/TimelineList/style.less +0 -17
  173. package/dist/blocks/Title/Title.js +0 -109
  174. package/dist/blocks/Title/schema.json +0 -136
  175. package/dist/blocks/Title/style.less +0 -17
  176. package/dist/blocks/TitleInput/TitleInput.js +0 -122
  177. package/dist/blocks/TitleInput/schema.json +0 -171
  178. package/dist/blocks/TitleInput/style.less +0 -17
  179. package/dist/blocks/Tooltip/Tooltip.js +0 -48
  180. package/dist/blocks/Tooltip/schema.json +0 -91
  181. package/dist/blocks/Tooltip/style.less +0 -17
  182. package/dist/blocks/WeekSelector/WeekSelector.js +0 -91
  183. package/dist/blocks/WeekSelector/schema.json +0 -183
  184. package/dist/blocks/WeekSelector/style.less +0 -18
  185. package/dist/blocks.js +0 -74
  186. package/dist/color.js +0 -85
  187. package/dist/disabledDate.js +0 -45
  188. package/dist/getUniqueValues.js +0 -30
  189. package/dist/getValueIndex.js +0 -42
  190. package/dist/style.less +0 -17
  191. package/dist/types.js +0 -31
  192. package/dist/useRunAfterUpdate.js +0 -29
  193. package/dist/validationExamples.js +0 -40
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-antd",
3
- "version": "4.0.0-alpha.26",
3
+ "version": "4.0.0-alpha.29",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lowdefy Ant Design Blocks",
6
6
  "homepage": "https://lowdefy.com",
@@ -42,18 +42,17 @@
42
42
  "dist/*"
43
43
  ],
44
44
  "scripts": {
45
- "build": "yarn swc",
45
+ "build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start && pnpm copyfiles",
46
46
  "clean": "rm -rf dist",
47
47
  "copyfiles": "copyfiles -u 1 \"./src/**/*\" dist -e \"./src/**/*.js\" -e \"./src/**/*.yaml\" -e \"./src/**/*.snap\"",
48
- "prepare": "yarn build",
49
- "swc": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start && yarn copyfiles",
48
+ "prepublishOnly": "pnpm build",
50
49
  "test:watch": "jest --coverage --watch",
51
50
  "test": "jest --coverage"
52
51
  },
53
52
  "dependencies": {
54
53
  "@ant-design/icons": "4.7.0",
55
- "@lowdefy/block-utils": "4.0.0-alpha.26",
56
- "@lowdefy/helpers": "4.0.0-alpha.26",
54
+ "@lowdefy/block-utils": "4.0.0-alpha.29",
55
+ "@lowdefy/helpers": "4.0.0-alpha.29",
57
56
  "antd": "4.22.5",
58
57
  "classnames": "2.3.1",
59
58
  "moment": "2.29.4",
@@ -64,9 +63,9 @@
64
63
  },
65
64
  "devDependencies": {
66
65
  "@emotion/jest": "11.9.1",
67
- "@lowdefy/block-dev": "4.0.0-alpha.26",
68
- "@lowdefy/jest-yaml-transform": "4.0.0-alpha.26",
69
- "@lowdefy/node-utils": "4.0.0-alpha.26",
66
+ "@lowdefy/block-dev": "4.0.0-alpha.29",
67
+ "@lowdefy/jest-yaml-transform": "4.0.0-alpha.29",
68
+ "@lowdefy/node-utils": "4.0.0-alpha.29",
70
69
  "@swc/cli": "0.1.57",
71
70
  "@swc/core": "1.2.194",
72
71
  "@swc/jest": "0.2.21",
@@ -81,5 +80,5 @@
81
80
  "publishConfig": {
82
81
  "access": "public"
83
82
  },
84
- "gitHead": "ef60e34f87b95204d103db4a65e4ba3c54a5a1b5"
83
+ "gitHead": "621a191ebc0a1569ee6669dc74c12f8be5a8c7f3"
85
84
  }
@@ -1,43 +0,0 @@
1
- /*
2
- Copyright 2020-2022 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 { Affix } from 'antd';
17
- import { get } from '@lowdefy/helpers';
18
- import { blockDefaultProps } from '@lowdefy/block-utils';
19
- const AffixBlock = ({ blockId , content , methods , properties , rename })=>/*#__PURE__*/ React.createElement(Affix, {
20
- id: blockId,
21
- className: methods.makeCssClass(properties.style),
22
- offsetBottom: properties.offsetBottom,
23
- offsetTop: properties.offsetTop,
24
- onChange: (affixed)=>{
25
- methods.triggerEvent({
26
- name: get(rename, 'events.onChange', {
27
- default: 'onChange'
28
- }),
29
- event: {
30
- affixed
31
- }
32
- });
33
- }
34
- }, content.content && content.content());
35
- AffixBlock.defaultProps = blockDefaultProps;
36
- AffixBlock.meta = {
37
- category: 'container',
38
- icons: [],
39
- styles: [
40
- 'blocks/Affix/style.less'
41
- ]
42
- };
43
- export default AffixBlock;
@@ -1,34 +0,0 @@
1
- {
2
- "type": "object",
3
- "properties": {
4
- "type": "object",
5
- "additionalProperties": false,
6
- "properties": {
7
- "offsetBottom": {
8
- "type": "number",
9
- "description": "Offset from the bottom of the viewport (in pixels)."
10
- },
11
- "offsetTop": {
12
- "type": "number",
13
- "description": "Offset from the top of the viewport (in pixels)."
14
- },
15
- "style": {
16
- "type": "object",
17
- "description": "Css style object to applied to affix.",
18
- "docs": {
19
- "displayType": "yaml"
20
- }
21
- }
22
- }
23
- },
24
- "events": {
25
- "type": "object",
26
- "additionalProperties": false,
27
- "properties": {
28
- "onChange": {
29
- "type": "array",
30
- "description": "Triggered when container affix status changes."
31
- }
32
- }
33
- }
34
- }
@@ -1,17 +0,0 @@
1
- /*
2
- Copyright 2020-2022 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/affix/style/index.less';
@@ -1,78 +0,0 @@
1
- function _extends() {
2
- _extends = Object.assign || function(target) {
3
- for(var i = 1; i < arguments.length; i++){
4
- var source = arguments[i];
5
- for(var key in source){
6
- if (Object.prototype.hasOwnProperty.call(source, key)) {
7
- target[key] = source[key];
8
- }
9
- }
10
- }
11
- return target;
12
- };
13
- return _extends.apply(this, arguments);
14
- }
15
- /*
16
- Copyright 2020-2022 Lowdefy, Inc
17
-
18
- Licensed under the Apache License, Version 2.0 (the "License");
19
- you may not use this file except in compliance with the License.
20
- You may obtain a copy of the License at
21
-
22
- http://www.apache.org/licenses/LICENSE-2.0
23
-
24
- Unless required by applicable law or agreed to in writing, software
25
- distributed under the License is distributed on an "AS IS" BASIS,
26
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27
- See the License for the specific language governing permissions and
28
- limitations under the License.
29
- */ import React from 'react';
30
- import { Alert } from 'antd';
31
- import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
32
- import { type } from '@lowdefy/helpers';
33
- const AlertBlock = ({ blockId , content , events , components: { Icon } , methods , properties })=>{
34
- const additionalProps = {};
35
- if (properties.icon) {
36
- additionalProps.icon = /*#__PURE__*/ React.createElement(Icon, {
37
- blockId: `${blockId}_icon`,
38
- events: events,
39
- properties: properties.icon
40
- });
41
- }
42
- return /*#__PURE__*/ React.createElement(Alert, _extends({
43
- action: content.action && content.action(),
44
- afterClose: ()=>methods.triggerEvent({
45
- name: 'afterClose'
46
- }),
47
- banner: properties.banner,
48
- closable: properties.closable,
49
- closeText: properties.closeText,
50
- description: renderHtml({
51
- html: properties.description,
52
- methods
53
- }),
54
- id: blockId,
55
- message: type.isNone(properties.message) ? /*#__PURE__*/ React.createElement("div", {
56
- style: {
57
- marginBottom: -4
58
- }
59
- }) : renderHtml({
60
- html: properties.message,
61
- methods
62
- }),
63
- onClose: ()=>methods.triggerEvent({
64
- name: 'onClose'
65
- }),
66
- showIcon: properties.showIcon === false ? false : true,
67
- type: properties.type
68
- }, additionalProps));
69
- };
70
- AlertBlock.defaultProps = blockDefaultProps;
71
- AlertBlock.meta = {
72
- category: 'container',
73
- icons: [],
74
- styles: [
75
- 'blocks/Alert/style.less'
76
- ]
77
- };
78
- export default AlertBlock;
@@ -1,62 +0,0 @@
1
- {
2
- "properties": {
3
- "type": "object",
4
- "additionalProperties": false,
5
- "properties": {
6
- "banner": {
7
- "type": "boolean",
8
- "default": false,
9
- "description": "Style as banner at top of application window."
10
- },
11
- "closable": {
12
- "type": "boolean",
13
- "default": false,
14
- "description": "Allow alert to be closed."
15
- },
16
- "closeText": {
17
- "type": "string",
18
- "description": "Close text to show."
19
- },
20
- "description": {
21
- "type": "string",
22
- "description": "Content description of alert - supports html."
23
- },
24
- "icon": {
25
- "type": ["string", "object"],
26
- "description": "Name of an Ant Design Icon or properties of an Icon block to customize alert icon.",
27
- "docs": {
28
- "displayType": "icon"
29
- }
30
- },
31
- "message": {
32
- "type": "string",
33
- "description": "Content message of alert - supports html."
34
- },
35
- "showIcon": {
36
- "type": "boolean",
37
- "default": true,
38
- "description": "Show type default icon."
39
- },
40
- "type": {
41
- "type": "string",
42
- "enum": ["success", "info", "warning", "error"],
43
- "default": "info",
44
- "description": "Alert style type."
45
- }
46
- }
47
- },
48
- "events": {
49
- "type": "object",
50
- "additionalProperties": false,
51
- "properties": {
52
- "onClose": {
53
- "type": "array",
54
- "description": "Called when Alert close button is clicked."
55
- },
56
- "afterClose": {
57
- "type": "array",
58
- "description": "Called after Alert has been closed."
59
- }
60
- }
61
- }
62
- }
@@ -1,17 +0,0 @@
1
- /*
2
- Copyright 2020-2022 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/alert/style/index.less';
@@ -1,86 +0,0 @@
1
- /*
2
- Copyright 2020-2022 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 { AutoComplete } from 'antd';
17
- import { blockDefaultProps } from '@lowdefy/block-utils';
18
- import { type } from '@lowdefy/helpers';
19
- import Label from '../Label/Label.js';
20
- const Option = AutoComplete.Option;
21
- const AutoCompleteInput = ({ blockId , components , events , loading , methods , properties , required , validation , value , })=>{
22
- return /*#__PURE__*/ React.createElement(Label, {
23
- blockId: blockId,
24
- components: components,
25
- events: events,
26
- properties: {
27
- title: properties.title,
28
- size: properties.size,
29
- ...properties.label
30
- },
31
- validation: validation,
32
- required: required,
33
- content: {
34
- content: ()=>/*#__PURE__*/ React.createElement(AutoComplete, {
35
- id: `${blockId}_input`,
36
- autoFocus: properties.autoFocus,
37
- backfill: properties.backfill,
38
- bordered: properties.bordered,
39
- className: methods.makeCssClass([
40
- {
41
- width: '100%'
42
- },
43
- properties.inputStyle
44
- ]),
45
- defaultOpen: properties.defaultOpen,
46
- disabled: properties.disabled || loading,
47
- placeholder: properties.placeholder || 'Type or select item',
48
- allowClear: properties.allowClear !== false,
49
- size: properties.size,
50
- filterOption: (input, option)=>`${option.value}`.toLowerCase().indexOf(input.toLowerCase()) >= 0,
51
- onChange: (newVal)=>{
52
- methods.setValue(newVal);
53
- methods.triggerEvent({
54
- name: 'onChange'
55
- });
56
- },
57
- onSearch: (newVal)=>{
58
- methods.triggerEvent({
59
- name: 'onSearch',
60
- event: {
61
- value: newVal
62
- }
63
- });
64
- },
65
- value: type.isNone(value) ? undefined : `${value}`
66
- }, (properties.options || []).map((opt, i)=>/*#__PURE__*/ React.createElement(Option, {
67
- className: methods.makeCssClass(properties.optionsStyle),
68
- id: `${blockId}_${i}`,
69
- key: i,
70
- value: `${opt}`
71
- }, `${opt}`)))
72
- }
73
- });
74
- };
75
- AutoCompleteInput.defaultProps = blockDefaultProps;
76
- AutoCompleteInput.meta = {
77
- valueType: 'string',
78
- category: 'input',
79
- icons: [
80
- ...Label.meta.icons
81
- ],
82
- styles: [
83
- 'blocks/AutoComplete/style.less'
84
- ]
85
- };
86
- export default AutoCompleteInput;
@@ -1,148 +0,0 @@
1
- {
2
- "type": "object",
3
- "properties": {
4
- "type": "object",
5
- "additionalProperties": false,
6
- "properties": {
7
- "allowClear": {
8
- "type": "boolean",
9
- "default": true,
10
- "description": "Allow the user to clear the selected value, sets the value to null."
11
- },
12
- "autoFocus": {
13
- "type": "boolean",
14
- "default": false,
15
- "description": "Autofocus to the block on page load."
16
- },
17
- "bordered": {
18
- "type": "boolean",
19
- "default": true,
20
- "description": "Whether or not the input has a border style."
21
- },
22
- "backfill": {
23
- "type": "boolean",
24
- "default": false,
25
- "description": "Backfill selected item the input when using keyboard"
26
- },
27
- "defaultOpen": {
28
- "type": "boolean",
29
- "default": false,
30
- "description": "Initial open state of dropdown."
31
- },
32
- "disabled": {
33
- "type": "boolean",
34
- "default": false,
35
- "description": "Disable the block if true."
36
- },
37
- "inputStyle": {
38
- "type": "object",
39
- "description": "Css style to applied to input.",
40
- "docs": {
41
- "displayType": "yaml"
42
- }
43
- },
44
- "label": {
45
- "type": "object",
46
- "description": "Label properties.",
47
- "additionalProperties": false,
48
- "properties": {
49
- "align": {
50
- "type": "string",
51
- "enum": ["left", "right"],
52
- "default": "left",
53
- "description": "Align label left or right when inline."
54
- },
55
- "colon": {
56
- "type": "boolean",
57
- "default": true,
58
- "description": "Append label with colon."
59
- },
60
- "extra": {
61
- "type": "string",
62
- "description": "Extra text to display beneath the content."
63
- },
64
- "title": {
65
- "type": "string",
66
- "description": "Label title."
67
- },
68
- "span": {
69
- "type": "number",
70
- "description": "Label inline span."
71
- },
72
- "disabled": {
73
- "type": "boolean",
74
- "description": "Hide input label."
75
- },
76
- "hasFeedback": {
77
- "type": "boolean",
78
- "default": true,
79
- "description": "Display feedback extra from validation, this does not disable validation."
80
- },
81
- "inline": {
82
- "type": "boolean",
83
- "default": false,
84
- "description": "Render input and label inline."
85
- },
86
- "extraStyle": {
87
- "type": "object",
88
- "description": "Css style to applied to label extra.",
89
- "docs": {
90
- "displayType": "yaml"
91
- }
92
- },
93
- "feedbackStyle": {
94
- "type": "object",
95
- "description": "Css style to applied to label feedback.",
96
- "docs": {
97
- "displayType": "yaml"
98
- }
99
- }
100
- }
101
- },
102
- "options": {
103
- "default": [],
104
- "type": "array",
105
- "description": "Options can either be an array of string values.",
106
- "items": {
107
- "type": "string"
108
- }
109
- },
110
- "optionsStyle": {
111
- "type": "object",
112
- "description": "Css style to applied to option elements.",
113
- "docs": {
114
- "displayType": "yaml"
115
- }
116
- },
117
- "placeholder": {
118
- "type": "string",
119
- "default": "Type or select item",
120
- "description": "Placeholder text inside the block before user selects input."
121
- },
122
- "size": {
123
- "type": "string",
124
- "enum": ["small", "default", "large"],
125
- "default": "default",
126
- "description": "Size of the block."
127
- },
128
- "title": {
129
- "type": "string",
130
- "description": "Title to describe the input component, if no title is specified the block id is displayed."
131
- }
132
- }
133
- },
134
- "events": {
135
- "type": "object",
136
- "additionalProperties": false,
137
- "properties": {
138
- "onChange": {
139
- "type": "array",
140
- "description": "Trigger actions when selection is changed."
141
- },
142
- "onSearch": {
143
- "type": "array",
144
- "description": "Called when searching items."
145
- }
146
- }
147
- }
148
- }
@@ -1,17 +0,0 @@
1
- /*
2
- Copyright 2020-2022 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/auto-complete/style/index.less';
@@ -1,49 +0,0 @@
1
- /*
2
- Copyright 2020-2022 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 { Avatar } from 'antd';
17
- import { blockDefaultProps } from '@lowdefy/block-utils';
18
- const AvatarBlock = ({ blockId , events , components: { Icon } , methods , properties })=>/*#__PURE__*/ React.createElement(Avatar, {
19
- id: blockId,
20
- alt: properties.alt,
21
- gap: properties.gap,
22
- shape: properties.shape,
23
- size: properties.size,
24
- src: properties.src,
25
- onClick: ()=>methods.triggerEvent({
26
- name: 'onClick'
27
- }),
28
- className: methods.makeCssClass([
29
- {
30
- backgroundColor: !properties.src && properties.color,
31
- cursor: events.onClick && 'pointer'
32
- },
33
- properties.style,
34
- ]),
35
- icon: properties.icon && /*#__PURE__*/ React.createElement(Icon, {
36
- blockId: `${blockId}_icon`,
37
- events: events,
38
- properties: properties.icon
39
- })
40
- }, properties.content);
41
- AvatarBlock.defaultProps = blockDefaultProps;
42
- AvatarBlock.meta = {
43
- category: 'display',
44
- icons: [],
45
- styles: [
46
- 'blocks/Avatar/style.less'
47
- ]
48
- };
49
- export default AvatarBlock;
@@ -1,71 +0,0 @@
1
- {
2
- "type": "object",
3
- "properties": {
4
- "type": "object",
5
- "additionalProperties": false,
6
- "properties": {
7
- "alt": {
8
- "type": "string",
9
- "description": "This attribute defines the alternative text describing the image."
10
- },
11
- "color": {
12
- "type": "string",
13
- "description": "The background color of the avatar if not using a src url. Should be a hex color string. Color is a random color if not specified.",
14
- "docs": {
15
- "displayType": "color"
16
- }
17
- },
18
- "content": {
19
- "type": "string",
20
- "description": "Text to display inside avatar."
21
- },
22
- "gap": {
23
- "type": "number",
24
- "description": "Letter type unit distance between left and right sides."
25
- },
26
- "icon": {
27
- "type": ["string", "object"],
28
- "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 use an icon in avatar.",
29
- "docs": {
30
- "displayType": "icon"
31
- }
32
- },
33
- "shape": {
34
- "type": "string",
35
- "enum": ["circle", "square"],
36
- "default": "circle",
37
- "description": "Shape of the avatar."
38
- },
39
- "size": {
40
- "type": ["string", "object"],
41
- "default": "default",
42
- "enum": ["default", "small", "large"],
43
- "description": "Size of the avatar; default, small, large or responsive.",
44
- "docs": {
45
- "displayType": "string"
46
- }
47
- },
48
- "src": {
49
- "type": "string",
50
- "description": "The address of the image for an image avatar."
51
- },
52
- "style": {
53
- "type": "object",
54
- "description": "Css style object to applied to avatar.",
55
- "docs": {
56
- "displayType": "yaml"
57
- }
58
- }
59
- }
60
- },
61
- "events": {
62
- "type": "object",
63
- "additionalProperties": false,
64
- "properties": {
65
- "onClick": {
66
- "type": "array",
67
- "description": "Triggered when avatar item is clicked."
68
- }
69
- }
70
- }
71
- }