@lowdefy/blocks-basic 3.23.2 → 4.0.0-alpha.6
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/Anchor/Anchor.js +89 -0
- package/dist/blocks/Anchor/schema.json +61 -0
- package/dist/blocks/Box/Box.js +42 -0
- package/dist/blocks/Box/schema.json +30 -0
- package/dist/blocks/DangerousHtml/DangerousHtml.js +58 -0
- package/dist/blocks/DangerousHtml/schema.json +30 -0
- package/dist/blocks/Html/Html.js +33 -0
- package/dist/blocks/Html/schema.json +23 -0
- package/dist/blocks/Icon/Icon.js +29 -0
- package/dist/blocks/Icon/schema.json +63 -0
- package/dist/blocks/Img/Img.js +44 -0
- package/dist/blocks/Img/schema.json +59 -0
- package/dist/blocks/List/List.js +56 -0
- package/dist/blocks/List/schema.json +40 -0
- package/dist/blocks/Span/Span.js +42 -0
- package/dist/blocks/Span/schema.json +30 -0
- package/dist/blocks.js +22 -0
- package/dist/types.js +32 -0
- package/package.json +35 -37
- package/dist/14.js +0 -2
- package/dist/14.js.LICENSE.txt +0 -43
- package/dist/203.js +0 -1
- package/dist/22.js +0 -1
- package/dist/261.js +0 -1
- package/dist/328.js +0 -2
- package/dist/328.js.LICENSE.txt +0 -1
- package/dist/330.js +0 -1
- package/dist/397.js +0 -1
- package/dist/52.js +0 -1
- package/dist/700.js +0 -1
- package/dist/757.js +0 -2
- package/dist/757.js.LICENSE.txt +0 -14
- package/dist/93.js +0 -1
- package/dist/941.js +0 -1
- package/dist/964.js +0 -1
- package/dist/main.js +0 -1
- package/dist/meta/Box.json +0 -1
- package/dist/meta/Context.json +0 -1
- package/dist/meta/DangerousHtml.json +0 -1
- package/dist/meta/Html.json +0 -1
- package/dist/meta/Img.json +0 -1
- package/dist/meta/List.json +0 -1
- package/dist/meta/Span.json +0 -1
- package/dist/remoteEntry.js +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/ import React from 'react';
|
|
17
|
+
import { get, type } from '@lowdefy/helpers';
|
|
18
|
+
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
19
|
+
const Strong = ({ children , strong })=>strong ? /*#__PURE__*/ _jsx("b", {
|
|
20
|
+
children: children
|
|
21
|
+
}) : /*#__PURE__*/ _jsx(_Fragment, {
|
|
22
|
+
children: children
|
|
23
|
+
})
|
|
24
|
+
;
|
|
25
|
+
const Tag = ({ blockId , children , className , disabled , href , Link , newTab , onClick , rel })=>disabled ? /*#__PURE__*/ _jsx("span", {
|
|
26
|
+
id: blockId,
|
|
27
|
+
className: className,
|
|
28
|
+
children: children
|
|
29
|
+
}) : /*#__PURE__*/ _jsx(Link, {
|
|
30
|
+
id: blockId,
|
|
31
|
+
className: className,
|
|
32
|
+
href: href,
|
|
33
|
+
onClick: onClick,
|
|
34
|
+
rel: rel || 'noopener noreferrer',
|
|
35
|
+
target: newTab ? '_blank' : '_self',
|
|
36
|
+
children: children
|
|
37
|
+
})
|
|
38
|
+
;
|
|
39
|
+
const AnchorBlock = ({ blockId , events , components: { Icon , Link } , loading , methods , properties , })=>{
|
|
40
|
+
const title = type.isNone(properties.title) ? type.isNone(properties.href) ? properties.href : blockId : properties.title;
|
|
41
|
+
const showLoading = get(events, 'onClick.loading') || loading;
|
|
42
|
+
const disabled = properties.disabled || showLoading;
|
|
43
|
+
return(/*#__PURE__*/ _jsx(Tag, {
|
|
44
|
+
blockId: blockId,
|
|
45
|
+
className: methods.makeCssClass([
|
|
46
|
+
properties.style,
|
|
47
|
+
disabled && {
|
|
48
|
+
color: '#BEBEBE',
|
|
49
|
+
cursor: 'not-allowed'
|
|
50
|
+
},
|
|
51
|
+
]),
|
|
52
|
+
disabled: disabled,
|
|
53
|
+
href: properties.href,
|
|
54
|
+
Link: Link,
|
|
55
|
+
rel: properties.rel,
|
|
56
|
+
newTab: properties.newTab,
|
|
57
|
+
onClick: ()=>methods.triggerEvent({
|
|
58
|
+
name: 'onClick'
|
|
59
|
+
})
|
|
60
|
+
,
|
|
61
|
+
children: /*#__PURE__*/ _jsxs(Strong, {
|
|
62
|
+
strong: properties.strong,
|
|
63
|
+
children: [
|
|
64
|
+
properties.icon && /*#__PURE__*/ _jsx(Icon, {
|
|
65
|
+
blockId: `${blockId}_icon`,
|
|
66
|
+
events: events,
|
|
67
|
+
properties: showLoading ? {
|
|
68
|
+
name: 'LoadingOutlined',
|
|
69
|
+
spin: true
|
|
70
|
+
} : properties.icon
|
|
71
|
+
}),
|
|
72
|
+
` ${title}`
|
|
73
|
+
]
|
|
74
|
+
})
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
77
|
+
AnchorBlock.defaultProps = blockDefaultProps;
|
|
78
|
+
AnchorBlock.meta = {
|
|
79
|
+
category: 'display',
|
|
80
|
+
loading: {
|
|
81
|
+
type: 'SkeletonParagraph',
|
|
82
|
+
properties: {
|
|
83
|
+
lines: 1
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
icons: [],
|
|
87
|
+
styles: []
|
|
88
|
+
};
|
|
89
|
+
export default AnchorBlock;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"properties": {
|
|
7
|
+
"disabled": {
|
|
8
|
+
"type": "boolean",
|
|
9
|
+
"default": false,
|
|
10
|
+
"description": "Disable the anchor if true."
|
|
11
|
+
},
|
|
12
|
+
"icon": {
|
|
13
|
+
"type": ["string", "object"],
|
|
14
|
+
"description": "Name of an Ant Design Icon or properties of an Icon block for anchor icon.",
|
|
15
|
+
"docs": {
|
|
16
|
+
"displayType": "icon"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"href": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Anchor element href property."
|
|
22
|
+
},
|
|
23
|
+
"rel": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"default": "noopener noreferrer",
|
|
26
|
+
"description": "The relationship of the linked URL as space-separated link types."
|
|
27
|
+
},
|
|
28
|
+
"newTab": {
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"default": false,
|
|
31
|
+
"description": "Open link in a new tab when the anchor link is clicked."
|
|
32
|
+
},
|
|
33
|
+
"strong": {
|
|
34
|
+
"type": "boolean",
|
|
35
|
+
"default": false,
|
|
36
|
+
"description": "Makes the text bold when true."
|
|
37
|
+
},
|
|
38
|
+
"style": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"description": "Css style object to applied to anchor.",
|
|
41
|
+
"docs": {
|
|
42
|
+
"displayType": "yaml"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"title": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "Text to display in the anchor."
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"events": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"additionalProperties": false,
|
|
54
|
+
"properties": {
|
|
55
|
+
"onClick": {
|
|
56
|
+
"type": "array",
|
|
57
|
+
"description": "Called when Anchor is clicked."
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/ import React from 'react';
|
|
17
|
+
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
18
|
+
const Box = ({ blockId , content , events , methods , properties })=>/*#__PURE__*/ _jsx("div", {
|
|
19
|
+
id: blockId,
|
|
20
|
+
"data-testid": blockId,
|
|
21
|
+
onClick: ()=>methods.triggerEvent({
|
|
22
|
+
name: 'onClick'
|
|
23
|
+
})
|
|
24
|
+
,
|
|
25
|
+
className: methods.makeCssClass([
|
|
26
|
+
{
|
|
27
|
+
outline: 'none',
|
|
28
|
+
cursor: events.onClick && 'pointer'
|
|
29
|
+
},
|
|
30
|
+
properties.style,
|
|
31
|
+
]),
|
|
32
|
+
children: properties.content || content.content && content.content()
|
|
33
|
+
})
|
|
34
|
+
;
|
|
35
|
+
Box.defaultProps = blockDefaultProps;
|
|
36
|
+
Box.meta = {
|
|
37
|
+
category: 'container',
|
|
38
|
+
loading: false,
|
|
39
|
+
icons: [],
|
|
40
|
+
styles: []
|
|
41
|
+
};
|
|
42
|
+
export default Box;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"properties": {
|
|
7
|
+
"content": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Box content string. Overrides the \"content\" content area."
|
|
10
|
+
},
|
|
11
|
+
"style": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"description": "Css style object to apply to Box div.",
|
|
14
|
+
"docs": {
|
|
15
|
+
"displayType": "yaml"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"events": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"additionalProperties": false,
|
|
23
|
+
"properties": {
|
|
24
|
+
"onClick": {
|
|
25
|
+
"type": "array",
|
|
26
|
+
"description": "Trigger actions when the Box is clicked."
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/ import React from 'react';
|
|
17
|
+
import DOMPurify from 'dompurify';
|
|
18
|
+
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
19
|
+
import { type } from '@lowdefy/helpers';
|
|
20
|
+
let DangerousHtml = class DangerousHtml extends React.Component {
|
|
21
|
+
componentDidMount() {
|
|
22
|
+
const htmlString = type.isNone(this.props.properties.html) ? '' : this.props.properties.html.toString();
|
|
23
|
+
this.div.innerHTML = DOMPurify.sanitize(htmlString, this.DOMPurifyOptions);
|
|
24
|
+
}
|
|
25
|
+
componentDidUpdate() {
|
|
26
|
+
const htmlString = type.isNone(this.props.properties.html) ? '' : this.props.properties.html.toString();
|
|
27
|
+
this.div.innerHTML = DOMPurify.sanitize(htmlString, this.DOMPurifyOptions);
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
const { blockId , properties , methods } = this.props;
|
|
31
|
+
return(/*#__PURE__*/ _jsx("div", {
|
|
32
|
+
id: blockId,
|
|
33
|
+
"data-testid": blockId,
|
|
34
|
+
ref: (el)=>{
|
|
35
|
+
if (el) {
|
|
36
|
+
this.div = el;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
className: methods.makeCssClass(properties.style)
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
constructor(props){
|
|
43
|
+
super(props);
|
|
44
|
+
this.div = {
|
|
45
|
+
innerHTML: ''
|
|
46
|
+
};
|
|
47
|
+
// we do not revaluate DOMPurifyOptions improve options safety by not making options dynamic.
|
|
48
|
+
this.DOMPurifyOptions = props.properties.DOMPurifyOptions;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
DangerousHtml.defaultProps = blockDefaultProps;
|
|
52
|
+
DangerousHtml.meta = {
|
|
53
|
+
category: 'display',
|
|
54
|
+
loading: false,
|
|
55
|
+
icons: [],
|
|
56
|
+
styles: []
|
|
57
|
+
};
|
|
58
|
+
export default DangerousHtml;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"properties": {
|
|
7
|
+
"html": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Content to be rendered as Html.",
|
|
10
|
+
"docs": {
|
|
11
|
+
"displayType": "text-area"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"DOMPurifyOptions": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"description": "Customize DOMPurify options. Options are only applied when the block is mounted, thus any parsed settings is only applied at first render.",
|
|
17
|
+
"docs": {
|
|
18
|
+
"displayType": "yaml"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"style": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"description": "Css style object to apply to Html div.",
|
|
24
|
+
"docs": {
|
|
25
|
+
"displayType": "yaml"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/ import React from 'react';
|
|
17
|
+
import { blockDefaultProps, HtmlComponent } from '@lowdefy/block-utils';
|
|
18
|
+
const HtmlBlock = ({ blockId , properties , methods })=>/*#__PURE__*/ _jsx(HtmlComponent, {
|
|
19
|
+
div: true,
|
|
20
|
+
html: properties.html,
|
|
21
|
+
id: blockId,
|
|
22
|
+
methods: methods,
|
|
23
|
+
style: properties.style
|
|
24
|
+
})
|
|
25
|
+
;
|
|
26
|
+
HtmlBlock.defaultProps = blockDefaultProps;
|
|
27
|
+
HtmlBlock.meta = {
|
|
28
|
+
category: 'display',
|
|
29
|
+
loading: false,
|
|
30
|
+
icons: [],
|
|
31
|
+
styles: []
|
|
32
|
+
};
|
|
33
|
+
export default HtmlBlock;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"properties": {
|
|
7
|
+
"html": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Content to be rendered as Html.",
|
|
10
|
+
"docs": {
|
|
11
|
+
"displayType": "text-area"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"style": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"description": "Css style object to apply to Html div.",
|
|
17
|
+
"docs": {
|
|
18
|
+
"displayType": "yaml"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/ import React from 'react';
|
|
17
|
+
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
18
|
+
const IconBlock = ({ components: { Icon } , ...props })=>/*#__PURE__*/ _jsx(Icon, {
|
|
19
|
+
...props
|
|
20
|
+
})
|
|
21
|
+
;
|
|
22
|
+
IconBlock.defaultProps = blockDefaultProps;
|
|
23
|
+
IconBlock.meta = {
|
|
24
|
+
category: 'display',
|
|
25
|
+
loading: false,
|
|
26
|
+
icons: [],
|
|
27
|
+
styles: []
|
|
28
|
+
};
|
|
29
|
+
export default IconBlock;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"properties": {
|
|
7
|
+
"color": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Primary icon color.",
|
|
10
|
+
"docs": {
|
|
11
|
+
"displayType": "color"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"name": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"default": "AiCloseCircleOutlined",
|
|
17
|
+
"description": "Name of icon to be displayed."
|
|
18
|
+
},
|
|
19
|
+
"rotate": {
|
|
20
|
+
"type": "number",
|
|
21
|
+
"description": "Number of degrees to rotate the icon."
|
|
22
|
+
},
|
|
23
|
+
"size": {
|
|
24
|
+
"type": ["string", "number"],
|
|
25
|
+
"description": "Size of the icon.",
|
|
26
|
+
"docs": {
|
|
27
|
+
"displayType": "number"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"spin": {
|
|
31
|
+
"type": "boolean",
|
|
32
|
+
"default": false,
|
|
33
|
+
"description": "Continuously spin icon with animation."
|
|
34
|
+
},
|
|
35
|
+
"title": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "Icon description for accessibility."
|
|
38
|
+
},
|
|
39
|
+
"style": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"description": "CSS style object.",
|
|
42
|
+
"docs": {
|
|
43
|
+
"displayType": "yaml"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"disableLoadingIcon": {
|
|
47
|
+
"type": "boolean",
|
|
48
|
+
"default": false,
|
|
49
|
+
"description": "While loading after the icon has been clicked, don't render the loading icon."
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"events": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"additionalProperties": false,
|
|
56
|
+
"properties": {
|
|
57
|
+
"onClick": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"description": "Trigger actions when icon is clicked."
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/ import React from 'react';
|
|
17
|
+
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
18
|
+
const ImgBlock = ({ blockId , events , properties , methods })=>{
|
|
19
|
+
const { style , ...allProps } = properties;
|
|
20
|
+
return(/*#__PURE__*/ _jsx("img", {
|
|
21
|
+
...allProps,
|
|
22
|
+
id: blockId,
|
|
23
|
+
"data-testid": blockId,
|
|
24
|
+
onClick: ()=>methods.triggerEvent({
|
|
25
|
+
name: 'onClick'
|
|
26
|
+
})
|
|
27
|
+
,
|
|
28
|
+
className: methods.makeCssClass([
|
|
29
|
+
{
|
|
30
|
+
outline: 'none',
|
|
31
|
+
cursor: events.onClick && 'pointer'
|
|
32
|
+
},
|
|
33
|
+
style,
|
|
34
|
+
])
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
37
|
+
ImgBlock.defaultProps = blockDefaultProps;
|
|
38
|
+
ImgBlock.meta = {
|
|
39
|
+
category: 'display',
|
|
40
|
+
loading: false,
|
|
41
|
+
icons: [],
|
|
42
|
+
styles: []
|
|
43
|
+
};
|
|
44
|
+
export default ImgBlock;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["src"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"src": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The image URL."
|
|
11
|
+
},
|
|
12
|
+
"alt": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "Alternative text description of the image."
|
|
15
|
+
},
|
|
16
|
+
"crossOrigin": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"enum": ["anonymous", "use-credentials"],
|
|
19
|
+
"description": "Indicates if the fetching of the image must be done using a CORS request."
|
|
20
|
+
},
|
|
21
|
+
"decoding": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"enum": ["sync", "async", "auto"],
|
|
24
|
+
"description": "An image decoding hint to the browser. Sync for atomic presentation with other content, async, to reduce delay in presenting other content and auto leave to browser to decide."
|
|
25
|
+
},
|
|
26
|
+
"height": {
|
|
27
|
+
"type": "number",
|
|
28
|
+
"description": "Height of the image."
|
|
29
|
+
},
|
|
30
|
+
"loading": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"enum": ["eager", "lazy"],
|
|
33
|
+
"description": "How the browser should load the image. Eager loads the image immediately, lazy, defers loading until the image it reaches a calculated distance from the viewport, as defined by the browser."
|
|
34
|
+
},
|
|
35
|
+
"sizes": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "Indicating a set of source sizes of strings separated by commas."
|
|
38
|
+
},
|
|
39
|
+
"srcSet": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"description": "Possible image sources for the user agent to use, strings separated by commas.",
|
|
42
|
+
"docs": {
|
|
43
|
+
"displayType": "text-area"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"style": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"description": "Css style object to applied to the image.",
|
|
49
|
+
"docs": {
|
|
50
|
+
"displayType": "yaml"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"width": {
|
|
54
|
+
"type": "number",
|
|
55
|
+
"description": "Width of the image."
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/ import React, { useEffect } from 'react';
|
|
17
|
+
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
18
|
+
import Box from '../Box/Box.js';
|
|
19
|
+
const List = ({ blockId , events , list , methods , properties })=>{
|
|
20
|
+
useEffect(()=>{
|
|
21
|
+
methods.registerMethod('pushItem', methods.pushItem);
|
|
22
|
+
methods.registerMethod('unshiftItem', methods.unshiftItem);
|
|
23
|
+
methods.registerMethod('removeItem', methods.removeItem);
|
|
24
|
+
methods.registerMethod('moveItemDown', methods.moveItemDown);
|
|
25
|
+
methods.registerMethod('moveItemUp', methods.moveItemUp);
|
|
26
|
+
}, []);
|
|
27
|
+
return(/*#__PURE__*/ _jsx(Box, {
|
|
28
|
+
blockId: blockId,
|
|
29
|
+
events: events,
|
|
30
|
+
properties: {
|
|
31
|
+
style: {
|
|
32
|
+
...properties.direction ? {
|
|
33
|
+
display: 'flex',
|
|
34
|
+
flexDirection: properties.direction,
|
|
35
|
+
flexWrap: properties.wrap ? properties.wrap : 'wrap',
|
|
36
|
+
overflow: properties.scroll ? 'auto' : 'visible'
|
|
37
|
+
} : {},
|
|
38
|
+
...properties.style
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
methods: methods,
|
|
42
|
+
content: {
|
|
43
|
+
content: ()=>list.map((item)=>item.content()
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
List.defaultProps = blockDefaultProps;
|
|
49
|
+
List.meta = {
|
|
50
|
+
category: 'list',
|
|
51
|
+
valueType: 'array',
|
|
52
|
+
loading: false,
|
|
53
|
+
icons: [],
|
|
54
|
+
styles: []
|
|
55
|
+
};
|
|
56
|
+
export default List;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"properties": {
|
|
7
|
+
"direction": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"enum": ["row", "column", "row-reverse", "column-reverse"],
|
|
10
|
+
"description": "List content along a 'row' or down a 'column'. Applies the 'flex-direction' css property to the List block."
|
|
11
|
+
},
|
|
12
|
+
"wrap": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"enum": ["wrap", "nowrap", "wrap-reverse"],
|
|
15
|
+
"description": "Specifies wrapping style to be applied to List block as 'wrap', 'nowrap' or 'wrap-reverse'. Applies the 'flex-wrap' css property to the List block - defaults to 'wrap', requires List direction to be set."
|
|
16
|
+
},
|
|
17
|
+
"scroll": {
|
|
18
|
+
"type": "boolean",
|
|
19
|
+
"description": "Specifies whether scrolling should be applied to the List, can be true or false. Applies the 'overflow' css property to the List block - defaults to 'visible', requires List direction to be set."
|
|
20
|
+
},
|
|
21
|
+
"style": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"description": "Css style object to apply to List block.",
|
|
24
|
+
"docs": {
|
|
25
|
+
"displayType": "yaml"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"events": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"properties": {
|
|
34
|
+
"onClick": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"description": "Trigger actions when the List is clicked."
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|