@lowdefy/client 4.0.0-alpha.9
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/LICENSE +201 -0
- package/README.md +3 -0
- package/dist/Client.js +67 -0
- package/dist/Context.js +45 -0
- package/dist/DisplayMessage.js +29 -0
- package/dist/ErrorBoundary.js +52 -0
- package/dist/ErrorPage.js +61 -0
- package/dist/Head.js +19 -0
- package/dist/MountEvents.js +43 -0
- package/dist/ProgressBarController.js +85 -0
- package/dist/block/Block.js +62 -0
- package/dist/block/CategorySwitch.js +116 -0
- package/dist/block/Container.js +77 -0
- package/dist/block/List.js +86 -0
- package/dist/block/LoadingBlock.js +84 -0
- package/dist/block/LoadingContainer.js +68 -0
- package/dist/block/LoadingList.js +72 -0
- package/dist/callRequest.js +25 -0
- package/dist/createIcon.js +103 -0
- package/dist/createLinkComponent.js +65 -0
- package/dist/index.js +16 -0
- package/dist/initLowdefyContext.js +66 -0
- package/dist/request.js +32 -0
- package/dist/setupLink.js +51 -0
- package/dist/style.less +29 -0
- package/package.json +71 -0
|
@@ -0,0 +1,116 @@
|
|
|
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 { BlockLayout } from '@lowdefy/layout';
|
|
17
|
+
import { makeCssClass } from '@lowdefy/block-utils';
|
|
18
|
+
import { type } from '@lowdefy/helpers';
|
|
19
|
+
import Container from './Container.js';
|
|
20
|
+
import List from './List.js';
|
|
21
|
+
import LoadingBlock from './LoadingBlock.js';
|
|
22
|
+
const CategorySwitch = ({ block , Blocks , context , loading , lowdefy })=>{
|
|
23
|
+
if (!block.eval) return null; // TODO: check Renderer updates before eval is executed for the first time on lists. See #520
|
|
24
|
+
if (block.eval.visible === false) return(/*#__PURE__*/ React.createElement("div", {
|
|
25
|
+
id: `vs-${block.blockId}`,
|
|
26
|
+
style: {
|
|
27
|
+
display: 'none'
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
const Component = lowdefy._internal.blockComponents[block.type];
|
|
31
|
+
if (loading && type.isObject(block.eval.skeleton)) {
|
|
32
|
+
return(/*#__PURE__*/ React.createElement(LoadingBlock, {
|
|
33
|
+
blockLayout: block.eval.layout,
|
|
34
|
+
context: context,
|
|
35
|
+
lowdefy: lowdefy,
|
|
36
|
+
skeleton: block.eval.skeleton
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
switch(Component.meta.category){
|
|
40
|
+
case 'list':
|
|
41
|
+
return(/*#__PURE__*/ React.createElement(List, {
|
|
42
|
+
block: block,
|
|
43
|
+
Blocks: Blocks,
|
|
44
|
+
Component: Component,
|
|
45
|
+
context: context,
|
|
46
|
+
loading: loading,
|
|
47
|
+
lowdefy: lowdefy
|
|
48
|
+
}));
|
|
49
|
+
case 'container':
|
|
50
|
+
return(/*#__PURE__*/ React.createElement(Container, {
|
|
51
|
+
block: block,
|
|
52
|
+
Blocks: Blocks,
|
|
53
|
+
Component: Component,
|
|
54
|
+
context: context,
|
|
55
|
+
loading: loading,
|
|
56
|
+
lowdefy: lowdefy
|
|
57
|
+
}));
|
|
58
|
+
case 'input':
|
|
59
|
+
return(/*#__PURE__*/ React.createElement(BlockLayout, {
|
|
60
|
+
id: `bl-${block.blockId}`,
|
|
61
|
+
blockStyle: block.eval.style,
|
|
62
|
+
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
63
|
+
layout: block.eval.layout || {},
|
|
64
|
+
makeCssClass: makeCssClass
|
|
65
|
+
}, /*#__PURE__*/ React.createElement(Component, {
|
|
66
|
+
methods: Object.assign(block.methods, {
|
|
67
|
+
makeCssClass,
|
|
68
|
+
registerEvent: block.registerEvent,
|
|
69
|
+
registerMethod: block.registerMethod,
|
|
70
|
+
setValue: block.setValue,
|
|
71
|
+
triggerEvent: block.triggerEvent
|
|
72
|
+
}),
|
|
73
|
+
basePath: lowdefy.basePath,
|
|
74
|
+
blockId: block.blockId,
|
|
75
|
+
components: lowdefy._internal.components,
|
|
76
|
+
events: block.eval.events,
|
|
77
|
+
key: block.blockId,
|
|
78
|
+
loading: loading,
|
|
79
|
+
menus: lowdefy.menus,
|
|
80
|
+
pageId: lowdefy.pageId,
|
|
81
|
+
properties: block.eval.properties,
|
|
82
|
+
required: block.eval.required,
|
|
83
|
+
user: lowdefy.user,
|
|
84
|
+
validation: block.eval.validation,
|
|
85
|
+
value: block.value
|
|
86
|
+
})));
|
|
87
|
+
default:
|
|
88
|
+
return(/*#__PURE__*/ React.createElement(BlockLayout, {
|
|
89
|
+
id: `bl-${block.blockId}`,
|
|
90
|
+
blockStyle: block.eval.style,
|
|
91
|
+
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
92
|
+
layout: block.eval.layout || {},
|
|
93
|
+
makeCssClass: makeCssClass
|
|
94
|
+
}, /*#__PURE__*/ React.createElement(Component, {
|
|
95
|
+
methods: Object.assign(block.methods, {
|
|
96
|
+
makeCssClass,
|
|
97
|
+
registerEvent: block.registerEvent,
|
|
98
|
+
registerMethod: block.registerMethod,
|
|
99
|
+
triggerEvent: block.triggerEvent
|
|
100
|
+
}),
|
|
101
|
+
basePath: lowdefy.basePath,
|
|
102
|
+
blockId: block.blockId,
|
|
103
|
+
components: lowdefy._internal.components,
|
|
104
|
+
events: block.eval.events,
|
|
105
|
+
key: block.blockId,
|
|
106
|
+
loading: loading,
|
|
107
|
+
menus: lowdefy.menus,
|
|
108
|
+
pageId: lowdefy.pageId,
|
|
109
|
+
properties: block.eval.properties,
|
|
110
|
+
required: block.eval.required,
|
|
111
|
+
user: lowdefy.user,
|
|
112
|
+
validation: block.eval.validation
|
|
113
|
+
})));
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
export default CategorySwitch;
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { Area, BlockLayout, layoutParamsToArea } from '@lowdefy/layout';
|
|
17
|
+
import { makeCssClass } from '@lowdefy/block-utils';
|
|
18
|
+
import Block from './Block.js';
|
|
19
|
+
const Container = ({ block , Blocks , Component , context , loading , lowdefy })=>{
|
|
20
|
+
const content = {};
|
|
21
|
+
// eslint-disable-next-line prefer-destructuring
|
|
22
|
+
const areas = Blocks.subBlocks[block.id][0].areas;
|
|
23
|
+
Object.keys(areas).forEach((areaKey, i)=>{
|
|
24
|
+
content[areaKey] = (areaStyle)=>/*#__PURE__*/ React.createElement(Area, {
|
|
25
|
+
id: `ar-${block.blockId}-${areaKey}`,
|
|
26
|
+
key: `ar-${block.blockId}-${areaKey}-${i}`,
|
|
27
|
+
area: layoutParamsToArea({
|
|
28
|
+
area: block.eval.areas[areaKey] || {},
|
|
29
|
+
areaKey,
|
|
30
|
+
layout: block.eval.layout || {}
|
|
31
|
+
}),
|
|
32
|
+
areaStyle: [
|
|
33
|
+
areaStyle,
|
|
34
|
+
block.eval.areas[areaKey] && block.eval.areas[areaKey].style
|
|
35
|
+
],
|
|
36
|
+
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
37
|
+
makeCssClass: makeCssClass
|
|
38
|
+
}, areas[areaKey].blocks.map((bl, k)=>/*#__PURE__*/ React.createElement(Block, {
|
|
39
|
+
key: `co-${bl.blockId}-${k}`,
|
|
40
|
+
Blocks: Blocks.subBlocks[block.id][0],
|
|
41
|
+
block: bl,
|
|
42
|
+
context: context,
|
|
43
|
+
parentLoading: loading,
|
|
44
|
+
lowdefy: lowdefy
|
|
45
|
+
})
|
|
46
|
+
))
|
|
47
|
+
;
|
|
48
|
+
});
|
|
49
|
+
return(/*#__PURE__*/ React.createElement(BlockLayout, {
|
|
50
|
+
id: `bl-${block.blockId}`,
|
|
51
|
+
blockStyle: block.eval.style,
|
|
52
|
+
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
53
|
+
layout: block.eval.layout || {},
|
|
54
|
+
makeCssClass: makeCssClass
|
|
55
|
+
}, /*#__PURE__*/ React.createElement(Component, {
|
|
56
|
+
methods: Object.assign(block.methods, {
|
|
57
|
+
makeCssClass,
|
|
58
|
+
registerEvent: block.registerEvent,
|
|
59
|
+
registerMethod: block.registerMethod,
|
|
60
|
+
triggerEvent: block.triggerEvent
|
|
61
|
+
}),
|
|
62
|
+
basePath: lowdefy.basePath,
|
|
63
|
+
blockId: block.blockId,
|
|
64
|
+
components: lowdefy._internal.components,
|
|
65
|
+
content: content,
|
|
66
|
+
events: block.eval.events,
|
|
67
|
+
key: block.blockId,
|
|
68
|
+
loading: loading,
|
|
69
|
+
menus: lowdefy.menus,
|
|
70
|
+
pageId: lowdefy.pageId,
|
|
71
|
+
properties: block.eval.properties,
|
|
72
|
+
required: block.eval.required,
|
|
73
|
+
user: lowdefy.user,
|
|
74
|
+
validation: block.eval.validation
|
|
75
|
+
})));
|
|
76
|
+
};
|
|
77
|
+
export default Container;
|
|
@@ -0,0 +1,86 @@
|
|
|
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 { Area, BlockLayout, layoutParamsToArea } from '@lowdefy/layout';
|
|
17
|
+
import { makeCssClass } from '@lowdefy/block-utils';
|
|
18
|
+
import Block from './Block.js';
|
|
19
|
+
const List = ({ block , Blocks , Component , context , loading , lowdefy })=>{
|
|
20
|
+
const content = {};
|
|
21
|
+
const contentList = [];
|
|
22
|
+
Blocks.subBlocks[block.id].forEach((SBlock)=>{
|
|
23
|
+
Object.keys(SBlock.areas).forEach((areaKey)=>{
|
|
24
|
+
content[areaKey] = (areaStyle)=>/*#__PURE__*/ React.createElement(Area, {
|
|
25
|
+
id: `ar-${block.blockId}-${SBlock.id}-${areaKey}`,
|
|
26
|
+
key: `ar-${block.blockId}-${SBlock.id}-${areaKey}`,
|
|
27
|
+
area: layoutParamsToArea({
|
|
28
|
+
area: block.eval.areas[areaKey] || {},
|
|
29
|
+
areaKey,
|
|
30
|
+
layout: block.eval.layout || {}
|
|
31
|
+
}),
|
|
32
|
+
areaStyle: [
|
|
33
|
+
areaStyle,
|
|
34
|
+
block.eval.areas[areaKey] && block.eval.areas[areaKey].style
|
|
35
|
+
],
|
|
36
|
+
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
37
|
+
makeCssClass: makeCssClass
|
|
38
|
+
}, SBlock.areas[areaKey].blocks.map((bl)=>/*#__PURE__*/ React.createElement(Block, {
|
|
39
|
+
key: `ls-${bl.blockId}`,
|
|
40
|
+
Blocks: SBlock,
|
|
41
|
+
block: bl,
|
|
42
|
+
context: context,
|
|
43
|
+
parentLoading: loading,
|
|
44
|
+
lowdefy: lowdefy
|
|
45
|
+
})
|
|
46
|
+
))
|
|
47
|
+
;
|
|
48
|
+
});
|
|
49
|
+
contentList.push({
|
|
50
|
+
...content
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
return(/*#__PURE__*/ React.createElement(BlockLayout, {
|
|
54
|
+
id: `bl-${block.blockId}`,
|
|
55
|
+
blockStyle: block.eval.style,
|
|
56
|
+
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
57
|
+
layout: block.eval.layout || {},
|
|
58
|
+
makeCssClass: makeCssClass
|
|
59
|
+
}, /*#__PURE__*/ React.createElement(Component, {
|
|
60
|
+
methods: Object.assign(block.methods, {
|
|
61
|
+
makeCssClass,
|
|
62
|
+
moveItemDown: block.moveItemDown,
|
|
63
|
+
moveItemUp: block.moveItemUp,
|
|
64
|
+
pushItem: block.pushItem,
|
|
65
|
+
registerEvent: block.registerEvent,
|
|
66
|
+
registerMethod: block.registerMethod,
|
|
67
|
+
removeItem: block.removeItem,
|
|
68
|
+
triggerEvent: block.triggerEvent,
|
|
69
|
+
unshiftItem: block.unshiftItem
|
|
70
|
+
}),
|
|
71
|
+
basePath: lowdefy.basePath,
|
|
72
|
+
blockId: block.blockId,
|
|
73
|
+
components: lowdefy._internal.components,
|
|
74
|
+
events: block.eval.events,
|
|
75
|
+
key: block.blockId,
|
|
76
|
+
list: contentList,
|
|
77
|
+
loading: loading,
|
|
78
|
+
menus: lowdefy.menus,
|
|
79
|
+
pageId: lowdefy.pageId,
|
|
80
|
+
properties: block.eval.properties,
|
|
81
|
+
required: block.eval.required,
|
|
82
|
+
user: lowdefy.user,
|
|
83
|
+
validation: block.eval.validation
|
|
84
|
+
})));
|
|
85
|
+
};
|
|
86
|
+
export default List;
|
|
@@ -0,0 +1,84 @@
|
|
|
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, { useEffect } from 'react';
|
|
16
|
+
import { BlockLayout } from '@lowdefy/layout';
|
|
17
|
+
import { makeCssClass } from '@lowdefy/block-utils';
|
|
18
|
+
import LoadingContainer from './LoadingContainer.js';
|
|
19
|
+
import LoadingList from './LoadingList.js';
|
|
20
|
+
const blockMethods = {
|
|
21
|
+
makeCssClass,
|
|
22
|
+
moveItemDown: ()=>{},
|
|
23
|
+
moveItemUp: ()=>{},
|
|
24
|
+
pushItem: ()=>{},
|
|
25
|
+
registerEvent: ()=>{},
|
|
26
|
+
registerMethod: ()=>{},
|
|
27
|
+
removeItem: ()=>{},
|
|
28
|
+
setValue: ()=>{},
|
|
29
|
+
triggerEvent: ()=>{},
|
|
30
|
+
unshiftItem: ()=>{}
|
|
31
|
+
};
|
|
32
|
+
const LoadingBlock = ({ blockLayout , blockId , context , lowdefy , skeleton })=>{
|
|
33
|
+
let Component = lowdefy._internal.blockComponents[skeleton.type];
|
|
34
|
+
useEffect(()=>{
|
|
35
|
+
if (!lowdefy._internal.blockComponents[skeleton.type]) {
|
|
36
|
+
console.warn(`Skeleton block type not found for ${skeleton.type} in ${blockId}. Only '@lowdefy/blocks-basic' and '@lowdefy/blocks-loaders' block types are supported for skeletons.`);
|
|
37
|
+
}
|
|
38
|
+
return;
|
|
39
|
+
}, []);
|
|
40
|
+
if (!Component) {
|
|
41
|
+
// default to box when a skeleton block is not found - should be a basic or loader block.
|
|
42
|
+
Component = lowdefy._internal.blockComponents.Box;
|
|
43
|
+
}
|
|
44
|
+
const layout = skeleton.layout || blockLayout || {};
|
|
45
|
+
switch(Component.meta.category){
|
|
46
|
+
case 'list':
|
|
47
|
+
return(/*#__PURE__*/ React.createElement(LoadingList, {
|
|
48
|
+
blockId: blockId,
|
|
49
|
+
Component: Component,
|
|
50
|
+
context: context,
|
|
51
|
+
layout: layout,
|
|
52
|
+
lowdefy: lowdefy,
|
|
53
|
+
skeleton: skeleton
|
|
54
|
+
}));
|
|
55
|
+
case 'container':
|
|
56
|
+
return(/*#__PURE__*/ React.createElement(LoadingContainer, {
|
|
57
|
+
blockId: blockId,
|
|
58
|
+
Component: Component,
|
|
59
|
+
context: context,
|
|
60
|
+
layout: layout,
|
|
61
|
+
lowdefy: lowdefy,
|
|
62
|
+
skeleton: skeleton
|
|
63
|
+
}));
|
|
64
|
+
default:
|
|
65
|
+
return(/*#__PURE__*/ React.createElement(BlockLayout, {
|
|
66
|
+
blockStyle: skeleton.style,
|
|
67
|
+
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
68
|
+
id: `s-bl-${blockId}-${skeleton.id}`,
|
|
69
|
+
layout: layout,
|
|
70
|
+
makeCssClass: makeCssClass
|
|
71
|
+
}, /*#__PURE__*/ React.createElement(Component, {
|
|
72
|
+
basePath: lowdefy.basePath,
|
|
73
|
+
blockId: blockId,
|
|
74
|
+
components: lowdefy._internal.components,
|
|
75
|
+
key: `s-${blockId}-${skeleton.id}`,
|
|
76
|
+
menus: lowdefy.menus,
|
|
77
|
+
methods: blockMethods,
|
|
78
|
+
pageId: lowdefy.pageId,
|
|
79
|
+
properties: skeleton.properties,
|
|
80
|
+
user: lowdefy.user
|
|
81
|
+
})));
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
export default LoadingBlock;
|
|
@@ -0,0 +1,68 @@
|
|
|
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 { Area, BlockLayout, layoutParamsToArea } from '@lowdefy/layout';
|
|
17
|
+
import { makeCssClass } from '@lowdefy/block-utils';
|
|
18
|
+
import LoadingBlock from './LoadingBlock.js';
|
|
19
|
+
const LoadingContainer = ({ blockId , Component , context , layout , lowdefy , skeleton })=>{
|
|
20
|
+
const content = {};
|
|
21
|
+
// eslint-disable-next-line prefer-destructuring
|
|
22
|
+
Object.keys(skeleton.areas).forEach((areaKey, i)=>{
|
|
23
|
+
content[areaKey] = (areaStyle)=>/*#__PURE__*/ React.createElement(Area, {
|
|
24
|
+
area: layoutParamsToArea({
|
|
25
|
+
area: skeleton.areas[areaKey] || {},
|
|
26
|
+
areaKey,
|
|
27
|
+
layout
|
|
28
|
+
}),
|
|
29
|
+
areaStyle: [
|
|
30
|
+
areaStyle,
|
|
31
|
+
skeleton.areas[areaKey] && skeleton.areas[areaKey].style
|
|
32
|
+
],
|
|
33
|
+
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
34
|
+
id: `s-ar-${blockId}-${skeleton.id}-${areaKey}`,
|
|
35
|
+
key: `s-ar-${blockId}-${skeleton.id}-${areaKey}-${i}`,
|
|
36
|
+
makeCssClass: makeCssClass
|
|
37
|
+
}, skeleton.areas[areaKey].blocks.map((skl, k)=>/*#__PURE__*/ React.createElement(LoadingBlock, {
|
|
38
|
+
blockId: blockId,
|
|
39
|
+
context: context,
|
|
40
|
+
key: `s-co-${skl.id}-${k}`,
|
|
41
|
+
lowdefy: lowdefy,
|
|
42
|
+
skeleton: skl
|
|
43
|
+
})
|
|
44
|
+
))
|
|
45
|
+
;
|
|
46
|
+
});
|
|
47
|
+
return(/*#__PURE__*/ React.createElement(BlockLayout, {
|
|
48
|
+
blockStyle: skeleton.style,
|
|
49
|
+
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
50
|
+
id: `s-bl-${blockId}-${skeleton.id}`,
|
|
51
|
+
layout: layout,
|
|
52
|
+
makeCssClass: makeCssClass
|
|
53
|
+
}, /*#__PURE__*/ React.createElement(Component, {
|
|
54
|
+
basePath: lowdefy.basePath,
|
|
55
|
+
blockId: blockId,
|
|
56
|
+
components: lowdefy._internal.components,
|
|
57
|
+
content: content,
|
|
58
|
+
key: skeleton.id,
|
|
59
|
+
menus: lowdefy.menus,
|
|
60
|
+
methods: {
|
|
61
|
+
makeCssClass
|
|
62
|
+
},
|
|
63
|
+
pageId: lowdefy.pageId,
|
|
64
|
+
properties: skeleton.properties,
|
|
65
|
+
user: lowdefy.user
|
|
66
|
+
})));
|
|
67
|
+
};
|
|
68
|
+
export default LoadingContainer;
|
|
@@ -0,0 +1,72 @@
|
|
|
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 { Area, BlockLayout, layoutParamsToArea } from '@lowdefy/layout';
|
|
17
|
+
import { makeCssClass } from '@lowdefy/block-utils';
|
|
18
|
+
import LoadingBlock from './LoadingBlock.js';
|
|
19
|
+
const LoadingList = ({ blockId , Component , context , layout , lowdefy , skeleton })=>{
|
|
20
|
+
const content = {};
|
|
21
|
+
const contentList = [];
|
|
22
|
+
new Array(3).forEach(()=>{
|
|
23
|
+
Object.keys(skeleton.areas).forEach((areaKey, i)=>{
|
|
24
|
+
content[areaKey] = (areaStyle)=>/*#__PURE__*/ React.createElement(Area, {
|
|
25
|
+
area: layoutParamsToArea({
|
|
26
|
+
area: skeleton.areas[areaKey] || {},
|
|
27
|
+
areaKey,
|
|
28
|
+
layout
|
|
29
|
+
}),
|
|
30
|
+
areaStyle: [
|
|
31
|
+
areaStyle,
|
|
32
|
+
skeleton.areas[areaKey] && skeleton.areas[areaKey].style
|
|
33
|
+
],
|
|
34
|
+
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
35
|
+
id: `s-ar-${blockId}-${skeleton.id}-${areaKey}`,
|
|
36
|
+
key: `s-ar-${blockId}-${skeleton.id}-${areaKey}-${i}`,
|
|
37
|
+
makeCssClass: makeCssClass
|
|
38
|
+
}, skeleton.areas[areaKey].blocks.map((skl, k)=>/*#__PURE__*/ React.createElement(LoadingBlock, {
|
|
39
|
+
blockId: blockId,
|
|
40
|
+
context: context,
|
|
41
|
+
key: `s-co-${skl.id}-${k}`,
|
|
42
|
+
lowdefy: lowdefy,
|
|
43
|
+
skeleton: skl
|
|
44
|
+
})
|
|
45
|
+
))
|
|
46
|
+
;
|
|
47
|
+
});
|
|
48
|
+
contentList.push({
|
|
49
|
+
...content
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
return(/*#__PURE__*/ React.createElement(BlockLayout, {
|
|
53
|
+
blockStyle: skeleton.style,
|
|
54
|
+
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
55
|
+
id: `s-bl-${blockId}-${skeleton.id}`,
|
|
56
|
+
layout: layout,
|
|
57
|
+
makeCssClass: makeCssClass
|
|
58
|
+
}, /*#__PURE__*/ React.createElement(Component, {
|
|
59
|
+
basePath: lowdefy.basePath,
|
|
60
|
+
blockId: blockId,
|
|
61
|
+
components: lowdefy._internal.components,
|
|
62
|
+
list: contentList,
|
|
63
|
+
menus: lowdefy.menus,
|
|
64
|
+
methods: {
|
|
65
|
+
makeCssClass
|
|
66
|
+
},
|
|
67
|
+
pageId: lowdefy.pageId,
|
|
68
|
+
properties: skeleton.properties,
|
|
69
|
+
user: lowdefy.user
|
|
70
|
+
})));
|
|
71
|
+
};
|
|
72
|
+
export default LoadingList;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 request from './request.js';
|
|
16
|
+
function callRequest({ pageId , payload , requestId }) {
|
|
17
|
+
return request({
|
|
18
|
+
url: `/api/request/${pageId}/${requestId}`,
|
|
19
|
+
method: 'POST',
|
|
20
|
+
body: {
|
|
21
|
+
payload
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export default callRequest;
|
|
@@ -0,0 +1,103 @@
|
|
|
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 classNames from 'classnames';
|
|
17
|
+
import { omit, type } from '@lowdefy/helpers';
|
|
18
|
+
import Icon from '@ant-design/icons';
|
|
19
|
+
import { blockDefaultProps, makeCssClass } from '@lowdefy/block-utils';
|
|
20
|
+
import ErrorBoundary from './ErrorBoundary.js';
|
|
21
|
+
function _extends() {
|
|
22
|
+
_extends = Object.assign || function(target) {
|
|
23
|
+
for(var i = 1; i < arguments.length; i++){
|
|
24
|
+
var source = arguments[i];
|
|
25
|
+
for(var key in source){
|
|
26
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
27
|
+
target[key] = source[key];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
return _extends.apply(this, arguments);
|
|
34
|
+
}
|
|
35
|
+
const lowdefyProps = [
|
|
36
|
+
'actionLog',
|
|
37
|
+
'basePath',
|
|
38
|
+
'components',
|
|
39
|
+
'content',
|
|
40
|
+
'eventLog',
|
|
41
|
+
'list',
|
|
42
|
+
'loading',
|
|
43
|
+
'menus',
|
|
44
|
+
'pageId',
|
|
45
|
+
'registerEvent',
|
|
46
|
+
'registerMethod',
|
|
47
|
+
'schemaErrors',
|
|
48
|
+
'user',
|
|
49
|
+
'validation',
|
|
50
|
+
];
|
|
51
|
+
const createIcon = (Icons)=>{
|
|
52
|
+
const AiOutlineLoading3Quarters = Icons['AiOutlineLoading3Quarters'];
|
|
53
|
+
const AiOutlineExclamationCircle = Icons['AiOutlineExclamationCircle'];
|
|
54
|
+
const IconBlock = ({ blockId , events , methods , onClick , properties , ...props })=>{
|
|
55
|
+
const propertiesObj = type.isString(properties) ? {
|
|
56
|
+
name: properties
|
|
57
|
+
} : properties;
|
|
58
|
+
const spin = (propertiesObj.spin || events.onClick && events.onClick.loading) && !propertiesObj.disableLoadingIcon;
|
|
59
|
+
const iconProps = {
|
|
60
|
+
id: blockId,
|
|
61
|
+
className: classNames({
|
|
62
|
+
[makeCssClass([
|
|
63
|
+
{
|
|
64
|
+
cursor: (onClick || events.onClick) && 'pointer'
|
|
65
|
+
},
|
|
66
|
+
propertiesObj.style,
|
|
67
|
+
])]: true,
|
|
68
|
+
'icon-spin': spin
|
|
69
|
+
}),
|
|
70
|
+
rotate: propertiesObj.rotate,
|
|
71
|
+
color: propertiesObj.color,
|
|
72
|
+
title: propertiesObj.name,
|
|
73
|
+
size: propertiesObj.size,
|
|
74
|
+
// twoToneColor: propertiesObj.color, // TODO: track https://github.com/react-icons/react-icons/issues/508
|
|
75
|
+
...omit(props, lowdefyProps)
|
|
76
|
+
};
|
|
77
|
+
let IconComp = Icons[propertiesObj.name];
|
|
78
|
+
if (!IconComp) {
|
|
79
|
+
IconComp = AiOutlineExclamationCircle;
|
|
80
|
+
}
|
|
81
|
+
return(/*#__PURE__*/ React.createElement(React.Fragment, null, spin ? /*#__PURE__*/ React.createElement(AiOutlineLoading3Quarters, _extends({}, iconProps)) : /*#__PURE__*/ React.createElement(ErrorBoundary, {
|
|
82
|
+
fallback: ()=>/*#__PURE__*/ React.createElement(AiOutlineExclamationCircle, _extends({}, {
|
|
83
|
+
...iconProps,
|
|
84
|
+
color: '#F00'
|
|
85
|
+
}))
|
|
86
|
+
}, /*#__PURE__*/ React.createElement(IconComp, _extends({
|
|
87
|
+
id: blockId,
|
|
88
|
+
onClick: onClick || events.onClick && (()=>methods.triggerEvent({
|
|
89
|
+
name: 'onClick'
|
|
90
|
+
})
|
|
91
|
+
),
|
|
92
|
+
size: propertiesObj.size,
|
|
93
|
+
title: propertiesObj.title
|
|
94
|
+
}, iconProps)))));
|
|
95
|
+
};
|
|
96
|
+
const AntIcon = (all)=>/*#__PURE__*/ React.createElement(Icon, {
|
|
97
|
+
component: ()=>/*#__PURE__*/ React.createElement(IconBlock, _extends({}, all))
|
|
98
|
+
})
|
|
99
|
+
;
|
|
100
|
+
AntIcon.defaultProps = blockDefaultProps;
|
|
101
|
+
return AntIcon;
|
|
102
|
+
};
|
|
103
|
+
export default createIcon;
|